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

SEND data TO MB51

Former Member
0 Likes
1,877

Hi all,

i need to send data to transaction mb51 and execute this transaction from my program.

my question is: how can i send data to posting date and than execute the transaction.

thanks,

dana.

1 ACCEPTED SOLUTION
Read only

Former Member
1,382

mb51 is a report type program.

you need to use the submit statement

ranges r_budat for mkpf-budat.

r_budat-low = sy-datum - 30

r_budat-high = sy-datum.

r_budat-sign = 'I'.

r_budat-option = 'EQ'.

append r_budat.

submit RM07DOCS with budat in r_budat.

Regards,

Ravi

6 REPLIES 6
Read only

Former Member
0 Likes
1,382

hi,

i didnt said that to the other data i using the parameter id:

set parameter id 'KOS' field itab_ekkn-KOSTL.

but to the posting date there is no parameter id - is it possible to send

it data?

Read only

Former Member
0 Likes
1,382

Hi dana,

try this:

  • Definition der BDC-Tabelle

DATA: BEGIN OF BDCDATA OCCURS 500.

INCLUDE STRUCTURE BDCDATA.

DATA: END OF BDCDATA.

*

DATA: CTU_PARAMS_0 LIKE CTU_PARAMS.

*

REFRESH BDCDATA.

*

PERFORM BDC_DYNPRO USING 'RM07DOCS' '1000'.

PERFORM BDC_FIELD USING 'MATNR-LOW' MATNR.

PERFORM BDC_FIELD USING 'WERKS-LOW' WERKS.

PERFORM BDC_FIELD USING 'LGORT-LOW' SPACE.

PERFORM BDC_FIELD USING 'CHARG-LOW' SPACE.

PERFORM BDC_FIELD USING 'LIFNR-LOW' SPACE.

PERFORM BDC_FIELD USING 'KUNNR-LOW' SPACE.

PERFORM BDC_FIELD USING 'BWART-LOW' SPACE.

PERFORM BDC_FIELD USING 'BWART-HIGH' SPACE.

PERFORM BDC_FIELD USING 'SOBKZ-LOW' SPACE.

PERFORM BDC_FIELD USING 'BUDAT-LOW' BUDAT_LOW.

PERFORM BDC_FIELD USING 'BUDAT-HIGH' BUDAT_HIGH.

PERFORM BDC_FIELD USING 'BDC_OKCODE' '=ONLI'.

*

CALL TRANSACTION 'MB51' USING BDCDATA MODE 'E'.

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

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.

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

Set the parameters as you need.

Regards, Dieter

Read only

0 Likes
1,382

i rather not doing it as batch input.

if you have another solution i glad to hear.

Read only

0 Likes
1,382

Hi dana,

it's not an batch-input. It's a call transaction with parameters

which are inserted in the BDC-DATA. Try it and you can see it.

Regards, Dieter

Read only

Former Member
1,383

mb51 is a report type program.

you need to use the submit statement

ranges r_budat for mkpf-budat.

r_budat-low = sy-datum - 30

r_budat-high = sy-datum.

r_budat-sign = 'I'.

r_budat-option = 'EQ'.

append r_budat.

submit RM07DOCS with budat in r_budat.

Regards,

Ravi

Read only

Former Member
0 Likes
1,382

Hai dona touty.....

u can achieve this with the <b>using</b> adition of call transaction(BDC).

just execute the following code once u will undrestand:

REPORT ZTEST_MB51

NO STANDARD PAGE HEADING LINE-SIZE 255.

DATA BDCDATA LIKE STANDARD TABLE OF BDCDATA WITH HEADER LINE.

START-OF-SELECTION.

PERFORM BDC_DYNPRO USING 'RM07DOCS' '1000'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'BUDAT-LOW'.

PERFORM BDC_FIELD USING 'BUDAT-LOW'

'06.03.2007'.

CALL TRANSACTION 'MB51' USING BDCDATA.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM. "BDC_DYNPRO

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDFORM. "BDC_FIELD