Hi Sameer,
when i am using the Test Sequences like BAPI_ROUTING_CREATE and BAPI_TRANSACTION_COMMIT in SE37 i am able to updating the task level, Material task allocation and Operation details in CA01 Transaction.
The same when i am using the Programmatic ally ie., while Uploading required details from Excel file and after passing into BAPI_ROUTING_CREATE i am able to Getting the 'S' Message and after cursor moving to BAPI_TRANSACTION_COMMIT i am able to see the Updating only Task, Material task allocation in CA01 Transaction level.
Please suggest how to proceed further and see the below my code.
LOOP AT gt_routing INTO gs_routing.
lv_count1 = lv_count1 + 1.
* ON CHANGE OF gs_routing-material.
*
* IF gs_routing-material IS NOT INITIAL AND gt_task IS NOT INITIAL.
*
** Call Subroutine to Load the routing
* PERFORM call_bapi_and_commit.
*
** Re-initialise the internal tables
*
* CLEAR: gt_mat_task_allo[], gt_task[], gt_op[], gt_inspchar[], gt_ret[].
*
* ENDIF.
* ENDON.
*
* IF gs_routing-plant IS NOT INITIAL.
* gv_plant = gs_routing-plant.
* ENDIF.
IF gs_routing-plant NE space.
CLEAR gt_mat_task_allo.
* Moving Corresponding fields to Material internal table
gt_mat_task_allo-material = gs_routing-material.
gt_mat_task_allo-plant = gv_plant.
IF gs_routing-valid_from IS NOT INITIAL.
gt_mat_task_allo-valid_from = gs_routing-valid_from.
ELSE.
gt_mat_task_allo-valid_from = sy-datum.
gt_mat_task_allo-valid_to_date = '99993112'.
ENDIF.
APPEND gt_mat_task_allo.
* Moving Corresponding fields to task internal table
CLEAR gt_task.
IF gs_routing-valid_from IS NOT INITIAL.
gt_task-valid_from = gs_routing-valid_from.
ELSE.
gt_task-valid_from = sy-datum.
gt_mat_task_allo-valid_to_date = '99993112'.
ENDIF.
gt_task-description = gs_routing-description.
gt_task-task_list_usage = gs_routing-task_list_usage.
gt_task-task_list_status = gs_routing-task_list_status.
gt_task-lot_size_from = gs_routing-lot_size_from.
gt_task-lot_size_to = gs_routing-lot_size_to.
gt_task-plant = gv_plant.
SELECT *
FROM t006
INTO TABLE gt_t006.
READ TABLE gt_t006 INTO gs_t006 WITH KEY isocode = 'PCE'.
gt_task-task_measure_unit = gs_t006-msehi.
APPEND gt_task.
* Moving Corresponding fields to Operation internal table
CLEAR gt_op.
IF gs_routing-valid_from IS NOT INITIAL.
gt_op-valid_from = gs_routing-valid_from.
ELSE.
gt_op-valid_from = sy-datum.
gt_op-valid_to_date = '99993112'.
ENDIF.
gt_op-activity = gs_routing-activity.
gt_op-plant = gv_plant.
gt_op-control_key = gs_routing-control_key.
gt_op-work_cntr = gs_routing-work_cntr.
gt_op-description = gs_routing-description_opr.
gt_op-denominator = '2'.
gt_op-nominator = '0'.
gt_op-base_quantity = gs_routing-base_quantity.
gt_op-std_value_01 = gs_routing-std_value_01.
gt_op-std_value_02 = gs_routing-std_value_02.
gt_op-std_value_03 = gs_routing-std_value_03.
gt_op-std_value_04 = gs_routing-std_value_04.
gt_op-std_value_05 = gs_routing-std_value_05.
gt_op-std_value_06 = gs_routing-std_value_06.
gt_op-std_unit_01 = gs_routing-std_unit_01.
gt_op-std_unit_02 = gs_routing-std_unit_02.
gt_op-std_unit_03 = gs_routing-std_unit_03.
gt_op-std_unit_04 = gs_routing-std_unit_04.
gt_op-std_unit_05 = gs_routing-std_unit_05.
gt_op-std_unit_06 = gs_routing-std_unit_06.
gt_op-info_rec = gs_routing-info_rec.
gt_op-purch_org = gs_routing-purch_org.
gt_op-matl_group = gs_routing-matl_group.
gt_op-purch_group = gs_routing-purch_group.
gt_op-vendor_no = gs_routing-vendor_no.
gt_op-cost_elem = gs_routing-cost_elem.
gt_op-ext_proc_with_subcontract_ind = gs_routing-ext_proc_with_subcontract_ind.
APPEND gt_op.
ELSE.
CLEAR gt_op.
IF gs_routing-valid_from IS NOT INITIAL.
gt_op-valid_from = gs_routing-valid_from.
ELSE.
gt_op-valid_from = sy-datum.
gt_op-valid_to_date = '99993112'.
ENDIF.
gt_op-activity = gs_routing-activity.
gt_op-plant = gv_plant.
gt_op-control_key = gs_routing-control_key.
gt_op-work_cntr = gs_routing-work_cntr.
gt_op-description = gs_routing-description_opr.
gt_op-denominator = '2'.
gt_op-nominator = '0'.
gt_op-base_quantity = gs_routing-base_quantity.
gt_op-std_value_01 = gs_routing-std_value_01.
gt_op-std_value_02 = gs_routing-std_value_02.
gt_op-std_value_03 = gs_routing-std_value_03.
gt_op-std_value_04 = gs_routing-std_value_04.
gt_op-std_value_05 = gs_routing-std_value_05.
gt_op-std_value_06 = gs_routing-std_value_06.
gt_op-std_unit_01 = gs_routing-std_unit_01.
gt_op-std_unit_02 = gs_routing-std_unit_02.
gt_op-std_unit_03 = gs_routing-std_unit_03.
gt_op-std_unit_04 = gs_routing-std_unit_04.
gt_op-std_unit_05 = gs_routing-std_unit_05.
gt_op-std_unit_06 = gs_routing-std_unit_06.
gt_op-info_rec = gs_routing-info_rec.
gt_op-purch_org = gs_routing-purch_org.
gt_op-matl_group = gs_routing-matl_group.
gt_op-purch_group = gs_routing-purch_group.
gt_op-vendor_no = gs_routing-vendor_no.
gt_op-cost_elem = gs_routing-cost_elem.
gt_op-ext_proc_with_subcontract_ind = gs_routing-ext_proc_with_subcontract_ind.
APPEND gt_op.
ENDIF.
IF lv_count1 EQ lv_count.
* Call Subroutine to Load the routing
PERFORM call_bapi_and_commit.
ENDIF.
CLEAR: gs_routing.
ENDLOOP.
CALL FUNCTION 'BAPI_ROUTING_CREATE'
* EXPORTING
* TESTRUN = ' '
* PROFILE =
* BOMUSAGE =
* APPLICATION =
IMPORTING
group = gv_group
groupcounter = gv_gr_counter
TABLES
task = gt_task[]
materialtaskallocation = gt_mat_task_allo[]
* SEQUENCE =
operation = gt_op[]
* SUBOPERATION =
* REFERENCEOPERATION =
* WORKCENTERREFERENCE =
* COMPONENTALLOCATION =
* PRODUCTIONRESOURCE =
* INSPCHARACTERISTIC =
* TEXTALLOCATION =
* TEXT =
return = gt_ret[].
READ TABLE gt_ret INDEX 1.
DESCRIBE TABLE gt_ret.
BREAK-POINT.
* Check for success message and then Commit, otherwise dont commit
IF gt_ret-type EQ 'S' AND sy-tfill EQ 1.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
* EXPORTING
* wait = space
* IMPORTING
* return = gt_ret.