SAP ABAP4 Learning --- BDC Batch Enter Write a Inner Table Program

xiaoxiao2021-03-06  100

* ------------------------------------------------- ---------------------- * Program ID: ZTEST904_BDC * Program Name: ZTEST904_BDC * ----------------- -------------------------------------------------- ---- * Created Date: 2004/09/04 * create by: liugang * description: This program is to learn how to call * BDC automatically import data through the program. * ------------------------------------------------- ---------------------- * MODIFICATION: * DATE MODIFIED Modified by Transport Request Description * 2004/09/04 liugang version: 01/01 Learning * --- -------------------------------------------------- ----------------- Report ZTEST904_BDC.

* Define the inner table of the BDC format ********************************************************************************** ******** DATA: BEGIN OF I_BDCDATA OCCURS 0, * BDC program name, such as the program name of the code MM01 is Saplmgmm (SAP standard program) Program Like bdcdata-program, * bdc Dynpro number Dynpro Like Bdcdata- Dynpro, * BDC BDC Dynpro Start Dynbegin Like BDCData-Dynbegin, * BDC Project Name FNAM Like Bdcdata-FNAM, * BDC Project Name Added Fval Like BDCData-Fval, End of i_bdcdata.

Data: Begin of Itab Occurs 0, A (9), END OF ITAB.

ITAB-A = 'A0010'.Append itab.itab-a =' A0011'.Append iTAB.

* Start-of-selectstart-of-selection.loop at itab. Perform append_mm01 using itab-a. Perform run_bdc.endloop.

* ------------------------------------------------- -------------------- ** Form Append_data_mm01 ** ------------------------ -------------------------------------------- ** Define a child Inside the program, you are used to store each step ** ------------------------------------ ------------------------------- * form append_mm01 using fval like itab-a.

Clear i_bdcdata. Clear i_bdcdata [].

* Start the new screen event * 0173 screen * Start the program name and BDC DynPro number, start sign to the inner table head, i_bdcdata-program = 'saplmgmm'. I_bdcdata-dynpro = '0060'. I_bdcdata-dynbegin = 'x' Clear i_bdcdata.i_bdcdata-fnam = 'bdc_cursor'. I_bdcdata-fval = 'rmmg1-matnr'. Append i_bdcdata. Clear i_bdcdata.

I_bdcdata-fnam = 'bdc_okcode'. I_bdcdata-fval = '/ 00'. Append i_bdcdata. Clear i_bdcdata.

I_bdcdata-fnam = 'rmmg1-matnr'. * Newly established material document number * i_bdcdata-fval = 'A004'. I_bdcdata-fval = fval. Append i_bdcdata. Clear i_bdcdata.

I_bdcdata-fnam = 'rmmg1-mbrsh'. I_bdcdata-fval = 'c'. Append i_bdcdata. Clear i_bdcdata.

I_bdcdata-fnam = 'rmmg1-mtart'. I_bdcdata-fval = 'werb'. Append i_bdcdata. Clear i_bdcdata.

* Start the new screen event i_bdcdata-program = 'saplmgmm'. I_bdcdata-DynPro = '0070'. I_bdcdata-dynbegin = 'x'. Append i_bdcdata. Clear i_bdcdata.

I_bdcdata-fnam = 'bdc_cursor'. I_bdcdata-fval = 'msichtausw-dytxt (01)'. Append i_bdcdata. Clear i_bdcdata.

I_bdcdata-fnam = 'bdc_okcode'. I_bdcdata-fval = '= entr'. Append i_bdcdata. Clear i_bdcdata.

I_bdcdata-fnam = 'msichtausw-kzsel (01)'. I_bdcdata-fval = 'x'. Append i_bdcdata. Clear i_bdcdata.

* Start new screen event i_bdcdata-program = 'saplmgmm'. I_bdcdata-DynPro = '4004'. I_bdcdata-dynbegin = 'x'. Append i_bdcdata. Clear i_bdcdata.

I_bdcdata-fnam = 'bdc_okcode'. I_bdcdata-fval = '= bu'. Append i_bdcdata. Clear i_bdcdata.

I_BDCDATA-FNAM = 'BDC_CURSOR'. I_BDCDATA-FVAL = 'MAKT-MAKTX'. APPEND I_BDCDATA. CLEAR I_BDCDATA.I_BDCDATA-FNAM = 'MAKT-MAKTX'. I_BDCDATA-FVAL = 'test data import BDC'. APPEND I_BDCDATA. CLEAR I_BDCDATA .

I_bdcdata-fnam = 'mara-meins'. I_bdcdata-fval = '000'. Append i_bdcdata. Clear i_bdcdata.

I_bdcdata-fnam = 'mara-mtpos_mara'. I_bdcdata-fval = 'norm'. Append i_bdcdata. Clear i_bdcdata.

ENDFORM.

* ------------------------------------------------- -------------------- ** form run_bdc ** ------------------------ -------------------------------------------- ** ... ..... ** ------------------------------------------- ------------------------- * form run_bdc. * Start calling the transaction MM01, pass the doPed BDC object, and set the mode to A, * That is to say, you can see it. * N means that you don't see it, Call Transaction 'mm01' use i_bdcdata mode 'n'.

ENDFORM.

转载请注明原文地址:https://www.9cbs.com/read-105150.html

New Post(0)