Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

learning BDC

Former Member
0 Likes
750

hi i am learning BDC call transaction,

i went through SHDB, ran the transaction XK01, with minimum most data,

got the recording, and after selecting this recording, and pressing the create program button, i got the following code, can any one tell me where to make changes to make this program a call transaction program,

or am i in a wrong way, do i need to go in a different approach:

*******************************

report ZHW01

no standard page heading line-size 255.

include bdcrecx1.

start-of-selection.

perform open_group.

perform bdc_dynpro using 'SAPMF02K' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-REF_EKORG'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-REF_LIFNR'

'3950000'.

perform bdc_field using 'RF02K-REF_BUKRS'

'zz01'.

perform bdc_field using 'RF02K-REF_EKORG'

'0001'.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-ANRED'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFA1-LAND1'

'US'.

perform bdc_field using 'LFA1-SPRAS'

'EN'.

perform bdc_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'XK01'.

perform close_group.

5 REPLIES 5
Read only

Former Member
Read only

Former Member
0 Likes
703

hello sanjana,

what ever u have done is right. let me tell u the steps of a bdc program.

first u have to upload the flat file which is in ur system to an internal table . for this u have to use gui_upoload. then create two table stucure with the stucture of BDCDATA and BDCMSGCOLL. first one for mapping logic and the secind one for error records. and then loop ur internal table and inside that u put ur recording logic. below that write the syntax for call transaction using method. collect the error recordsin to the internal table with sturcture BDCMSGCOLL and then close the loop.

Read only

0 Likes
703

perform bdc_screen using 'SAPMM07I' '0701' 'X'.

perform bdc_field using 'RM07I-IBLNR' docno.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_screen using 'SAPMM07I' '0731' 'X'.

i = 1.

loop at itab_stock.

quantchar = itab_stock-menge.

concatenate 'ISEG-ERFMG(' i ')' into fnam.

perform bdc_field using 'BDC_CURSOR' FNAM.

perform bdc_field using fnam quantchar.

  • BREAK-POINT.

if i = '5'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_screen using 'SAPMM07I' '0731' 'X'.

i = 0.

endif.

i = i + 1.

endloop.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_screen using 'SAPMM07I' '0731' 'X'.

perform bdc_field using 'BDC_OKCODE' '=BU'.

call transaction 'MI04' using itab_bdcdata mode 'A'.

Read only

SAPAI
Participant
0 Likes
703

BDC using Call transaction involves calling an SAP transaction in back ground from within the ABAP program. The process involves building an Internal BDC table containing the screen information needed to execute the required transaction and then passing this to the Call transaction command (See code example).

The full procedure for creating a BDC program is as follows:

STEP 1

Create recording using SM35(or SHDB).

STEP 2

Use recording as a basis to populate the Internal BDC table. See

'FORM bdc_update' within the code example

&----


*& Form BDC_UPDATE

&----


  • Populate BDC table and call transaction ME22

----


FORM bdc_update.

PERFORM dynpro USING:

'X' 'SAPMM06E' '0105',

' ' 'BDC_CURSOR' 'RM06E-BSTNR',

' ' 'RM06E-BSTNR' wa_ekko-ebeln,

' ' 'BDC_OKCODE' '/00', "OK code

'X' 'SAPMM06E' '0120',

' ' 'BDC_CURSOR' 'EKPO-NETPR(01)',

' ' 'EKPO-NETPR(01)' p_newpr,

' ' 'BDC_OKCODE' '=BU'. "OK code

<b>* Call transaction to update customer instalment text

CALL TRANSACTION 'ME22' USING bdc_tab MODE 'N' UPDATE 'S'

MESSAGES INTO messtab.</b>

  • Check if update was succesful

IF sy-subrc EQ 0.

ADD 1 TO gd_update.

APPEND wa_ekko TO it_success.

ELSE.

  • Retrieve error messages displayed during BDC update

LOOP AT messtab WHERE msgtyp = 'E'.

  • Builds actual message based on info returned from Call transaction

CALL FUNCTION 'MESSAGE_TEXT_BUILD'

EXPORTING

msgid = messtab-msgid

msgnr = messtab-msgnr

msgv1 = messtab-msgv1

msgv2 = messtab-msgv2

msgv3 = messtab-msgv3

msgv4 = messtab-msgv4

IMPORTING

message_text_output = w_textout.

ENDLOOP.

  • Build error table ready for output

wa_error = wa_ekko.

wa_error-err_msg = w_textout.

APPEND wa_error TO it_error.

CLEAR: wa_error.

ENDIF.

  • Clear bdc date table

CLEAR: bdc_tab.

REFRESH: bdc_tab.

ENDFORM. " BDC_UPDATE

----


  • FORM DYNPRO *

----


  • stores values to bdc table *

----


  • --> DYNBEGIN *

  • --> NAME *

  • --> VALUE *

----


FORM dynpro USING dynbegin name value.

IF dynbegin = 'X'.

CLEAR bdc_tab.

MOVE: name TO bdc_tab-program,

value TO bdc_tab-dynpro,

'X' TO bdc_tab-dynbegin.

APPEND bdc_tab.

ELSE.

CLEAR bdc_tab.

MOVE: name TO bdc_tab-fnam,

value TO bdc_tab-fval.

APPEND bdc_tab.

ENDIF.

ENDFORM. " DYNPRO

I hope this will solve your query.. If not get back.

Reward points if helpful and close the thread.

Read only

Former Member
0 Likes
703

Hi sanjana ,

just send me ur email id i will send some ppts on it andd a pdf file which will able to learn to solve d problem.