SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Creation of a routing



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sun Oct 14, 2007 8:11 pm    Post subject: Creation of a routing Reply with quote

BAPI_ROUTING_CREATE is used for Creation of a routing

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: 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.

Code:
REPORT ZBAPI_ROUTING_CREATE.
********************
Data declaration
*******************
Data:
TASK like BAPI1012_TSK_C
occurs 0 with header line,
MATERIALTASKALLOCATION like BAPI1012_MTK_C
occurs 0 with header line,
SEQUENCE like BAPI1012_SEQ_C
occurs 0 with header line,
OPERATION like BAPI1012_OPR_C
occurs 0 with header line,
SUBOPERATION like BAPI1012_SUB_OPR_C
occurs 0 with header line,
REFERENCEOPERATION like BAPI1012_REF_OPR_C
occurs 0 with header line,
WORKCENTERREFERENCE like BAPI1012_WC_REF_OPR_C
occurs 0 with header line,
COMPONENTALLOCATION like BAPI1012_COM_C
occurs 0 with header line,
PRODUCTIONRESOURCE like BAPI1012_PRT_C
occurs 0 with header line,
INSPCHARACTERISTIC like BAPI1012_CHA_C
occurs 0 with header line,
TEXTALLOCATION like BAPI1012_TXT_HDR_C
occurs 0 with header line,
TEXT like BAPI1012_TXT_C
occurs 0 with header line,
RETURN like BAPIRET2
occurs 0 with header line,

T_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE,
BAPI_RETN_INFO LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

************************************************************************
* SELECTION SCREEN
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.

PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1 .

************************************************************************
* AT SELECTION SCREEN
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE.



**********************************************************************
* TO UPLOAD THE DATA *
**********************************************************************

START-OF-SELECTION.
V_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = V_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = IT_MATMASTER
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'BAPI_ROUTING_CREATE'
       exporting
         TESTRUN = TESTRUN
         PROFILE = PROFILE
         BOMUSAGE = BOMUSAGE
         APPLICATION = APPLICATION
       importing
         GROUP = GROUP
         GROUPCOUNTER = GROUPCOUNTER
       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
       exceptions
         OTHERS =  1
         .
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.