Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling BAPI_MATERIAL_SAVE_DATA inside BTE 1250 FM sample_inetrface_00001250

former_member188251
Active Participant
0 Kudos

Hi All,

I am calling BAPI_MATERIAL_SAVE_DATA  inside my BTE 1250 FM  sample_inetrface_00001250 , to update Z-fields in amterial master (MVKE-Zfield). But the issue I am facing is that  BAPI_MATERIAL_SAVE_DATA agains triggeres the BTE , and this goes on and on. Is there any way to avoid the BAPI call second time from the BTE or is the basic design itself flawed?

This development is an inbound IDOC process code , from which the BTE is triggered and I have to add validation and update material master inside the BTE. Kindly help.

BR,

Shankar.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

You should add some check in the triggered FM like CHECK I_MARA_NEW NE I_MARA_OLD or similar check ?

Regards,

Raymond

7 REPLIES 7

raymond_giuseppi
Active Contributor
0 Kudos

You should add some check in the triggered FM like CHECK I_MARA_NEW NE I_MARA_OLD or similar check ?

Regards,

Raymond

0 Kudos

Thanks Raymond . I have put in the check for I_MVKE_OLD-ZFIELD <> I_MVKE_NEW-ZFIELD and it is  working for a normal scenario.  I am now checking for all my unit test cases.

BR,

Shankar.

former_member188251
Active Participant
0 Kudos

Hi All,

From the indbound IDOC process code , the FM 'IDOC_WRITE_AND_START_INBOUND' is called which triggers the BTE 1250 FM 'sample_interface_00001250' the first time. Inside this BTE FM , I am calling BAPI_MATERIAL_SAVE_DATA to update material master MVKE-Zfield. This BAPI again triggers the BTE and the BTE again the BAPI and this goes on. Now if I place a check on I_MARA_NEW <> I_MARA_OLD, the BTE FM does not gets processed at all the first time it is called from FM 'IDOC_WRITE_AND_START_INBOUND'.  Is my design itself wrong ?

Also just  for my knowledge sake, can someone let me know how does the FM 'IDOC_WRITE_AND_START_INBOUND' trigger the BTE 1250 , since this BTE is only for material master update ? I went through the stack flow and obserevd that the FM 'BAPI_MATERIAL_SAVEREPLICA' is triggered by this FM . How does this happen and where is the configuration mainatained for this?

BR,

Shankar.

0 Kudos

Hi Shankar,

What is the Process Code your using to process the Inbound IDOC?

- BTE Event 1250 will only once when Material Data is posting after all the validation. If the custom FM which is linked to the EVENT 1250 is triggering then check the where used list and correct it.

If you still not able to fix it. Let me know the IDOC and Process code details to help you on this.

0 Kudos

Hi Saravanan,

First time my BTE 1250 FM gets triggered from the FM 'IDOC_WRITE_AND_START_INBOUND' . Then inside this BTE FM , I am  calling BAPI_MATERIAL_SAVEDATA to update other materials which are fetched based on some Z field in I_MARA_NEW of the original material for which the BTE was triggered the first time. Now this BAPI material save data is again triggering the BTE and the BTE again the BAPI etc.

I guess BAPI_MAERIAL_SAVE_DATA should not be called inside the BTE FM. That itself is wrong. PLs let me know your opinion.

BR,

Shankar.

0 Kudos

Shankar,

I think you should not call BAPI in BTE function module. Check the User Exit in IDoc process code to populate the value to custom field. Also tell me the process code and IDoc your using to help you better.

Regards,

Saravanan M

0 Kudos

Hi Saravanan,

Its a Z Basic type and Z process code and and not copied from any standard process code. The initial triggering point of the BTE is from FM  'IDOC_WRITE_AND_START_INBOUND'. PLs let me know your thoughts.

BR,

Shankar.