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

how to capture MBLNR value using mb1b tcode

Former Member
0 Likes
2,007

Hi Guys,

i have converted mb1b standard report in z report and created t code also & I need to capture Generated material document number using MB1b tcode and need to insert that generated document in z table.

My problem is that i am doing with z mb1b report but how i captured that value

because its generated at end of all procedure when click on save button.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,855

The message number is '060' , (message class - M7), if you are doing it in the above way.

I have one more solution.

You have the copy of the original transaction right ?

Try this.

data lv_mblnr like mkpf-mblnr.

data lv_mjahr like mkpf-mjahr.


call transaction zmbib or submit zprogram.

After you return to the main program

GET PARAMETER ID 'MBN' FIELD lv_mblnr

GET PARAMETER ID 'MJA' FIELD lv_mjahr.

You get the document number and year for document posted.


14 REPLIES 14
Read only

FredericGirod
Active Contributor
0 Likes
1,855

Hi Mahaveer,

you could use a BADI or an exit (MB_CF001) to export the number in memory and catch-it after. or better, save your specific table in this exit.

regards

Fred

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,855

You could also try BTE like BTE 00001050. (Try to set a BREAK-POINT at start of FM
BF_FUNCTIONS_FIND)

Regards,

Raymond

Read only

Former Member
0 Likes
1,855

After call transaction , check SYST table.

You should get the document number in the system messages.

Put a break point and check the values in sy table. Find the component in sy table having the document number that was posted. It might be sy-msgv1.

Pass the document number you get here to your ztable.

(You many need to call this transaction within another program to capture the messages after you click the save button. )

Read only

0 Likes
1,855

Hi susmitha,

How could i call this transaction because i am doing in z report of mb1b. i have converted 

standard report in z report.

Read only

0 Likes
1,855

You said you had created a tcode also right? So you can call this with call transaction statement.

or you can call your Z program using submit program.

Read only

0 Likes
1,855

sy-msgv1 capturing plant not document number and in that z program i had added 3 fields in screen 400. beacuse i need to add fields in standard mb1b so i copy that report in my z program.

Read only

0 Likes
1,855

Actually, it would be better if you call transaction using BDC.

I had done something similar with MIGO transaction.

This is how i did to capture the document number of the posted document in MIGO.

I called the transaction using BDC. After coming back in the message table, I had the document number in the MSGV1 field. And this was updated in another ZTABLE.

DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
*       messages of call transaction
DATA:   MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

CALL TRANSACTION TCODE USING BDCDATA
                      MODE   'A'
                      UPDATE 'L'
                      MESSAGES INTO MESSTAB.


read table messtab with  KEY tcode = 'MIGO' msgnr = '012'.
       if sy-subrc = 0.
         wa_efih1-mblnr = messtab-msgv1.
         WA_efih1-mjahr = sy-datum(4).
         INSERT INTO zefih VALUES wa_efih1.

      endif.

Read only

0 Likes
1,855

what is this in your code wa_efih1  ?

Read only

0 Likes
1,855

that is the work area of my ztable where the document number is updated.

Instead of that, move the document number to any field in your program to capture it.

The crux is that you can get the document number from the messtab.

you may need to debug it to get the correct msg no in messtab that has the document number (may or may not be 012) but it would be there if the document was successfully posted.

Read only

Former Member
0 Likes
1,856

The message number is '060' , (message class - M7), if you are doing it in the above way.

I have one more solution.

You have the copy of the original transaction right ?

Try this.

data lv_mblnr like mkpf-mblnr.

data lv_mjahr like mkpf-mjahr.


call transaction zmbib or submit zprogram.

After you return to the main program

GET PARAMETER ID 'MBN' FIELD lv_mblnr

GET PARAMETER ID 'MJA' FIELD lv_mjahr.

You get the document number and year for document posted.


Read only

0 Likes
1,855

Thanks susmitha its working now..

You solved my problem...

If any problem then i'll get back to you for further help..

Thanks

Read only

0 Likes
1,855

Sure!

Please close the thread as Answered if solved.

Read only

Former Member
0 Likes
1,855

Hi ,

why you have created ZMB1B , do you have any special requirements ?

iPBC

Read only

0 Likes
1,855

yes i need to add 3 fields in screen 400 of mb1b and pass that value to screen 421 and here while clicking on save button that values need to insert in z table along with generated document number of mb1b.