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

Va01

Former Member
0 Likes
1,693

Hi friends,

I need a small help.I am implementing a custom enhancement for Sales Orders.

For this,I am using the User Exit SAVE_DOCUMENT_PREPARE in the standard program MV45FZZ(Include in SAPMV45A).I wrote a small logic,that gets triggered each time a Sales Order is created or Changed through VA01 or VA02 respectively.

I need to check the Pricing date PRSDT in VBKD for the Current Sales Order.If it is less than a value(Constant Date),I need to place a Billing Block.

While changing i.e., VA02,I can access XVBAP-VBELN and retrieve PRSDT from VBKD and check it.

But,while Creation i.e., VA01, XVBAP-VBELN is blank.

How can I get the current Sales Order while creation through VA01 ?

For VA02 i.e., change my logic works pretty well.I am capturing the current Sales Order Number using XVBAP-VBELN and implementing my logic.

But while creation i.e., VA01,I am using the same logic and trying to capture current Sales Order through XVBAP-VBELN(not yet saved).

But,XVBAP-VBELN is blank when I am debugging.

Where does the Sales Order Number get stored,while it is being created i.e., before being updated to VBAK-VBELN.(before commit).

REgards,

Imran.

6 REPLIES 6
Read only

former_member404244
Active Contributor
0 Likes
1,298

Hi,

u can get the sales documentnumber in XVBAK temporary table....chek the same..

Regards,

Nagaraj

Read only

0 Likes
1,298

No,it is blank..while creation.

any other option. ?

Read only

0 Likes
1,298

Sorry i missunderstood you...

Regards,

Gianpietro

Read only

Former Member
0 Likes
1,298

hello Masood,

How are you creating the sales order in VA01?

if you are creating sales order (VA01) by using Call transaction then the message with the new sale order number will be in the messages table.

check the below code.

CALL TRANSACTION 'VA01' USING bdcdata OPTIONS FROM opt

MESSAGES INTO g_t_messtab.

IF sy-subrc = 0.

IF l_f_vbeln IS INITIAL.

READ TABLE g_t_messtab WITH KEY tcode = 'VA01'

dyname = 'SAPMV45A'

dynumb = '4001'

msgtyp = 'S'

msgid = 'V1'

msgnr = '261'.

IF sy-subrc = 0.

l_f_vbeln = g_t_messtab-msgv2.

ELSE.

CLEAR l_f_vbeln.

ENDIF.

ENDIF.

l_f_ebeln is the field where i will getting the new sale order number.

i will use it for future purposes.

Read only

Former Member
0 Likes
1,298

hi,

there would be a structure NRIV, Which holds the number temporarily.

if helpful reward points.

regards

Mukesh

Read only

Former Member
0 Likes
1,298

Hi Masood,

If you have got the answer for this please share.

Mohan