cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with BBP_DOC_CHECK_BADI

Former Member
0 Kudos

Hi

We're on SRM 4.0 with SRM Server 5.0 SP08.

We're trying to add some additional checks on field DELIV_DATE of a new SC being entered. For this we want to use BBP_DOC_CHECK_BADI.

In the BAdI with content of field IV_DOC_GUID we read the SC details with a CALL FUNCTION 'BBP_PD_SC_GETDETAIL'. But we always get an emtpy table (E_ITEM) back, thus no chance do apply our additional checks.

What are we doing wrong here? Does the call function require some special importing paramters besides the i_guid and e_item?

The SC we want to do the checks on is not yet parked / saved. It's just being entered and when the user changes the DELIV_DATE field content it must follow some rules (e.g. must be a working day and other things).

Thanks for helpful hints! I'd like to reward some points!

Kind regards,

Renaud

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Renaud,

this is really strange.

This is the correct methodology.

I used it several times to control the delivery date against some calendar (factory, or supplier delivery calenda) and had no problem with this BADI.

Can you post the complete code of your BADI ?

Rgds

Christophe

Former Member
0 Kudos

Hi christophe,

How do i check the Delivery date through the CHECK badi??

Regards,

Disha.

Former Member
0 Kudos

Read Renaud's question: he is trying to do exactly the same thing as you:

BADI BBP_DOC_CHECK_BADI

- use parameter IV_DOC_GUID with BBP_PD_SC_GETDETAIL

- loop on items sent by the FM, and check each SC item delivery date

- if needed, add message in ET_MESSAGES

Rgds

Christophe

Former Member
0 Kudos

Hi Christophe

You're right of course... I was wrong! Re-checked it again and found this out:

a) I debugged the BAdI and after the BBP_PD_SC_GETDETAIL call I got back an empty E_ITEM table. Switching off debugging it worked correctly! This behaviour mislead me to believe it doesn't work.

b) The BAdI is called when adding items from catalog to SC

c) The BAdI is called when navigating to the SC item detail screen

d) The BAdI is called when clicking on the "refresh" button

