‎2009 Jan 23 9:42 AM
Dear Experts,
Please give me any sample code for Routing upload.
I am trying to upload the routing through the BAPI_ROUTING_CREATE, But I am not able to upload the sequences and dependencies.
Please help me.
‎2009 Jan 23 11:32 AM
The following description might help u out..
Short Description
Creation of a routing
Function Module
BAPI_ROUTING_CREATE
Functionality
This method serves to create routings with all their subordinated objects. Here, you can generate a key date view as well as the complete history of a routing. The latter is particularly useful for data transfers from non-SAP systems.
Example
You want to create a routing with its sequences, operations and inspection characteristics on the key date 01.01.2000. You generate an entry for each object in the following table by always entering the date 01.01.2000 in the attribute VALID_FROM:
TASK
Enter the relevant task list header data here. The attributes TASK_LIST_GROUP and GROUP_COUNTER only have to be supplied if you work with external number assignment. For internal number assignment the task list group and the group counter are determined automatically.
SEQUENCE
Here, only entries for alternative or parallel sequences are allowed. The standard sequence of a routing is always generated automatically and therefore does not have to be entered. Here also, the attributes TASK_LIST_GROUP and GROUP_COUNTER need only be supplied in the case of external number assignment.
OPERATION
You generate an entry for each operation in this table. To identify the operations, you have to enter an external operation identifier in the field OPERATION_ID. This identifier has to contain at least one character that is not a number (such as VORG0010). This external identifier is used by the definition of the alternative or parallel sequences to identify the corresponding branch or return operation. You only have to supply the TASK_LIST_GROUP and GROUP_COUNTER in the case of external number assignment.
INSPCHARACTERISTIC
You generate an entry for each inspection characteristic in this table. To identify the inspection characteristics you have to enter an inspection characteristic number in the field INSPCHAR. You can create inspection characteristics with or without reference to a master inspection characteristic. In the field CHA_MASTER_IMPORT_MODUS (Modus for the reference to the master inspection characteristic) enter the reference to the master inspection characteristic: 'L' for reference. In this case, the master inspection characteristic has to be completely maintained. In the parameter INSPCHARACTERISTIC you only have to supply those fields that could not be copied from the master inspection characteristic; 'C' for copy the data from the master inspection characteristic into the inspection characteristic, 'N' for create a lockable and unlockable reference to the master inspection characteristic without a data transfer from the master inspection characteristic. In this case manually fill out all fields in the parameter INSPCHARACTERISTIC. You can either transfer the inspection characteristic control indicator directly from the master inspection characteristic, enter it individually or in the field PRESET_CTRL_INDS_KEY you enter a key for the control indicator if you have stored this key in Customizing. If you have individually entered a control indicator, note the following special features:
SCOPE_IND: Inspection scope. This indicator can have different
characteristics: You set " " for: Free inspection scope You set "<">" for: Larger inspection scope permitted You set "=" for: Defined inspection scope
RESULT_RECORDING_TYPE: Record entry type. This indicator can have different characteristics:
You set "-" for: No record entry You set "*" for: Classified record entry You set "+" for: Single record entry You set " " for: Summarized record entry
DOCU_REQU: Documentation required for check results. This indicator can
have different characteristics: You set " " for: No documention required You set "." for: Documentation for rejection You set "" for: Document all check results You set "" for: Document all check results.
CONFIRMATION_CATEGORY Characteristic category
You set " " for: Optional characteristic You set "+" for: Limited to the acceptance of the previous mandatory characteristic You set "-" for: Limited to the rejection of the previous mandatory characteristic
You set "X" for: Mandatory characteristic
PRINT_IND: Print control This indicator can have different characteristics: You set " " for: Print You set "x" for: Do not print You set "*" for: Do not print at skip If you want to assign an inspection equipment to the inspection characteristic in the field ITEM_NO_OF_PRODUCTION_RESOURCE, note that this has to be assigned to the operation in the PARAMETER PRODUCTIONRESOURCE.
‎2009 Jan 23 11:48 AM
Dear Chenna kesava R.
I have gone through these steps but my issue is that, I want to upload the external sequenced with the operrations and dependencies.
When I am passing the operations only to bapi that time standard sequence '0' is getting created with all operations but when I am passing alternative sequence '1', '2' with specific to the operations belongs to sequence respectively to BAPI then it is saying that 'This sequnce is not found'.
Please suggest.
‎2009 Jan 23 11:40 AM
Hi,
Check this,
it_task TYPE TABLE OF bapi1012_tsk_c,
wa_task TYPE bapi1012_tsk_c,
it_materialtaskallocation TYPE TABLE OF bapi1012_mtk_c,
wa_materialtaskallocation TYPE bapi1012_mtk_c,
it_operation TYPE TABLE OF bapi1012_opr_c,
wa_operation TYPE bapi1012_opr_c,
it_return TYPE TABLE OF bapiret2,
wa_return TYPE bapiret2.
FORM f_header .
CLEAR : wa_materialtaskallocation.
REFRESH : it_materialtaskallocation.
wa_materialtaskallocation-material = wa_mat_plant-matnr.
wa_materialtaskallocation-plant = wa_mat_plant-werks.
wa_materialtaskallocation-group_counter = c_01.
wa_materialtaskallocation-valid_from = v_eff.
APPEND wa_materialtaskallocation TO it_materialtaskallocation.
CLEAR : wa_task.
REFRESH: it_task.
wa_task-valid_from = v_eff.
wa_task-valid_to_date = c_valid_todate.
wa_task-task_list_usage = c_1.
wa_task-plant = wa_mat_plant-werks.
wa_task-task_list_status = c_status.
wa_task-task_measure_unit = c_ea.
wa_task-lot_size_from = c_lot_size.
wa_task-lot_size_to = c_tosize.
wa_task-description = v_mat_desc.
APPEND wa_task TO it_task.
ENDFORM. " f_header
----
FORM f_lot_start .
CLEAR: wa_operation.
REFRESH: it_operation.
wa_operation-valid_from = v_eff.
wa_operation-valid_to_date = c_valid_todate.
wa_operation-activity = c_0001.
wa_operation-control_key = c_zp02.
wa_operation-work_cntr = c_lotstart.
wa_operation-plant = wa_mat_plant-werks.
wa_operation-description = c_lot_start.
wa_operation-operation_measure_unit = c_ea.
wa_operation-denominator = c_1.
wa_operation-nominator = c_1.
wa_operation-std_value_01 = c_std_value.
wa_operation-base_quantity = c_1.
wa_operation-cost_relevant = 'X'.
APPEND wa_operation TO it_operation.
ENDFORM. " f_lot_start
&----
FORM f_lot_complete .
CLEAR: wa_operation.
wa_operation-valid_from = v_eff.
wa_operation-valid_to_date = c_valid_todate.
wa_operation-activity = c_9999.
wa_operation-control_key = c_zp01.
wa_operation-work_cntr = c_lotcmplt.
wa_operation-plant = wa_mat_plant-werks.
wa_operation-description = c_lot_complete.
wa_operation-operation_measure_unit = c_ea.
wa_operation-base_quantity = c_1.
wa_operation-denominator = c_1.
wa_operation-std_value_01 = c_std_value.
wa_operation-nominator = c_1.
wa_operation-scrap_factor = v_scrap.
wa_operation-cost_relevant = 'X'.
APPEND wa_operation TO it_operation.
CLEAR: v_scrap. "CCT53428
ENDFORM. " f_lot_complete
FORM f_create_routing .
CALL FUNCTION 'BAPI_ROUTING_CREATE'
IMPORTING
group = v_group
groupcounter = v_group_counter
TABLES
task = it_task
materialtaskallocation = it_materialtaskallocation
operation = it_operation
return = it_return.
IF it_return IS NOT INITIAL.
READ TABLE it_return INTO wa_return WITH KEY type = c_error.
IF sy-subrc = 0.
wa_emsg-msg_type = c_error.
wa_emsg-plant = wa_mat_plant-werks.
wa_emsg-material = wa_mat_plant-matnr.
wa_emsg-eff_date = v_eff.
wa_emsg-fg_critical = c_x.
wa_emsg-description = text-112.
APPEND wa_emsg TO it_emsg.
PERFORM f_errfile.
ENDIF.
LOOP AT it_return INTO wa_return WHERE type = c_error.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_return-id
no = wa_return-number
v1 = wa_return-message_v1
v2 = wa_return-message_v2
v3 = wa_return-message_v3
v4 = wa_return-message_v4
IMPORTING
msg = v_msgid.
CLEAR: wa_emsg.
fg_bapi_fail = c_x.
wa_emsg-msg_type = c_error.
wa_emsg-plant = wa_mat_plant-werks.
wa_emsg-material = wa_mat_plant-matnr.
wa_emsg-eff_date = v_eff.
wa_emsg-fg_critical = c_x.
wa_emsg-description = v_msgid.
APPEND wa_emsg TO it_emsg.
‎2009 Jan 23 11:52 AM
Dear Selva M ,
Thanks for the reply.
In this code, whatever the operations I am passing are getting created into the standard sequence'0'.
But my problem is, I want create the sequences '1', '2' with the different operations allong with dependencies.
Please suggest.