ā2014 Jun 29 12:44 PM
Dear Experts,
Greetings.
I am using BAPI_ALM_ORDER_MAINTAIN to change the quantity of the Material Components of a Process Order using BAPI_ALM_ORDER_MAINTAIN. The BAPI returns an error message saying 'Entry Pegged requirement = 12345(Header Material of the Process Order) does not exist in (check entry)'.
Request you to throw some light on this so that i can fix this issue with your guidance.
Also, Can I add new material components obtained from external source using the same BAPI? If Yes, Request you to provide some pointers for the same.
Below is the code that I have written to achieve my first requirement. Please do let me know in case any correction is required.
CALL FUNCTION 'BAPI_ALM_ORDER_GET_DETAIL'
EXPORTING
number = l_aufnr
IMPORTING
es_header = wa_header
TABLES
et_partner = it_partner
et_operations = it_oper
et_components = it_comp
et_relations = it_relat
et_texts = it_text
et_text_lines = it_text_lines
et_prts = it_prt
et_costs_sum = it_cost
et_costs_details = it_cost_det
return = it_return.
w_anfme = w_pqty.
LOOP AT it_comp WHERE batch = l_charg.
* Change the component qty of the process order
MOVE-CORRESPONDING it_comp TO it_component.
CLEAR : w_anfme.
w_anfme = it_comp-withd_quan.
it_component-requirement_quantity = w_anfme.
APPEND it_component.
CLEAR it_component.
it_component_up-requirement_quantity = 'X'.
APPEND it_component_up.
* Fill the method used in the BAPI
it_method-refnumber = '1'.
it_method-objecttype = ' '.
it_method-method = 'SAVE'.
it_method-objectkey = l_aufnr.
APPEND it_method.
CLEAR it_method.
it_method-refnumber = '1'.
it_method-objecttype = 'COMPONENT'.
it_method-method = 'CHANGE'.
it_method-objectkey = l_aufnr.
APPEND it_method.
CLEAR it_method.
ENDLOOP.
* Update the qty of the component
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = it_method
it_component = it_component
it_component_up = it_component_up
return = it_return.
Thanks a lot in advance.
Regards,
Ram
ā2014 Jun 30 7:59 AM
Hi Ram,
As per my analysis, for the fields which ever you are passing to it_component, that fields should be passed as 'X' in the table it_component_up.
And also table it_method should be outside the loop. method change component can happen only once. hence not required within the loop.
Please check it once and let me know if you need any further help.
Regards,
Saipirya
ā2014 Jun 30 8:42 AM
Hi Saipriya,
Thanks for your response to my query.
As far as the flag in the internal table it_component is concerned, I have already done that. I shall put the internal table it_method outside the loop now.
However, when I try doing a dry run of the mentioned BAPI by passing the appropriate parameters in SE37, I am getting the same error. Here, the internal table it_method is not inside the loop. It must work right? I suppose the reason could be something else.
Please do let me know your views on the same.
Thanks again for your time.
Regards,
Ram
ā2014 Jun 30 8:58 AM
Is this message only in BAPI? It looks like it is a general problem in your order, can you check it with transaction IW32? The messages sounds like your used material in the order in components tab does not exist anymore.
Regards
Michael
ā2014 Jun 30 11:12 AM
Hi Michael,
Thanks for taking your time to reply to my query.
Unfortunately, this does not seem to help as the material in the component tab still exists.
However, Thanks again.
Regards,
Ram
ā2014 Jun 30 12:08 PM
Hi Ram,
Along with Components data , either corresponding header or item data should be passed.
Please check it by passing the header data , and also entry header change in the method table.
let me know if you need any further help.
Thanks & Regards,
Saipriya