Beruflich Dokumente
Kultur Dokumente
Call Transaction.
Session Method.
BDCDATA is a structure defined with below fields in data dictionary, it holds the information
related to each screen field .
Use of BDCDATA
It is a structure which holds the information related to each screen i.e. program name, screen no,
field name, field values, information of that particular screen to be transferred into the SAP.
In simple words, it holds all the screen related information and field information to be transferred
into corresponding SAP transaction. Program Dynpro Dynbegin Fnam Fval
SAPLGMM 0060 "X"
RMMG1-MATNR "1011"
RMMG1-MBRSH "FOOD"
RMMG1-MTART "FERT"
SAPLGMM 0070 "X" RZSEL "X"
To find the above information for each field, press F1 on particular field It will display help
information.
Click on the button "technical information".
It will show the entire technical information of a screen.
Please note down the program name, screen number, screen field name.
This procedure has to be repeated for each field on a SAP screen.Since, it is very difficult to note
down the technical information for each field, we have an alternate and easy method called as
"RECORDING METHOD".
Update: There are two types of updates are available.
Asynchronous update (COMMIT).
Synchronous update (COMMIT & WAIT).
DIALOG WORK PROCESS: A work process which is dedicated to process screen information is
called "Dialog work process".
There will be 6 to 7 dialog work processes.
These dialog work processes are defined by basis consultant.
UPDATE WORK PROCESS: This work process is responsible for updating the data into the
database.
There will be always only "1" update work process.
In this type the call transaction screens will communicate with the update work process to
update the data into database.
It doesn"t wait for the update to be finished.
It immediately starts to process the next record without waiting for the update to be
finished.
That"s why this process is very fast.
It is generally not recommended for the large amount of data, because the called
transaction does not return any success or error messages.
In this mode, the called transaction communicates with the update work process to
update the data into database.
It will wait for the update to be finished.
Once the update is finished, then it continues to process the next record.
Thats why this process is very slow.
It is generally recommended for large amount of data because it returns success and
error messages.
MODE:
It specifies the type of the mode to execute the transaction.
There are 3 options for mode
RECORDING METHOD:
Since, it is very difficult to find technical information of each field on the screen, we go for a
method called as "Recording method".
The recording method is going to record all the fields in the transaction and it generated the
technical information such as program name, screen no, field name, field value for each field on
the SAP screen.
By using the recording method, it is very easy to create a BDC program.
A pop up will open, provide a recording name ZSAPN_MM01, provide transaction code as MM01
and click recording.
Click Save, go back, you will go to recording overview screen and click on program button to
create a program for this.
Save it in a local object, you will find the below code in the program
report ZSAPN_MM01
no standard page heading line-size 255.
include bdcrecx1.
*
*
***
*
*** Generated data section with specific formatting - DO NOT CHANGE
data: begin of record,
* data element: MATNR
MATNR_001(018),
* data element: MBRSH
MBRSH_002(001),
* data element: MTART
MTART_003(004),
* data element: XFELD
KZSEL_01_004(001),
* data element: MATNR
MATNR_005(018),
* data element: MBRSH
MBRSH_006(001),
* data element: MTART
MTART_007(004),
* data element: XFELD
KZSEL_01_008(001),
* data element: MAKTX
MAKTX_009(040),
* data element: MEINS
MEINS_010(003),
end of record.
start-of-selection.
***
do.
perform bdc_dynpro
perform bdc_field
using 'BDC_CURSOR'
'RMMG1-MTART'.
perform bdc_field
using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field
using 'RMMG1-MATNR'
record-MATNR_001.
perform bdc_field
using 'RMMG1-MBRSH'
record-MBRSH_002.
perform bdc_field
using 'RMMG1-MTART'
record-MTART_003.
perform bdc_dynpro
perform bdc_field
using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field
using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field
using 'MSICHTAUSW-KZSEL(01)'
record-KZSEL_01_004.
perform bdc_dynpro
perform bdc_field
using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field
using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field
using 'RMMG1-MATNR'
record-MATNR_005.
perform bdc_field
using 'RMMG1-MBRSH'
record-MBRSH_006.
perform bdc_field
using 'RMMG1-MTART'
record-MTART_007.
perform bdc_dynpro
perform bdc_field
using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field
using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field
using 'MSICHTAUSW-KZSEL(01)'
record-KZSEL_01_008.
perform bdc_dynpro
perform bdc_field
using 'BDC_OKCODE'
'/00'.
perform bdc_field
using 'MAKT-MAKTX'
record-MAKTX_009.
perform bdc_field
using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field
using 'MARA-MEINS'
record-MEINS_010.
perform bdc_dynpro
perform bdc_field
using 'BDC_OKCODE'
'=YES'.
enddo.
perform close_group.
perform close_dataset using dataset.
perform bdc_field
using 'BDC_CURSOR'
'RMMG1-MTART'.
perform bdc_field
using 'BDC_OKCODE'
'ENTR'.
perform bdc_field
using 'RMMG1-MATNR'
record-MATNR_001. "pass material no
perform bdc_field
using 'RMMG1-MBRSH'
record-MBRSH_002. "pass industry sector
perform bdc_field
using 'RMMG1-MTART'
record-MTART_003. "pass material type
perform bdc_dynpro
perform bdc_field
using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field
using 'BDC_OKCODE'
"enter
'=ENTR'.
perform bdc_field
using 'MSICHTAUSW-KZSEL(01)'
record-KZSEL_01_004. "basic view1 pass 'X'
perform bdc_dynpro
view1)
perform bdc_field
using 'BDC_OKCODE'
'=BU'.
perform bdc_field
using 'MAKT-MAKTX'
record-MAKTX_005. "material description
perform bdc_field
using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field
using 'MARA-MEINS'
record-MEINS_006.
FILETYPE
= IT_MARA.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'RMMG1-MTART'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'ENTR'.
PERFORM BDC_FIELD
USING 'RMMG1-MATNR'
WA_MARA-MATNR. "pass material no
PERFORM BDC_FIELD
USING 'RMMG1-MBRSH'
WA_MARA-MBRSH. "pass indistry sector
PERFORM BDC_FIELD
USING 'RMMG1-MTART'
WA_MARA-MTART. "pass material type
PERFORM BDC_DYNPRO
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD
USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM BDC_DYNPRO
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'=BU'.
PERFORM BDC_FIELD
USING 'MAKT-MAKTX'
WA_MARA-MAKTX. "pass material description
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'MARA-MEINS'.
PERFORM BDC_FIELD
USING 'MARA-MEINS'
WA_MARA-MEINS. "pass base unit oe meassure
BDCMSG. "messages
IF SY-SUBRC EQ 0.
WRITE :/
ENDIF.
ENDLOOP.
The filnal BDC for migrating Material Master basic data is below
REPORT ZSAPN_BDC
NO STANDARD PAGE HEADING LINE-SIZE 255.
START-OF-SELECTION.
IF P_FILE IS NOT INITIAL.
FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD' "upload flat file
EXPORTING
FILENAME
FILETYPE
= IT_MARA.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
LOOP AT IT_MARA INTO WA_MARA. "loop all records and pass one by one to BDC
PERFORM BDC_DYNPRO
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'RMMG1-MTART'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'ENTR'.
PERFORM BDC_FIELD
USING 'RMMG1-MATNR'
WA_MARA-MATNR. "pass material no
PERFORM BDC_FIELD
USING 'RMMG1-MBRSH'
WA_MARA-MBRSH. "pass indistry sector
PERFORM BDC_FIELD
USING 'RMMG1-MTART'
WA_MARA-MTART. "pass material type
PERFORM BDC_DYNPRO
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD
USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM BDC_DYNPRO
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'=BU'.
PERFORM BDC_FIELD
USING 'MAKT-MAKTX'
WA_MARA-MAKTX. "pass material description
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'MARA-MEINS'.
PERFORM BDC_FIELD
USING 'MARA-MEINS'
WA_MARA-MEINS. "pass base unit oe meassure
BDCMSG. "messages
IF SY-SUBRC EQ 0.
WRITE :/
ENDIF.
ENDLOOP.
ENDIF.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM
= PROGRAM. "program
WA_BDCDATA-DYNPRO
= DYNPRO. "screen
ENDIF.
ENDFORM.