Skip to Content
author's profile photo Former Member
Former Member

Problem with creation of routing

Dear All,

I use below BAPI for creation of routing. BAPI is succeddful but when i go to CS03 and display, work center, plant, control key information is not filled. But header details are filled. Do you have any idea why it happens ? Am i not filling some parameters ?

Please let me know.

CLEAR : LR_BAPIRET2,

LT_BAPIRET2.

CLEAR LT_TASK.

LR_TASK-VALID_FROM = SY-DATUM.

LR_TASK-VALID_TO_DATE = '99991231'.

LR_TASK-TASK_LIST_USAGE = '1'.

LR_TASK-PLANT = '1830'.

LR_TASK-TASK_LIST_STATUS = '4'.

LR_TASK-TASK_MEASURE_UNIT = 'PC'.

LR_TASK-DESCRIPTION = 'TEST1'.

LR_TASK-LOT_SIZE_FROM = '0.000'.

LR_TASK-LOT_SIZE_TO = '0.000'.

APPEND LR_TASK TO LT_TASK.

CLEAR : LR_MATERIALTASKALLOCATION,

LT_MATERIALTASKALLOCATION.

LR_MATERIALTASKALLOCATION-MATERIAL = 'TEST-0008'.

LR_MATERIALTASKALLOCATION-PLANT = '1830'.

LR_MATERIALTASKALLOCATION-VALID_FROM = SY-DATUM.

APPEND LR_MATERIALTASKALLOCATION TO LT_MATERIALTASKALLOCATION.

CLEAR : LR_OPERATION,

LT_OPERATION.

LR_OPERATION-WORK_CNTR = 'HCPA001'.

LR_OPERATION-PLANT = '1830'.

LR_OPERATION-CONTROL_KEY = 'PP01'.

LR_OPERATION-BASE_QUANTITY = '1.000'.

LR_OPERATION-VALID_FROM = SY-DATUM.

LR_OPERATION-SEQUENCE_NO = '0'.

LR_OPERATION-OBJ_ID = '00000000'.

*LR_OPERATION-ACTIVITY = '0010'.

LR_OPERATION-DESCRIPTION = 'TEST'.

APPEND LR_OPERATION TO LT_OPERATION.

CALL FUNCTION 'BAPI_ROUTING_CREATE'

  • EXPORTING

  • TESTRUN = ' '

  • PROFILE =

  • BOMUSAGE = 'X'

  • APPLICATION =

  • IMPORTING

  • GROUP =

  • GROUPCOUNTER =

TABLES

TASK = LT_TASK

MATERIALTASKALLOCATION = LT_MATERIALTASKALLOCATION

SEQUENCE = LT_SEQUENCE

OPERATION = LT_OPERATION

  • SUBOPERATION =

  • REFERENCEOPERATION =

  • WORKCENTERREFERENCE =

  • COMPONENTALLOCATION =

  • PRODUCTIONRESOURCE =

  • INSPCHARACTERISTIC =

  • TEXTALLOCATION =

  • TEXT =

RETURN = LT_BAPIRET2

.

LOOP AT LT_BAPIRET2 INTO LR_BAPIRET2 WHERE TYPE = 'E' OR

TYPE = 'A'.

LF_ROUTING_ERROR = 'X'.

ENDLOOP.

IF LF_ROUTING_ERROR NE 'X'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'

  • IMPORTING

  • RETURN =

.

