Folio number not updated in the table RG23D

Hi all,
Folio number not updated in the table RG23D when I create depot excise invoice using batch program J_1IJCHK. Can any one help me by providing rootcause and solution.
Thanks in advance.
Regards
Balaji

See can i know in which version u r working,Because if u r in 4.6c there will be some problem.Some patches will be there.
Try this program i have send and assign excise duty
REPORT YJ_1IJCHK MESSAGE-ID 8I.
TABLES :  J_1IEXCHDR,                  "excise header
          J_1IEXCDTL,                  "excise detail
          J_1IRG23D ,                  "RG23D register
          J_1IWRKCUS,                  "Plant level customisation
          J_1IREGSET,                  "register set customisation
          J_1IEXCDEF,                  "Tax default information
          VBFA,                        "sales document flow
          LIKP,                        "delivery header
          LIPS,                        "delivery detail
          T005,                        "country information
          KUAGV,                       "sold-to-party information
          KUWEV,                       "ship-to-party information
          KNA1,                        "customer master
          VBPA,                        "sales document partner
          TVKO,                        "sales organisation to company co
          VBUK,                        "delivery information
          MAKT,                        "material description
          T001.                        "company code
selection-screen begin of block delivery_details no intervals.
PARAMETERS: FCODE    TYPE C,
            DELIVERY LIKE LIPS-VBELN,
            EXCGROUP LIKE J_1IEXCHDR-EXGRP,
            SERGROUP LIKE J_1IEXCHDR-SRGRP.
TYPES : BEGIN OF RG23D.
        INCLUDE STRUCTURE J_1IRG23D.
TYPES:  MENGR LIKE J_1IEXCDTL-MENGR,           "remaining quantity
        MENGA LIKE J_1IEXCDTL-MENGA,           "quantity actually rec
        ADDBED LIKE J_1IEXCDTL-ADDBED,
        ADDSED LIKE J_1IEXCDTL-ADDSED,
        ADDAED LIKE J_1IEXCDTL-ADDAED,
        END OF RG23D.
DATA : BEGIN OF J1IJ300,
        BUKRS   LIKE TVKO-BUKRS,
        WERKS   LIKE LIPS-WERKS,
        REGID   LIKE J_1IREGSET-J_1IREGID,
        WAERS   LIKE T001-WAERS,
        SHIPFROM_IND TYPE C,                          " Added 10/12/1998
        RG23D_SERIALNO TYPE C,                        " Added 10/12/1998
     END OF J1IJ300.
DATA :  TRNTYP(4)   TYPE C,
        CONDT-NAME(3) TYPE C,
        TOTAL_LRG23D   LIKE LIPS-LFIMG,
        ALLOC_LRG23D   LIKE LIPS-LFIMG,
        SHIPFROM_IND   LIKE J_1IEXCHDR-STATUS,
        RG23D_SERIALNO LIKE J_1IEXCHDR-STATUS.
DATA : BEGIN OF XLIPS OCCURS 10,
internal table to store the delivery item information
         VBELN LIKE LIPS-VBELN,
         POSNR LIKE LIPS-POSNR,
         MATNR LIKE LIPS-MATNR,
         MAKTX LIKE MAKT-MAKTX,
         WERKS LIKE LIPS-WERKS,
         LGORT LIKE LIPS-LGORT,
         CHARG LIKE LIPS-CHARG,
         LFIMG LIKE LIPS-LFIMG,
         MEINS LIKE LIPS-MEINS,
         BED   LIKE J_1IRG23D-EXBED,
         SED   LIKE J_1IRG23D-EXSED,
         AED   LIKE J_1IRG23D-EXAED,
         CUR   LIKE J_1IRG23D-EXCUR,
         SELFLAG TYPE C ,              "T=excise invoice selected
         INDEX LIKE SY-TABIX,          "index in the table
         FLG TYPE C.                   "item selection
DATA : END OF XLIPS.
DATA : CRG23D TYPE RG23D OCCURS 30 WITH HEADER LINE.
contains all rg23d entries for the document
DATA : LRG23D TYPE RG23D OCCURS 30 WITH HEADER LINE.
contains item rg23d entries
DATA : BEGIN OF Z_1IRG23D OCCURS 30.
stores the data to be updated
        INCLUDE STRUCTURE J_1IRG23D.
DATA : END OF Z_1IRG23D.
DATA : BEGIN OF EXCINV OCCURS 30.
factory inovoics selected for item
        INCLUDE STRUCTURE J_1IEXCDTL.
DATA : END OF EXCINV.
DATA : BEGIN OF ASSIGNED_EXCINV OCCURS 30.
        INCLUDE STRUCTURE J_1IEXCDTL.
DATA : END OF ASSIGNED_EXCINV.
DATA : A_INDEX LIKE SYST-TABIX.
DATA : BEGIN OF LOCK_TABLE OCCURS 10,
table containing plant-material combination and status of the lock
          WERKS  LIKE J_1IEXCDTL-WERKS,
          MATNR  LIKE J_1IEXCDTL-MATNR,
          STATUS TYPE C,                   "LOCKED/UNLOCKED
       END OF LOCK_TABLE.
DATA : BEGIN OF LOCKTAB OCCURS 0,
           TRNTYP LIKE J_1IEXCDTL-TRNTYP,
           DOCNO  LIKE J_1IEXCDTL-DOCNO,
           DOCYR LIKE  J_1IEXCDTL-DOCYR,
           ZEILE LIKE  J_1IEXCDTL-ZEILE,
        END OF LOCKTAB.
DATA :
      CRG23D-CTR  TYPE I,              "Line count of crg23d table
      SHIPFROM    LIKE J_1IRG23D-SHIPFROM,
      FOLIO       LIKE J_1IRG23D-FOLIO,
      SERIALNO    LIKE J_1IRG23D-SERIALNO,
      DEPEXNUM    LIKE J_1IRG23D-DEPEXNUM,
      DEPEXYEAR   LIKE J_1IRG23D-DEPEXYEAR.
CONSTANTS :
   BED       LIKE CONDT-NAME VALUE 'BED',
   AED       LIKE CONDT-NAME VALUE 'AED',
   SED       LIKE CONDT-NAME VALUE 'SED',
   CES       LIKE CONDT-NAME VALUE 'CES',
   LOCKED    TYPE C          VALUE '1',
   UNLOCKED  TYPE C          VALUE '2'.
AT SELECTION-SCREEN.
   PERFORM CHECK_VBELN_INPUT.
IF     FCODE = 'S'.
       PERFORM DELIVERY_START_USER_EXIT.
       PERFORM READ_DELIVERY_HEADER.
       PERFORM GET_COMP_CODE.
       PERFORM READ_CUSTOMISATION.
       PERFORM GET_ITEM_INFO.
       PERFORM LOCKING.
       PERFORM RG23D_SELECTION.
       PERFORM SAVE_DOCUMENT.
       MESSAGE I000 WITH 'Selection Complete for Delivery ' DELIVERY.
ELSEIF FCODE = 'V'.
       PERFORM GET_COMP_CODE.
       PERFORM READ_CUSTOMISATION.
       PERFORM GET_ITEM_INFO.
       PERFORM LOCKING.
       PERFORM UPDATE_DOCUMENT.
       MESSAGE I000 WITH 'Verfiy/Post Complete for Delivery ' DELIVERY.
ENDIF.
FORM CHECK_VBELN_INPUT.
Validate Function Code
   IF NOT ( FCODE = 'S' OR FCODE = 'V' ).
     MESSAGE E000 WITH 'Valid Functions are S/V - Select/Verify Post'.
   ENDIF.
  IF DELIVERY IS INITIAL.
     MESSAGE E000 WITH 'Delivery number cannot be initial'.
  ENDIF.
check if goods issue done for the delivery
    SELECT SINGLE WBSTK INTO VBUK-WBSTK
        FROM  VBUK
        WHERE VBELN = DELIVERY.
    IF  SY-SUBRC = 0.
        IF VBUK-WBSTK <> 'C' AND FCODE = 'V'.
           MESSAGE W339 WITH DELIVERY.
        ENDIF.
    ELSE.
           MESSAGE E000 WITH 'Invalid Delivery'.
    ENDIF.
if in select mode check if excise invoice already selected for delive
    SELECT SINGLE * FROM J_1IRG23D
        WHERE VBELN = DELIVERY.
    IF     FCODE = 'S'.
           IF SY-SUBRC = 0.
              MESSAGE E325 WITH DELIVERY.
           ENDIF.
    ELSEIF FCODE = 'V'.
           IF     SY-SUBRC NE 0.
                  MESSAGE E000 WITH 'Selection not over for ' DELIVERY.
           ELSEIF J_1IRG23D-STATUS = 'P'.
                  MESSAGE E000 WITH 'Record Already Posted '.
           ENDIF.
    ENDIF.
  CLEAR J_1IRG23D.
ENDFORM.                    " CHECK_VBELN_INPUT
FORM READ_DELIVERY_HEADER.
  SELECT SINGLE * FROM LIKP
    WHERE VBELN = DELIVERY.
