Hi experts.
I'm having problems using the function module BAPI_MOSRVAPS_CREATESNPORDER in a LOOP, for creation of production orders per month, the program only creates the first order.
The structure of the PDS is as follows:
Main product - Validity: 01/01/2011 to 12/31/9999 - 1000 TO
Component Input 1 - Validity: 01/01/2011 to 01/31/2011 - 10 TO
Component Input 1 - Validity: 02/01/2011 to 02/28/2011 - 13 TO
Component Input 1 - Validity: 03/01/2011 to 03/31/2011 - 20 TO
Component Input 2 - Validity: 01/01/2011 to 01/31/2011 - 1010 TO
Component Input 2 - Validity: 02/01/2011 to 02/28/2011 - 1030 TO
Component Input 2 - Validity: 03/01/2011 to 03/31/2011 - 1020 TO
In each iteration to the BAPI, i'm filling the Head valid for 1 month.
ti_head-order_end_date = Always 1 month
ti_head-order_number = An Index.
ti_head-master_product = Main product.
ti_head-master_plant = Plant.
ti_head-master_order_quantity = Value.
ti_head-master_loctype = '1001'.
ti_head-master_atpcat = 'EE'.
ti_head-coproduct_atpcat = 'EM'.
ti_head-input_atpcat = 'EL'.
ti_head-source_name = PDS.
For the PDS above, the BAPI should have created three orders, but has created only the first.
BAPI call.
CLEAR: ti_return, ti_mapp.
REFRESH: ti_return, ti_mapp.
CALL FUNCTION 'BAPI_MOSRVAPS_CREATESNPORDER'
EXPORTING
logical_system = gc_logsys
order_type = '5'
ext_number_assignment = ' '
commit_control = 'E'
planning_version = st_otimiza-versnp
change_if_exists = ' '
check_ppm_existence = 'X'
snp_planning_profile = ' '
TABLES
order_head = ti_head
mapping_data = ti_mapp
return = ti_return.
Please Help.
Thanks in advance.