Reply from Anjali301 on May 25 at 2:32 AM Hi, Following is the BDC program for tk11. TYPES: BEGIN OF t_final, kschl TYPE kschl, inco1 TYPE inco1, vsart TYPE vsart, tdlnr TYPE tdlnr, pstlza TYPE pstlza, pstlzz TYPE pstlza, konwa TYPE konwa, datab TYPE char10, datbi TYPE char10, scaid TYPE scaid, vl01 TYPE char30, END OF t_final, DATA : i_final TYPE STANDARD TABLE OF t_final, wa_final TYPE t_final, FORM upload_to_tk11 . DATA : lw_tabix(2) TYPE c, lw_field(10) TYPE c, lw_field_no TYPE c VALUE '0'. CLEAR wa_final. CLEAR wa_bdcdata. IF NOT i_final IS INITIAL. i_final_temp[] = i_final[]. " Move excel data into another internal table for further use. LOOP AT i_final INTO wa_final. IF NOT wa_final-kschl IS INITIAL AND NOT wa_final-inco1 IS INITIAL AND NOT wa_final-vsart IS INITIAL AND NOT wa_final-tdlnr IS INITIAL AND NOT wa_final-pstlza IS INITIAL AND NOT wa_final-pstlzz IS INITIAL AND NOT wa_final-konwa IS INITIAL AND NOT wa_final-datab IS INITIAL AND NOT wa_final-datbi IS INITIAL AND NOT wa_final-scaid IS INITIAL. lw_tabix = sy-tabix. * Fill BDC table for processing. PERFORM fill_bdc_program USING 'SAPMV13A' '0100' 'X' ' ' ' '. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_CURSOR' 'RV13A-KSCHL'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_OKCODE' '/00'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'RV13A-KSCHL' wa_final-kschl. PERFORM fill_bdc_program USING 'SAPLV14A' '0100' 'X' ' ' ' ' . PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_CURSOR' 'RV130-SELKZ(01)'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_OKCODE' '=WEIT'. PERFORM fill_bdc_program USING 'SAPMV13A' '1703' 'X' ' ' ' '. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_CURSOR' 'RV13A-DATBI(01)'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_OKCODE' '/00'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'KOMG-INCO1' wa_final-inco1. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'KOMG-VSART' wa_final-vsart. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'KOMG-TDLNR' wa_final-tdlnr. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'KOMG-PSTLZA' wa_final-pstlza. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'KOMG-PSTLZZ(01)' wa_final-pstlzz. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'KONP-KONWA(01)' wa_final-konwa. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'RV13A-DATAB(01)' wa_final-datab. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'RV13A-DATBI(01)' wa_final-datbi. PERFORM fill_bdc_program USING 'SAPMV13A' '1703' 'X' ' ' ' '. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_CURSOR' 'KOMG-PSTLZZ(01)'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_OKCODE' '=MARL'. PERFORM fill_bdc_program USING 'SAPMV13A' '1703' 'X' ' ' ' '. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_CURSOR' 'KOMG-PSTLZZ(01)'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_OKCODE' '=PSTF'. PERFORM fill_bdc_program USING 'SAPLV57S' '0200' 'X' ' ' ' '. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_CURSOR' 'VFKONX-SCAID(01)'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_OKCODE' '=ENT1'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'VFKONX-SCAID(01)' wa_final-scaid. PERFORM fill_bdc_program USING 'SAPLWMMB' '6000' 'X' ' ' ' '. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_OKCODE' '/00'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_SUBSCR' 'SAPLV57S 0100HEADER'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_SUBSCR' 'SAPLV57S 0101SHEET'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_SUBSCR' 'SAPLWMMB 2101MTX_SUBSC'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_CURSOR' 'VL01(06)'. * This part is to upload scale amount onto screen field. * This is to make sure if scale fields increases in future on screen, code can handle it. LOOP AT i_final_temp INTO wa_final_temp FROM lw_tabix. IF sy-subrc EQ 0 . IF NOT wa_final_temp-kschl IS INITIAL AND NOT wa_final_temp-inco1 IS INITIAL AND NOT wa_final_temp-vsart IS INITIAL AND NOT wa_final_temp-tdlnr IS INITIAL AND NOT wa_final_temp-pstlza IS INITIAL AND NOT wa_final_temp-pstlzz IS INITIAL AND NOT wa_final_temp-konwa IS INITIAL AND NOT wa_final_temp-datab IS INITIAL AND NOT wa_final_temp-datbi IS INITIAL AND NOT wa_final_temp-scaid IS INITIAL. IF wa_final EQ wa_final_temp . * This is always first scale amount. lw_field_no = lw_field_no + 1. CONCATENATE 'VL01(0' lw_field_no ')' INTO lw_field . CONDENSE lw_field NO-GAPS. PERFORM fill_bdc_program USING ' ' ' ' ' ' lw_field wa_final_temp-vl01. ELSE. CLEAR: lw_tabix, wa_final_temp, lw_field, lw_field_no. EXIT. ENDIF. ELSE. * THese are rest of the scale amounts lw_field_no = lw_field_no + 1. CONCATENATE 'VL01(0' lw_field_no ')' INTO lw_field . PERFORM fill_bdc_program USING ' ' ' ' ' ' lw_field wa_final_temp-vl01. ENDIF. lw_tabix = lw_tabix + 1. CLEAR lw_field. ENDIF. ENDLOOP. ** PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_SUBSCR' 'SAPLWMMB 0101HORINAVI'. PERFORM fill_bdc_program USING 'SAPLWMMB' '6000' 'X' ' ' ' '. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_OKCODE' '=VF_SICH'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_SUBSCR' 'SAPLV57S 0100HEADER'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_SUBSCR' 'SAPLV57S 0101SHEET'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_SUBSCR' 'SAPLWMMB 2101MTX_SUBSC'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_CURSOR' 'VL01(06)'. PERFORM fill_bdc_program USING ' ' ' ' ' ' 'BDC_SUBSCR' 'SAPLWMMB 0101HORINAVI'. * Call tcode TK11 wa_opt-dismode = c_n. wa_opt-defsize = c_x. wa_opt-updmode = c_s. CALL TRANSACTION c_tk11 USING i_bdcdata OPTIONS FROM wa_opt MESSAGES INTO i_msg. * Displaying all messages LOOP AT i_msg INTO wa_msg. CALL FUNCTION 'MESSAGE_TEXT_BUILD' EXPORTING msgid = wa_msg-msgid msgnr = wa_msg-msgnr msgv1 = wa_msg-msgv1 msgv2 = wa_msg-msgv2 msgv3 = wa_msg-msgv3 msgv4 = wa_msg-msgv4 IMPORTING message_text_output = w_msgtxt. IF sy-subrc EQ 0. wa_output_upld-kschl = wa_final-kschl. wa_output_upld-inco1 = wa_final-inco1. wa_output_upld-vsart = wa_final-vsart. wa_output_upld-tdlnr = wa_final-tdlnr. wa_output_upld-pstlza = wa_final-pstlza. wa_output_upld-pstlzz = wa_final-pstlzz. wa_output_upld-msgtype = wa_msg-msgtyp. wa_output_upld-msgtext = w_msgtxt. APPEND wa_output_upld TO i_output_upld. CLEAR wa_output_upld. ENDIF. ENDLOOP. CLEAR: wa_final, wa_bdcdata, wa_opt. REFRESH: i_msg, i_bdcdata. ENDIF. ENDLOOP. ENDIF. ENDFORM. " UPLOAD_TO_TK11 For more information you can visit http://www.runsapbasis.com/ Anjali Rao SAP Manager Apprisia
| | | ---------------Original Message--------------- From: Misha_D Sent: Tuesday, April 19, 2016 11:10 PM Subject: Mass Upload Or Download of Freight Rates - TK11 I need to upload Excel files into tk11 using BDC. I did recording in BDC using transaction code tk11. But stuck in halfway. Can anyone please help me in this? Sample codes will be much appreciated and it will be easy for me to compare with mine. Thank you in advance. | | Reply to this email to post your response. __.____._ | _.____.__ |