get the sold-to-party
  CLEAR: KUAGV, KUWEV.
  SELECT SINGLE KUNNR NAME1 LAND1
          FROM KNA1 INTO (KUAGV-KUNNR,KUAGV-NAME1,KUAGV-LAND1)
     WHERE KUNNR = LIKP-KUNAG.
get the ship-to-party
  SELECT SINGLE KUNNR LAND1 NAME1
          FROM KNA1 INTO (KUWEV-KUNNR,KUWEV-LAND1,KUWEV-NAME1)
      WHERE KUNNR = LIKP-KUNNR.
ENDFORM.                    " READ_DELIVERY_HEADER
FORM GET_COMP_CODE.
get the company code of the document from the sales organisation
  CLEAR TVKO-BUKRS.
  SELECT SINGLE BUKRS FROM TVKO INTO TVKO-BUKRS
    WHERE VKORG = LIKP-VKORG.
  J1IJ300-BUKRS = TVKO-BUKRS.
  SELECT SINGLE WAERS FROM T001 INTO J1IJ300-WAERS
    WHERE BUKRS = J1IJ300-BUKRS.
ENDFORM.                    " GET_COMP_CODE
FORM READ_CUSTOMISATION.
  SELECT SINGLE WERKS INTO J1IJ300-WERKS
       FROM   LIPS
       WHERE  VBELN = DELIVERY.
Plant level customisation
  SELECT SINGLE * FROM  J_1IWRKCUS
         WHERE  J_1IWERKS   = J1IJ300-WERKS .
  IF SY-SUBRC <> 0.
    MESSAGE E303 WITH 'plant' J1IJ300-WERKS 'J_1IWRKCUS'.
  ENDIF.
  IF J_1IWRKCUS-J_1IDEPOT IS INITIAL.
plant is defined as factory
    MESSAGE E322 WITH J1IJ300-WERKS.
  ENDIF.
  J1IJ300-REGID = J_1IWRKCUS-J_1IREGID.
  TRNTYP = 'DLDO'.
  SELECT SINGLE * FROM J_1IREGSET
       WHERE J_1IREGID = J1IJ300-REGID.
  IF SY-SUBRC <> 0.
    MESSAGE E303 WITH 'Register id' J1IJ300-REGID 'J_1IREGSET'.
  ENDIF.
ENDFORM.                    " READ_CUSTOMISATION
*&      Form  GET_ITEM_INFO
      text                                                           *
-->  p1        text
<--  p2        text
FORM GET_ITEM_INFO.
  REFRESH : CRG23D, LRG23D, EXCINV, XLIPS.
  PERFORM READ_DELIVERY_ITEM.
ENDFORM.                    " GET_ITEM_INFO
*&      Form  READ_DELIVERY_ITEM
      text                                                           *
-->  p1        text
<--  p2        text
FORM READ_DELIVERY_ITEM.
  DATA : CNT LIKE SY-TABIX.
  CLEAR CNT.
  REFRESH XLIPS.
  SELECT * FROM LIPS
     WHERE VBELN = DELIVERY.
read the delivery item
perform plant checking only if in create mode
      IF LIPS-WERKS <> J1IJ300-WERKS.
plant is different from that of the first item
        SELECT SINGLE J_1IREGID INTO J_1IWRKCUS-J_1IREGID
             FROM   J_1IWRKCUS
             WHERE  J_1IWERKS = LIPS-WERKS.
        IF SY-SUBRC <> 0.
          MESSAGE E303 WITH 'plant' LIPS-WERKS 'J_1IWRKCUS'.
        ENDIF.
        IF J_1IWRKCUS-J_1IREGID <> J1IJ300-REGID.
register id of the two plants are different
          MESSAGE E338 WITH DELIVERY.
        ENDIF.
      ENDIF.
    CLEAR XLIPS.
store the item details
    XLIPS-VBELN = LIPS-VBELN.
    XLIPS-POSNR = LIPS-POSNR.
    XLIPS-MATNR = LIPS-MATNR.
    PERFORM GET_MATERIAL_DESC
          USING XLIPS-MATNR
                XLIPS-MAKTX.
   XLIPS-WERKS = LIPS-WERKS.
   XLIPS-LGORT = LIPS-LGORT.
   XLIPS-CHARG = LIPS-CHARG.
   XLIPS-LFIMG = LIPS-LFIMG.
   XLIPS-MEINS = LIPS-VRKME.                           "changed 2.3.98
   CLEAR : XLIPS-BED, XLIPS-SED, XLIPS-AED.
   XLIPS-CUR = J1IJ300-BUKRS.
   CNT = CNT + 1.
   XLIPS-INDEX = CNT.
   XLIPS-SELFLAG = 'F'.
   APPEND XLIPS.
ENDSELECT.
ENDFORM.                    " READ_DELIVERY_ITEM
*&      Form  GET_MATERIAL_DESC
      text                                                           *
-->  p1        text
<--  p2        text
FORM GET_MATERIAL_DESC USING MATNR MAKTX.
  SELECT SINGLE MAKTX FROM  MAKT INTO MAKTX
         WHERE  MATNR       = MATNR
         AND    SPRAS       = 'E'            .
ENDFORM.                               " GET_MATERIAL_DESC
*&      Form  LOCKING
      text                                                           *
-->  p1        text
<--  p2        text
FORM LOCKING.
REFRESH LOCK_TABLE.
LOOP AT XLIPS.
  LOCK_TABLE-WERKS  = XLIPS-WERKS.
  LOCK_TABLE-MATNR  = XLIPS-MATNR.
  LOCK_TABLE-STATUS = UNLOCKED.
  COLLECT LOCK_TABLE.
ENDLOOP.
PERFORM LOCK_UNLOCK_PLANT_MATERIAL USING LOCKED.
  SELECT TRNTYP DOCNO DOCYR ZEILE INTO
      (LOCKTAB-TRNTYP,
      LOCKTAB-DOCNO,LOCKTAB-DOCYR,
      LOCKTAB-ZEILE)
                          FROM   J_1IEXCDTL
                      WHERE TRNTYP = 'GRPO'
                      AND  WERKS = XLIPS-WERKS
                      AND  LGORT = XLIPS-LGORT
                      AND  MATNR = XLIPS-MATNR
                      AND  CHARG = XLIPS-CHARG.
    APPEND LOCKTAB.
  ENDSELECT.
*share lock for all excise invoices
  LOOP AT LOCKTAB.
    CALL FUNCTION 'ENQUEUE_EJ_1IEXDTL'
         EXPORTING
              MODE_J_1IEXCDTL = 'S'
              MANDT           = SY-MANDT
              TRNTYP          = LOCKTAB-TRNTYP
              DOCYR           = LOCKTAB-DOCYR
              DOCNO           = LOCKTAB-DOCNO
              ZEILE           = LOCKTAB-ZEILE
         EXCEPTIONS
              FOREIGN_LOCK    = 1
              SYSTEM_FAILURE  = 2
              OTHERS          = 3.
  ENDLOOP.
ENDFORM.                    " LOCKING
*&      Form  LOCK_UNLOCK_PLANT_MATERIAL
      text                                                           *
-->  p1        text
<--  p2        text
FORM LOCK_UNLOCK_PLANT_MATERIAL USING ACTION.
  DATA: __UNAME  LIKE SY-UNAME,
        __OBJECT LIKE DD25V-VIEWNAME.
  DATA : BEGIN OF LOCK_STRUCT,
           GRANNAME(10)   VALUE 'J1IJ',
           ENQMODE        VALUE 'E',
           MANDT          LIKE  SY-MANDT,
           WERKS          LIKE  J_1IEXCDTL-WERKS,
           MATNR          LIKE  J_1IEXCDTL-MATNR,
        END OF LOCK_STRUCT.
  LOCK_STRUCT-MANDT = SY-MANDT.
  LOOP AT LOCK_TABLE WHERE STATUS <> ACTION.
perform the locking/unlocking operation only for the items for which
it is not already done
    LOCK_STRUCT-WERKS = LOCK_TABLE-WERKS.
    LOCK_STRUCT-MATNR = LOCK_TABLE-MATNR.
   CALL 'C_ENQUEUE'
     ID 'OPCODE'           FIELD ACTION
     ID 'ENQOBJ'           FIELD 'J_1IJ'
     ID '01'               FIELD LOCK_STRUCT
     ID 'COLLISION_UNAME'  FIELD __UNAME
     ID 'COLLISION_OBJECT' FIELD __OBJECT.
   CASE SY-SUBRC.
     WHEN 0.
       LOCK_TABLE-STATUS = ACTION.
       MODIFY LOCK_TABLE.
     WHEN 2.
       MESSAGE E341 WITH LOCK_TABLE-WERKS LOCK_TABLE-MATNR  __UNAME.
     WHEN OTHERS.
       IF ACTION = LOCKED.
         MESSAGE E342 WITH 'locking'
                           LOCK_TABLE-WERKS LOCK_TABLE-MATNR.
       ELSE.
         MESSAGE E342 WITH 'unlocking'
                           LOCK_TABLE-WERKS LOCK_TABLE-MATNR.
       ENDIF.
   ENDCASE.
  ENDLOOP.
