cancel
Showing results for 
Search instead for 
Did you mean: 

Alternate of CREATE_PROCESS_FORECAST for CTR

RicardoRomero_1
Active Contributor
0 Kudos

Hi all,


I need to add a validation in badi BBP_DOC_CHECK_BADI depending on the approval data.


I'm trying to use the method   /SAPSRM/CL_WF_APV_FACADE=>CREATE_PROCESS_FORECAST within this badi, but doesn't work fine.


I've found this thread of Ashish Shah with a similar problem, but for PO. In this thread Konstantin Anikeev suggested using the method  /SAPSRM/IF_PDO_DO_APV_EXT~GET_PROCESS_INFO_REF of class /SAPSRM/IF_PDO_BO_PO_ADV.

I've found the class /SAPSRM/IF_PDO_BO_CTR_ADV for CTR, but the method GET_PROCESS_INFO_REF doesn't exist there.

Do you know which method can I use for CTR?

Thanks in advance.
Regards,

Ricardo.

Accepted Solutions (1)

Accepted Solutions (1)

konstantin_anikeev
Active Contributor
0 Kudos

Hmmm.

konstantin_anikeev
Active Contributor
0 Kudos

You can get the reference directly to the class, not to interface, just writing

lo_pdo ?= ....

instead of

lo_pdo = ...

In this case, you can try to define lo_pro TYPE REF TO /SAPSRM/CL_PDO_BO_CTR_ADV

RicardoRomero_1
Active Contributor
0 Kudos

Ok, thanks Konstantin, I was watching the interface not the class. I didn't realize I can use the class and a widening cast.

RicardoRomero_1
Active Contributor
0 Kudos

Hello again Konstantin Anikeev ,

The method works fine if a modify a Contract in status "Saved".

But if I create a contract using bapi  BBP_PD_CTR_CREATE (from a custom program) then doesn't work,

The parameter  er_process_info is returned empty. I've tried also with the method CREATE_PROCESS_FORECAST , but doesn't work neither.


Any idea ?

Thanks in advance,
Regards,
Ricardo.

konstantin_anikeev
Active Contributor
0 Kudos

Hi Ricardo,

It's because "old" function modules does not create the object instances. You have to use "new" PDO-classes for that.

Regards

Konstantin

konstantin_anikeev
Active Contributor
0 Kudos

Had the same issue with PO. If PO created from Sourcing Cockpit - it is created also via function module, so, no classes available.

Fortunatelly, the workflow was designed also by me, and I could predict the results directly via the classes, without involving SAP standard.

RicardoRomero_1
Active Contributor
0 Kudos

mmm, ok, thanks for answer.
Could you provide me the name of the class and method I need to use to create a contract ?

Thanks in advance.

konstantin_anikeev
Active Contributor
0 Kudos

Something like

lo_pdo = /SAPSRM/CL_PDO_FACTORY_CTR_ADV=>CREATE_NEW_INSTANCE(...)

For OO approach you create first the empty class and then put the data...

lo_pdo->/SAPSRM/IF_PDO_BO_CTR~UPDATE_HEADER(...)

lo_pdo->/SAPSRM/IF_PDO_BO_CTR~UPDATE_ITEM(...)

etc.

Answers (0)