‎2011 Feb 10 11:36 AM
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
‎2011 Feb 10 11:47 AM
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 ?
‎2011 Feb 10 12:01 PM
I'm doing this check during runtime in a user exit. I don't believe I can use this.
Thanks for the reply.
‎2011 Feb 10 12:13 PM
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.
‎2011 Feb 10 12:17 PM
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.
‎2011 Feb 10 12:23 PM
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