ENDFORM.                    " LOCK_UNLOCK_PLANT_MATERIAL
*&      Form  RG23D_SELECTION
      text                                                           *
-->  p1        text
<--  p2        text
FORM RG23D_SELECTION.
REFRESH CRG23D.
REFRESH ASSIGNED_EXCINV.
LOOP AT XLIPS.
*write: / xlips-vbeln,xlips-posnr,xlips-matnr, xlips-meins, xlips-lfimg.
REFRESH EXCINV.
CALL FUNCTION 'J_1I6_SELECT_EXCISE_INVOICE_DE'
     EXPORTING
         BUKRS        = J1IJ300-BUKRS
         CHARG        = XLIPS-CHARG
         WERKS        = XLIPS-WERKS
         EXGRP        = EXCGROUP
         MATNR        = XLIPS-MATNR
         QTY_CHECK    = 'X'
         MULTI        = 'X'
         NO_DAY_CHECK = 'X'
         SHIPFROM     = SHIPFROM
         LGORT        = XLIPS-LGORT
     TABLES
          EXC_TAB     = EXCINV
     EXCEPTIONS
          OTHERS       = 1.
     TOTAL_LRG23D = 0.
     ALLOC_LRG23D = 0.
     SORT EXCINV BY DOCYR DOCNO .
     LOOP AT ASSIGNED_EXCINV.
        READ TABLE EXCINV WITH KEY DOCYR = ASSIGNED_EXCINV-DOCYR
                                 DOCNO = ASSIGNED_EXCINV-DOCNO
                                 ZEILE = ASSIGNED_EXCINV-ZEILE
                                 BINARY SEARCH.
        IF SY-SUBRC = 0.
           A_INDEX = SY-TABIX.
           EXCINV-MENGR = EXCINV-MENGR - ASSIGNED_EXCINV-MENGR.
           MODIFY EXCINV INDEX A_INDEX .
        ENDIF.
     ENDLOOP.
     DELETE EXCINV WHERE MENGR = 0.
total_lrg23d = total balance quantity in the selected excise invoices
alloc_lrg23d = Quantity allocated to a delivery line item,
Allocation continues till
  - We have balance quantity in excise invoice selection
  - Till total delivery quantity is allocated
    LOOP AT EXCINV.
  To Force the same shipfrom for all the excise invoices
  Shipfrom Ind can be determined in the start user-exit
    IF  J1IJ300-SHIPFROM_IND = 'Y'.
        IF  XLIPS-INDEX = 1 AND SY-TABIX = 1.
            SHIPFROM = EXCINV-SHIPFROM.
        ENDIF.
        IF SHIPFROM NE EXCINV-SHIPFROM.
           EXCINV-RIND3 = 'X'.
           MODIFY EXCINV.
           CONTINUE.
        ENDIF.
    ENDIF.
  Allocation
    IF XLIPS-LFIMG NE ALLOC_LRG23D.
        TOTAL_LRG23D = TOTAL_LRG23D + EXCINV-MENGR.
        IF XLIPS-LFIMG > TOTAL_LRG23D.
           ALLOC_LRG23D = ALLOC_LRG23D + EXCINV-MENGR.
        ELSE.
           EXCINV-MENGR = XLIPS-LFIMG - ALLOC_LRG23D.
           ALLOC_LRG23D = ALLOC_LRG23D + EXCINV-MENGR.
        ENDIF.
    ELSE.
           EXCINV-RIND3 = 'X'.
     ENDIF.
     MODIFY EXCINV.
     ENDLOOP.
     DELETE EXCINV WHERE RIND3 = 'X'.
     LOOP AT EXCINV.
        MOVE-CORRESPONDING EXCINV TO ASSIGNED_EXCINV.
        APPEND ASSIGNED_EXCINV.
        CLEAR ASSIGNED_EXCINV.
     ENDLOOP.
     IF TOTAL_LRG23D < XLIPS-LFIMG.
        MESSAGE E000 WITH 'Not enough balance in RG23D ......'.
    ENDIF.
Collect all allocated excise invoices to crg23d table
  LOOP AT EXCINV.
    PERFORM FILL_CRG23D.
    APPEND CRG23D.
  ENDLOOP.
ENDLOOP.
ENDFORM.                    " RG23D_SELECTION
*&      Form  SAVE_DOCUMENT
      text                                                           *
-->  p1        text
<--  p2        text
FORM SAVE_DOCUMENT.
      PERFORM PREPARE_RG23D_DATA.
Generate RG23D serial number and Excise Invoice Serial Number
   IF J1IJ300-RG23D_SERIALNO = 'Y'.
   PERFORM GENERATE_RG23D_SERIAL ON COMMIT.
   ENDIF.
   PERFORM GENERATE_EXCISE_INV_SERIAL ON COMMIT.
     CALL FUNCTION 'J_1I7_USEREXIT_DEPOT_BEF_SAVE'
          TABLES
               RG23D   = Z_1IRG23D
          EXCEPTIONS
               OTHERS  = 1.
     PERFORM UPDATE_RG23D ON COMMIT.
     PERFORM UPDATE_EXCDTL ON COMMIT.
     COMMIT WORK.
    PERFORM LOCK_UNLOCK_PLANT_MATERIAL USING UNLOCKED.
     PERFORM UNLOCKING.
     MESSAGE S333 WITH DELIVERY.
ENDFORM.                    " SAVE_DOCUMENT
*&      Form  PREPARE_RG23D_DATA
      text                                                           *
-->  p1        text
<--  p2        text
FORM PREPARE_RG23D_DATA.
  REFRESH Z_1IRG23D.
  LOOP AT CRG23D WHERE MENGE <> 0.
    CLEAR Z_1IRG23D.
    Z_1IRG23D = CRG23D.
    Z_1IRG23D-USNAM = SY-UNAME.
    Z_1IRG23D-CPUDT = SY-DATUM.
    Z_1IRG23D-EXGRP    = EXCGROUP.
    Z_1IRG23D-SRGRP    = SERGROUP.
    APPEND Z_1IRG23D.
    IF CRG23D-ADDAED <> 0 OR CRG23D-ADDSED <> 0 OR CRG23D-ADDAED <> 0 .
additional excise is applicable
make quantity zero for A certificate entries
      CLEAR : Z_1IRG23D-MENGE.
get all the A certificates for the excise document item
      SELECT * FROM J_1IEXCDTL
TODO : add the transaction type to the selection procedure
             WHERE RDOC1    = CRG23D-DOCNO
             AND   RYEAR1   = CRG23D-DOCYR
             AND   RITEM1   = CRG23D-ZEILE
             AND   RIND1    = 'G'.
get the A certificate number
        SELECT SINGLE
               EXNUM EXYEAR INTO (Z_1IRG23D-EXNUM, Z_1IRG23D-EXYEAR)
               FROM  J_1IEXCHDR
               WHERE  TRNTYP = J_1IEXCDTL-TRNTYP
               AND    DOCYR  = J_1IEXCDTL-DOCYR
               AND    DOCNO  = J_1IEXCDTL-DOCNO.
        Z_1IRG23D-TRNTYP = J_1IEXCDTL-TRNTYP.
        Z_1IRG23D-DOCYR  = J_1IEXCDTL-DOCYR.
        Z_1IRG23D-DOCNO  = J_1IEXCDTL-DOCNO.
        Z_1IRG23D-ZEILE  = J_1IEXCDTL-ZEILE.
        Z_1IRG23D-EXBED  = ( J_1IEXCDTL-EXBED * CRG23D-MENGE )
                                      / CRG23D-MENGA.
        Z_1IRG23D-EXSED  = ( J_1IEXCDTL-EXSED * CRG23D-MENGE )
                                      / CRG23D-MENGA.
        Z_1IRG23D-EXAED  = ( J_1IEXCDTL-EXAED * CRG23D-MENGE )
                                      / CRG23D-MENGA.
        Z_1IRG23D-RG23ASER = J_1IEXCDTL-RG23ASER.
        Z_1IRG23D-RG23CSER = J_1IEXCDTL-RG23CSER.
        Z_1IRG23D-RGPLASER = J_1IEXCDTL-RGPLASER.
        APPEND Z_1IRG23D.
      ENDSELECT.
    ENDIF.
ENDLOOP.
ENDFORM.                    " PREPARE_RG23D_DATA
*&      Form  UPDATE_RG23D
      text                                                           *
-->  p1        text
<--  p2        text
FORM UPDATE_RG23D.
*update the rg23d register
  INSERT J_1IRG23D FROM TABLE Z_1IRG23D ACCEPTING DUPLICATE KEYS.
  IF SY-SUBRC <> 0.
    MESSAGE A308 WITH 'J_1IRG23D'.
  ENDIF.
ENDFORM.                    " UPDATE_RG23D
*&      Form  UPDATE_EXCDTL
      text                                                           *
