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

Sales order create/append difference

tabraiz_khan
Participant
0 Likes
728

Hi,

I've been trying to find a standard way to find out whether a sales order is being created or appended through any means other than the below:

1) VBAK-VBELN can be checked to see if the sales order number has beencreated while in a user exit

2) SY-TCODE can be checked for value 'VA01' or 'VA02' - of course this will not work while calling a BAPI to create the order

3) T180-TRTYP Again, this is line specific, it will only show if a line is being inserted or amended - so this doesn't help me

Does anyone know any other way, preferrable using a SAP standard field to figure out the difference between sales order create and append?

Thanks,

Tabraiz

5 REPLIES 5
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
675

Using change log tables CDHDR/CDPOS.

When the change indicator is I and if it does not contain U or D...then its created and not changed else its created and was changed later.

Does this answer your question or you meant somethig else ?

Read only

0 Likes
675

I'm doing this check during runtime in a user exit. I don't believe I can use this.

Thanks for the reply.

Read only

0 Likes
675

So you need to check whether the order is being created or changed in your user exit.

Using sy-tcode as you said you can do it .... Using bapi just place a break point in your exit and check whether it triggers when executed through bapi ... if so you can code it and accomplish it.

Read only

0 Likes
675

I'm quite sure the BAPI doesn't populate VA01/VA01. It populates the transaction code u call it from.

For example, u call the bapi from tcode 'ZABC', it populates 'ZABC' in the sy-tcode.

Read only

0 Likes
675

What i mean to say is if the exit triggers in bapi execution and

if the any of the parameter in your exits has the document number,

then you can just do a select single from db and confirm whether its change or create.

like

if ( sy-tcode = 'BAPI' ) or ( sy-code CP 'Z*' ) or ( sy-tcode = 'SE38' ) or ( sy-tcode = 'SE37' ).

select single * from abc.....

elseif sy-tcode = 'VA01'.

elseif sy-tcode = 'VA02'.

endif.

also

did you check the field TCODE in table T180