cancel
Showing results for 
Search instead for 
Did you mean: 

How to find if the PO Change Badi is called for the first time for a PO

Former Member
0 Kudos

Hi Experts,

We have a scenario wherein we need to set a default value in PO only incase the PO-CHange Badi is called very first time, so as to pass SCs value into PO.
After that a separate logic will be used to default incase again the PO change BAdi is called next time.

Please suggest if their is any way we can find if the PO has just been created out of SC fo rthe first itme.

Thanks in advance.

With Regards,

Gaurav Gupta

Accepted Solutions (1)

Accepted Solutions (1)

RicardoRomero_1
Active Contributor
0 Kudos

Hi,

If you want to know if the badi is called the first time check the parameter IV_MODE. If the value of this parameter is C then is the first time, the next times the badi is called the value changes to U, even if you are in creation mode and the PO doesn't exit in the database.

Regards,

Former Member
0 Kudos

Thanks Ricardo,
It's working great.

Thanks for sharing this info. This resolved my issue as I required to set few values in PO incase the it has been just created or one can say incase the PO Change Badi is called the very first time.

Thanks a lot...
Regards,

Gaurav

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Gaurav,

You can use the following logic.

Use FM BBP_PD_PO_GETDETAIL. Then provide the PO number/GUID as an import parameter and under E_HEADER (export parameter), get the value of VERSION_NO. If VERSION_NO = '1', it would imply that the PO has just been created from the SC.

Cheers,

Nikhil

Former Member
0 Kudos

Hi Nikhil,

Thanks for your valuable info, but I checked for the version and it is coming blank.
Be it if the PO is created out of SC and PO going in saved state or be it in awaiting approval state, the Version No is blank in both cases.

Both in E_HEADER as well as in E_VERSION the version no is blank.

Looking forward to your response. Thanks.

Former Member
0 Kudos

Hi Gaurav,

This is a pretty standard functionality and VERSION_NO should always be populated. Anyways you can try one more thing. Use the PO number/GUID under table BBP_PDHGP and check for VERSION_NO that is returned from this table.

Regards,

Nikhil

Former Member
0 Kudos

Hi Nikhil,


Thanks,
but the resolution with badi import parameter - IV_MODE that Ricardo detailed worked all fine.

Not sure why Version_No is not working at all in here .