‎2006 Mar 10 5:29 AM
if anybody has used this bapi for creating routing .
i want to use it as dont want to go for bdc.
thanks in advance
‎2006 Mar 10 5:37 AM
Hai james,
Try BAPI_ROUTING_CREATE. Use se37 to test it. Look at function module documentation by displaying the function in SE37, then click FM documentation.
Here ia an example code...
DATA: GROUP TYPE BAPI1012_TSK_C-TASK_LIST_GROUP,
GROUP_COUNTER TYPE BAPI1012_TSK_C-GROUP_COUNTER,
SEQUENCE_NO TYPE BAPI1012_OPR_C-SEQUENCE_NO,
TASK_LIST_USAGE TYPE BAPI1012_TSK_C-TASK_LIST_USAGE,
TASK_LIST_STATUS TYPE BAPI1012_TSK_C-TASK_LIST_STATUS,
LOT_SIZE_FROM TYPE BAPI1012_TSK_C-LOT_SIZE_FROM,
LOT_SIZE_TO TYPE BAPI1012_TSK_C-LOT_SIZE_TO,
TASK_MEASURE_UNIT TYPE BAPI1012_TSK_C-TASK_MEASURE_UNIT,
TESTRUN TYPE BAPIFLAG,
PROFILE TYPE BAPI1012_CONTROL_DATA-PROFILE,
TASK TYPE BAPI1012_TSK_C
OCCURS 0 WITH HEADER LINE,
MATERIALTASKALLOCATION TYPE BAPI1012_MTK_C
OCCURS 0 WITH HEADER LINE,
SEQUENCE TYPE BAPI1012_SEQ_C
OCCURS 0 WITH HEADER LINE,
OPERATION TYPE BAPI1012_OPR_C
OCCURS 0 WITH HEADER LINE,
SUBOPERATION TYPE BAPI1012_SUB_OPR_C
OCCURS 0 WITH HEADER LINE,
REFERENCEOPERATION TYPE BAPI1012_REF_OPR_C
OCCURS 0 WITH HEADER LINE,
WORKCENTERREFERENCE TYPE BAPI1012_WC_REF_OPR_C
OCCURS 0 WITH HEADER LINE,
COMPONENTALLOCATION TYPE BAPI1012_COM_C
OCCURS 0 WITH HEADER LINE,
PRODUCTIONRESOURCE TYPE BAPI1012_PRT_C
OCCURS 0 WITH HEADER LINE,
INSPCHARACTERISTIC TYPE BAPI1012_CHA_C
OCCURS 0 WITH HEADER LINE,
TEXTALLOCATION TYPE BAPI1012_TXT_HDR_C
OCCURS 0 WITH HEADER LINE,
TEXT TYPE BAPI1012_TXT_C
OCCURS 0 WITH HEADER LINE,
RETURN TYPE BAPIRET2
OCCURS 0 WITH HEADER LINE,
BAPI_RETN_INFO LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
Initialization
GROUP_COUNTER = '01'.
TASK_LIST_USAGE = '1'.
TASK_LIST_STATUS = '4'.
LOT_SIZE_FROM = '0'.
LOT_SIZE_TO = '999999999'.
TASK_MEASURE_UNIT = 'ST'.
TASK-GROUP_COUNTER = GROUP_COUNTER.
TASK-VALID_FROM = VALID_FROM.
TASK-TASK_LIST_USAGE = BOMUSAGE.
TASK-PLANT = PLANT.
TASK-TASK_LIST_STATUS = TASK_LIST_STATUS.
TASK-DESCRIPTION = MATERIAL.
TASK-LOT_SIZE_FROM = LOT_SIZE_FROM.
TASK-LOT_SIZE_TO = LOT_SIZE_TO.
TASK-TASK_MEASURE_UNIT = TASK_MEASURE_UNIT.
APPEND TASK.
MATERIALTASKALLOCATION-MATERIAL = MATERIAL.
MATERIALTASKALLOCATION-PLANT = PLANT.
MATERIALTASKALLOCATION-GROUP_COUNTER = GROUP_COUNTER.
MATERIALTASKALLOCATION-VALID_FROM = VALID_FROM.
APPEND MATERIALTASKALLOCATION.
SEQUENCE-GROUP_COUNTER = '01'.
SEQUENCE-SEQUENCE_NO = '000000'.
SEQUENCE-VALID_FROM = '20040816'.
SEQUENCE-SEQUENCE_CATEGORY = '0'.
SEQUENCE-REFERENCE_SEQUENCE = ''.
SEQUENCE-DESCRIPTION = '4587201_JK'.
SEQUENCE-TASK_MEASURE_UNIT = 'PC'.
APPEND SEQUENCE.
REFRESH : IT_REF.
LOOP AT rout_list WHERE component = material.
LOOP AT ROUT_LIST.
IF ROUT_LIST-REFSET = 'X' AND
NOT ROUT_LIST-VPLNR IS INITIAL.
REFERENCEOPERATION-GROUP_COUNTER = GROUP_COUNTER.
REFERENCEOPERATION-SEQUENCE_NO = SEQUENCE_NO.
REFERENCEOPERATION-VALID_FROM = VALID_FROM.
REFERENCEOPERATION-ACTIVITY = ROUT_LIST-VORNR.
REFERENCEOPERATION-REFERENCED_TASK_LIST_GROUP = ROUT_LIST-VPLNR.
REFERENCEOPERATION-REFERENCED_GROUP_COUNTER = GROUP_COUNTER.
APPEND REFERENCEOPERATION.
IT_REF-VPLNR = ROUT_LIST-VPLNR.
IT_REF-VORNR = ROUT_LIST-VORNR.
APPEND IT_REF.
CLEAR IT_REF.
ELSE.
OPERATION-GROUP_COUNTER = GROUP_COUNTER.
OPERATION-SEQUENCE_NO = SEQUENCE_NO.
OPERATION-VALID_FROM = VALID_FROM.
OPERATION-ACTIVITY = ROUT_LIST-VORNR.
OPERATION-CONTROL_KEY = ROUT_LIST-STEUS.
OPERATION-WORK_CNTR = ROUT_LIST-ARBPL.
OPERATION-PLANT = PLANT.
OPERATION-DESCRIPTION = ROUT_LIST-LTXA1.
OPERATION-DENOMINATOR = ROUT_LIST-UMREN.
Start of changes STC001
IF ROUT_LIST-UMREZ IS INITIAL.
OPERATION-NOMINATOR = '1'.
ELSE.
OPERATION-NOMINATOR = ROUT_LIST-UMREZ.
ENDIF.
End of changes STC001
OPERATION-BASE_QUANTITY = ROUT_LIST-BMSCH.
OPERATION-STD_VALUE_01 = ROUT_LIST-VGW01.
OPERATION-STD_VALUE_02 = ROUT_LIST-VGW02.
OPERATION-STD_VALUE_03 = ROUT_LIST-VGW03.
OPERATION-STD_VALUE_04 = ROUT_LIST-VGW04.
OPERATION-STD_VALUE_05 = ROUT_LIST-VGW05.
OPERATION-STD_VALUE_06 = ROUT_LIST-VGW06.
APPEND OPERATION.
ENDIF.
ENDLOOP.
SORT IT_REF BY VPLNR VORNR.
DELETE ADJACENT DUPLICATES FROM IT_REF COMPARING VPLNR.
LOOP AT REFERENCEOPERATION.
L_TABIX = SY-TABIX.
READ TABLE IT_REF
WITH KEY VPLNR = REFERENCEOPERATION-REFERENCED_TASK_LIST_GROUP
VORNR = REFERENCEOPERATION-ACTIVITY.
IF SY-SUBRC <> 0.
DELETE REFERENCEOPERATION INDEX L_TABIX.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_ROUTING_CREATE'
DESTINATION 'NONE'
EXPORTING
TESTRUN = TESTRUN
PROFILE = PROFILE
BOMUSAGE = BOMUSAGE
APPLICATION = APPLICATION
IMPORTING
GROUP = GROUP
GROUPCOUNTER = GROUP_COUNTER
TABLES
TASK = TASK
MATERIALTASKALLOCATION = MATERIALTASKALLOCATION
SEQUENCE = SEQUENCE
OPERATION = OPERATION
SUBOPERATION = SUBOPERATION
REFERENCEOPERATION = REFERENCEOPERATION
WORKCENTERREFERENCE = WORKCENTERREFERENCE
COMPONENTALLOCATION = COMPONENTALLOCATION
PRODUCTIONRESOURCE = PRODUCTIONRESOURCE
INSPCHARACTERISTIC = INSPCHARACTERISTIC
TEXTALLOCATION = TEXTALLOCATION
TEXT = TEXT
RETURN = RETURN.
Regards,
Srikanth.
‎2006 Mar 10 6:27 AM
it would be great if you please explain the things what you have done
‎2006 Mar 10 6:29 AM
‎2006 Mar 10 5:41 AM
Hi,
Go thru the following example.
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: Smaller inspection scope permitted
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.
Notes
Provided that during the data transfer no errors can be found, the export parameters GROUP and GROUPCOUNTER contain the key for the generated task list. To secure the data in the database, you now have to carry out a COMMIT WORK.
All error that occur are logged in the external parameter RETURN. In the case of inconsistencies, the entire routing to be generated is rejected.
Hope it helps..
Regards,
Shashank
‎2006 Mar 10 6:17 AM
LOOP AT ROUT_LIST.
IF ROUT_LIST-REFSET = 'X' AND
NOT ROUT_LIST-VPLNR IS INITIAL.
REFERENCEOPERATION-GROUP_COUNTER = GROUP_COUNTER.
REFERENCEOPERATION-SEQUENCE_NO = SEQUENCE_NO.
REFERENCEOPERATION-VALID_FROM = VALID_FROM.
REFERENCEOPERATION-ACTIVITY = ROUT_LIST-VORNR.
REFERENCEOPERATION-REFERENCED_TASK_LIST_GROUP = ROUT_LIST-VPLNR.
REFERENCEOPERATION-REFERENCED_GROUP_COUNTER = GROUP_COUNTER.
APPEND REFERENCEOPERATION.
please explain where you have declared this internal table.and what type