Updating a Customised table

Hi Experts,
I am working on a requirement where if i update the records in a table it will refelct in the other table..hence i need to dispaly a message whenever a record is updated stating the same.
For this i m using a method.
Now here are my querries.
In the final table the user clicks on each record and tries to update he shud not be able to update the record if the date field is not zero which i m a doing.
but as a whole when the screen is appearing user is able to change teh values and save it.
so please suggest and help me.
These all i m doing in sm30.
Thanks,
Varun.

In SM30 give the table name u updating... once u get in go to the screen-- flow logic-- PBO.. write ur logic .

Similar Messages

  • Entries in customised table

    Hi,
       I created a customised table,in that user will enter H(hold)in a particular field.he will take the printout using the prog which i created and he will check whether the details are correct and if correct then they wants to change all the H to S.
       Here i dont know how to change all H to S .not that manually the user will go and change all the H to S.it should be automatically all H should change to S.
       Pls help me to solve the problem and give me in details would be more usefull for me.
    Thanks,
    Raj.

    > Hi Rajendra
    >
    Hi Eswar,
       Even i put in end of the prog but it is not fetching the data.pls check help to solve the issue.
       below is the coding i used and i wants to use the code in   Form  1200_INPUT.
    Database tables
    TABLES : Z2006TMMAMEND.        "Amendment Notice Master Data
    Internal tables
    DATA : BEGIN OF ITAB OCCURS 0,
                  ZMATNR  LIKE Z2006TMMAMEND-ZMATNR,
                  ZMAKTX  LIKE Z2006TMMAMEND-ZMAKTX,
                  ZAMEND  LIKE Z2006TMMAMEND-ZAMEND,
                  ZMATKL  LIKE Z2006TMMAMEND-ZMATKL,
                  ZCHARG  LIKE Z2006TMMAMEND-ZCHARG,
                  ZWEEKS  LIKE Z2006TMMAMEND-ZWEEKS,
                  ZDATES  LIKE Z2006TMMAMEND-ZDATES,
                  ZSTATUS LIKE Z2006TMMAMEND-ZSTATUS,
           END OF ITAB.
    ******TO GET THE LAST AMENDMENT NO
    DATA : BEGIN OF ITABLAST OCCURS 0,
                 ZMATNR  LIKE Z2006TMMAMEND-ZMATNR,
                 ZMAKTX  LIKE Z2006TMMAMEND-ZMAKTX,
                 ZAMEND  LIKE Z2006TMMAMEND-ZAMEND,
                 ZMATKL  LIKE Z2006TMMAMEND-ZMATKL,
                 ZCHARG  LIKE Z2006TMMAMEND-ZCHARG,
                 ZWEEKS  LIKE Z2006TMMAMEND-ZWEEKS,
                 ZDATES  LIKE Z2006TMMAMEND-ZDATES,
                 ZSTATUS LIKE Z2006TMMAMEND-ZSTATUS,
           END OF ITABLAST.
    ******FOR INPUT AMENDMENT NOTICES LISTING FOR YEAR WEEK NO***********.
    DATA : BEGIN OF ITAB_H OCCURS 0,
                 ZMATNR  LIKE Z2006TMMAMEND-ZMATNR,
                 ZMAKTX  LIKE Z2006TMMAMEND-ZMAKTX,
                 ZAMEND  LIKE Z2006TMMAMEND-ZAMEND,
                 ZMATKL  LIKE Z2006TMMAMEND-ZMATKL,
                 ZCHARG  LIKE Z2006TMMAMEND-ZCHARG,
                 ZWEEKS  LIKE Z2006TMMAMEND-ZWEEKS,
                 ZDATES  LIKE Z2006TMMAMEND-ZDATES,
                 ZSTATUS LIKE Z2006TMMAMEND-ZSTATUS,
                 ZAMENDL LIKE Z2006TMMAMEND-ZAMEND,
           END OF ITAB_H.
    ******FOR  AMENDMENT NOTICES UPDATE LIST***********
    DATA : BEGIN OF ITAB_S OCCURS 0,
                  ZMATNR  LIKE Z2006TMMAMEND-ZMATNR,
                  ZMAKTX  LIKE Z2006TMMAMEND-ZMAKTX,
                  ZAMEND  LIKE Z2006TMMAMEND-ZAMEND,
                  ZMATKL  LIKE Z2006TMMAMEND-ZMATKL,
                  ZCHARG  LIKE Z2006TMMAMEND-ZCHARG,
                  ZWEEKS  LIKE Z2006TMMAMEND-ZWEEKS,
                  ZDATES  LIKE Z2006TMMAMEND-ZDATES,
                  ZSTATUS LIKE Z2006TMMAMEND-ZSTATUS,
                  ZAMENDL LIKE Z2006TMMAMEND-ZAMEND,
                  ZAMENDR LIKE Z2006TMMAMEND-ZAMEND,
            END OF ITAB_S.
    DATA :I_ITABLAST LIKE ITABLAST OCCURS 0 WITH HEADER LINE.
    DATA: WA         LIKE ITAB.
    DATA: WA1        LIKE ITAB_H.
    DATA: WA2        LIKE ITAB_S.
    DATA: V_INT      TYPE INT4.
    DATA: W_ZMATKL   LIKE Z2006TMMAMEND-ZMATKL.
    DATA: W_ZWEEKS   LIKE Z2006TMMAMEND-ZWEEKS.
    DATA: L_TABIX    LIKE SY-TABIX.
    *SELECTION-SCREEN
    selection-screen begin of block mysel with frame title text-001.
    SELECT-OPTIONS : S_ZMATNR FOR Z2006TMMAMEND-ZMATNR,
                     S_ZWEEKS FOR Z2006TMMAMEND-ZWEEKS,
                     S_ZCHARG FOR Z2006TMMAMEND-ZCHARG,
                     S_ZAMEND FOR Z2006TMMAMEND-ZAMEND,
                     S_ZDATES FOR Z2006TMMAMEND-ZDATES.
    selection-screen end of block mysel.
    selection-screen begin of block mysel1 with frame title text-002.
    PARAMETERS: C1 RADIOBUTTON GROUP R1,
                C2 RADIOBUTTON GROUP R1,
                C3 RADIOBUTTON GROUP R1,
                C4 RADIOBUTTON GROUP R1.
    selection-screen end of block mysel1.
    *selection-screen begin of block mysel2 with frame title text-003.
    *SELECTION-SCREEN PUSHBUTTON /79(10) charly USER-COMMAND CONF.
    *selection-screen end of block mysel2.
    *INITIALIZATION.
    MOVE 'CONF' TO charly.
    START-OF-SELECTION
    START-OF-SELECTION.
      IF C1 = 'X'.
        PERFORM 1100_DELETE.
      ELSEIF C2 = 'X'.
        PERFORM 1200_INPUT.
      ELSEIF C3 = 'X'.
        PERFORM 1300_UPDATE.
    ELSEIF C4 = 'X'.
        PERFORM 1400_PRINT.
      ENDIF.
    *END-OF-SELECTION.
    TOP-OF-PAGE
    top-of-page.
    *& Form TOP_OF_PAGE
    text
    ******FOR LIST OF DELETED AMENDMENT NOTICES***********
    FORM TOP_OF_PAGEC1.
      SKIP.
      WRITE:/51 'MOTION SMITH CHART',  100 'Page :', 110 sy-pagno.
      SKIP.
      WRITE:/43 'LIST OF DELETED AMENDMENT NOTICES' ,100 'Date :', 110 sy-datum.
      SKIP.
    ENDFORM.                               "TOP_OF_PAGEC1
    ******FOR INPUT AMENDMENT NOTICES LISTING FOR YESR WEEK NO***********
    FORM TOP_OF_PAGEC2.
      SKIP.
      WRITE:/51 'MOTION SMITH CHART',  100 'Page :', 110 sy-pagno.
      SKIP.
      WRITE:/43 'INPUT AMENDMENT NOTICES LISTING' ,100 'Date :', 110 sy-datum.
      SKIP.
    endform.                               "TOP_OF_PAGEC2
    ******FOR  AMENDMENT NOTICES UPDATE LIST***********
    FORM TOP_OF_PAGEC3.
      SKIP.
      WRITE:/51 'MOTION SMITH CHART',  100 'Page :', 110 sy-pagno.
      SKIP.
      WRITE:/43 'AMENDMENT NOTICE UPDATE LIST' ,100 'Date :', 110 sy-datum.
      SKIP.
    endform.                               "TOP_OF_PAGEC3
    ******FOR PRINT AMENDMENT LIST***********
    FORM TOP_OF_PAGEC4.
      SKIP.
      WRITE:/51 'MOTION SMITH  AMENDMENT  LIST', 100 'Date :', 110 sy-datum, 140 'Page :', 150 sy-pagno.
      SKIP.
    endform.                               "TOP_OF_PAGEC4
    *&      Form  1100_DELETE
          text
    -->  p1        text
    <--  p2        text
    FORM 1100_DELETE .
      NEW-PAGE.
      ULINE.
      PERFORM TOP_OF_PAGEC1.
      SELECT SINGLE ZMATKL INTO W_ZMATKL FROM Z2006TMMAMEND WHERE ZMATNR IN S_ZMATNR.
      WRITE:/ 'AGENCY CODE:', W_ZMATKL.
      SKIP.
      ULINE.
      SKIP.
      WRITE:/ 'CHART/PUBLICATION', 30 'DESCRIPTION', 61 '************* A  M  E  N  D  M  E  N  T  S *************'.
      SKIP.
      ULINE.
      SELECT * FROM  Z2006TMMAMEND INTO CORRESPONDING FIELDS OF TABLE ITAB
                                        WHERE ZMATNR IN S_ZMATNR
                                          AND ZWEEKS IN S_ZWEEKS
                                          AND ZCHARG IN S_ZCHARG
                                          AND ZAMEND IN S_ZAMEND
                                          AND ZDATES IN S_ZDATES
                                          AND ZSTATUS EQ 'D'.
      SORT ITAB BY ZMATNR.
      LOOP AT ITAB.
        WA = ITAB.
        AT NEW ZMATNR.
          V_INT = 1.
          WRITE:/ WA-ZMATNR(18), WA-ZMAKTX(40).
        ENDAT.
        IF V_INT >= 1 AND V_INT < 6.
          WRITE: WA-ZAMEND(11).
        ELSE.
          WRITE: /61 WA-ZAMEND(11).
          V_INT = 1.
        ENDIF.
        V_INT = V_INT + 1.
      ENDLOOP.
    ENDFORM.                    " 1100_DELETE
    *&      Form  1200_INPUT
          text
    -->  p1        text
    <--  p2        text
    FORM 1200_INPUT .
      NEW-PAGE.
      ULINE.
    SET PF-STATUS 'Z2006RMMAMEND'.
    AT USER-COMMAND .
    AT SELECTION-SCREEN.
      IF SY-UCOMM = 'CONF'.
          UPDATE Z2006TMMAMEND SET ZSTATUS = 'S'
                             WHERE ZSTATUS = 'H'.
      ENDIF.
      PERFORM TOP_OF_PAGEC2.
      SELECT SINGLE ZWEEKS INTO W_ZWEEKS FROM Z2006TMMAMEND WHERE ZWEEKS IN S_ZWEEKS.
      WRITE:/43 'FOR YEAR WEEK N0 :', W_ZWEEKS.
      SKIP.
      ULINE.
      SKIP.
      WRITE:/ 'AGENCYCODE', 15 'CHART NO', 30 'DESCRIPTION', 61 'YR/WK', 70 'LAST FAMD', 85 'LAMEND', 100 'AMENDMENT'.
      SKIP.
      ULINE.
    **********TO GET THE INPUT AMENDMENT NOTICE LISTING FOR YEAR WEEK.
      SELECT * FROM  Z2006TMMAMEND INTO CORRESPONDING FIELDS OF TABLE ITAB
                                        WHERE ZMATNR IN S_ZMATNR
                                          AND ZWEEKS IN S_ZWEEKS
                                          AND ZCHARG IN S_ZCHARG
                                          AND ZAMEND IN S_ZAMEND
                                          AND ZDATES IN S_ZDATES
                                          AND ZSTATUS EQ 'H'.
    ***********TO GET THE LAST AMENDMENT NO.
      SELECT * FROM Z2006TMMAMEND INTO CORRESPONDING FIELDS OF TABLE ITABLAST
                                         WHERE ZMATNR  IN S_ZMATNR
                                           AND ZWEEKS  IN S_ZWEEKS
                                           AND ZSTATUS EQ 'S'.
      SORT ITABLAST DESCENDING BY ZWEEKS.
      LOOP AT ITAB.
        CLEAR ITABLAST.
        LOOP AT ITABLAST WHERE ZMATNR = ITAB-ZMATNR.
          EXIT.
        ENDLOOP.
        IF SY-SUBRC EQ 0.
          MOVE ITAB-ZMATKL TO ITAB_H-ZMATKL.
          MOVE ITAB-ZMATNR TO ITAB_H-ZMATNR.
          MOVE ITAB-ZMAKTX TO ITAB_H-ZMAKTX.
          MOVE ITAB-ZWEEKS TO ITAB_H-ZWEEKS.
          MOVE ITAB-ZAMEND TO ITAB_H-ZAMEND.
          READ TABLE ITABLAST WITH KEY ZMATNR = ITAB-ZMATNR.
          MOVE ITABLAST-ZAMEND TO ITAB_H-ZAMENDL.
          APPEND ITAB_H.
          CLEAR ITAB_H.
        ENDIF.
      ENDLOOP.
       SORT ITAB_H BY ZMATNR.
      LOOP AT ITAB_H.
        WA1 = ITAB_H.
        AT NEW ZMATNR.
          V_INT = 1.
          WRITE:/ WA1-ZMATKL(9),15 WA1-ZMATNR(18),30 WA1-ZMAKTX(40), 61 WA1-ZWEEKS(6),85 WA1-ZAMENDL.
        ENDAT.
        IF V_INT >= 1 AND V_INT < 3.
          WRITE: WA1-ZAMEND(11).
        ELSE.
          WRITE: /100 WA1-ZAMEND(11).
          V_INT = 1.
        ENDIF.
        V_INT = V_INT + 1.
      ENDLOOP.
    ENDFORM.                    " 1200_INPUT
    *&      Form  1300_UPDATE
          text
    -->  p1        text
    <--  p2        text
    FORM 1300_UPDATE .
      NEW-PAGE.
      ULINE.
      PERFORM TOP_OF_PAGEC3.
      SKIP.
      ULINE.
      SKIP.
      WRITE:/ 'CHART/PUBLICATION', 30 'DESCRIPTION', 61 'AMENDMENT NO', 81 'AMENDMENT DATE', 100 'LAST AMENDMENT'.
      SKIP.
      ULINE.
      SELECT * FROM  Z2006TMMAMEND INTO CORRESPONDING FIELDS OF TABLE ITAB
                                        WHERE ZMATNR  IN S_ZMATNR
                                          AND ZWEEKS  IN S_ZWEEKS
                                          AND ZCHARG  IN S_ZCHARG
                                          AND ZAMEND  IN S_ZAMEND
                                          AND ZDATES  IN S_ZDATES
                                          AND ZSTATUS EQ 'S'.
        sort itab by zmatnr ZCHARG descending.
      loop at itab.
        l_tabix = sy-tabix.
        at new zmatnr.
          read table itab  index l_tabix.
          MOVE ITAB-ZMATKL TO ITAB_S-ZMATKL.
          MOVE ITAB-ZMATNR TO ITAB_S-ZMATNR.
          MOVE ITAB-ZMAKTX TO ITAB_S-ZMAKTX.
          MOVE ITAB-ZAMEND TO ITAB_S-ZAMEND.
          MOVE ITAB-ZWEEKS TO ITAB_S-ZWEEKS.
          MOVE ITAB-ZAMEND TO ITAB_S-ZAMENDR.
          l_tabix = l_tabix + 1.
          read table itab index l_tabix.
          MOVE ITAB-ZAMEND TO ITAB_S-ZAMENDL.
          APPEND ITAB_S.
          CLEAR  ITAB_S.
        ENDAT.
      ENDLOOP.
      LOOP AT ITAB_S.
        WA2 = ITAB_S.
        AT NEW ZMATNR.
          V_INT = 1.
          WRITE:/ WA2-ZMATKL,9'-',13 WA2-ZMATNR,27 WA2-ZMAKTX(40),63 WA2-ZAMENDR(15),83 WA2-ZWEEKS(6),103 WA2-ZAMENDL(15).
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " 1300_UPDATE
    *&      Form  1400_PRINT
          text
    -->  p1        text
    <--  p2        text
    FORM 1400_PRINT .
      NEW-PAGE.
      ULINE.
      PERFORM TOP_OF_PAGEC4.
      SELECT SINGLE ZMATKL INTO W_ZMATKL FROM Z2006TMMAMEND WHERE ZMATNR IN S_ZMATNR.
      WRITE:/ 'AGENCY CODE:', W_ZMATKL.
      SKIP.
      ULINE.
      SKIP.
      WRITE:/ 'CHART NUMBER', 20 'EDITION DATE', 45 'DESCRIPTION', 75 '************* A  M  E  N  D  M  E  N  T  S *************'.
      SKIP.
      ULINE.
      SELECT * FROM  Z2006TMMAMEND INTO CORRESPONDING FIELDS OF TABLE ITAB
                                        WHERE ZMATNR IN S_ZMATNR
                                          AND ZWEEKS IN S_ZWEEKS
                                          AND ZCHARG IN S_ZCHARG
                                          AND ZAMEND IN S_ZAMEND
                                          AND ZDATES IN S_ZDATES.
      SORT ITAB BY ZMATNR.
      LOOP AT ITAB.
        WA = ITAB.
        AT NEW ZMATNR.
          V_INT = 1.
          WRITE:/  WA-ZMATNR(18),20 wa-zcharg(10),35 WA-ZMAKTX(40).
        ENDAT.
        IF V_INT >= 1 AND V_INT < 6.
          WRITE: WA-ZAMEND(12).
        ELSE.
          WRITE: /76 WA-ZAMEND(12).
          V_INT = 1.
        ENDIF.
        V_INT = V_INT + 1.
      ENDLOOP.
    ENDFORM.                    " 1400_PRINT
    ***********TO UPDATE THE CUSTOMISED TABLE WHEN USER PRESS THE CONF BUTTON
    AT USER-COMMAND .
    *AT SELECTION-SCREEN.
      IF SY-UCOMM = 'CONF'.
          UPDATE Z2006TMMAMEND SET ZSTATUS = 'S'
                             WHERE ZSTATUS = 'H'.
      ENDIF.

  • Load the data from a transparent customised table in BW to an ODS

    Hi there,
    How can you load the data from a transparent customised table created in BW to an ODS.
    Many thanks.
    Sarah

    Hi,
    just create a generic datasource in rso2 for that table, replicate the datasource for source system 'myself', create a infosource and assign the new datasource to that infosource. Create a update rule from infosource to ods, create a infopackage and load the data.
    regards
    Siggi

  • Problem with delta update on customised export data source.

    Hi all BW gurus,
    I have created several customised export data sources in the R/3 system. And I have made use of the utility program <Z_CHANGE_DELTA_PROCESS> to update the ROOSOURCE table.
    While this can result in being able to do initial update (instead of full update), the subsuquent delta update is not working.
    In RSA7, the datasource is with green light and in RSA3, the extractor can extractor data out of it.
    Does anybody have some idea on this?
    I heard that there is a way to change the Business Transaction Event (BTE), but I don't quite understand how this is performed. And wonder if this is the only way out. To me, the triggering point would be the same, meaning the InfoPackage would be executed, then call the extractors in R/3 to extract the delta update in order to load into the InfoCube.
    And how do others do for executing delta update of the customised data source?
    Thanks a lot!!
    The utility program of <Z_CHANGE_DELTA_PROCESS>:
    =================================================
    report z_change_delta_process .
    *P_DATAS DataSource
    *P_DELTAP Delta Process for DataSource
    parameters:
      p_datas type roosource-oltpsource,
      p_deltap type roosource-delta.
    tables:
      roosource.
    data:
      ls_roosource type roosource.
      if p_datas(2) ne 'Z_'.
       message 'The DataSource needs to begin with ''Z_''.'  type 'E'.
      endif.
    select single * from roosource into ls_roosource
           where oltpsource = p_datas
           and objvers = 'A'.
    if sy-subrc eq 0.
       ls_roosource-delta = p_deltap.
       update roosource from ls_roosource.
    message 'The DataSource has been updated successfully.' type 'I'.
    else.
       message 'The DataSource entered is not valid, try again.' type 'E'.
    endif.

    Doesn't anyone have any idea on this topic?
    Appreciate for all the help. Thanks.

  • Customising table

    What is a customising table?

    Hi kartik,
    Customizing Tables
    Definition
    Customizing data is data created by customers when they customize their systems.
    The Customizing data in a customer client is not overwritten by a language import or an upgrade. Data is only imported into client 000. This is because Customizing data is the responsibility of the customer and cannot be overwritten by data from SAP. This also applies, without restrictions, to translations. However, customers may occasionally want to update their sample data and default settings with the latest translations from SAP.
    Only copy the clients from client 000 after all the required languages have been imported into client 000.
    You have the following options for updating a translation language for the Customizing settings of an existing customer client:
           1.      Using tools
           2.      Manual translation
    Using Tools
    As of Basis Release 3.1H, SAP provides the following tools for updating Customizing texts in clients other than 000:
    ·        Report RSREFILL
    The report RSREFILL compares the Customizing texts in the logon client with the SAP proposals in a reference language in client 000. If these texts are identical, their translations in the target language are copied from client 000 to the logon client. Data is inserted only; no existing data is overwritten.
    For more information on RSREFILL, see the documentation on the report, and SAP Note 48047.
    ·        Client maintenance with transaction SMLT
    This function works in the same way as the report RSREFILL, but does not make a comparison with a reference language. This means that more texts can be copied from client 000 to the target client.
    As with RSREFILL, Customizing data is inserted. No data is deleted or overwritten.
    You call RSREFILL as a report. You start the client maintenance function in transaction SMLT by choosing Language ® Special Actions ® Client Maintenance.
    SAP recommends that you use the language supplementation program, which now integrates the program RSREFILL and the client maintenance function.
    Combining RSREFILL or the client maintenance function with the language supplementation program has the following consequences for each client-specific Customizing table:
           1.      Any previous supplementation is reset.
           2.      RSREFILL or the client maintenance function is executed.
           3.      The table is supplemented.
    This avoids any problems caused by the order in which RSREFILL, the client maintenance function, and the language supplementation program run.
    Manual Translation
    The link between the translation environment and the Change and Transport System enables you to create translated Customizing texts in a particular system, record them in transport requests, and distribute them in the system landscape.
    Translate the remaining Customizing texts in transaction SE63. Record the translations in transport requests, and then use the Transport Management System (TMS) to distribute these requests in the system landscape.
    Integration of Address Maintenance for a Customizing Table
    Process Flow
    To automatically display address maintenance for a Customizing table, you have to carry out the following steps:
    Add a field for storing the address number to the table or the view. To do this, use domain AD_ADDRNUM. Based on the address domain, the system automatically generates an indicator (OBJH-OBJHASADDR) in transaction SE54 which specifies if the table or view contains an address or not.
    Maintain the TSADRV entry as described in Address Maintenance in Customizing.
    Use transaction SE54 to generate the table maintenance dialog for transaction SM30 (see also: BC - Generate Table Maintenance Dialog).
    Result
    Address maintenance is now an integral part of Customizing object maintenance.
    The address dialog box is called when you choose the address icon. If an address has already been maintained for the object, this address appears in either change or display mode on the dialog box.
    If no address has been maintained for the object or if no address exists for an address number, the system takes you automatically to the screen for creating an address.
    When you create an object, the system takes you automatically to the address dialog box at the time you release or save the data to prompt you to maintain the address. You can skip the address dialog box using the Cancel function.
    You can find examples of address maintenance in Customizing in transactions OX10 (plants) and OX02 (company codes). (See also: Customizing Objects Using Address Functionality).
    thanks
    sekhar
    reward me if usefull

  • 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

  • Updating a customizing table throw interface

    hello Exprtes,
    We are facing the next scenario,
    We have a Legacy system that contains a several master data tables (like Countries, Cities etc),
    We want to synchronize those tables with our ECC system using automatic interface throw XI,
    New entries will be added to the legacy system and than they will transfer to the ECC,
    Our problem is that those tables in the ECC are define as customize tables (like T005), so we cannot add records to them with an interface,
    Is there any way that we can do it with an interface instead of standard customizing process?
    Is there anyone else who faced this problem? How did they solve it?
    thanks in advance,
    Liad,

    Hi,
    You cannot and you should not enter the details in customising tables through interfaces. This can be done in cases where the customising table can be  somthing similar to a  masterdata table (T023 for material groups, for example)
    However for highly sensitive data like countries , cities etc. I would advise you to stick to teh settings provided by SAP (SAP has provided settings for almost all possible countries) or change teh entries given by SAP.
    XI routed updation of tables like T005 is not at all advisable, I doubt even SAP will support that kind of work at later point of time.
    Hope this helps you

  • Jython error while updating a oracle table based on file count

    Hi,
    i have jython procedure for counting counting records in a flat file
    Here is the code(took from odiexperts) modified and am getting errors, somebody take a look and let me know what is the sql exception in this code
    COMMAND on target: Jython
    Command on source : Oracle --and specified the logical schema
    Without connecting to the database using the jdbc connection i can see the output successfully, but i want to update the oracle table with count. any help is greatly appreciated
    ---------------------------------Error-----------------------------
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 45, in ?
    java.sql.SQLException: ORA-00936: missing expression
    ---------------------------------------Code--------------------------------------------------
    import java.sql.Connection
    import java.sql.Statement
    import java.sql.DriverManager
    import java.sql.ResultSet
    import java.sql.ResultSetMetaData
    import os
    import string
    import java.sql as sql
    import java.lang as lang
    import re
    filesrc = open('c:\mm\xyz.csv','r')
    first=filesrc.readline()
    lines = 0
    while first:
    #get the no of lines in the file
    lines += 1
    first=filesrc.readline()
    #print lines
    ## THE ABOVE PART OF THE PROGRAM IS TO COUNT THE NUMBER OF LINES
    ## AND STORE IT INTO THE VARIABLE `LINES `
    def intWithCommas(x):
    if type(x) not in [type(0), type(0L)]:
    raise TypeError("Parameter must be an integer.")
    if x < 0:
    return '-' + intWithCommas(-x)
    result = ''
    while x >= 1000:
    x, r = divmod(x, 1000)
    result = ",%03d%s" % (r, result)
    return "%d%s" % (x, result)
    ## THE ABOVE PROGRAM IS TO DISPLAY THE NUMBERS
    sourceConnection = odiRef.getJDBCConnection("SRC")
    sqlstring = sourceConnection.createStatement()
    sqlstmt="update tab1 set tot_coll_amt = to_number( "#lines ") where load_audit_key=418507"
    sqlstring.executeQuery(sqlstmt)
    sourceConnection.close()
    s0=' \n\nThe Number of Lines in the File are ->> '
    s1=str(intWithCommas(lines))
    s2=' \n\nand the First Line of the File is ->> '
    filesrc.seek(0)
    s3=str(filesrc.readline())
    final=s0 + s1 + s2 + s3
    filesrc.close()
    raise final

    i changed as you adviced ankit
    am getting the following error now
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 37, in ?
    java.sql.SQLException: ORA-00911: invalid character
    here is the modified code
    sourceConnection = odiRef.getJDBCConnection("SRC")
    sqlstring = sourceConnection.createStatement()
    sqlstmt="update tab1 set tot_coll_amt = to_number('#lines') where load_audit_key=418507;"
    result=sqlstring.executeUpdate(sqlstmt)
    sourceConnection.close()
    Any ideas
    Edited by: Sunny on Dec 3, 2010 1:04 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

  • Data is not getting updated in DB table

    hi all
    i am doing IDOC to jdbc scenario
    i am triggering idoc from R/3 and the data is going into DB table
    sender side:       ZVendorIdoc
    receiver side:
    DT_testVendor
      Table
        tblVendor
          action       UPDATE_INSERT
          access      1:unbounded
            cVendorName 1
            cVendorCode 1
         fromdate    1
         todate      1
          Key
            cVendorName  1
    if i trigger idoc for example vendor 2005,2006 and 2010 data is getting updated in the table
    but again if i trigger idoc for same vendor nos data does not get updated in DB table while message is successfull in moni and RWB both
    plz suggest if any change need to be done to update the data
    Regards
    sandeep sharma

    Hi Ravi
    you are right, vendor no is my key field . problem is when i send data again then it should Update the data but it's not updating the data again
    i did on exp with this : i deleted all the record from the table and then  triggered idoc for vendor 2005 , 2006,2010 after this data is updated in the table i deleted the rows for vendor no 2006 and 2010 and kept the row for vendor 2005
    then i again trigered the idoc for vendor no 2005,2006 and 2010 now this should update and it should insert rows for vendor no 2006 and 2010 but i am surprised its not updating the data
    Thanks
    sandeep

  • 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

  • Can't update a sql-table with a space

    Hello,
    In a transaktion I'm getting some Values from a SAP-ERP System via JCO.
    I update a sql-table with this values with a sql-query command.
    But sometimes the values I get from SAP-ERP are empty (space) and I'm not able to update the sql-table because of a null-value exception. (The column doesn't allow null-values). It seems that MII thinks null and space are the same.
    I tried to something like this when passing the value to the sql-query parameter but it didn't work:
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", " ")
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", " ")
    this works but I don't want to have a "_"
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", "_")
    Any suggestions?
    thank you.
    Matthias

    The problem is Oracle doesn't know the space function. But it knows a similar function: NVL --> replaces a null value with something else. So this statement works fine for me:
    update marc set
    LGort = '[Param.3]',
    dispo = '[Param.4]',
    schgt = NVL('[Param.5]', ' '),
    dismm = '[Param.6]',
    sobsl = NVL('[Param.7]',' '),
    fevor = '[Param.8]'
    where matnr = '[Param.1]' and werks = '[Param.2]'
    If Param.5 or Param.7 is null Oracle replaces it with a space in every other case it is the parameter itself.
    Christian, thank you for your hint with the space function. So I remembered the NVL-function.
    Regards
    Matthias

  • Update or delete table from XML

    Is it possible to update or delete table's row from XML file?
    Thanks
    Prasanta De

    Hi Steve,
    Thanks for your reply but I could not find any example from the documentation for update-request or delete-request. I need your help in this regards.
    1. I have emp table with many rows and the simple structure like this
    DEPTNO NUMBER(2)
    EMPNO NUMBER(2)
    EMPNAME VARCHAR2(20)
    EMPSAL NUMBER(8,2)
    Key is defined on deptno and empno
    2. I have a xml file like this
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <DEPTNO>1</DEPTNO>
    <EMPNO>11</EMPNO>
    <EMPSAL>1111.11</EMPSAL>
    </ROW>
    <ROW num="2">
    <DEPTNO>1</DEPTNO>
    <EMPNO>12</EMPNO>
    <EMPSAL>2222.22</EMPSAL>
    </ROW>
    <ROW num="3">
    <DEPTNO>1</DEPTNO>
    <EMPNO>13</EMPNO>
    <EMPSAL>3333.33</EMPSAL>
    </ROW>
    </ROWSET>
    3. I want that xsql servlet will read this xml file and update EMPSAL column depending upon the value of DEPTNO and EMPNO from xml file.
    Please let me know how I should use update-request in xsql page.
    Thanks
    Prasanta De
    null

  • 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

  • How does CLOSED_CODE updated in PO_LINES_ARCHIVE_ALL table

    Hi,
      How does CLOSED_CODE column will be updated in PO_LINES_ARCHIVE_ALL table. We have setup "Archive On Approve" for archiving.
      Does below is a valid check to verify the line count between lines table and archive table?
      We are comparing the line count in Lines table and Archive table, and if there is difference in count, then it is assumed to be change in the Lines,
      so then direct the PO Approval Worfkflow for re-approval.
      Kindly suggest if below check is correct or not, especially check on CLOSED_CODE='OPEN'.
      In few cases, the lines in PO_LINES_ALL table has CLOSED_CODE = 'CLOSED' but, PO_LINES_ARCHIVE_ALL table has lines with CLOSED_CODE = 'OPEN' even after PO approval.
      Is this expected behavior? When Does CLOSED_CODE will get updated in archive table?
    SELECT COUNT(*)
             INTO x_lines_count
             FROM po_lines_all
            WHERE closed_code = 'OPEN'
              AND po_header_id = x_po_header_id;
           SELECT COUNT(*)
             INTO x_ar_line_count
             from po_lines_archive_all
          where closed_code = 'OPEN'
            and latest_external_flag = 'Y'
            and po_header_id = x_po_header_id;
    IF x_lines_count <> x_ar_line_count THEN
         RESULT: "Change in PO Lines";
    Regards,
    Ram

    Sathyaseelan wrote:
    Hi All,
    After creating requisition from R12 iProcurement , the column document_type_code in the table PO_REQUISITION_LINES_ALL got updated as BLANKET or CONTRACT.
    Need to know how these values was defaulting in the requisition.
    I am able to see the values soon after added the item to shopping cart.
    Regards,
    SathyaI think whatever the item is in the requistion..It should be associated with the blanket or contract agreement..that the reason why you are seeing that document type code
    HTH
    Mahendra

Maybe you are looking for

  • Sr. Engineer - DFW, TX

    Good Automation is now accepting resumes for a Senior Engineer position. www.goodautomation.com Must be willing to live in the Dallas/Ft. Worth area. Job Description In this role you will consult with cutting edge companies across many different indu

  • Screen exit for ME21N

    Hi friends,   I need steps to create screen field in ME21N using the BADI ME_PROCESS_PO_CUST. Can anybody suggest me how to implement this.   Thanks in advance Regards Srikanth S

  • Is there such a thing as an IP address alias?

    I'm resigning the address scheme of my network and wonder if there is a way I can setup a second IP address in the router that will point to the new address of a server. My idea would be to make a virtual address out of the old address so that it wil

  • Problem Concurent client WLC 5508

    Hi All support, i have running cisco wlc 5508 with software upgrade 7-4-100-0.aes  and 24 cisco 1552 AP with mode mesh, concurent client only show 185 clients but if we using dual load wlc ( Whitout mobility group, if using mobility group clients sti

  • Does Logic crash alot?

    I was wondering if anyone else is experiencing an unreasonable amount of random crashes in Logic. ( just want to make it clear before I start this little rant that I really do love Logic, it is my "instrument" and that is why I am so upset about this