Creation of Session Method BDC and Call Transaction BDC Using OOPs.pdf
Transcript of Creation of Session Method BDC and Call Transaction BDC Using OOPs.pdf
Generated by Jive on 2014-08-22+02:001
Creation of Session Method BDC and CallTransaction BDC Using OOPS
Hello Friends,
I have developed the class for creating the Session Method BDC and Call Transaction method BDC using
OOPS concept.
This document i have demostrated how to create the Session Method BDC using OOPS concept for Material
Creation with BASIC View.
Batch Data Communication is used for Data Migration from one system to another system .
Session Method has more advantage over the Call transaction method especially when you uploading large
data and if data contains error then it can be handled Implicitly by the system in the error log in SM35 whereas
on the other hand error need to be handled explicitly in the Call Transaction method.
But Session method is slow compared to the Call Transaction method.
For creating the BDC session method using OOPS, we required the following method,
1. BDC_OPEN method ==> This method is used to call the BDC_OPEN function module
2. BDC_INSERT method ==> This method is used to call the BDC_INSERT function module.
3. BDC_CLOSE method ==> This method is used to call the BDC_CLOSE function module.
4. BDC_GROUP_RUN method ==> This method is used to call Batch Input Session Overview.
5. BDC_DISMODE method ==> This method is used to assign the values to CTU_PARAMS structure.
6. BDC_FIELD Method ==> This method is used to pass input value to BDCDATA structure.
7. BDC_DYNPRO Method ==> This method is used to pass program name and screen name to BDCDATA
structure.
Class Attributes:
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:002
BDC OPEN Method Implementation and its Parameters.
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:003
BDC Insert Method Implementation and its Parameters .
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:004
BDC_Close Method implementation and its Parameters.
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:005
BDC_GROUP_RUN method implementation and its parameters.
BDC_DISMODE method implementation and its parameters.
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:006
BDC_FIELD method Implementation and its Parameters
BDC_DYNPRO method Implementation and its Parameters.
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:007
Here simple example for the Creation the Material using ZCL_BDC_SESS_TEST class using Session Method
BDC.
REPORT ztest_sess_bdc_upload_new.
DATA : lt_bdc TYPE REF TO ZCL_BDC_SESS_TEST.
DATA : BEGIN OF it_file OCCURS 0,
matnr TYPE matnr,
mbrsh TYPE mbrsh,
mtart TYPE mtart,
maktx TYPE char10,
meins TYPE meins,
matkl TYPE matkl,
END OF it_file.
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:008
DATA v_file TYPE string.
PARAMETERS p_file TYPE IBIPPARMS-PATH MEMORY ID FIL.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = p_file
.
START-OF-SELECTION.
v_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = it_file[]
.
DATA: i_grp TYPE APQI-GROUPID VALUE 'TEST',
i_tcode like sy-tcode VALUE 'MM01'.
CREATE OBJECT LT_BDC.
lt_bdc->BDC_OPEN( I_GROUP = i_grp ). " Calling the BDC Open Method
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:009
LOOP AT it_file.
lt_bdc->BDC_DYNPRO( I_PROGRAMNAME = 'SAPLMGMM' i_dynpro = '0060' ). " Calling the BDC
Dynpro Method
lt_bdc->BDC_FIELD( i_name = 'BDC_CURSOR' i_value = 'RMMG1-MATNR' ). " Calling the BDC field
Method
lt_bdc->BDC_FIELD( i_name = 'BDC_OKCODE' i_value = '=AUSW' ).
lt_bdc->BDC_FIELD( i_name = 'RMMG1-MATNR' i_value = it_file-matnr ).
lt_bdc->BDC_FIELD( i_name = 'RMMG1-MBRSH' i_value = it_file-MBRSH ).
lt_bdc->BDC_FIELD( i_name = 'RMMG1-MTART' i_value = it_file-MTART ).
lt_bdc->BDC_DYNPRO( I_PROGRAMNAME = 'SAPLMGMM' i_dynpro = '0070' ). " Calling the BDC
Dynpro Method
lt_bdc->BDC_FIELD( i_name = 'BDC_CURSOR' i_value = 'MSICHTAUSW-DYTXT(01)' ).
lt_bdc->BDC_FIELD( i_name = 'BDC_OKCODE' i_value = '=ENTR' ).
lt_bdc->BDC_FIELD( i_name = 'MSICHTAUSW-KZSEL(01)' i_value = 'X' ).
lt_bdc->BDC_DYNPRO( I_PROGRAMNAME = 'SAPLMGMM' i_dynpro = '3005' ).
lt_bdc->BDC_FIELD( i_name = 'BDC_OKCODE' i_value = '=BU' ).
lt_bdc->BDC_FIELD( i_name = 'SKTEXT-MAKTX(01)' i_value = it_file-maktx ). " Calling the BDC Dynpro
Method
lt_bdc->BDC_FIELD( i_name = 'BDC_CURSOR' i_value = 'MARA-MATKL' ).
lt_bdc->BDC_FIELD( i_name = 'MARA-MEINS' i_value = it_file-meins ).
lt_bdc->BDC_FIELD( i_name = 'MARA-MATKL' i_value = it_file-matkl ).
lt_bdc->BDC_FIELD( i_name = 'MARA-MTPOS_MARA' i_value = 'ZHW1' ).
lt_bdc->BDC_INSERT( I_TCODE = I_TCODE ). " Calling the BDC Insert Method
ENDLOOP.
lt_bdc->BDC_CLOSE( ). " Calling the BDC close Method
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:0010
lt_bdc->BDC_DISMODE( I_DISPLAY_MODE = 'E' " Calling the BDC_dismode Method
I_BINPT = abap_true
I_DEFSIZE = 'S').
lt_bdc->BDC_GROUP_RUN( ). " Calling the BDC Group run Method
********************************************************************************************************** End of the
program
We can make use same program and it can be extended to CALL TRANSACTION bdc method also by using
the following method.
CALL TRANS Method implementation and its parameters.
Creation of Session Method BDC and Call Transaction BDC Using OOPS
Generated by Jive on 2014-08-22+02:0011
.