-->  p1        text
<--  p2        text
FORM UPDATE_EXCDTL.
  LOOP AT CRG23D WHERE MENGE <> 0.
update the remaining quantity in the excise invoice item tables
    UPDATE J_1IEXCDTL
       SET      MENGR   = MENGR - CRG23D-MENGE
                AENAM   = SY-UNAME
                AEDAT   = SY-DATUM
       WHERE    TRNTYP  = 'GRPO'
         AND    DOCYR   = CRG23D-DOCYR
         AND    DOCNO   = CRG23D-DOCNO
         AND    ZEILE   = CRG23D-ZEILE.
    IF SY-SUBRC <> 0.
      MESSAGE A308 WITH 'J_1IRG23D'.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " UPDATE_EXCDTL
*&      Form  FILL_CRG23D
      text                                                           *
-->  p1        text
<--  p2        text
FORM FILL_CRG23D.
  CRG23D-TRNTYP   = EXCINV-TRNTYP.
  CRG23D-DOCYR    = EXCINV-DOCYR.
  CRG23D-DOCNO    = EXCINV-DOCNO.
  CRG23D-ZEILE    = EXCINV-ZEILE.
  CRG23D-VBELN    = XLIPS-VBELN.
  CRG23D-POSNR    = XLIPS-POSNR.
  CRG23D-EXNUM    = EXCINV-EXNUM.
  CRG23D-EXYEAR   = EXCINV-EXYEAR.
  CRG23D-LIFNR    = EXCINV-LIFNR.
  CRG23D-MATNR    = EXCINV-MATNR.
  CRG23D-MAKTX    = EXCINV-MAKTX.
  CRG23D-CHAPID   = EXCINV-CHAPID.
  CRG23D-MEINS    = EXCINV-MENGR_UOM.
  CRG23D-WERKS    = EXCINV-WERKS.
  CRG23D-EXCUR    = EXCINV-EXCUR.
  CRG23D-RG23ASER = EXCINV-RG23ASER.
  CRG23D-RG23CSER = EXCINV-RG23CSER.
  CRG23D-RGPLASER = EXCINV-RGPLASER.
  CRG23D-MENGR    = EXCINV-MENGR.
  CRG23D-MENGA    = EXCINV-MENGA.
  CRG23D-MENGE    = EXCINV-MENGR.            " Move the allocated Qty
  CRG23D-EXBED    = ( EXCINV-EXBED  * CRG23D-MENGE ) / EXCINV-MENGA.
  CRG23D-EXSED    = ( EXCINV-EXSED  * CRG23D-MENGE ) / EXCINV-MENGA.
  CRG23D-EXAED    = ( EXCINV-EXAED  * CRG23D-MENGE ) / EXCINV-MENGA.
ENDFORM.                    " FILL_CRG23D
*&      Form  UPDATE_DOCUMENT
      text                                                           *
-->  p1        text
<--  p2        text
FORM UPDATE_DOCUMENT.
LOOP AT XLIPS.
  UPDATE J_1IRG23D SET STATUS = 'P'
  WHERE  VBELN       = XLIPS-VBELN
  AND    POSNR       = XLIPS-POSNR.
ENDLOOP.
COMMIT WORK.
ENDFORM.                    " UPDATE_DOCUMENT
*&      Form  DELIVERY_START_USER_EXIT
      text                                                           *
-->  p1        text
<--  p2        text
FORM DELIVERY_START_USER_EXIT.
CALL FUNCTION 'J_1I7_USEREXIT_EXGRP_DETERM'
     EXPORTING
          EXCGRP         = EXCGROUP
        MBLNR          =
        MJAHR          =
        VENDOR         =
          VBELN          = DELIVERY
     IMPORTING
          EXCGRP         = EXCGROUP
          SHIPFROM_IND   = J1IJ300-SHIPFROM_IND
          RG23D_SERIALNO = J1IJ300-RG23D_SERIALNO
     EXCEPTIONS
          OTHERS         = 1.
CALL FUNCTION 'J_1I7_USEREXIT_SERGRP_DETERM'
     EXPORTING
          SRGRP          = SERGROUP
        MBLNR          =
        MJAHR          =
          VBELN          = DELIVERY
     IMPORTING
          SRGRP          = SERGROUP
     EXCEPTIONS
          OTHERS         = 1.
ENDFORM.                    " DELIVERY_START_USER_EXIT
*&      Form  GENERATE_RG23D_SERIAL
      text                                                           *
-->  p1        text
<--  p2        text
FORM GENERATE_RG23D_SERIAL.
  LOOP AT Z_1IRG23D WHERE MENGE <> 0.
  CLEAR: FOLIO, SERIALNO.
  SELECT MAX( FOLIO ) MAX( SERIALNO )
  INTO   (Z_1IRG23D-FOLIO, Z_1IRG23D-SERIALNO)
  FROM   J_1IRG23D
  WHERE  TRNTYP = Z_1IRG23D-TRNTYP
  AND    DOCNO  = Z_1IRG23D-DOCNO
  AND    DOCYR  = Z_1IRG23D-DOCYR
  AND    ZEILE  = Z_1IRG23D-ZEILE.
  MODIFY Z_1IRG23D.
  ENDLOOP.
ENDFORM.                    " GENERATE_RG23D_SERIAL
*&      Form  GENERATE_EXCISE_INV_SERIAL
      text                                                           *
-->  p1        text
<--  p2        text
FORM GENERATE_EXCISE_INV_SERIAL.
  CLEAR: DEPEXNUM, DEPEXYEAR.
CALL FUNCTION 'J_1I6_DETERMINE_EXC_YEAR'
     EXPORTING
          I_BUKRS      = J1IJ300-BUKRS
     IMPORTING
          EXCISE_YEAR  = DEPEXYEAR
     EXCEPTIONS
          MISS_COMPANY = 1
          OTHERS       = 2.
  IF SY-SUBRC NE 0.
    MESSAGE E526 WITH 'Company ' J1IJ300-BUKRS.
  ENDIF.
  CALL FUNCTION 'NUMBER_GET_NEXT'
       EXPORTING
            NR_RANGE_NR             = '01'
            OBJECT                  = 'J_1IDEPINV'
            QUANTITY                = '1'
            SUBOBJECT               = SERGROUP
            TOYEAR                  = DEPEXYEAR
       IMPORTING
            NUMBER                  = DEPEXNUM
       EXCEPTIONS
            INTERVAL_NOT_FOUND      = 1
            NUMBER_RANGE_NOT_INTERN = 2
            OBJECT_NOT_FOUND        = 3
            QUANTITY_IS_0           = 4
            QUANTITY_IS_NOT_1       = 5
            INTERVAL_OVERFLOW       = 6
            OTHERS                  = 7.
  CASE SY-SUBRC.
    WHEN 0.
    WHEN 1.
      MESSAGE A336 WITH 'internal document' ': Interval not found'
                        '. Number object : J_1IDEPINV'.
    WHEN 3.
      MESSAGE A336 WITH 'internal document' ': Object not found'
                        '. Number object : J_1IDEPINV'.
    WHEN OTHERS.
      MESSAGE A336 WITH 'internal document'
                        '. Number object : J_1IDEPINV'.
  ENDCASE.
Update Depot Excise Invoice Year and Number in the table
  LOOP AT Z_1IRG23D.
    Z_1IRG23D-SERIALNO  = Z_1IRG23D-SERIALNO + 1.
    Z_1IRG23D-DEPEXYEAR = DEPEXYEAR.
    Z_1IRG23D-DEPEXNUM  = DEPEXNUM.
    MODIFY Z_1IRG23D.
  ENDLOOP.
ENDFORM.                    " GENERATE_EXCISE_INV_SERIAL
*&      Form  UNLOCKING
      text
-->  p1        text
<--  p2        text
FORM UNLOCKING.
  LOOP AT LOCKTAB.
    CALL FUNCTION 'DEQUEUE_EJ_1IEXDTL'
         EXPORTING
              MODE_J_1IEXCDTL = 'S'
              MANDT           = SY-MANDT
              TRNTYP          = LOCKTAB-TRNTYP
              DOCYR           = LOCKTAB-DOCYR
              DOCNO           = LOCKTAB-DOCNO
              ZEILE           = LOCKTAB-ZEILE.
  ENDLOOP.
ENDFORM.                    " UNLOCKING

