‎2006 Oct 31 7:59 PM
Hi ,
I am using Call Transaction in BDC .
After Posting the document , the system generates an Accounting Document Number ..how can i get that document number after the call transaction call ??
Thank You
‎2006 Oct 31 8:11 PM
Hi,
You can also code something like this.
...
clear i_msgtab.
refresh i_msgtab.
call transaction 'VA02' using bdcdata
mode p_mode
update 'S'
messages into i_msgtab.
if sy-subrc <> 0.
*Process and display error messages
loop at i_msgtab.
clear t100.
select single * from t100
where sprsl = i_msgtab-msgspra and
arbgb = i_msgtab-msgid and
msgnr = i_msgtab-msgnr.
perform process_message using t100-text.
endloop.
skip.
endif.
form process_message using p_message.
data: l_message(480).
if sy-subrc = 0.
l_message = p_message.
if l_message cs '&1'.
replace '&1' with i_msgtab-msgv1 into l_message.
replace '&2' with i_msgtab-msgv2 into l_message.
replace '&3' with i_msgtab-msgv3 into l_message.
replace '&4' with i_msgtab-msgv4 into l_message.
else.
replace '&' with i_msgtab-msgv1 into l_message.
replace '&' with i_msgtab-msgv2 into l_message.
replace '&' with i_msgtab-msgv3 into l_message.
replace '&' with i_msgtab-msgv4 into l_message.
endif.
condense l_message.
write: /2 i_msgtab-msgtyp, l_message(250).
else.
write: /2 i_msgtab.
endif.
endform. " process_messageHope this will help.
Regards,
Ferry Lianto
‎2006 Oct 31 8:01 PM
Hi, this is pretty simple, use the MESSAGES INTO MESSTAB extension of the CALL TRANSACTION statement, your document number will be there in one of the messages. All you need to do is read the MESSTAB table and get it.
For example, here is a small example from one of my programs.
data: messtab like bdcmsgcoll occurs 0 with header line.
call transaction 'CO40' using bdcdata mode mode
update 'S'
<b>messages into messtab.</b>
* This is the success message, the production order
* number is in the <b> MSGV1 field of MESSTAB</b>
read table messtab with key msgid = 'CO'
msgnr = '100'.
if sy-subrc = 0.
<b>write:/ messtab-MSGV1.</b>
endif.
Regards,
Rich Heilman
‎2006 Oct 31 8:11 PM
Hi,
You can also code something like this.
...
clear i_msgtab.
refresh i_msgtab.
call transaction 'VA02' using bdcdata
mode p_mode
update 'S'
messages into i_msgtab.
if sy-subrc <> 0.
*Process and display error messages
loop at i_msgtab.
clear t100.
select single * from t100
where sprsl = i_msgtab-msgspra and
arbgb = i_msgtab-msgid and
msgnr = i_msgtab-msgnr.
perform process_message using t100-text.
endloop.
skip.
endif.
form process_message using p_message.
data: l_message(480).
if sy-subrc = 0.
l_message = p_message.
if l_message cs '&1'.
replace '&1' with i_msgtab-msgv1 into l_message.
replace '&2' with i_msgtab-msgv2 into l_message.
replace '&3' with i_msgtab-msgv3 into l_message.
replace '&4' with i_msgtab-msgv4 into l_message.
else.
replace '&' with i_msgtab-msgv1 into l_message.
replace '&' with i_msgtab-msgv2 into l_message.
replace '&' with i_msgtab-msgv3 into l_message.
replace '&' with i_msgtab-msgv4 into l_message.
endif.
condense l_message.
write: /2 i_msgtab-msgtyp, l_message(250).
else.
write: /2 i_msgtab.
endif.
endform. " process_messageHope this will help.
Regards,
Ferry Lianto