cancel
Showing results for 
Search instead for 
Did you mean: 

URGENT - How to change a SC while it's been saved?

Former Member
0 Kudos

Hi all,

Is there a way to update/change the SC info before it has been committed to the DB?

I have implemented the BBP_DOC_SAVE BADI with the customer validation as they have asked, then when i have the data as it has to be saved, i tried the BBP_PD_SC_UPDATE but the FM returns a lot of error messages including "document doesn't exist", so i don't know if there's a way to change the unsaved SC data, or if i need to change the standard BBP_PD_SC_CREATE...

Do you have any comments? i will post reward points..

Best regards,

Gerardo.

Message was edited by: Gerardo R. Espino

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Gerardo,

You can use the BADI BBP_DOC_CHANGE_BADI to change the SC data while it is being saved.BADI BBP_DOC_CHECK_BADI can be used to validate the SC item fields.You can even use both the BADI's togeher using the external memory.

Hope this helps..

BR,

Disha.

pls reward points for helpful answers.

Former Member
0 Kudos

Hi Disha

This is something I also was investigating it some days ago and didn't yet find a solution.

How can one differentiate the moment when the SC is being saved from other moments during SC creation like "refreshing" or "checking"? Because as far as I understood it, the BAdI BBP_DOC_CHANGE_BADI is called in all those situations (and some more). How to ensure that the BAdI code is only processed when saving the SC?

Kind regards,

Renaud

Former Member
0 Kudos

Hi all,

BBP_DOC_CHANGE_BADI is called everytime: each time you change some screen data, or click on some buttons, the request will be sent to SRM, and the update will take place (with a real change or not) in BBP_PD_SC_UPDATE.

If you want to change data only when saving the SC, you could try to check the field SY-UCOMM in this BADI.

The other solution is to use BBP_DOC_SAVE BADI, that is called after the SC save. Here, you will have to call BBP_PD_SC_GETDETAIL, BBP_PD_SC_UPDATE (with changed data), & BBP_PD_SC_SAVE (I think commit is not needed).

Rgds

Christophe

PS: please reward points for helpfull answers

Former Member
0 Kudos

Hi Christophe

Great info, thanks! Unfortunately I can not reward points as I'm not the thread owner/initiatior

Kind regards,

Renaud

Former Member
0 Kudos

I will let Gerardo do it for you ))

Former Member
0 Kudos

Hi christophe,

Really great info..Thanks a tons!!!

BR,

Disha.

Former Member
0 Kudos

Hi all,

Unfortunately i was working with the BBP_DOC_CHANGE_BADI without success, cuz i didn't find the right structures to modify the SC data. The fact it's that the SC it's being created from XI interface (RFC), so you may be thinking that my user it's working directly into SRM SC screens but that's wrong, the SC it's created from a Bapi call (BBP_PD_SC_CREATE).

I debugged the SC creation bapi and i found that there's a call to transfer the BBP_DOC_CHANGE_BADI data, but those structures seems to be not available from the Badi code.

Could you please tell me how to access the SC data structures in the DOC_CHANGE or DOC_SAVE BADI's to modify them? cuz i haven't found them.

Ps. Points posted 4everybody.

Former Member
0 Kudos

Hi Gerardo

Didn't work with the BAPI until now, so maybe the following explanations will not help. But anyway, let's try it:

In BAdI BBP_DOC_CHANGE_BADI you have to set a filter on object type = BUS2121 (represents the SC object type). Then implement method BBP_SC_CHANGE. It is essential to fill all exporting structures and tables. Even if you simply have to copy the content 1:1 from the importing structures and tables! See example code:

method IF_EX_BBP_DOC_CHANGE_BADI~BBP_SC_CHANGE.

  DATA: wa_item TYPE BBP_PDS_SC_ITEM_ICU.

  LOOP AT it_item INTO wa_item.
*   Do whatever is needed on SC item level here
    APPEND wa_item TO et_item.
  ENDLOOP.

* All other imported structures / tables have to be mapped
* to the corresponding exporting structures / tables!
  es_header    = is_header.
  et_account[] = it_account[].
  et_partner[] = it_partner[].
  et_orgdata[] = it_orgdata[].
  et_hcf[]     = it_hcf[].
  et_icf[]     = it_icf[].

endmethod.

Hope this helps...

Regards,

Renaud

Former Member
0 Kudos

Hi Gerardo,

I don't get it. The BADIs are provided with some parameters (using some structures).

What are the right structures that you are searching for ?

What kind of data do you want to modify ?

In BADI DOC_SAVE, like I already told, you have to call your own functions BBP_PD_SC_GETDETAIL / UPDATE / SAVE from the inbound parameter IV_DOC_GUID.

So if here you don't find your "right structures", I don't understand anything.

in BADI DOC_CHANGE, lot of data is passed to the BADI, so you should find it...

To see the BADI structure definitions, goes to SE18 and enter/search the BADI name: BBP_DOC_CHECK_BADI or BBP_DOC_CHANGE_BADI.

Rgds

Christophe

PS: please reward points for helpfull answers

Former Member
0 Kudos

Hi all,

Thanks for your help...

Christophe, the data that i want to modify it's the pricing of the items, today, the user its typing a different price than SRM, but some materials has this contract that tells the buyer that a different price condition will apply...

So, what i'm trying to do its to take the contract price and replace the user specific price, that's why i was looking for the contract (as you know). So, i did not which structures are the ones that store the data, to modify them...

Kind regards,

Gerardo.

Former Member
0 Kudos

Ok...

in DOC_CHANGE_BADI, you don't have pricing details, but you can try to change ET_ITEM-PRICE, and also assign the contract ref and vendor.

in DOC_SAVE BADI, you must call the BBP_PD_SC_GETDETAIL and get the pricing data in table E_PRIDOC. And can get also the item price in table E_ITEM.

Another option is to use the BADI BBP_SOS_BADI. In this one you could search for your contract, assign it, and let the system adapt the price, the vendor...

I think this is the best approach, but you have to check if the SOS is determined when you create your SC via RFC from XI...

Rgds

Christophe

PS: please reward points for helpfull answers

Former Member
0 Kudos

Christophe,

I will check the BBP_SOS_BADI to verify if the RFC call triggers it.

Thanks a lot guys.

Best regards,

Gerardo.

Answers (0)