Similar Messages

  • Not updated in the table  RBKP

    Hi,
    I have created an append on the tables RBKP_V and RBKP.
    I am parking a vendor invoice in transaction MIR7.
    I'm using the BADI BADI_FDCB_SUBBAS04 to enhance MIR7 transaction. I have followed the BADI documentation.
    When I click on 'Save as completed' button :
    The customer fields are  not  updated in the table RBKP.
    Whats the solution ?
    Best Regards,
    Ramesh.S

    Hi, In my opinion, some of Custom fields should move to corresponding field in user exit to update to table.
    Example . you have add a field that zzabb into vbak , you should add code like move struct-zzabb to xvbak-zzabb.
    **"struct" is from screen field you be inputed

  • Check number not updated in the payment Document

    Hi,
    In transaction code F110, we have created one proposal and do the payment run, System is creating the payment document but the check number not getting updated in the document.
    Kindly revert back.
    Thanks,
    Samir Bhatt

    Go to transaction SE38 and run program RFCHKU00. This will update the assignment field of the document with the check numbers.

  • Document number not updating in the document

    hi gurus,
    this is a excise invoice voucher form used by the client .
    some values are not updated in document no.
    could someone tell me why it is not updating.
    if there are any corrections in code pls update me and solve my problem.
    urs
    pradeep.r
    *&  Include           ZFI_PAY_ADVICE_F01_STR_2                         *
    *&      Form  select_data
          text
    -->  p1        text
    <--  p2        text
    FORM SELECT_DATA .
      REFRESH IT_BKPF.
      CLEAR   IT_BKPF.
      SELECT BELNR GJAHR XBLNR BLDAT BLART INTO CORRESPONDING FIELDS OF
      TABLE IT_BKPF FROM BKPF
      WHERE BELNR IN S_BELNR
      AND   GJAHR IN S_GJAHR
      AND   BUKRS IN S_BUKRS.
      IF IT_BKPF[] IS INITIAL.
        MESSAGE S001.
      ENDIF.
      SORT IT_BKPF BY BELNR GJAHR.
      LOOP AT IT_BKPF.
        SELECT SINGLE EBELN WRBTR WERKS LIFNR KUNNR  INTO
        (IT_BKPF-ZUONR,IT_BKPF-WRBTR,IT_BKPF-WERKS,IT_BKPF-LIFNR,IT_BKPF-KUNNR)
        FROM BSEG
        WHERE BELNR = IT_BKPF-BELNR
        AND   GJAHR = IT_BKPF-GJAHR
        AND BUKRS IN S_BUKRS
        AND   KOART = 'K'.
        IF NOT IT_BKPF-LIFNR IS INITIAL.
          DATA : WRK_ADRNR LIKE LFA1-ADRNR.
          CLEAR  WRK_ADRNR.
          SELECT SINGLE ADRNR INTO WRK_ADRNR FROM LFA1
          WHERE LIFNR = IT_BKPF-LIFNR.
          SELECT SINGLE NAME1
                        NAME2
                        NAME3
                        NAME4
                        CITY1
                        REGION
                        COUNTRY
                        STREET
         INTO (IT_BKPF-NAME1,IT_BKPF-NAME2,IT_BKPF-NAME3,IT_BKPF-NAME4,
         IT_BKPF-CITY1,IT_BKPF-REGION,IT_BKPF-COUNTRY,IT_BKPF-STREET)
         FROM ADRC
         WHERE ADDRNUMBER EQ WRK_ADRNR.
    Text for Country
          SELECT SINGLE LANDX INTO IT_BKPF-LANDX FROM T005T
          WHERE LAND1 = IT_BKPF-COUNTRY
          AND   SPRAS EQ SY-LANGU.
    Text for Region
          SELECT SINGLE BEZEI INTO IT_BKPF-BEZEI FROM T005U
          WHERE BLAND = IT_BKPF-REGION
          AND   SPRAS EQ SY-LANGU
          AND   LAND1 = IT_BKPF-COUNTRY.
        ENDIF.
        IF NOT IT_BKPF-KUNNR IS INITIAL.
          CLEAR  WRK_ADRNR.
          SELECT SINGLE ADRNR INTO (WRK_ADRNR) FROM KNA1
          WHERE KUNNR = IT_BKPF-KUNNR.
          SELECT SINGLE NAME1
                        NAME2
                        NAME3
                        NAME4
                        CITY1
                        REGION
                        COUNTRY
                        STREET
         INTO (IT_BKPF-NAME1,IT_BKPF-NAME2,IT_BKPF-NAME3,IT_BKPF-NAME4,
         IT_BKPF-CITY1,IT_BKPF-REGION,IT_BKPF-COUNTRY,IT_BKPF-STREET)
         FROM ADRC
         WHERE ADDRNUMBER EQ WRK_ADRNR.
    Text for Country
          SELECT SINGLE LANDX INTO IT_BKPF-LANDX FROM T005T
          WHERE LAND1 = IT_BKPF-COUNTRY
          AND   SPRAS EQ SY-LANGU.
    Text for Region
          SELECT SINGLE BEZEI INTO IT_BKPF-BEZEI FROM T005U
          WHERE BLAND = IT_BKPF-REGION
          AND   SPRAS EQ SY-LANGU
          AND   LAND1 = IT_BKPF-COUNTRY.
        ENDIF.
        MODIFY IT_BKPF.
      ENDLOOP.
      REFRESH IT_DATA.
      CLEAR   IT_DATA.
      LOOP AT IT_BKPF.
        DATA : WRK_BSAKBELNR LIKE BSAK-BELNR.
        CLEAR  WRK_BSAKBELNR.
        SELECT SINGLE BELNR INTO WRK_BSAKBELNR FROM BSAK
        WHERE AUGBL = IT_BKPF-BELNR
        AND   GJAHR = IT_BKPF-GJAHR
        AND BUKRS IN S_BUKRS.
    Advance
        IF WRK_BSAKBELNR IS INITIAL.
          IT_DATA-VBELNR = IT_BKPF-BELNR.
          IT_DATA-BELNR = IT_BKPF-BELNR.
          IT_DATA-GJAHR = IT_BKPF-GJAHR.
          IT_DATA-XBLNR = IT_BKPF-XBLNR.
          IT_DATA-BLDAT = IT_BKPF-BLDAT.
          IT_DATA-BLART = IT_BKPF-BLART.
          IT_DATA-ZUONR = IT_BKPF-ZUONR.
          IT_DATA-WRBTR = IT_BKPF-WRBTR.
          IT_DATA-WRBTRC = IT_DATA-WRBTR.
          APPEND IT_DATA.
          IT_DATA-VBELNR = IT_BKPF-BELNR.
          IT_DATA-BELNR = ' '.
          IT_DATA-GJAHR = ' '.
          IT_DATA-BLDAT = ' '.
          IT_DATA-BLART = ' '.
          IT_DATA-ZUONR = ' '.
    TDS
          DATA : WRK_TDSWRBTR LIKE BSIS-WRBTR.
          CLEAR  WRK_TDSWRBTR.
          SELECT SUM( WRBTR ) INTO WRK_TDSWRBTR FROM BSIS
          WHERE BELNR = IT_BKPF-BELNR
          AND   GJAHR = IT_BKPF-GJAHR
          AND BUKRS IN S_BUKRS
          AND   QSSKZ NE SPACE
          AND   QSSKZ NE 'XX'
          AND   XREF3 NE SPACE
          AND   QSSKZ NE 'S1'
          AND   QSSKZ NE 'S2'.
          IF WRK_TDSWRBTR IS INITIAL.
            SELECT SUM( WRBTR ) INTO WRK_TDSWRBTR FROM BSAS
            WHERE BELNR = IT_BKPF-BELNR
            AND   GJAHR = IT_BKPF-GJAHR
            AND   QSSKZ NE SPACE
            AND   QSSKZ NE 'XX'
            AND   XREF3 NE SPACE
            AND BUKRS IN S_BUKRS
            AND   QSSKZ NE 'S1'
            AND   QSSKZ NE 'S2'.
          ENDIF.
          DATA : WRK_BSCHL LIKE BSIS-BSCHL.
          CLEAR  WRK_BSCHL.
          IF NOT WRK_TDSWRBTR IS INITIAL.
            IT_DATA-XBLNR = 'TDS/ECess'.
            IT_DATA-WRBTR = WRK_TDSWRBTR.
            SELECT SINGLE BSCHL INTO WRK_BSCHL FROM BSIS
            WHERE BELNR = IT_BKPF-BELNR
            AND   GJAHR = IT_BKPF-GJAHR
            AND   QSSKZ NE SPACE
            AND BUKRS IN S_BUKRS
            AND   QSSKZ NE 'XX'
            AND   XREF3 NE SPACE
            AND   QSSKZ NE 'S1'
            AND   QSSKZ NE 'S2'
            AND   BSCHL = '40'.
            IF WRK_BSCHL IS INITIAL.
              SELECT SINGLE BSCHL INTO WRK_BSCHL FROM BSAS
              WHERE BELNR = IT_BKPF-BELNR
              AND   GJAHR = IT_BKPF-GJAHR
              AND   QSSKZ NE SPACE
              AND   QSSKZ NE 'XX'
              AND   XREF3 NE SPACE
              AND BUKRS IN S_BUKRS
              AND   QSSKZ NE 'S1'
              AND   QSSKZ NE 'S2'
              AND   BSCHL = '40'.
            ENDIF.
            IF WRK_BSCHL IS INITIAL.
              IT_DATA-WRBTR = IT_DATA-WRBTR * - 1.
            ENDIF.
            IT_DATA-WRBTRC = IT_DATA-WRBTR.
            APPEND IT_DATA.
          ENDIF.
          IT_DATA-VBELNR = IT_BKPF-BELNR.
          IT_DATA-BELNR = ' '.
          IT_DATA-GJAHR = ' '.
          IT_DATA-BLDAT = ' '.
          IT_DATA-BLART = ' '.
          IT_DATA-ZUONR = ' '.
    Discount
          DATA : WRK_DEDWRBTR LIKE BSIS-WRBTR.
          CLEAR  WRK_DEDWRBTR.
          SELECT SUM( WRBTR ) INTO WRK_DEDWRBTR FROM BSIS
          WHERE BELNR = IT_BKPF-BELNR
          AND   GJAHR = IT_BKPF-GJAHR
          AND   QSSKZ EQ SPACE
          AND BUKRS IN S_BUKRS
          AND   BSCHL NE '50'.
          IF NOT WRK_DEDWRBTR IS INITIAL.
            SELECT SUM( WRBTR ) INTO WRK_DEDWRBTR FROM BSAS
            WHERE BELNR = IT_BKPF-BELNR
            AND   GJAHR = IT_BKPF-GJAHR
            AND   QSSKZ EQ SPACE
            AND BUKRS IN S_BUKRS
            AND   BSCHL NE '50'.
          ENDIF.
          IF NOT WRK_DEDWRBTR IS INITIAL.
            IT_DATA-XBLNR = 'Discount'.
            IT_DATA-WRBTR = WRK_DEDWRBTR.
            IT_DATA-WRBTR = IT_DATA-WRBTR * - 1.
            IT_DATA-WRBTRC = IT_DATA-WRBTR.
            APPEND IT_DATA.
          ENDIF.
    Invoice
        ELSE.
          REFRESH IT_BELNR.
          CLEAR   IT_BELNR.
          DATA : W_YEAR(4),
                 W_MONTH(2) VALUE '04',
                 W_DATE(2) VALUE '01',
                 W_YEAR1(8).
          W_YEAR = S_GJAHR-LOW.
          CONCATENATE W_YEAR W_MONTH W_DATE INTO W_YEAR1.
          SELECT BELNR GJAHR XBLNR BLDAT BLART ZUONR WRBTR BSCHL INTO
          TABLE IT_BELNR FROM BSAK
          WHERE AUGBL = IT_BKPF-BELNR
                AND AUGDT GE W_YEAR1
              AND   GJAHR = IT_BKPF-GJAHR
                AND   BELNR NE IT_BKPF-BELNR
                AND BUKRS IN S_BUKRS.
          SORT IT_BELNR BY BELNR GJAHR.
          LOOP AT IT_BELNR.
            CLEAR  WRK_TDSWRBTR.
            SELECT SUM( WRBTR ) INTO WRK_TDSWRBTR FROM BSIS
            WHERE BELNR = IT_BELNR-BELNR
            AND   GJAHR = IT_BELNR-GJAHR
            AND   QSSKZ NE SPACE
            AND BUKRS IN S_BUKRS
            AND   QSSKZ NE 'XX'.
            IF WRK_TDSWRBTR IS INITIAL.
              SELECT SUM( WRBTR ) INTO WRK_TDSWRBTR FROM BSAS
              WHERE BELNR = IT_BELNR-BELNR
              AND   GJAHR = IT_BELNR-GJAHR
              AND   QSSKZ NE SPACE
              AND BUKRS IN S_BUKRS
              AND   QSSKZ NE 'XX'.
            ENDIF.
            IT_DATA-VBELNR = IT_BKPF-BELNR.
            IT_DATA-BELNR = IT_BELNR-BELNR.
            IT_DATA-GJAHR = IT_BELNR-GJAHR.
            IT_DATA-XBLNR = IT_BELNR-XBLNR.
            IT_DATA-BLDAT = IT_BELNR-BLDAT.
            IT_DATA-BLART = IT_BELNR-BLART.
            IT_DATA-ZUONR = IT_BELNR-ZUONR.
            IT_DATA-WRBTR = IT_BELNR-WRBTR + WRK_TDSWRBTR .
            IF IT_BELNR-BSCHL GE '31' AND IT_BELNR-BSCHL LE '39'.
              IT_DATA-WRBTRC = IT_DATA-WRBTR.
            ELSE.
              IF IT_BELNR-BSCHL GE '21' AND IT_BELNR-BSCHL LE '29'.
                IT_DATA-WRBTRC = IT_DATA-WRBTR * - 1.
              ENDIF.
            ENDIF.
            APPEND IT_DATA.
            IT_DATA-VBELNR = IT_BKPF-BELNR.
            IT_DATA-BELNR = ' '.
            IT_DATA-GJAHR = ' '.
            IT_DATA-BLDAT = ' '.
            IT_DATA-BLART = ' '.
            IT_DATA-ZUONR = ' '.
    TDSBELNR
            IF NOT WRK_TDSWRBTR IS INITIAL.
              IT_DATA-XBLNR = 'TDS/ECess'.
              IT_DATA-WRBTR = WRK_TDSWRBTR.
              CLEAR  WRK_BSCHL.
              IF NOT WRK_TDSWRBTR IS INITIAL.
                IT_DATA-XBLNR = 'TDS/ECess'.
                IT_DATA-WRBTR = WRK_TDSWRBTR.
                SELECT SINGLE BSCHL INTO WRK_BSCHL FROM BSIS
                WHERE BELNR = IT_BELNR-BELNR
                AND   GJAHR = IT_BELNR-GJAHR
                AND   QSSKZ NE SPACE
                AND   QSSKZ NE 'XX'
                AND   BSCHL = '40'.
                IF WRK_BSCHL IS INITIAL.
                  SELECT SINGLE BSCHL INTO WRK_BSCHL FROM BSAS
                  WHERE BELNR = IT_BELNR-BELNR
                  AND   GJAHR = IT_BELNR-GJAHR
                  AND   QSSKZ NE SPACE
                  AND   QSSKZ NE 'XX'
                  AND   BSCHL = '40'.
                ENDIF.
                IF WRK_BSCHL IS INITIAL.
                  IT_DATA-WRBTR = IT_DATA-WRBTR * - 1.
                ENDIF.
                IT_DATA-WRBTRC = IT_DATA-WRBTR.
                APPEND IT_DATA.
              ENDIF.
            ENDIF.
          ENDLOOP.
          IT_DATA-VBELNR = IT_BKPF-BELNR.
          IT_DATA-BELNR = ' '.
          IT_DATA-GJAHR = ' '.
          IT_DATA-BLDAT = ' '.
          IT_DATA-BLART = ' '.
          IT_DATA-ZUONR = ' '.
    TDSVBELNR
          CLEAR  WRK_TDSWRBTR.
          SELECT SUM( WRBTR ) INTO WRK_TDSWRBTR FROM BSIS
          WHERE BELNR = IT_BKPF-BELNR
          AND   GJAHR = IT_BKPF-GJAHR
          AND   QSSKZ NE SPACE
          AND BUKRS IN S_BUKRS
          AND   QSSKZ NE 'XX'
          AND   QSSKZ NE 'S1'
          AND   QSSKZ NE 'S2'.
          IF WRK_TDSWRBTR IS INITIAL.
            SELECT SUM( WRBTR ) INTO WRK_TDSWRBTR FROM BSAS
            WHERE BELNR = IT_BKPF-BELNR
            AND   GJAHR = IT_BKPF-GJAHR
            AND   QSSKZ NE SPACE
            AND   QSSKZ NE 'XX'
            AND   AUGBL = SPACE
            AND BUKRS IN S_BUKRS
            AND   QSSKZ NE 'S1'
            AND   QSSKZ NE 'S2'.
          ENDIF.
    **INSERTED BY PALANI ON 01.04.2006
          IF WRK_TDSWRBTR IS INITIAL.
            SELECT SUM( WRBTR ) INTO WRK_TDSWRBTR FROM BSIS
            WHERE BELNR = IT_BKPF-BELNR
            AND   GJAHR = IT_BKPF-GJAHR.
          ENDIF.
    ***END BY PALANI.
          IF NOT WRK_TDSWRBTR IS INITIAL.
            IT_DATA-XBLNR = 'TDS/ECess'.
            IT_DATA-WRBTR = WRK_TDSWRBTR.
            IT_DATA-WRBTR = IT_DATA-WRBTR * - 1.
            IT_DATA-WRBTRC = IT_DATA-WRBTR.
            APPEND IT_DATA.
          ENDIF.
          IT_DATA-VBELNR = IT_BKPF-BELNR.
          IT_DATA-BELNR = ' '.
          IT_DATA-GJAHR = ' '.
          IT_DATA-BLDAT = ' '.
          IT_DATA-BLART = ' '.
          IT_DATA-ZUONR = ' '.
    *DiscountVBELNR
          CLEAR  WRK_DEDWRBTR.
          SELECT SUM( WSKTO ) INTO WRK_DEDWRBTR FROM BSE_CLR
          WHERE BELNR_CLR = IT_BKPF-BELNR
          AND   GJAHR_CLR = IT_BKPF-GJAHR
          AND BUKRS IN S_BUKRS.
          IF NOT WRK_DEDWRBTR IS INITIAL.
            IT_DATA-XBLNR = 'Discount'.
            IT_DATA-WRBTR = WRK_DEDWRBTR.
            IT_DATA-WRBTR = IT_DATA-WRBTR * - 1.
            IT_DATA-WRBTRC = IT_DATA-WRBTR.
            APPEND IT_DATA.
          ENDIF.
        ENDIF.
      ENDLOOP.
    LOOP AT IT_BKPF.
      SELECT SINGLE BUTXT ORT01 LAND1 INTO (IT_DATA-BUTXT,IT_DATA-ORT01,IT_DATA-LAND1)
      FROM T001
      WHERE BUKRS IN S_BUKRS.
      MODIFY IT_DATA INDEX SY-TABIX.
    *ENDLOOP.
    ENDFORM.                    " select_data
    *&      Form  print_data
          text
    -->  p1        text
    <--  p2        text
    FORM PRINT_DATA .
      PERFORM OPEN_FORM.
      PERFORM WRITE_FORM.
      PERFORM CLOSE_FORM.
      LEAVE LIST-PROCESSING.
    ENDFORM.                    " print_data
    *&      Form  open_form
          text
    -->  p1        text
    <--  p2        text
    FORM OPEN_FORM .
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          FORM     = 'ZFI_PAY_ADV_MODN'
          LANGUAGE = SY-LANGU.
    ENDFORM.                    " open_form
    *&      Form  write_form
          text
    -->  p1        text
    <--  p2        text
    FORM WRITE_FORM .
      LOOP AT IT_BKPF.
        IF SY-TABIX GT 1.
          AT NEW BELNR.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                ELEMENT = 'NEW'
                WINDOW  = 'MAIN'.
          ENDAT.
        ENDIF.
        LOOP AT IT_DATA WHERE VBELNR = IT_BKPF-BELNR.
          DATA : BEGIN OF IT_HKONT OCCURS 0,
                   HKONT LIKE BSIS-HKONT,
                   WRBTR LIKE BSIS-WRBTR,
                 END OF IT_HKONT.
          REFRESH IT_HKONT.
          CLEAR   IT_HKONT.
          SELECT HKONT WRBTR INTO TABLE IT_HKONT FROM BSIS
          WHERE BELNR = IT_BKPF-BELNR
          AND   GJAHR = IT_BKPF-GJAHR.
          DELETE IT_HKONT WHERE HKONT(3) NE '005'.
          IF NOT IT_HKONT[] IS INITIAL.
            LOOP AT IT_HKONT.
              IT_DATA-TOTAL = IT_DATA-TOTAL + IT_HKONT-WRBTR.
              MODIFY IT_DATA.
            ENDLOOP.
          ELSE.
            IT_DATA-TOTAL = IT_DATA-TOTAL + IT_DATA-WRBTR.
            MODIFY IT_DATA.
          ENDIF.
        ENDLOOP.
        LOOP AT IT_DATA WHERE VBELNR = IT_BKPF-BELNR.
          IF IT_DATA-BLART EQ ''. " for invoice Date
            IT_DATA-BLDAT = IT_BKPF-BLDAT.
          ENDIF.
          IT_DATA-LIFNR = IT_BKPF-LIFNR.
          IT_DATA-KUNNR = IT_BKPF-KUNNR.
          IT_DATA-NAME1 = IT_BKPF-NAME1.
          IT_DATA-NAME2 = IT_BKPF-NAME2.
          IT_DATA-NAME3 = IT_BKPF-NAME3.
          IT_DATA-NAME4 = IT_BKPF-NAME4.
          IT_DATA-CITY1 = IT_BKPF-CITY1.
          IT_DATA-REGION = IT_BKPF-REGION.
          IT_DATA-COUNTRY = IT_BKPF-COUNTRY.
          IT_DATA-STREET = IT_BKPF-STREET.
          IT_DATA-LANDX = IT_BKPF-LANDX.
          IT_DATA-BEZEI = IT_BKPF-BEZEI.
          CLEAR : WRK_HBKID , WRK_BANKL.
          SELECT SINGLE CHECT ZALDT HBKID INTO
          (IT_DATA-CHECT , IT_DATA-ZALDT , WRK_HBKID)
          FROM PAYR
          WHERE VBLNR = IT_BKPF-BELNR
          AND   GJAHR = IT_BKPF-GJAHR
          AND   VOIDR = '00'.
          SELECT SINGLE BANKL INTO WRK_BANKL
          FROM T012
          WHERE HBKID = WRK_HBKID.
         AND spras EQ 'EN'.
          SELECT SINGLE BANKA INTO IT_DATA-BANKA
          FROM BNKA
          WHERE BANKL = WRK_BANKL.
          MODIFY IT_DATA.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              ELEMENT = 'ITEMS'
              WINDOW  = 'MAIN'.
        ENDLOOP.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            ELEMENT = 'TOTAL'
            WINDOW  = 'MAIN'.
      ENDLOOP.
    ENDFORM.                    " write_form
    *&      Form  close_form
          text
    -->  p1        text
    <--  p2        text
    FORM CLOSE_FORM .
      CALL FUNCTION 'CLOSE_FORM' .
    ENDFORM.                    " close_form

    Hi
    Could you tell us what fields are not updated?
    Regards,
    Raj

  • Serial Number not updating in the system

    Hi Frnds
    My client is in to retail and has most of the materials under variant configuration. The materials are sold with serial numbers so that they can be tracked and returns/maintenance can be accounted for. The customer is also given discount if he buys that material again using the serial number as reference and the dependency written for that material updates the old purchase qty(old factor) when new purchase qty(new factor) is added to it.
    Since the serial number can only be referenced once the goods has been posted and billing has been done. The factors get updated in the system, the factors were updating correctly for the past 2+yrs but since the last couple of months the updating of serial number old factor is screwed. It is not updating for some serial numbers.
    Any bright ideas what may be the issue. I have searched every nook and corner but could not trace the cause. Is it possible that a particular serial number can update for a certain number or memory or something???

    Sorry, but the problem is not solved: it shows the same, 10 numbers and three points.
    Seeing the espana2004 message, maybe it is related to the use of a proportional font? All the characters in my Pre's serial number are wide.
    This number is needed to download WebOS Doctor. I've had to put my phone in developer mode, connect through novaterm and do a 'lunaprop com.palm.properties.PalmSN' in order to obtain the number. Is there an easier way to get it?
    Regards.

  • Data is not updating in the tables

    Hi all,
    I am facing a problem while creating customer and material, after creating and saving the customer and material, if i am going in the change mode, then system is giving awkward message;
    "The material '##' is not been created yet or it has not been activated ",
    in case of customer also it is giving the same error, saying "the customer '#######' is not been created yet"
    please help me solving this problem, as i am not able to understand why this is happening.
    Thanks
    Edited by: saur06_80 on Jul 1, 2010 12:34 PM

    Check your workplace, use TCODE SBWP.
    If SAP fails to store the newly created material/cusrtomer in the database, then the user usually receives an exception message (which is so cryptic that noone understands this mail and just ignores it). This message is just telling you that there was a posting failure. You can then analyze the reason for the failure in SM13.
    Hope this can assist you.
    Thanks & Regards
    JP

  • Rows are not updating  in the table..

    I have a 2 EO objects and VO query which gets the data from 2 tables, now when i try to save a new row only primary key gets saved, can any one give me the solution for this

    Also just check if you query contains external join of EOs, in that case you may get into issues!
    --Mukul                                                                                                                                                                                                                                                   

  • PO no is not updateing in MSEG table for transfer posting wrt PO

    Hi All ,
    PO number not updateing  in MSEG table field EBELN for transfer posting with reference to PO . What should be the reason . This is for subcontracting process .

    Hi Raghavendra Balegar
    If u r doing through scheduling agreement then it will not sit in MSEG. only if u doing through standard PO i.e. NB then only u can view the data of PO in MSEG.
    Regards
    Ram

  • Reference field is not updating in VBAK table

    Hi Experts,
    I am using SD_SALESDOCUMENT_CREATE bapi for Credit Memo Creation .
    but the field XBLNR is not updating in the table vbak.
    Kindly help me to sort out this issue.
    Thanks in advance.
    In which field i should pass the value to update in the table vbak.
    Regards,
    Ajay.
    Edited by: srinivasan12345 on Nov 14, 2011 9:21 AM

    Hi,
    follow this,may help u..
    Re: Credit Memo Creation
    thanks & regards.

  • TDS amount not getting updated in the table under the field QBSHB

    Dear Friends,
    The TDS amount entered while booking the vendor invoices through MIRO T-cde, is not getting updated in the table BSEG under the field QBSHB. 
    Kindly let me know the reason for the same and guide me to correct it
    TIA.
    Regards,
    Vincent

    HI Vincent,
    Bseg-QBSHB field is relavent for classic WT.
    I hope you are using the EWT.
    Hence if you post a document through MIRO it will not update
    (but if you post document FB60 it will update but wrongly).
    Reason is Miro document is posted through interface.
    Hence SAP is suggested to not refer the Bseg-QBSHB and etc., fields.
    refer only with_item table.
    Please refer the below replay from SAP
       Please refer the below note .363309
    Please review attached note 363309 for detailed explanation
    BSEG-QBSHB is designed to fill for the classic withholding tax. And
    extended withholding tax information is stored exclusive in table
    WITH_ITEM.
    You can check in table BSEG for the fields and will find that system
    do NOT update field BSEG-QBSHB.
    In your line layout,you define a field BSEG-QBSHB. But actully the field
    of vendor/customer line item is filled with zero from FI. Thus,it shows
    zero in line item display.
    And as note 363309 says,
    "Remove the field which contains the withholding tax information
    from your display variant.
    If you want to display the withholding tax information, double-click on
    the document number and subsequently choose 'Withholding tax' button."
    (BSEG-QSSKZ, BSEG-QSSHB, BSEG-QBSHB) field is not relavent for
    Extended withholding tax and not suppose to use in report FBL1N.
    It basically does not make any sense to use the withholding tax fields
    of the document line items (BSEG-QSSKZ, BSEG-QSSHB, BSEG-QBSHB) with the
    activated extended withholding tax.
    regards
    Madhu M
    Edited by: M Madhu on Jan 31, 2011 1:19 PM

  • The currency is not getting updated in the table VBAP

    Hi ,
    The currency is not getting updated in the table VBAP. The currency was suppossed to be copied from the header table VBAK for a Sales Order. When the user creating a Sales Order the currency WAERK is not shown in VBAP table. VBAK-WAERk is in EUR . Does anyone know why is this happenning?
    Currency is maintained in the Customer Master, Material Master and Sales Org. Any suggestions?.
    Also it is happened for only one line item in a set of line items , Other line items did display the currency field.
    The net Value has data in it .
    The system is ECC 5.0
    Regards,
    Senthil

    Dear Senthil,
    Please apply the following notes (if they apply to your support pack level) and retest:
    1460621 VBAP-WAERK is deleted after the sold-to party is changed
    1426441 VBAP-WAERK deleted for subitems
    1493998 VBAP-WAERK deleted for subitems
    This should resolve the issue. I hope this helps.
    Best regards,
    Ian Kehoe

  • Automatic payment program (F110) document are not update in PAYR table

    Hi all,
    I have make payment in F110 (automatic payment) to customer 
    But it is not update in PAYR table
    Please guide me what I have to do for documents update in PAYR table
    Thanks and Regards,
    Prudhvi

    Hi,
    It is possible to enter multiple documents.
    You can enter a list of single documents or in intervals.
    Enter the document number in ascending order.
    Ex:
    Individual documents.
    10001,10003,10011
    If the documents are in a sequence you can enter the Interval like this
    (10001,10011)
    Hope it helps you
    Regards
    Andrew
    Edited by: Andrew J on May 28, 2009 4:26 PM

  • Equipment not updated in all tables properly

    Hi Friends
    Equipment was updated in EQUI table with limited data only and not updated in other tables EQKT, EQUZ. When I go through the IE03, there I am unable to find the equipment. Material and serial number provides the equipment, I know it, but if we check it in IQ02 for the serial number with the material, I was unable to see the equipment details those are sales and distribution tab and some tabs not updated and equipment not activated. When I tried to activate the equipment in IQ02, system allows saving the document. When I am coming back, system is giving the update termination error. I think at the time of creating user might have done some mistake, but I am unable to find it
    Could you please let me know the reason and possible solution?
    Thanks in advance
    Ravi

    hi
    After creating the equipment in IE01 ,you are not able to change in IE02 or display the same in IE03, then kindly check with your basis team for your update termination error
    regards
    thyagarajan

  • Excise Base amount not updated in J_1iexcdtl table -reg

    Dear Gurus,
    We have used SAP Ecc 5.0 Patch level 21. In patch level 20, SAP admit without delivery , can do commercial billing and excise billing in foreground. After batch update SAP not support excise invoice creation in foreground. It support only background. We have 2 senario. 1 is capex sales . ie. without material stock we have raise the comm.billing and excise billing. 2 is supplimentary billing. both the senario now getting effected because of no delivery. Asper SAP advise we have setting for background process excise invoice creation. Excise invoice created. but excise base amount not updated in j_1iexcdtl table. Using J_1I7_USEREXIT_CALC_EXC_BASE user exit we are trying to update the same. For single material it works fine. But more than one material for the first material's base amount is updated in all materials. for your reference i have mentioned the codding . SAP advise it is possible to update excise base amount. But not possible to do. pl.adivse if any correct or guide to solve it.
    FUNCTION J_1I7_USEREXIT_CALC_EXC_BASE.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(EXCITM_BASE) TYPE  KOMV-KAWRT
    *"     VALUE(POSNR) TYPE  VBRP-POSNR
    *"  EXPORTING
    *"     VALUE(EXCITM_BASE) TYPE  KOMV-KAWRT
    *"  TABLES
    *"      KONV STRUCTURE  KONV
    *{   INSERT         RDSK925285                                        1
    TABLES : KONV.
    data :   W_INDEX LIKE SY-TABIX.
    DATA :ITAB LIKE TABLE OF KONV WITH HEADER LINE.
    DATA :ITAB1 LIKE TABLE OF KOmV WITH HEADER LINE.
    ITAB1[] = KONV[].
    DATA : BEGIN OF I_TAB OCCURS 0,
           KAWRT LIKE KONV-KAWRT,
           POSNR LIKE VBRP-POSNR,
           END OF I_TAB.
    LOOP AT ITAB1.
    READ TABLE ITAB1 WITH KEY KSCHL = 'JMOD' KPOSN = ITAB1-KPOSN.
    IF SY-SUBRC EQ 0.
        EXCITM_BASE = ITAB1-KAWRT.
        POSNR = ITAB1-KPOSN.
    ENDIF.
    ENDLOOP.
    *}   INSERT
    ENDFUNCTION.
    Thanks & Regards
    R.Udayakumar

    solved with the same user exit

  • Record not inserting into the table through Forms 10g

    Hi all,
    I have created a form in 10g(10.1.2.0.2) based on just one table that has 4 columns(col1, col2, col3, col4).
    Here col1, col2 and col3 are VARCHAR2 and col4 is date and all the columns are not null columns(There are no primary and foriegn key constrains, which means duplicates are allowed).
    My form contains 2 blocks where block 1 has one text item (col1) and 3 buttons (Delete, Save, Exit).
    And block2 is a database block and has col2,col3,col4 which are in tabluar layout frame displaying 10 records.
    When the form is opened the cursor has to be in block1.col1 for querrying. Here i enter a value in col1, and then when I click on col2 in the block2, then I put execute_query in new_block_instance of block2, which displays the records.
    The block2 properties are not updatable, insertable and query is allowed.
    Everything is working good until here. But here in the block2 when I want to insert another record into the table, by navigating all the way down to the last empty record and entering the new values for col2, col3 and col4 And then Ctrl+S will display the message "*FRM-40400: Transaction complete: 1 record applied and saved.*" But actually the record is not inserted into the table.
    I also disabled the col4 by setting the Enabled property to No, since while inserting new record the date have to be populated into it and it shouldnt be changed by the user. And im populating the sysdate into the new record by setting Intial Value property to *$$DATE$$*.
    And another requirement which I could not work arround here is that, the col3 also should be populated with the username of the user while inserting.
    please help me...

    Hi Sarah,
    I do not want to update the existing record. So I kept Udate Allowed to No in property palette for the items in block2.
    Do I have to do this property at block level also?
    I'm inserting a new record here.
    Edited by: Charan on Sep 19, 2011 8:48 AM

Maybe you are looking for

  • Report Script

    I have a substitution variable in report script for current week. Trying to add two more columns with the two prior weeks. Is there a command for that?

  • "Item 10     IPC:TTE:Calculation error: Pricing error: Mandatory condition & is

    Hello Experts, I need your help to solve this TTE pricing error. In Service Order, I am getting this error message for one particular material only "Item 10     IPC:TTE:Calculation error: Pricing error: Mandatory condition & is missing". Remaining ma

  • Dme file not created - france rffof__v rffof_v

    Hello all, when executing a payment through F110 (program RFFOF__V for France) the DME file is generated with no apparent error message in the payment run log. Is there any additional customizing necessary for France that is not needed in Germany or

  • Derelease of Purchase order in case of reducing the value

    Hi Friends, When ever we increase the value in Purchase Order it will derelease. But we want to derelease the Purchase Orders if we reduce the value also. Can we do this with any user exit or BADI. We also want to have if any changes happen in pertic

  • How to calculate the partition size in range partition,by value

    hi all, The primary key is number for the table. I have 5543201 records in a table. If I want to break them in 7 equal partition as per the primary key,how do i achieve this? rgds s