cancel
Showing results for 
Search instead for 
Did you mean: 

endless loop in ME_PROCESS_PO_CUST->PROCESS_SCHEDULE: clear BOM by SET_BOM

former_member185943
Participant

Hi,

I am trying to use ME_PROCESS_PO_CUST BADI in order to change BOM. Inside the method PROCESS_SCHEDULE I am calling GET_BOM and SET_BOM. It works well for all the cases where I am making changes, as well as for deletions, if at least one BOM item is left behind.

However, in one case I should completely remove the whole BOM so I call SET_BOM with empty IT_BOM internal table, in which case I am getting the well known endless loop error message "Data from Business Add-In ME_PROCESS_PO_CUST not adopted". I understand the long text documentation: I should not change certain "forbidden" fields. But complete deletion should not mean that.

I found a blog Endless loop in BADI ME_PROCESS_PO_CUST which looks complex, but I think that the bottom line could be: "do not call SET statement if there are no actual changes". This does not work for me, as my attempt to delete BOMs is always unsuccessful - they re-appear in next loop pass.

In this thread there was a suggestion to clear the MY_RECHECK_QUEUE public attribute of header object. I did it - the error disappeared, but there was also no effect of my method call (exactly as stated in the thread).

The same happens if I programmatically limit the SET_BOM # of calls to 1 - no error, but also no effect.

Does anyone has any more ideas before I create OSS note?

Thanks!

KR,

Igor

nabheetscn
Active Contributor

Hello

Basically in the link which you mentioned if you go step by step you will understand the OP is trying to skip the re-run. Can you please paste your sample code and some debugging screen shots.

Nabheet

former_member185943
Participant
0 Kudos

Hi, Nabheet,

Sorry for delayed reply - I was on holidays and busy with other urgent assignments.

Yes, the example in the link is skipping the re-run, exactly as you wrote and as I wrote in my post too. However, it does not help me. Here comes my code:

  im_schedule->get_bom( IMPORTING et_bom = lt_bom ).
IF lt_bom IS NOT INITIAL.
CLEAR lt_bom.
io_sched->set_bom( it_bom = lt_bom ).
ENDIF.

Theoretically, this "IF" should prevent repeated runs, but in my case it does not work, as BOM lines always re-appear, till the loop counter terminates the infinite loop and raises error, as described in the mentioned blog.

As for debugging screenshots, please be more specific - I don't know what are you looking for.

Thanks!

KR,

Igor

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

HI Igor,

Try this please:

im_schedule->get_bom( IMPORTING et_bom = lt_bom ).

IF lt_bom[] IS NOT INITIAL.

CLEAR lt_bom.

io_sched->set_bom( it_bom = lt_bom ).

ENDIF.

Cheers

raymond_giuseppi
Active Contributor
0 Kudos

Could you try some trick such as only refresh BOM when schedule 'IS_VALID' then and only then immediately 'INVALIDATE' the schedule (with some dummy error message such as 'BOW refreshed') does it prevent the infinite loop and is the BOM cleared?