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

Help with BDC recording / program

Former Member
0 Likes
724

I want to write a program for posting goods issue using BDC..I got the following recording. Can you tell me how to use(code) this in program for posting goods issue?

VL02N

SAPMV50A 4004 X

BDC_CURSOR LIKP-VBELN

BDC_OKCODE =WABU_T

LIKP-VBELN 114000400

Thank you very much,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
586

go to 'shdb' tcode, once the recording is over. clisk on program pushbutton in application tool bar. it takes you to the abap editor.

You should declare the internal table there. and upload the required file in start-of-selection event. then change the variables you are passed in the recording with internal table fields.

To make the transfer to all records put all the recorded code in a loop. Bz. recording will be created for one record only.

thanx.

3 REPLIES 3
Read only

Former Member
0 Likes
586

Hi,

If you used SHDB to record your transaction, then click 'PROGRAM' button in SHDB, this will create a program for your recording. Before clicking PROGRAM button make sure the name of the recording is checked in the list.

or else

perform bdc_dynpro using 'SAPMV50A' '4004'.

perform bdc_field using 'BDC_CURSOR' 'LIKP-VBELN'.

perform bdc_field using 'BDC_OKCODE' '=WABU'.

perform bdc_field using 'LIKP-VBELN' '114000400'

CALL TRANSACTION TCODE USING BDCDATA

MODE CTUMODE

UPDATE CUPDATE

MESSAGES INTO MESSTAB.

(Where TCODE = 'VL02N', CTUMODE = 'N' or 'A' and CUPDATE = 'S', MESSTAB of type BDCMSGCOLL)

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> NODATA.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM.

Regards,

Vamsi

Read only

0 Likes
586

Hi ,

check this code for goods issue.

data: ctumode like ctu_params-dismode value 'N'.

data: cupdate like ctu_params-updmode value 'L'.

perform create_first_screen.

loop at itab.

clear w_erfmg.

w_erfmg = itab-zmenge.

perform bdc_dynpro using 'SAPMM07M' '0421'.

perform bdc_field using 'BDC_OKCODE'

'=NLE'.

perform bdc_field using 'MSEG-MATNR(01)' "Material number

itab-matnr.

perform bdc_field using 'MSEG-ERFMG(01)' "Quantity

w_erfmg.

perform bdc_field using 'MSEG-ERFME(01)' "UoM

itab-meins.

perform bdc_field using 'MSEG-WERKS(01)' "PLANT

ITAB-WERKS.

perform bdc_field using 'MSEG-LGORT(01)' "STORAGE LOCATION

ITAB-lgort.

perform bdc_field using 'BDC_SUBSCR' 'SAPMM07M 2400BLOCK1'.

perform bdc_field using 'BDC_SUBSCR' 'SAPLKACB 9000BLOCK'.

if not itab-kostl is initial.

perform bdc_field using 'BDC_CURSOR' 'COBL-KOSTL'.

perform bdc_field using 'COBL-KOSTL' itab-kostl.

elseif not itab-aufnr is initial.

perform bdc_field using 'BDC_CURSOR' 'COBL-AUFNR'.

perform bdc_field using 'COBL-AUFNR' itab-aufnr.

endif.

endloop.

perform finish_trans.

form bdc_dynpro using program dynpro.

clear bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

append bdcdata.

endform.

form bdc_field using fnam fval.

clear bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

append bdcdata.

endform.

form create_first_screen.

data: w_date(10),

w_mov_type(3) value '201',

w_txt(19) TYPE C.

w_txt = 'abvB Replenishment'.

w_werks = 'abc'.

W_LGORT = 'abc'.

write sy-datum to w_date mm/dd/yyyy.

perform bdc_dynpro using 'SAPMM07M' '0400'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'RM07M-WERKS'.

*perform bdc_field using 'BDC_OKCODE'

  • '=NPE'.

perform bdc_field using 'BDC_CURSOR'

'RM07M-XNAPR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MKPF-BLDAT'

w_date.

perform bdc_field using 'MKPF-BUDAT'

w_date.

perform bdc_field using 'MKPF-BKTXT'

w_txt.

perform bdc_field using 'RM07M-BWARTWA' "movement type

w_mov_type.

perform bdc_field using 'RM07M-WERKS'

w_werks.

perform bdc_field using 'RM07M-LGORT'

' '.

perform bdc_field using 'XFULL'

' '.

  • perform bdc_field using 'RM07M-XNAPR' ' X'. "print flag

perform bdc_field using 'RM07M-WVERS3'

'X'.

endform. " create_first_screen

form finish_trans.

perform bdc_dynpro using 'SAPMM07M' '0421'.

perform bdc_field using 'BDC_CURSOR'

'MSEG-ERFMG(01)'.

perform bdc_field using 'BDC_OKCODE'

'=BU'. "Post

perform create_transaction using 'MB1A'.

endform. " finish_trans

LET ME KNOW IF YOU NEED ANYTHING ELSE.

tHANKS

VENKI

Read only

Former Member
0 Likes
587

go to 'shdb' tcode, once the recording is over. clisk on program pushbutton in application tool bar. it takes you to the abap editor.

You should declare the internal table there. and upload the required file in start-of-selection event. then change the variables you are passed in the recording with internal table fields.

To make the transfer to all records put all the recorded code in a loop. Bz. recording will be created for one record only.

thanx.