Skip to Content
0

BAPI_PRODORDCONF_CREATE_TT batch problem 101 movement

Nov 28, 2016 at 09:41 AM

174

avatar image
Former Member

I have created a custom program that makes confirmations using BAPI_PRODORDCONF_CREATE_TT.

Everything works fine except the fact that the batch are not the one that i filled but it takes it'own batch. And the problem is only in 101 movent and when i try to post 101 on second phase.
I have search a lot on internet but i cannot find any solution

Look my code please :

It might be a small details that i miss ....

  SORT ITAB_AUFNRS.
  LOOP AT ITAB_AUFNRS.


    INDX = 1.


    LOOP AT ITAB_BAPI WHERE "BWART = '101' AND
      AUFNR = ITAB_AUFNRS-AUFNR_DEST .
      IF ITAB_BAPI-BWART = '101'.
        TIMETICKETS-ORDERID   = ITAB_BAPI-AUFNR.
        TIMETICKETS-OPERATION = ITAB_BAPI-VORNR.            "'0010'.
        TIMETICKETS-SEQUENCE  = '000000'.
        TIMETICKETS-YIELD     = ITAB_BAPI-BDMNG.




        CASE ITAB-VGWTS.
          WHEN 'ZAN1'.
            IF ITAB_BAPI-DEL_HOURS <> 0.
              TIMETICKETS-CONF_ACTIVITY1  = ITAB_BAPI-DEL_HOURS.
              TIMETICKETS-CONF_ACTI_UNIT1 = 'MIN'.
              TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            ENDIF.


            IF ITAB_BAPI-MAC_HOURS <> 0.
              TIMETICKETS-CONF_ACTIVITY2  = ITAB_BAPI-MAC_HOURS.
              TIMETICKETS-CONF_ACTI_UNIT2 = 'MIN'.
              TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            ENDIF.


            TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            APPEND TIMETICKETS.


          WHEN 'ZAN2'.


            IF  ITAB_BAPI-LAB_HOURS <> 0.
              TIMETICKETS-CONF_ACTIVITY3  = ITAB_BAPI-LAB_HOURS.
              TIMETICKETS-CONF_ACTI_UNIT3 = 'H'.
              TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            ENDIF.


            TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            APPEND TIMETICKETS.


          WHEN 'ZANA'.


            IF ITAB_BAPI-SET_HOURS <> 0.
              TIMETICKETS-CONF_ACTIVITY1  = ITAB_BAPI-SET_HOURS.
              TIMETICKETS-CONF_ACTI_UNIT1 = 'MIN'.
              TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            ENDIF.


            IF ITAB_BAPI-MAC_HOURS <> 0.
              TIMETICKETS-CONF_ACTIVITY2  = ITAB_BAPI-MAC_HOURS.
              TIMETICKETS-CONF_ACTI_UNIT2 = 'MIN'.
              TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            ENDIF.


            IF  ITAB_BAPI-LAB_HOURS <> 0.
              TIMETICKETS-CONF_ACTIVITY3  = ITAB_BAPI-LAB_HOURS.
              TIMETICKETS-CONF_ACTI_UNIT3 = 'H'.
              TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            ENDIF.


            IF ITAB_BAPI-DEL_HOURS <> 0.
              TIMETICKETS-CONF_ACTIVITY4  = ITAB_BAPI-DEL_HOURS.
              TIMETICKETS-CONF_ACTI_UNIT4 = 'MIN'.
              TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            ENDIF.


            TIMETICKETS-POSTG_DATE      = ITAB-PROD_DATE.
            APPEND TIMETICKETS.


        ENDCASE.
      ENDIF.


***********************************************************************




      CLEAR GOODSMOVEMENTS_TAB.
      GOODSMOVEMENTS_TAB-PROD_DATE  = ITAB-PROD_DATE.
      GOODSMOVEMENTS_TAB-MATERIAL   = ITAB_BAPI-MATNR.
      GOODSMOVEMENTS_TAB-PLANT      = ITAB_BAPI-WERKS.
      GOODSMOVEMENTS_TAB-STGE_LOC   = ITAB_BAPI-LGORT.
      GOODSMOVEMENTS_TAB-MOVE_TYPE  = ITAB_BAPI-BWART.
      GOODSMOVEMENTS_TAB-BATCH      = ITAB_BAPI-CHARGDETA.
*                                      ITAB_BAPI-CHARG.
      IF ITAB_BAPI-BWART = '101'.
        GOODSMOVEMENTS_TAB-MVT_IND    = 'F'.
      ELSE.
        GOODSMOVEMENTS_TAB-MVT_IND    = ''.
      ENDIF.
      GOODSMOVEMENTS_TAB-ENTRY_QNT  = ITAB_BAPI-BDMNG.
      GOODSMOVEMENTS_TAB-ENTRY_UOM  = 'KG'.
      GOODSMOVEMENTS_TAB-ORDERID    = ITAB_BAPI-AUFNR.
      GOODSMOVEMENTS_TAB-ORDER_ITNO = '0001'.
      GOODSMOVEMENTS_TAB-PLANT      = ITAB_BAPI-WERKS.


      APPEND GOODSMOVEMENTS_TAB.




      LINK_CONF_GOODSMOV-INDEX_CONFIRM  = 1.


      IF ITAB_BAPI-FOR_DEL = ''.
        LINK_CONF_GOODSMOV-INDEX_GOODSMOV = INDX.
        INDX = INDX + 1.
      ELSE.
        LINK_CONF_GOODSMOV-INDEX_GOODSMOV = 0.
*        INDX = INDX + 1.
      ENDIF.
      APPEND LINK_CONF_GOODSMOV.


    ENDLOOP.

      CALL FUNCTION 'BAPI_PRODORDCONF_CREATE_TT'
        EXPORTING
          POST_WRONG_ENTRIES       = '2'
*          TESTRUN                  = TESTRUN
        IMPORTING
          RETURN                   = RETURN
        TABLES
          TIMETICKETS              = TIMETICKETS
          GOODSMOVEMENTS           = GOODSMOVEMENTS_TAB
          LINK_CONF_GOODSMOV       = LINK_CONF_GOODSMOV
*         CHARACTERISTICS_WIPBATCH =
*         LINK_CONF_CHAR_WIPBATCH  =
*         CHARACTERISTICS_BATCH    = CHARACTERISTICS_BATCH
*         LINK_GM_CHAR_BATCH       =
          DETAIL_RETURN            = D_RETURN.


      IF RETURN IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
     EXPORTING
       WAIT          = 'X'
* IMPORTING
*   RETURN        =
          .
      ENDIF.


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers