cancel
Showing results for 
Search instead for 
Did you mean: 

Account assignment depending on SC fields

Former Member
0 Kudos

Hi all,

we have the requirement to implenent an own account assignment in shopping carts depending on SC fields like PARTNER or PRICE. The accounting is intended as an initialization that can be overwritten later by the requisitioner.

I shall use BAdI BBP_DETERMINE_ACCT. But its import parameter ITEM_DATA seems tiny and does not contain any useable SC fields. BAdI BBP_DOC_CHANGE_BADI is not an option because it runs more than once. The initialization must only run at the time the accounting is first determined. And more, note 1912511 says one must not use that BAdI for custom account assigning.

How do I get SC details in BAdI BBP_DETERMINE_ACCT?

kind regards

José

Accepted Solutions (1)

Accepted Solutions (1)

RicardoRomero_1
Active Contributor
0 Kudos

Hi,

If you need some extra data from BAdI BBP_DETERMINE_ACCT may be you can use this:

http://scn.sap.com/thread/3338751

Check the answer by Konstantin Anikeev to get the data from the selected SC item.


Regards.

Former Member
0 Kudos

Hi Ricardo,

thank you for the reference to the possible solution. I already found a solution myself to get the shopping cart details from BAdI BBP_CATALOG_TRANSFER. In there I export et_items to a (session) memory id which I import in BBP_DETERMINE_ACCT.

However, this approach (and any other to retrieve the details) leads to a dead end. Although I now have all cart details available in BBP_DETERMINE_ACCT I cannot process them because there is no way to link them with the BAdI's parameter ITEM_DATA. There is neither a GUID or PRODUCT_ID nor a LINE (or any usefull key field).

I'm afraid I have to implement the request in BBP_DOC_CHANGE_BADI.

best regards

José

RicardoRomero_1
Active Contributor
0 Kudos

Hi José,

I've never used the badi BBP_DETERMINE_ACCT, so I don't know how it works or when is being triggered, I guess the badi is triggered when you select a line. There is a field LINE within the parameter ITEM_DATA, I don't know if you can use it to read the table you exported to memory, comparing with the field NUMBER_INT.

If the badi is being triggered when you select a line you can use the code in the link I put in my previous answer, in this way you can retrieve the data from the selected item in the SC.

Anyway, if you want to use badi BBP_DOC_CHANGE_BADI and you want to execute some code only the first time the line is added, as inicialization, you can use this code as reference to know if the line has just been added.

http://scn.sap.com/thread/1908996

Regards,
Ricardo.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Jose,

did you manage to find a way to resolve this? Thanks

Former Member
0 Kudos

No, I didn't.

Former Member
0 Kudos

Hi Jose, thanks,, what did you do then for this reqmt? Thanks!

Former Member
0 Kudos

We are using the classic approach by implementig the logic in BAdI BBP_DOC_CHANGE_BADI, see Ricardo Romero's answer.

Former Member
0 Kudos

Hi Jose,

The sample code I posted is from BBP_DETERMINE_ACCT. but looks we referring PO change to fill values to Memory Id..

BR
Srrimaan

Former Member
0 Kudos

Hi Jose,

It seems to be working with session memory Id.. Sample code we using..

------------------------------------------------------------

* this BADI gets the default G/L account based on company, plant, Icode,

* and account assignment category

  *** Import the GL Acct from class ZCL_IM__CP_EBP_UOM_OUT, method IF_EX_BBP_DOC_CHANGE_BADI~BBP_PO_CHANGE

   data: gv_gl_acct TYPE BBP_PDS_ACC-G_L_ACCT,

         lv_gl_acct TYPE BBP_PDS_ACC-G_L_ACCT.

   import gv_gl_acct to lv_gl_acct from MEMORY id 'GV_GL_ACCT'.

   if item_data-catalogid is INITIAL.

     CLEAR wa_acct.

     READ TABLE acct_data INTO wa_acct with key line = item_data-line.

     if sy-subrc eq 0.

       wa_acct-g_l_acct = lv_gl_acct.

       MODIFY acct_data FROM wa_acct

       TRANSPORTING g_l_acct WHERE line = item_data-line.

       CLEAR wa_acct.

     endif.

   ENDIF.

------------------------------------------------------------------------------------


BR

Srrimaan

Former Member
0 Kudos

Hello Srrimaan,

thank you for your reply. As I wrote in my first reply to Ricardo's posting that's exactly how I tried it. Except that you have implemented it in BBP_PO_CHANGE whereas I need the coding in BBP_DETERMINE_ACCT for shopping carts. The import structure ITEM_DATA of that BAdI contains the field LINE, too. But its content is always 0000. So no chance for me to READ TABLE from the session memory id to ITEM_DATA. I have reported this behaviour to OSS.

kind regards

José


RicardoRomero_1
Active Contributor
0 Kudos

Hi José,

Check this note:

586714 - Line number not filled in BBP_DETERMINE_ACCT BADI


Regards,

Ricardo.

Former Member
0 Kudos

I already checked that note. It is not relevant for our release 703. To be sure I pointed that note out in the OSS message.