Application Development 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: 

call transaction mb51 ?

Madhurivs23
Participant
0 Kudos

Hi All,

I want the data generated by MB51 transaction and use it in my report to calculate the gross production units.

Can I do Call transaction providing the material plant and posting date to MB51 and then access the final internal table and use those values in my report?

Otherwise I need to develop a logic used in MB51

Please help.

thanks in advance,

Rgds,

Madhuri

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

the Tcode MB51 exports the data to memory id see the code At line 1531 in report RM07DOCS

EXPORT export_list TO MEMORY ID 'MB51_EXPORT_LIST'.

So in your report you can call the tcode using MB51 using CALL TRANSACTION and later the read the data from memory using IMPORT i_list FROM MEMORY ID 'MB51_EXPORT_LIST' into internal table.

You can try this way..

6 REPLIES 6

Former Member
0 Kudos

Hi,

the Tcode MB51 exports the data to memory id see the code At line 1531 in report RM07DOCS

EXPORT export_list TO MEMORY ID 'MB51_EXPORT_LIST'.

So in your report you can call the tcode using MB51 using CALL TRANSACTION and later the read the data from memory using IMPORT i_list FROM MEMORY ID 'MB51_EXPORT_LIST' into internal table.

You can try this way..

0 Kudos

Hi Avinash,

Thanks for the reply.

How can I pass the values to MB51 ? like material , plant.

I checked for set get parameters. but could not get proper data.

Regards,

Madhuri

0 Kudos

try this code...

rm07docs is the report of 'MB51'.



SUBMIT rm07docs USING SELECTION-SCREEN '1000'
                        WITH matnr = '<your_material'
                        WITH werks = '<your_plant>'
                        AND RETURN.

0 Kudos

Hi All,

I have written a code like this.The MAT AND WRK values are passing correctly but not the 'MB51_NOLIST' and 'MB51_FLAG' .

Is there anything wrong in my code?

DATA: NO_LIST,FLAG.

NO_LIST = 'X'.

FLAG = 'X'.

SET PARAMETER ID: 'MAT' FIELD W_MB51_PARAMETER-matnr,

'WRK' FIELD W_MB51_PARAMETER-WERKS,

'MB51_NOLIST' FIELD NO_LIST,

'MB51_FLAG' FIELD FLAG.

CALL TRANSACTION 'MB51' AND SKIP FIRST SCREEN .

IMPORT EXPORT_LIST FROM MEMORY ID 'MB51_EXPORT_LIST' .

rgds,

Madhuri

Edited by: madhuri sonawane on Jan 14, 2009 3:57 PM

0 Kudos

Dear Madhuri ,

use ...

DATA : listtab LIKE abaplist OCCURS 1.

DATA : listtab_tmp LIKE abaplist OCCURS 1.

REFRESH listtab.

CALL FUNCTION 'LIST_FREE_MEMORY'

TABLES

listobject = listtab.

SUBMIT RM07DOCS using SELECTION-SCREEN '1000'

WITH matnr = '<your_material'

WITH werks = '<your_plant>' EXPORTING LIST TO MEMORY AND RETURN .

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = listtab

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DESCRIBE TABLE listtab LINES n .

*************************************Added By Sudhir on 14.01.2009*****************************

CALL FUNCTION 'WRITE_LIST'

EXPORTING

write_only = 'X'

TABLES

listobject = listtab

EXCEPTIONS

empty_list = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks And Regards

Deepak Dhamat .

Former Member
0 Kudos

Hi ,

See the code below and use submitt report RM07DOCS in your program .

Please read this following code carefully you will find how you can run MB51 and import the result in your program .

select * from mseg

into table it_mseg

for all entries in iekpo

where mblnr = w_mblnr

and werks = iekpo-werks

and lgort = iekpo-lgort.

read table it_mseg index 1 .

clear wa_seltab.

move: 'P_WERKS' to wa_seltab-selname, "field name of submit prog

'P' to wa_seltab-kind, "field type of submit prog

it_mseg-werks to wa_seltab-low. "field value to run submit prog

append wa_seltab to i_seltab.

clear wa_seltab.

move: 'P_LGORT' to wa_seltab-selname,

'P' to wa_seltab-kind,

it_mseg-lgort to wa_seltab-low.

append wa_seltab to i_seltab.

clear wa_seltab.

move: 'P_SOURCE' to wa_seltab-selname,

'P' to wa_seltab-kind,

it_mseg-mat_pspnr to wa_seltab-low.

append wa_seltab to i_seltab.

clear wa_seltab.

move: 'P_ISSUE' to wa_seltab-selname,

'P' to wa_seltab-kind,

ps_psp_pnr to wa_seltab-low.

append wa_seltab to i_seltab.

clear wa_seltab.

move: 'P_ERFMG' to wa_seltab-selname,

'P' to wa_seltab-kind,

it_mseg-erfmg to wa_seltab-low.

append wa_seltab to i_seltab.

clear wa_seltab.

move: 'P_BUDAT' to wa_seltab-selname,

'P' to wa_seltab-kind,

mkpf-budat to wa_seltab-low.

append wa_seltab to i_seltab.

clear wa_seltab.

move: 'P_SGTXT' to wa_seltab-selname,

'P' to wa_seltab-kind,

it_mseg-sgtxt to wa_seltab-low.

append wa_seltab to i_seltab.

clear wa_seltab.

move: 'P_RAD1' to wa_seltab-selname,

'R' to wa_seltab-kind,

'X' to wa_seltab-low.

append wa_seltab to i_seltab.

clear wa_seltab.

submit zmatissuewbs

with selection-table i_seltab

via selection-screen

and return.

endif.

As per the above code first you will find out the name of the fields of MB51 tcode where you want to

pass the data and execute the program , Than append this field names and value in i_seltab Than

use submitt statement and Import memory statement .

your prob will surely solved .

Regards ,

Nilesh Jain .