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: 

Getting the Order number in BDC

Former Member
0 Kudos

Hi ,

I have written on BDC where I am creating the sale orders, bu I would like to konw how to get the sale orders created.

belos is sample code.

Loop itab.

BDC processing.

Call transaction va01.

***here I need to get the created order number above.

endloop.

Regards,

vinesh

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Vinesh,

Simulate the VA01 trxn once & when the order is successfully created a success message is generated. Capture the success message number.

Call transaction va01 MESSAGES INTO it_msg.

From this table it_msg, get the message which is generated from VA01 & from there you will get the Order Number.

BR,

Suhas

6 REPLIES 6

Former Member
0 Kudos

Hi,

Check the Structure SYST or you can also capture succes message in Retirn table of BDC.

PS: Prefer BAPI/FM to create Sales order than BDC

Cheers,

Nag

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Vinesh,

Simulate the VA01 trxn once & when the order is successfully created a success message is generated. Capture the success message number.

Call transaction va01 MESSAGES INTO it_msg.

From this table it_msg, get the message which is generated from VA01 & from there you will get the Order Number.

BR,

Suhas

Former Member
0 Kudos

try to done it by BAPI..instead of BDC..

for BDC trap all messages and read message type S there you will get no.

sarbajitm
Contributor
0 Kudos

Hi,

After completion of BDC execution, write a select statement on VBAK

to get VBELN where ERDAT = sy-datum and ERNAM = sy-uname.

May be in this way you can get the desired output.

Regards.

Sarbajit.

Former Member
0 Kudos

data: it_msg type standard table og bdcmsgcoll,

lf_msg type string.

loop at it_msg into wa_msg.

call function format_message

exporting

id = wa_msg-msgid

lang = sy-langu

no = wa_msg-msgnr

v1 = wa_msg-msgv1

v2 = qa_msg-msgv2

v3 = wa_msg-msgv3

v4 = wa_msg-msgv4

importing .

msg = lf_msg.

try with this peace of code.

Regards,

Raji

Former Member
0 Kudos

call transaction va01 messages into it_msg. " internal table to capture the messages.

2 messages will be created.

capture the one with msgtype 'S'.

and capture the variabel msgv1.

call function format_message

exporting

id = wa_msg-msgid

lang = sy-langu

no = wa_msg-msgnr

v1 = wa_msg-msgv1

v2 = qa_msg-msgv2

v3 = wa_msg-msgv3

v4 = wa_msg-msgv4

importing .

msg = lf_msg.

regards,

sakshi