ENDIF.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 17, 2009 at 07:19 AM

    please format your post, noone wants to read such a block.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Sorry.

      CLEAR : LR_BAPIRET2,
            LT_BAPIRET2.
      CLEAR LT_TASK.
      LR_TASK-VALID_FROM = SY-DATUM.
      LR_TASK-VALID_TO_DATE = '99991231'.
      LR_TASK-TASK_LIST_USAGE = '1'.
      LR_TASK-PLANT = '1830'.
      LR_TASK-TASK_LIST_STATUS = '4'.
      LR_TASK-TASK_MEASURE_UNIT = 'PC'.
      LR_TASK-DESCRIPTION = 'TEST1'.
      LR_TASK-LOT_SIZE_FROM = '0.000'.
      LR_TASK-LOT_SIZE_TO = '0.000'.
      APPEND LR_TASK TO LT_TASK.
      
      CLEAR : LR_MATERIALTASKALLOCATION,
            LT_MATERIALTASKALLOCATION.
      LR_MATERIALTASKALLOCATION-MATERIAL = 'TEST-0008'.
      LR_MATERIALTASKALLOCATION-PLANT = '1830'.
      LR_MATERIALTASKALLOCATION-VALID_FROM = SY-DATUM.
      APPEND LR_MATERIALTASKALLOCATION TO LT_MATERIALTASKALLOCATION.
      
      
      *CLEAR : LR_SEQUENCE,
      *      LT_SEQUENCE.
      *LR_SEQUENCE-SEQUENCE_NO = '0'.
      *LR_SEQUENCE-SEQUENCE_CATEGORY = '0'.
      *LR_SEQUENCE-ALIGNMENT_KEY_FOR_SCHEDULING = '2'.
      *APPEND LR_SEQUENCE TO LT_SEQUENCE.
      
      CLEAR : LR_OPERATION,
            LT_OPERATION.
      LR_OPERATION-WORK_CNTR = 'HCPA001'.
      LR_OPERATION-PLANT = '1830'.
      LR_OPERATION-CONTROL_KEY = 'PP01'.
      LR_OPERATION-BASE_QUANTITY = '1.000'.
      LR_OPERATION-VALID_FROM = SY-DATUM.
      LR_OPERATION-SEQUENCE_NO = '0'.
      LR_OPERATION-OBJ_ID = '00000000'.
      *LR_OPERATION-ACTIVITY = '0010'.
      LR_OPERATION-DESCRIPTION = 'TEST'.
      APPEND LR_OPERATION TO LT_OPERATION.
      
      
      CALL FUNCTION 'BAPI_ROUTING_CREATE'
      *  EXPORTING
      *   TESTRUN                      = ' '
      *   PROFILE                      =
      *   BOMUSAGE                     = 'X'
      *   APPLICATION                  =
      * IMPORTING
      *   GROUP                        =
      *   GROUPCOUNTER                 =
        TABLES
          TASK                         = LT_TASK
          MATERIALTASKALLOCATION       = LT_MATERIALTASKALLOCATION
          SEQUENCE                     = LT_SEQUENCE
          OPERATION                    = LT_OPERATION
      *   SUBOPERATION                 =
      *   REFERENCEOPERATION           =
      *   WORKCENTERREFERENCE          =
      *   COMPONENTALLOCATION          =
      *   PRODUCTIONRESOURCE           =
      *   INSPCHARACTERISTIC           =
      *   TEXTALLOCATION               =
      *   TEXT                         =
          RETURN                       = LT_BAPIRET2
                .
      
      LOOP AT LT_BAPIRET2 INTO LR_BAPIRET2 WHERE TYPE = 'E' OR
                                             TYPE = 'A'.
        LF_ROUTING_ERROR = 'X'.
      ENDLOOP.
      
      IF LF_ROUTING_ERROR NE 'X'.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      *       EXPORTING
      *         WAIT          =
      *       IMPORTING
      *         RETURN        =
                  .
      ELSE.
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
      *     IMPORTING
      *       RETURN        =
                  .
      ENDIF.

  • author's profile photo Former Member
    Former Member
    Posted on Jul 17, 2009 at 08:44 AM

    Hi,

    We are not able to go thrgh the code please arrange in proper order...

    Anyway see have you this WORKCENTERREFERENCE table in Bapi...

    With regards,

    Aditya

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Sorry. i am not getting how to arrange the code. Though i paste properly it becomes like this.

      anyway, the problem is solved. i just commented the SEQUENCE_NO parameter in TABLES parameter OPERATION.

      thank you.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.