‎2013 Jun 11 10:36 AM
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.
‎2013 Jun 12 9:24 AM
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.
‎2013 Jun 11 11:11 AM
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
‎2013 Jun 11 12:11 PM
‎2013 Jun 11 12:20 PM
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. )
‎2013 Jun 12 5:56 AM
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.
‎2013 Jun 12 6:11 AM
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.
‎2013 Jun 12 6:33 AM
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.
‎2013 Jun 12 6:39 AM
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.
‎2013 Jun 12 7:42 AM
‎2013 Jun 12 8:04 AM
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.
‎2013 Jun 12 9:24 AM
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.
‎2013 Jun 12 1:29 PM
Thanks susmitha its working now..
You solved my problem...
If any problem then i'll get back to you for further help..
Thanks
‎2013 Jun 12 2:03 PM
‎2013 Jun 12 9:59 AM
Hi ,
why you have created ZMB1B , do you have any special requirements ?
iPBC
‎2013 Jun 12 10:08 AM
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.