e) BUT THE BAdI IS NOT CALLED when clicking on the "check" button! Of course (and according to Murphy's law) I tested it always with this "check" button and wondered why it never worked...

So is there a way to pass through this BAdI when clicking on the "check" button? Or do I have to implement a second BAdI accordingly? If so, which one?

Disha:

Here's some code I implemented in BBP_DOC_CHECK_BADI:

  DATA: lt_item TYPE TABLE OF BBP_PDS_SC_ITEM_D.
  DATA: wa_item TYPE BBP_PDS_SC_ITEM_D.

  CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
    exporting
      i_guid = iv_doc_guid
      i_with_itemdata = 'X'
    tables
      e_item = lt_item.

  LOOP AT lt_item INTO wa_item.
*   Do whatever is needed here...
  ENDLOOP.

Kind regards,

Renaud

Message was edited by: Renaud Desarzens

Former Member
0 Kudos

Hi Renaud,

to pass in the BADI only when clicking on "Check" (or "save" because then all checks are also performed), use the parameter IV_MODE = 'T' (for Check).

Rgds

Christophe

PS: please reward points for helpfull answers

Former Member
0 Kudos

Hi Christophe

There are sometime days where the system seems to randomly behave... Don't ask me why but without doing anything with parameter IV_MODE it "suddenly" passed through my coding in BBP_DOC_CHECK_BADI even when clicking the "check" button. It must be time for a little pause

Everything seems to work like I want now... except that I'm trying to pass variables to long text messages of own message id 'ZXXX'. But that's another story for probably another thread.

Kind regards,

Renaud

Former Member
0 Kudos

Hi Renaud /Christophe,

I have tried renaud's Suggestion..But i am still facing the same problem...Although the check is done for the delivery date..If i dont enter the Del date on the first screen..although the error message is thrown..I wnat that the control should reamin on the first screen itself until the delivary date is entered...

I feel that this cannot be controlled thru the BADI..rather i need to make the field mandatory through the template??

Regards,

Disha.

Former Member
0 Kudos

Hi,

I implemented method BBP_DOC_CHEKC of the BBP_DOC_CXHECK BAdI.

I am getting the follwoing error

"The following error text was processed in the system SRD : Templateinterpretation abgebrochen, Template nicht vorhanden."

I beleive "Template nicht vorhanden" means template not found. What template?

I checked ST22 and says an ABAP error occured when executing...

CALL FUNCTION 'BBP_PD_SC_GETDETAIL'

exporting

i_guid = iv_doc_guid

i_with_itemdata = 'X'

tables

e_item = lt_item.

I am just doing trying out implementing the check badi. I basically want to get a 'Hello World" check badi so I can use it as an example.

Thanks,

Naing Zaw-Tun

Former Member
0 Kudos

Hi,

Mabye Your Shopping Cart with guid = iv_doc_guid don't exist ?

Regards,

Marcin

Former Member
0 Kudos

Marcin,

I don't think that is the problem...

Below is the information from ST22. Note, the error occurs when trying to execute an ABAP statement. I put breakpoints...but the get the error before the breakpoint is reached (at I am not getting a change to see the break stop)

1 method IF_EX_BBP_DOC_CHECK_BADI~BBP_DOC_CHECK.

2

3 DATA: lt_item TYPE TABLE OF BBP_PDS_SC_ITEM_D.

4 DATA: wa_item TYPE BBP_PDS_SC_ITEM_D.

5

6

>>> CASE SY-UCOMM.

8 WHEN OTHERS.

9

10 ENDCASE.

11

12 CALL FUNCTION 'BBP_PD_SC_GETDETAIL'

13 exporting

14 i_guid = iv_doc_guid

15 i_with_itemdata = 'X'

16 tables

17 e_item = lt_item.

18

19

20 endmethod.

Thanks,

Naing

mani_sreedharala
Active Participant
0 Kudos

Hello Naing,

try this logic..

ls_messages_e-msgty = 'E'.

ls_messages_e-message = 'Hello World'.

APPEND ls_messages_e to et_messages.

this logic is more that enough to display hello world message during the check.

~Mani

Former Member
0 Kudos

Mani,

Thanks...I did some thing similar to your suggestion.

Turns out the error was "causeds" the HTTP_Breakpoint I set. When I removed them I did not get the error.

Thanks,

Naing Zaw-Tun

mani_sreedharala
Active Participant
0 Kudos

Hello Naing,

What i understood from your statement is that the error message in not displayed and even it is not stopping at the breakpoint..justify me..!

1.check whether the BADI implementation is active for the Shopping cart BO.

2. If it is not stopping at the break point , then please check whether the property

"~generateDynpro" is maintained for the service BBPSC01 or not.

3. try using the method parmeter IV_MODE.

Kind Regards,

Mani

Former Member
0 Kudos

Mani,

You understood me correctly.

I tried what you suggested...but still get errors.

What value do I set for parametr ~generateDynpro? I set it ot 1.

Thanks,

Naing

naing_zawtun@hotmail.com

Former Member
0 Kudos

Mani,

It's working now...I had to set the ~generateDynpro for bbpsc04...;-)

Naing

mani_sreedharala
Active Participant
0 Kudos

cool

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Did you try to set the parameter 'i_with_itemdata' in FM BBP_PD_SC_GETDETAIL to 'X'?

BR,

Sjoerd

Former Member
0 Kudos

Hi Sjoerd

Yes, I did but it didn't help either. Thanks anyway for your appreciated feedback!

Will give a try on Disha's suggestion and report back about results later.

Kind regards,

Renaud

Message was edited by: Renaud Desarzens

Former Member
0 Kudos

Hi Renaud,

For your reqt of checking the Delivery date field,you can use the BADI BBP_DOC_CHANGE_BADI(to check the date value) as well as the badi BBP_DOC_CHECK_BADI (to throw the corresponding error message) together using external memory.

In the 1st BADI ,you can check the date field(DELIV_DATE in struct BBP_PDS_SC_ITEM_ICU) and acc modiy the tables ET_ACCOUNT ,ET_PARTNER, ET_ORGDATA ,ET_HCF and ET_ICF.

Hope this helps...

Regards,

Disha.

Pls reward points for helpful answers