ORDER BY from itab fields

Hi,
is there a possibility to order data of a select statement by contents of an itab?
The order criteria of the itab are dynamic thus I cannot hard code them.
Example: (lt_order_criteria is actually an imported table)
I basically want to order by iobjnm1 iobjnm2 iobjnm3
append iobjnm1 to lt_order_criteria.
append iobjnm2 to lt_order_criteria.
append iobjnm3 to lt_order_criteria.
SELECT *
    FROM dbtab
    INTO TABLE itab
   ORDER BY lt_order_criteria[1] lt_order_criteria[2] lt_order_criteria[3]
Thanks,
Alex

Please read the F1 help for SELECT statement, there is (in release 7.00, maybe before) an option
... ORDER BY (column_syntax)
which you should be able to use for this purpose, by converting the itab content accordingly.
Thomas

Similar Messages

  • Custom fields mapping issue of sales order replication from R/3 to CRM

    Hello Experts,
    I have to replicate sales orders from R/3 to CRM system (Initial and Delta)
    The issue is I have custome fields in R/3 which are maintained in custom table(Z table) in R/3.
    We added those custom fields in CRM customer_i table to synchronise with R/3 data.
    To MAP R/3 custom fields to CRM custom fields, i have the following customization.
    1. Added the custom function module in the event CRMO_200 and moved all the custom fields into interal table  IT_OTHER_INFO.
    2. The intrnal table IT_OTHER_INFO with data is passed into CRM standard function modules.
    3. But in CRM the BADI 'CRM_DATAEXCHG_BADI' implementation does not have the input parameter of internal table TI_OTHER_INFO.
    All my custom data is in internal table TI_OTHER_INFO.
    Please suggest where can i map this data to CRM enhanced fields.
    Regards,
    Umashankar.

    Hello Vanessa,
    Thank you so much for your reply.
    I went through the Note (1053817). It is good. I understand that the custom fields should enhance in the BAPE_VBAP in R/3.
    My Scenario:
    Goal: Orders replication from R/3 to CRM along with Custom fields.
    In R/3, all the custom fields are maintained in Z table (Not VBAK or VBAP).
    All these custom fields are belongs to Item level.
    In CRM, The custom fields are maintained in CRMD_CUSTOMER_I table though AET.
    I need to MAP these custom fields to CRM while order replication from R/3 to CRM.
    Regards,
    Umashankar.

  • Get the Order # from the Field VBAP-ARKTX field

    hi,
    i.Order # - for order number parse description field (VBAP-ARKTX) from the right, grab numeric values until reaching a space or ‘#’ character.
    vbap-arktx = 'LABOR'.
    vbap-arktx = 'IC,OCTAL BUFFER/DRIVER 74C240'.
    vbap-arktx = 'IC,BUS TRNCVR,OCTAL    74HC245'.
    vbap-arktx = 'AP CER .1UF 20% 100V AX T/R'.
    vbap-arktx = 'CAP,ELECT,RAD,LOESR,1000UF,16V'.
    vbap-arktx = 'SOCKET,IC,.600 DIP,40-PIN,PHBZ'.
    for the above VBAP-ARKTX Value...how to get the Order# as per the requirement.......
    kindly let me know

    Hi Deepthi...
    I am afraid that there is no safe way to do it.
    Given that you write such a code snippet, for the examples you provide the resulting order string might be like this:
    vbap-arktx = 'LABOR'.
    Order = .... nothing... no numeric values found
    vbap-arktx = 'IC,OCTAL BUFFER/DRIVER 74C240'.
    order = 74C240 or 240 or 74240 ?
    vbap-arktx = 'IC,BUS TRNCVR,OCTAL 74HC245'.
    order = 74HC245 or 245 or 74245?
    vbap-arktx = 'AP CER .1UF 20% 100V AX T/R'.
    order = ???
    vbap-arktx = 'CAP,ELECT,RAD,LOESR,1000UF,16V'.
    order = ???
    vbap-arktx = 'SOCKET,IC,.600 DIP,40-PIN,PHBZ'.
    order = ???
    As you realize, there is no way to tell if there is an order in any case.
    Regards,
    George.

  • DELETE ADJACENT DUPLICATES FROM itab

    Hi Frends, can any one explain me about
    <b>DELETE ADJACENT DUPLICATES FROM itab</b>
    and can any one give me sample program using the above statement.
    full points will be given for good example
    Thanks and Regards
    Vijaya

    i am sending 2 programs to  u:
    DESCRIPTION: INTERACTIVE REPORT FOR SALES DOCUMENT
    *FOR PRINTING SALES DOCUMENT HEADER, SALES DOCUMENT DETAILS, PARTNER
                 DETAILS, SCHEDULE LINE DATA.
             D A T A D E C L A R A T I O N S                             *
    INCLUDE z8vg_isro1.
    INITIALIZATION.
      v_chkbox = ' '.
      v_chkbox1 = ''.
                   S T A R T  O F  S E L E C T I O N                     *
      SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-028.
      SELECT-OPTIONS: s_vbeln FOR i_vbak-vbeln.
      "FOR RANGE OF VALUES.
      SELECTION-SCREEN END  OF  BLOCK bl1.
      A T  S E L E C T I O N  S C R E E N ( V A L I D A T I O N S )      *
    AT SELECTION-SCREEN.
    Check if record exists or not.
      PERFORM  zf_validations.
                   S T A R T  O F  S E L E C T I O N                     *
    START-OF-SELECTION.
    *this is event blocks which is  executed when the user chooses the
    *corresponding function key
      REFRESH i_ucomm.
      CLEAR i_ucomm.
      i_ucomm-ucomm = 'G002'.                               " schdl data
      APPEND i_ucomm.
      SET PF-STATUS 'MENU2' EXCLUDING i_ucomm.
      " MENU BAR STATUS.
    *populating sales order header data , item data , partner data ,
    *schedule data
      PERFORM  zf_select_headerdata.
    AT USER-COMMAND.
    "This event is executed whenever the user presses a menu option 'execute
      "' in the list
      CASE sy-ucomm.
        WHEN 'EX01'.                            "Cancel
          LEAVE PROGRAM.
        WHEN 'GO01'.                            "for item data
          vflag = '0'.
          REFRESH i_ucomm.
          CLEAR i_ucomm.
          i_ucomm-ucomm = 'GO01'.                " item data
          APPEND i_ucomm.
          SET PF-STATUS 'MENU2' EXCLUDING i_ucomm .
          PERFORM zf_select_details.
        WHEN 'G002'.                            "for schedule data .
          REFRESH i_ucomm.
          CLEAR i_ucomm.
          i_ucomm-ucomm = 'G000'.
          APPEND i_ucomm.
          APPEND 'GO01' TO i_ucomm.
          APPEND 'G002' TO i_ucomm.
          SET PF-STATUS 'MENU2' EXCLUDING i_ucomm .
          PERFORM zf_scheduledata .
        WHEN 'G000'.
          "function code for displaying partner details.
          REFRESH i_ucomm.
          CLEAR i_ucomm.
          i_ucomm-ucomm = 'G000'.
          APPEND i_ucomm.
          APPEND 'GO01' TO i_ucomm.
          APPEND 'G002' TO i_ucomm.
          SET PF-STATUS 'MENU2' EXCLUDING i_ucomm .
          IF vflag = '1'.
            PERFORM zf_partnerdetails.
            " FOR PARTNER DETAILS OF HEADER
          ELSE.
            PERFORM zf_partnerdetails1.
            " FOR PARTNER DETAILS OF SALES ORDER ITEMS .
          ENDIF.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    *&      FORM TOP_OF_PAGE
    TOP-OF-PAGE DURING LINE-SELECTION.
    printing header for secondary list of report.
      PERFORM zf_tols.
    TOP-OF-PAGE.
    printing hearder for basic list of report
      PERFORM zf_top.
    *&      Form  VALIDATIONS
          subroutine to check whether record exists or not
    -->  p1        text
    <--  p2        text
    FORM zf_validations .
      SELECT  SINGLE vbeln  FROM vbak
                     INTO  i_vbak-vbeln
                           WHERE vbeln IN s_vbeln.
      EXIT.
    CHECK IF THE RECORD EXISTS OR NOT.
      IF sy-subrc <> 0.
        MESSAGE e001.
      ENDIF.
    ENDFORM.                    " VALIDATIONS
    *&      Form  SELECT_HEADERDATA
    subroutine for populating header data and other details.
    -->  p1        text
    <--  p2        text
    FORM zf_select_headerdata .
    *refreshing all the internal tables.
      CLEAR i_vbak.
      REFRESH i_vbak.
      CLEAR i_vbap.
      REFRESH i_vbap.
      CLEAR i_vbpa.
      REFRESH i_vbpa.
      CLEAR i_vbep.
      REFRESH i_vbep.
    *populating sales order header data , item data , partner data ,
    *schedule data
      SELECT vbeln
             erdat
             vkorg
             FROM vbak
            INTO TABLE i_vbak
                  WHERE vbeln IN s_vbeln.
      IF NOT i_vbak[] IS INITIAL.
        SELECT vbeln
               posnr
               matnr FROM vbap
               INTO TABLE i_vbap
               FOR ALL ENTRIES IN i_vbak
               WHERE vbeln = i_vbak-vbeln.
      ENDIF.
      IF sy-subrc <> 0.
        MESSAGE e004.
      ENDIF.
      SORT i_vbap BY vbeln posnr.
      " SORTING TABLE WITH KEY FIELDS .
      REFRESH i_mat.
      CLEAR i_mat.
    fetching of unique material numbers  corresponding sales orderno.
      LOOP AT i_vbap.
        i_mat-matnr = i_vbap-matnr.
        APPEND i_mat.
      ENDLOOP.
      SORT i_mat BY matnr.                      " sorting of material nos.
      IF sy-SUBRC = 0.
    deleting duplicate entries from table
      DELETE ADJACENT DUPLICATES  FROM i_mat
                               COMPARING matnr.
    *endif.
      REFRESH i_mat1.
      CLEAR i_mat1.
    populating material no and dscription .
      SELECT matnr
             maktx FROM makt
                    INTO TABLE i_mat1
                    FOR ALL ENTRIES IN i_mat
                    WHERE matnr = i_mat-matnr.
      SELECT  vbeln
              posnr
              parvw
              kunnr
              FROM vbpa
              INTO TABLE i_vbpa
              FOR ALL ENTRIES IN i_vbap
              WHERE vbeln = i_vbap-vbeln .
      SORT i_vbap BY vbeln posnr.
      REFRESH i_tvbpa.
      REFRESH i_tpartf.
      CLEAR i_tpartf.
    *FOR FETCHING UNIQUE PARTNER FUNCTIONS
      LOOP AT i_vbpa.
        i_tpartf-parvw = i_vbpa-parvw.
        APPEND i_tpartf.
      ENDLOOP.
      SORT i_tpartf BY parvw.
      DELETE ADJACENT DUPLICATES  FROM i_tpartf
                                COMPARING parvw.
      SELECT spras
             parvw
             vtext
             FROM tpart
             INTO TABLE i_tvbpa
             FOR ALL ENTRIES IN i_tpartf
             WHERE parvw = i_tpartf-parvw AND spras = sy-langu.
      IF NOT i_vbap[] IS INITIAL.
        SELECT vbeln
               posnr
               etenr
               ettyp
               lfrel
               edatu
               FROM  vbep
               INTO TABLE i_vbep
               FOR ALL ENTRIES IN i_vbap
               WHERE vbeln = i_vbap-vbeln.
      ENDIF.
      SORT i_vbap BY vbeln posnr.
    to fetch data from internal table to print report
      LOOP AT  i_vbak.
        WRITE:/1 sy-vline,10   v_chkbox AS CHECKBOX, i_vbak-vbeln,28
        sy-vline,
                30 i_vbak-erdat,48 sy-vline,
                50 i_vbak-vkorg, 132 sy-vline.
      ENDLOOP.
      ULINE.
    ENDFORM.                    " SELECT_HEADERDATA
    *&      Form  ZF_SELECT_DETAILS
         SUBROUTINE  FOR DISPLAYING SELECTED ITEM DETAILS DATA
    -->  p1        text
    <--  p2        text
    FORM zf_select_details .
      vflag = 0.
      WRITE:/1 sy-vline,10 text-006 COLOR 3,28 sy-vline,
            30 text-007 COLOR 3, 48 sy-vline,
            50 text-008 COLOR 3, 68 sy-vline,
            70 text-022 COLOR 3, 132 sy-vline.
      ULINE.
      CLEAR i_selvbap.
      CLEAR i_final.
      REFRESH i_selvbap.
      REFRESH i_final.
      CLEAR i_mat1.
      vnline = 7.
      DO.
        READ LINE vnline FIELD VALUE i_vbak-vbeln v_chkbox.
        " READING LINES FROM BASIC LIST.
        IF sy-subrc <> 0. " no lines read.
          EXIT.
        ENDIF.
        IF v_chkbox = 'X'.
          " checking of selected items from basic list.
    *alpha conversion function - During conversion from the external to the
    *internal format, the system checks to see
    *if input is purely nummeric or not ,if not all spaces to the left of
    *the value are filled with zeroes ('0').
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = i_vbak-vbeln
            IMPORTING
              output = i_selvbap-vbeln.
          APPEND i_selvbap.
          " appending values from header line to body.
          flag = flag + 1.
          " TO CHECK VALUE OF CHECKBOX.
          CLEAR i_vbak.
          " clearing of header line after appending.
        ENDIF.
        vnline = vnline + 1.
      ENDDO.
      IF flag <> 0.
        CLEAR i_final.
        CHECK NOT i_selvbap[] IS INITIAL.
        LOOP AT i_selvbap.
          LOOP AT i_vbap WHERE vbeln = i_selvbap-vbeln.
            READ TABLE i_mat1 WITH KEY matnr = i_vbap-matnr BINARY SEARCH.
         IF sy-subrc = 0.
            i_final-vbeln = i_vbap-vbeln.
            i_final-posnr = i_vbap-posnr.
            i_final-matnr = i_vbap-matnr.
            i_final-maktx = i_mat1-maktx.
            APPEND i_final.
            CLEAR i_mat1.
         ENDIF.
          ENDLOOP.
          CLEAR i_selvbap.
          CLEAR i_vbap.
          CLEAR i_final.
        ENDLOOP.
      ENDIF.
      IF flag = 0.
        MESSAGE e005.
      ENDIF.
    to fetch data from internal table to print report
      LOOP AT i_final.
       WRITE:/1 sy-vline,10 v_chkbox1 AS CHECKBOX,i_final-vbeln,28 sy-vline
             30 i_final-posnr, 48 sy-vline,
             50 i_final-matnr, 68 sy-vline,
             70 i_final-maktx,
             132 sy-vline.
      ENDLOOP.
      ULINE.
    ENDFORM.                    " ZF_SELECT_DETAILS
    *&      Form  ZF_TOLS
          text
    -->  p1        text
    <--  p2        text
    FORM zf_tols .
    *printing header of secondary list
      ULINE.
      WRITE:/10 text-023,20 text-001 COLOR 4, 45 text-019 COLOR 4.
      WRITE: 80 text-024,90  sy-datum .
      WRITE:/10 text-025,20 text-027,80 text-026,90  sy-pagno.
      WRITE:/.
      ULINE.
    ENDFORM.                    " ZF_TOLS
    *&      Form  ZF_TOP
          text
    -->  p1        text
    <--  p2        text
    FORM zf_top .
    *printing header of basic list
      ULINE.
      WRITE:/10 text-023,20 text-001 COLOR 4 ,45 text-002 COLOR 4.
      WRITE: 80 text-024, 90  sy-datum.
      WRITE:/10 text-025,20 text-027,80 text-026,90  sy-pagno.
      ULINE.
      WRITE:/1 sy-vline, 10 text-003  COLOR 3 ,28 sy-vline,
            30 text-004 COLOR 3 ,48 sy-vline,
            50 text-005 COLOR 3 ,132 sy-vline.
      ULINE.
    ENDFORM.                    " ZF_TOP
    *&      Form  ZF_PARTNERDETAILS
         SUBROUTINE  FOR DISPLAYING SELECTED PARTNER DETAILS DATA
    -->  p1        text
    <--  p2        text
    FORM zf_partnerdetails .
      IF vflag = 1.
        WRITE:/1 sy-vline,10 text-016 COLOR 3,28 sy-vline,
             30 text-017 COLOR 3,48 sy-vline,
               30 text-018 COLOR 3,48 sy-vline,
               70 text-021 COLOR 3, 132 sy-vline.
        ULINE.
        CLEAR i_selvbpa.
        REFRESH i_selvbpa.
        " clearing work area and body of internal tables
        REFRESH i_finalpd.
        vnline = 7.
        DO.
          CLEAR i_selvbpa.
          READ LINE vnline FIELD VALUE i_vbak-vbeln v_chkbox.
          " READING LINES FROM BASIC LIST.
          IF sy-subrc <> 0.
            " NO LINES READ
            EXIT.
          ENDIF.
          IF v_chkbox = 'X'.
            " if any value is selected
    *converts any number into a string fill with zeroes, with the number at
    *the extreme right.
            CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
              EXPORTING
                input  = i_vbak-vbeln
              IMPORTING
                output = i_selvbpa-vbeln.
            APPEND i_selvbpa.
            CLEAR i_vbak.
            flag = flag + 1.
          ENDIF.
          vnline = vnline + 1.
        ENDDO.
        IF flag <> 0.
          CHECK NOT i_selvbpa[] IS INITIAL.
          LOOP AT i_selvbpa.
            LOOP AT i_vbpa WHERE vbeln = i_selvbpa-vbeln.
             READ TABLE i_tvbpa WITH KEY parvw = i_vbpa-parvw BINARY SEARCH
         IF sy-subrc = 0..
              i_finalpd-vbeln = i_vbpa-vbeln.
              i_finalpd-posnr = i_vbpa-posnr.
              i_finalpd-parvw = i_vbpa-parvw.
              i_finalpd-vtext = i_tvbpa-vtext.
              APPEND i_finalpd.
              CLEAR i_tvbpa.
         ENDIF.
            ENDLOOP.
          ENDLOOP.
        ENDIF.
        IF flag = 0.
          MESSAGE e005.
        ENDIF.
        LOOP AT i_finalpd.
          WRITE:/1 sy-vline,10 i_finalpd-vbeln, 28 sy-vline,
              30 i_finalpd-posnr, 48 SY-VLINE,
                 30 i_finalpd-parvw, 48 sy-vline,
                 70 i_finalpd-vtext, 132 sy-vline.
        ENDLOOP.
        ULINE.
      ENDIF.
    ENDFORM.                    " ZF_PARTNERDETAILS
    *&      Form  ZF_SCHEDULEDATA
         SUBROUTINE  FOR DISPLAYING SELECTED ITEM  SCHEDULE  DATA
    -->  p1        text
    <--  p2        text
    FORM zf_scheduledata .
      vflag = 0.
      WRITE:/1 sy-vline,10 text-009 COLOR 3,18 sy-vline,
            20 text-011 COLOR 3,38 sy-vline,
            40 text-012 COLOR 3,58 sy-vline,
            60 text-013 COLOR 3,78 sy-vline,
            80 text-020 COLOR 3,98 sy-vline,
           100 text-015 COLOR 3,132 sy-vline.
      ULINE.
      CLEAR i_selvbep.
      REFRESH i_selvbep.
      vnline1 = 5.
      CLEAR flag.
      CLEAR i_final.
      REFRESH i_finalsd.
      DO.
        READ LINE vnline1 FIELD VALUE i_final-vbeln v_chkbox1 i_final-posnr
        .       " READING LINES FROM BASIC LIST.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        IF v_chkbox1 = 'X'.
    *converts any number into a string fill with zeroes, with the number at
    *the extreme right
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = i_final-vbeln
            IMPORTING
              output = i_selvbep-vbeln.
          i_selvbep-posnr = i_final-posnr.
          APPEND i_selvbep.
          CLEAR i_final.
          flag = flag + 1.
        ENDIF.
        vnline1 = vnline1 + 1.
      ENDDO.
      IF flag <> 0.
        CHECK NOT i_selvbep[] IS INITIAL.
        LOOP AT i_selvbep.
          LOOP AT i_vbep WHERE vbeln = i_selvbep-vbeln AND posnr =
          i_selvbep-posnr.
            i_finalsd-vbeln = i_vbep-vbeln.
            i_finalsd-posnr = i_vbep-posnr.
            i_finalsd-etenr = i_vbep-etenr.
            i_finalsd-ettyp = i_vbep-ettyp.
            i_finalsd-lfrel = i_vbep-lfrel.
            i_finalsd-edatu = i_vbep-edatu.
            APPEND i_finalsd.
            CLEAR i_selvbep.
            CLEAR i_vbep.
            CLEAR i_finalsd.
          ENDLOOP.
        ENDLOOP.
      ENDIF.
      IF flag = 0.
        MESSAGE e005.
      ENDIF.
      LOOP AT i_finalsd.
        WRITE:/1 sy-vline,10 i_finalsd-vbeln,18 sy-vline,
              20 i_finalsd-posnr, 38 sy-vline,
              40 i_finalsd-etenr, 58 sy-vline,
              60 i_finalsd-ettyp, 78 sy-vline,
              80 i_finalsd-lfrel, 98 sy-vline,
             100 i_finalsd-edatu,132 sy-vline.
        CLEAR i_finalsd.
      ENDLOOP.
      ULINE.
    ENDFORM.                    " ZF_SCHEDULEDATA
    *&      Form  ZF_PARTNERDETAILS1
          text
    -->  p1        text
    <--  p2        text
    FORM zf_partnerdetails1 .
      vflag = 1.
      WRITE:/1 sy-vline,10 text-016 COLOR 3,18 sy-vline,
              20 text-017 COLOR 3,38 sy-vline,
              40 text-018 COLOR 3,58 sy-vline,
              60 text-021 COLOR 3,78 sy-vline,
              132 sy-vline.
      ULINE.
      CLEAR i_selvbpa1.
      REFRESH i_selvbpa1.
      REFRESH i_finalpd1.
      vnline1 = 7.
      DO.
       CLEAR I_SELVBEP.
        READ LINE vnline1 FIELD VALUE i_final-vbeln v_chkbox1 i_final-posnr
        .       " READING LINES FROM BASIC LIST.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        IF v_chkbox1 = 'X'.
    *converts any number into a string fill with zeroes, with the number at
    *the extreme right
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = i_final-vbeln
            IMPORTING
              output = i_selvbpa1-vbeln.
          i_selvbpa1-posnr = i_final-posnr.
          APPEND i_selvbpa1.
          CLEAR i_final.
          flag = flag + 1.
        ENDIF.
        vnline1 = vnline1 + 1.
      ENDDO.
      IF flag <> 0.
        CLEAR i_vbpa.
        CLEAR i_finalpd1.
        CHECK NOT i_selvbpa1[] IS INITIAL.
        LOOP AT i_selvbpa1.
          LOOP AT i_vbpa WHERE vbeln = i_selvbpa1-vbeln.
            CLEAR i_finalpd1.
         IF sy-subrc = 0.
            i_finalpd1-vbeln = i_vbpa-vbeln.
            IF i_vbpa-posnr = 0 OR i_vbpa-posnr = ''.
              i_finalpd1-parvw1 = 'NO DATA EXISTS'.
            ELSE.
              i_finalpd1-posnr = i_vbpa-posnr.
              i_finalpd1-parvw = i_vbpa-parvw.
              i_finalpd1-vtext = i_vbpa-vtext.
              i_finalpd1-kunnr = i_vbpa-kunnr.
            ENDIF.
            APPEND i_finalpd1.
            IF i_finalpd1-vbeln = i_selvbpa1-vbeln.
              EXIT.
            ENDIF.
            CLEAR i_vbpa.
            CLEAR i_finalpd1.
          ENDIF.
          ENDLOOP.
        ENDLOOP.
      ENDIF.
      IF flag = 0.
        MESSAGE e005.
      ENDIF.
    fetching data from internal table for printing.
      LOOP AT i_finalpd1.
        WRITE:/1 sy-vline,10 i_finalpd1-vbeln,18 sy-vline,
             20 I_FINALPD1-POSNR, 38 SY-VLINE,
               40 i_finalpd1-parvw1,
             58 SY-VLINE,
               60 i_finalpd1-vtext,
             78 SY-VLINE,
               80 i_finalpd1-kunnr,
              132 sy-vline.
      ENDLOOP.
      ULINE.
    ENDFORM.                    " ZF_PARTNERDETAILS1
    2nd is :-
    REPORT  Z8NB_SHA10_1
            NO STANDARD PAGE HEADING
            LINE-COUNT 30
            LINE-SIZE 170
            MESSAGE-ID Z8NBSHADOW.
                  T A B L E    D E C L A R A T I O N                     *
    TABLES : LIKP. " Delivery Header.
                  T Y P E      D E C L A R A T I O N                     *
    **-- Type decleration for Delivery Header
    TYPES : BEGIN OF T_LIKP,
              VBELN LIKE LIKP-VBELN,    " Delivery Number
              ERDAT LIKE LIKP-ERDAT,    " Date on which record was craeted
              KUNNR LIKE LIKP-KUNNR,    " Sold-to-party
              KUNAG LIKE LIKP-KUNAG,    " Ship-to-party
              TRMTYP LIKE LIKP-TRMTYP,  " Means of transport
            END OF T_LIKP.
    **-- Type decleration for Delivery Items
    TYPES : BEGIN OF T_LIPS,
              VBELN LIKE LIPS-VBELN,    " Delivery Number
              POSNR LIKE LIPS-POSNR,    " Delivery Item Number
              MATNR LIKE LIPS-MATNR,    " Material Number
              LFIMG LIKE LIPS-LFIMG ,   " DELIVERED QTY
              MEINS LIKE LIPS-MEINS,    " Unit of Measurement
              BRGEW LIKE LIPS-BRGEW,    " Gross Weight
              GEWEI LIKE LIPS-GEWEI,    " Weight Unit
              VOLUM LIKE LIPS-VOLUM,    " Volumn
              VOLEH LIKE LIPS-VOLEH,    " Volumn Unit
            END OF T_LIPS.
    **-- Type decleration for Customer Details
    TYPES : BEGIN OF T_KNA1,
              KUNNR LIKE KNA1-KUNNR,    " Customer Number
              NAME1 LIKE KNA1-NAME1,                            " Name1
              NAME2 LIKE KNA1-NAME2,                            " Name2
              STRAS LIKE KNA1-STRAS,    " House/ Street Number
              REGIO LIKE KNA1-REGIO,    " Region
              ORT01 LIKE KNA1-ORT01,    " City
              LAND1 LIKE KNA1-LAND1,    " Country Key
              TELF1 LIKE KNA1-TELF1,    " First Telephone Number
           END OF T_KNA1.
    **-- Type decleration for Partner Function
    TYPES : BEGIN OF T_KNVP,
            KUNNR LIKE KNVP-KUNNR,      " Customer Number
            PARVW LIKE KNVP-PARVW,      " Partner Function
            KUNN2 LIKE KNVP-KUNN2,      " Cust no of business partner
            END OF T_KNVP.
    **-- Type decleration for Shipment Header
    TYPES : BEGIN OF T_VTTK,
            TKNUM LIKE VTTK-TKNUM,      " Shipment Number
            TNDR_CRNM LIKE VTTK-TNDR_CRNM,   " Carrier
            END OF T_VTTK.
    **-- Type decleration for Shipment Item
    TYPES : BEGIN OF T_VTTP,
            TKNUM LIKE VTTP-TKNUM,      " Shipment Number
            VBELN LIKE VTTP-VBELN,      " Order Number
            END OF T_VTTP.
    **-- Type decleration for Material Description
    TYPES : BEGIN OF T_MAKT,
            MATNR LIKE MAKT-MATNR,      " Material Number
            MAKTX LIKE MAKT-MAKTX,      " Material Description
            END OF T_MAKT.
    **-- Type decleration for Final table containing all item details
    TYPES : BEGIN OF T_FINAL,
            VBELN LIKE LIPS-VBELN,    " Delivery Number
            POSNR LIKE LIPS-POSNR,    " Delivery Item Number
            MATNR LIKE LIPS-MATNR,    " Material Number
            LFIMG LIKE LIPS-LFIMG ,   " DELIVERED QTY
            MEINS LIKE LIPS-MEINS,    " Unit of Measurement
            BRGEW LIKE LIPS-BRGEW,    " Gross Weight
            GEWEI LIKE LIPS-GEWEI,    " Weight Unit
            VOLUM LIKE LIPS-VOLUM,    " Volumn
            VOLEH LIKE LIPS-VOLEH,    " Volumn Unit
            MAKTX LIKE MAKT-MAKTX,    " Material Description
            END OF T_FINAL.
             C O N S T A N T     D E C E L E R A T I O N                 *
    CONSTANTS: C_RE(4) TYPE C VALUE 'RE',  "Bill-to-party
               C_EQ(4) TYPE C VALUE 'EQ',  "Equal To
               C_I(2) TYPE C VALUE 'I'.    "Inclusion
             V A R I A B L E     D E C E L E R A T I O N                 *
    DATA : V_SUM TYPE LIPS-LFIMG,       "For calculating total of Quantity.
           V_SUM_FINAL TYPE LIPS-LFIMG, "For displaying total
           V_DESC TYPE C LENGTH 20.     "Storing Description
              I N T E R N A L      D E C L A R A T I O N                 *
    **-- Internal table for delivery header data
    DATA: IT_LIKP TYPE STANDARD TABLE OF T_LIKP WITH HEADER LINE,
    **-- Internal table for delivery item data
          IT_LIPS TYPE STANDARD TABLE OF T_LIPS WITH HEADER LINE,
    **-- Internal table for bill-to-party details
          IT_KNA1 TYPE STANDARD TABLE OF T_KNA1 WITH HEADER LINE,
    **-- Internal table to store partner function data
          IT_KVNP TYPE STANDARD TABLE OF T_KNVP WITH HEADER LINE,
    **-- Internal table for shipment header data
          IT_VTTK TYPE STANDARD TABLE OF T_VTTK WITH HEADER LINE,
    **-- Internal table for shipmant item data
          IT_VTTP TYPE STANDARD TABLE OF T_VTTP WITH HEADER LINE,
    **-- Internal table for material description
          IT_MAKT TYPE STANDARD TABLE OF T_MAKT WITH HEADER LINE,
    **-- Internal table for final item details
          IT_FINAL TYPE STANDARD TABLE OF T_FINAL WITH HEADER LINE,
    **-- Temporary internal table for Shipment Item
          IT_VTTP_TEMP TYPE STANDARD TABLE OF T_VTTP WITH HEADER LINE,
    **-- Temporary internal table for delivery item
          IT_LIPS_TEMP TYPE STANDARD TABLE OF T_LIPS WITH HEADER LINE,
    **-- Temporary internal table for delivery header
          IT_LIKP_TEMP TYPE STANDARD TABLE OF T_LIKP WITH HEADER LINE.
    **-- Ranges for Inquiry/Quotation
    RANGES R_CUSTOMER FOR KNA1-KUNNR.
                  S E L C T I O N       S C R E E N                      *
    **-- Selection screen containing Delivery no as the obligatory field
    SELECTION-SCREEN BEGIN OF BLOCK CHARLY WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_VBELN FOR LIKP-VBELN OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK CHARLY.
                         I N I T I A L I Z A T I O N                     *
    INITIALIZATION.
    **-- Clear all internal tables
      CLEAR : IT_LIKP,
              IT_LIPS,
              IT_KNA1,
              IT_KVNP,
              IT_VTTK,
              IT_VTTP,
              IT_MAKT,
              IT_FINAL,
              IT_VTTP_TEMP,
              R_CUSTOMER,
              V_SUM,
              V_SUM_FINAL,
              V_DESC.
    **-- Refresh all internal tables
      REFRESH : IT_LIKP,
                IT_LIPS,
                IT_KNA1,
                IT_KVNP,
                IT_VTTK,
                IT_VTTP,
                IT_MAKT,
                IT_FINAL,
                IT_VTTP_TEMP,
                R_CUSTOMER.
      A T  S E L E C T I O N  S C R E E N ( V A L I D A T I O N S )      *
    AT SELECTION-SCREEN.
    **-- Check the sales order number exists in the database table or not
      SELECT SINGLE VBELN
                    FROM LIKP
                    INTO IT_LIKP
                    WHERE VBELN IN S_VBELN.
    **-- If no single data selected display error message.
      IF SY-SUBRC <> 0.
        MESSAGE E000.
      ENDIF.
                   S T A R T    O F    S E L E C T I O N                 *
    START-OF-SELECTION.
    **-- Fetch data from the transprant tables into the internal tables
      PERFORM GET_DATA.
    **-- Final table for complete item data
      PERFORM FINAL_DATA.
                   E N D    O F    S E L E C T I O N                     *
    END-OF-SELECTION.
    **-- Display of Delivery Note
      PERFORM DISPLAY_DATA.
    *&      Form  GET_DATA
          text
    FORM GET_DATA .
    **-- Fetch data from Delivery Header Table ( LIKP )
      SELECT VBELN
             ERDAT
             KUNNR
             KUNAG
             TRMTYP
             FROM LIKP
             INTO TABLE IT_LIKP
             WHERE VBELN IN S_VBELN
             ORDER BY VBELN.
    **-- Check SY_SUBRC.
      IF SY-SUBRC <> 0 .
      ENDIF.
    **-- If record is present in IT_LIKP internal table then fetch data from
    **-- Delivery Item table (LIPS)
      IF  NOT IT_LIKP[] IS INITIAL.
        SELECT VBELN
               POSNR
               MATNR
               LFIMG
               MEINS
               BRGEW
               GEWEI
               VOLUM
               VOLEH
               FROM LIPS
               INTO TABLE IT_LIPS
               FOR ALL ENTRIES IN IT_LIKP
               WHERE VBELN = IT_LIKP-VBELN.
    **-- If record found, sort the internal table on delivery no and item no
        IF SY-SUBRC = 0.
          SORT IT_LIPS BY VBELN POSNR.
        ENDIF.
      ENDIF.
    **-- If record present in IT_LIPS internal table then fetch data from
    **-- Shipment Item Table where delivery number is same
      IF NOT IT_LIPS[] IS INITIAL.
        SELECT TKNUM
               VBELN
               FROM VTTP
               INTO TABLE IT_VTTP
               FOR ALL ENTRIES IN IT_LIPS
               WHERE VBELN = IT_LIPS-VBELN.
    **-- If record found, sort the internal table on shipment no
        IF SY-SUBRC = 0.
          SORT IT_VTTP BY TKNUM.
        ENDIF.
      ENDIF.
    **-- Move records in IT_LIPS to an temporary  internal table for
    **-- removing the duplicate entries of material number.
      IT_LIPS_TEMP[] = IT_LIPS[].
      SORT IT_LIPS_TEMP BY MATNR.
      DELETE ADJACENT DUPLICATES FROM IT_LIPS_TEMP
                                 COMPARING MATNR.
      IF NOT IT_LIPS_TEMP[] IS INITIAL.
    **-- Fetch Material description from MAKT for all materials in
    **-- IT_LIPS_TEMP
        SELECT MATNR
             MAKTX
             INTO TABLE IT_MAKT
             FROM MAKT FOR ALL ENTRIES IN IT_LIPS_TEMP
             WHERE MATNR = IT_LIPS_TEMP-MATNR.
    **-- If record found, sort the internal table on Matreial No.
        IF SY-SUBRC = 0.
          SORT IT_MAKT BY MATNR.
        ENDIF.
      ENDIF.
    **-- Transfer data in shipment item internal table to a temporary
    **-- internal table to delete duplicate entries of shipment number.
      IT_VTTP_TEMP[] = IT_VTTP[].
      SORT IT_VTTP_TEMP BY TKNUM.
      DELETE ADJACENT DUPLICATES FROM IT_VTTP_TEMP
                                 COMPARING TKNUM.
    **-- If record found in IT_VTTP_TEMP then fetch shipment no and carrier
    **--from Shipment Header Table(VTTK).
      IF NOT IT_VTTP_TEMP[] IS INITIAL.
        SELECT TKNUM
               TNDR_CRNM
               FROM VTTK
               INTO TABLE IT_VTTK
               FOR ALL ENTRIES IN IT_VTTP_TEMP
               WHERE TKNUM = IT_VTTP_TEMP-TKNUM.
    **-- If record found, sort the internal table on shipment no
        IF SY-SUBRC = 0.
          SORT IT_VTTK BY TKNUM.
        ENDIF.
      ENDIF.
    **-- Move the data of IT_LIKP to an internal table to remove the
    **-- duplicate entries of sold-to-party number.
      IT_LIKP_TEMP[] = IT_LIKP[].
      SORT IT_LIKP_TEMP BY KUNAG.
      DELETE ADJACENT DUPLICATES FROM IT_LIKP_TEMP
                             

  • Sales Order uplaod from JAVA to SAP R/3

    Hi all,
    My cousin is working on uploading Sales Order Document
    from java server to R/3.
    for that he is having a code from JCO jar.
    the below is the file from which one can upload his SO details from JAVA to R/3.
    But in this program he is  just able to upload one Item detail for one Sales document.
    but requirement is to upload 'n' item details for one Sales document.
    Here is the Java code.
    @author pega
    TODO To change the template for this generated type comment go to
    Window - Preferences - Java - Code Style - Code Templates
    Created on Jun 24, 2004
    To change the template for this generated file go to
    Window>Preferences>Java>Code Generation>Code and Comments
    package com.sap.satyam.salesorder;
    import java.sql.Timestamp;
    import java.util.Calendar;
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.IRepository;
    import com.sap.mw.jco.JCO;
    public class SalesOrder {
         static final String SID = "R3";
         static final String errorID = "E";
         IRepository repository;
         //String orderNumber = orderCreation("M-01","3000","0002",3,"ST");
         int counter;
         public SalesOrder()
                   try {
                        // Add a connection pool to the specified system
                        JCO.addClientPool(SID,            // Alias for this pool
                                             10,            // Max. number of connections
                                             "800",           // SAP client
                                             "develop",  // userid
                                             "bslabap", // password
                                             "EN",         // language
                                             "172.18.33.20",    // host name
                                             "00");
                        // Create a new repository
                        repository = JCO.createRepository("MYRepository", SID);
                   catch (JCO.Exception ex) {
                        System.out.println("Caught an exception: \n" + ex);
         //     Retrieves and sales order Create
         public void createSalesOrder(String PO_NO, String MAT,String RQTY,String CUSTMAT, String SOLD_NAME, String SOLD_STREET,String SOLD_COUNTRY, String SOLD_POST_CODE,String SHIP_NAME, String SHIP_STREET,String SHIP_COUNTRY, String SHIP_POST_CODE)
              try {
                   // Get a function template from the repository
                   IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_SALESORDER_CREATEFROMDAT1");
                   JCO.MetaData so_metadata = new JCO.MetaData("BAPI_SALESORDER_CREATEFROMDAT1");
                   // Create a function from the template
                   JCO.Function function = new JCO.Function(ftemplate);
                   // Get a client from the pool
                   JCO.Client client = JCO.getClient(SID);
                   // Fill in input parameters
                   // Header
                   JCO.ParameterList input = function.getImportParameterList();
                   JCO.ParameterList tables = function.getTableParameterList();
                   JCO.Structure input_header = input.getStructure("ORDER_HEADER_IN");
                   // Item details
                   JCO.Table table_item = tables.getTable("ORDER_ITEMS_IN");
                   //JCO.Structure input_item = table_item.getStructure("ORDER_ITEMS_IN");
                   // Partner details
                   JCO.Table table_partner = tables.getTable("ORDER_PARTNERS");
                   // Populate the header details
                   input_header.setValue("ZAD5","DOC_TYPE"); // Document Type
                   input_header.setValue("3000","SALES_ORG"); // Sales Organization
                   input_header.setValue("10","DISTR_CHAN");  // Distribution Channel
                   input_header.setValue("00","DIVISION");  // Distribution Channel
                   input_header.setValue("20041212","REQ_DATE_H");// can be changed in yyyymmdd (Requested date)
                   input_header.setValue(PO_NO,"PURCH_NO_C");// can be changed ( Customer PO Number )
                   //Populate the item detalis
                   table_item.appendRow();
                   table_item.setRow(1);
                   table_item.setValue("000010","ITM_NUMBER");
                   table_item.setValue("AA01","PO_ITM_NO");// can be changed
                   table_item.setValue("IAD-SC3000","MATERIAL");
                   table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
                   table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
                   table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
                   table_item.appendRow();
                   table_item.setRow(2);
                   table_item.setValue("000020","ITM_NUMBER");
                   table_item.setValue("AA01","PO_ITM_NO");// can be changed
                   table_item.setValue("IAD-SC3000","MATERIAL");
                   table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
                  table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
                   table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
                   //Populate the Partner details
                   // Sold to Party
                   table_partner.appendRow();
                   table_partner.setRow(1);
                   table_partner.setValue("AG","PARTN_ROLE");
                   //table_partner.setValue("0000002007","PARTN_NUMB");
                   table_partner.setValue("0000100067","PARTN_NUMB");
                   table_partner.setValue(SOLD_NAME,"NAME");  // can be changed
                   table_partner.setValue(SOLD_STREET,"STREET"); // can be changed
                   table_partner.setValue(SOLD_COUNTRY,"COUNTRY");
                   table_partner.setValue(SOLD_POST_CODE,"POSTL_CODE"); // can be changed
                   // Ship to party
                  table_partner.appendRow();
                   table_partner.setRow(2);
                   table_partner.setValue("WE","PARTN_ROLE");
                   table_partner.setValue("0000100067","PARTN_NUMB");
                   table_partner.setValue(SHIP_NAME,"NAME");// can be changed
                   table_partner.setValue(SHIP_STREET,"STREET"); // can be changed
                   table_partner.setValue(SHIP_COUNTRY,"COUNTRY");
                   table_partner.setValue(SHIP_POST_CODE,"POSTL_CODE");// can be changed
                   // Call the remote system
                   client.execute(function);
                   // Print return message
                   JCO.Structure ret = function.getExportParameterList().getStructure("RETURN");
                   System.out.println("BAPI_SALES_ORDER_GETLIST RETURN: " + ret.getString("MESSAGE"));
                   // Get table containing the orders
                   //JCO.Table sales_orders = function.getTableParameterList().getTable("SALES_ORDERS");
                  JCO.Field sales_order = function.getExportParameterList().getField("SALESDOCUMENT");
                   // Print results
                   String so = sales_order.getString();
                   String message = ret.getString("MESSAGE");
                   String message_type = ret.getString("TYPE");
                   if  (message_type.equalsIgnoreCase("E"))  {
                        System.out.println("Error in Sales Order Creation:" + message);
                   else{
                        System.out.println("Sales Order " + so + " Created Succesfully");
                   // Release the client into the pool
                   JCO.releaseClient(client);
              catch (Exception ex) {
                   System.out.println("Caught an exception: \n" + ex);
         //     Retrieves and sales order Create
          public void listSalesOrders()
               try {
                    // Get a function template from the repository
                    IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_SALESORDER_GETLIST");
                    // Create a function from the template
                    JCO.Function function = new JCO.Function(ftemplate);
                    // Get a client from the pool
                    JCO.Client client = JCO.getClient(SID);
                    // Fill in input parameters
                    JCO.ParameterList input = function.getImportParameterList();
                    //input.setValue("0000002007", "CUSTOMER_NUMBER"   );
                    input.setValue(      "3000", "SALES_ORGANIZATION");
                    //input.setValue(         "0", "TRANSACTION_GROUP" );
                    //input.setValue("PO_NUMBER_JAVA01","PURCHASE_ORDER_NUMBER");
                    // Call the remote system
                    client.execute(function);
                    // Print return message
                    JCO.Structure ret = function.getExportParameterList().getStructure("RETURN");
                    System.out.println("BAPI_SALES_ORDER_GETLIST RETURN: " + ret.getString("MESSAGE"));
                    // Get table containing the orders
                    JCO.Table sales_orders = function.getTableParameterList().getTable("SALES_ORDERS");
                    // Print results
                    if (sales_orders.getNumRows() > 0) {
                         // Loop over all rows
                         do {
                             counter++;
                              System.out.println("--" + counter + "--
                              // Loop over all columns in the current row
                              for (JCO.FieldIterator e = sales_orders.fields(); e.hasMoreElements(); ) {
                                   JCO.Field field = e.nextField();
                                   System.out.println(field.getName() + ":\t" + field.getString());
                              }//for
                         } while(sales_orders.nextRow());
                    else {
                         System.out.println("No results found");
                    }//if
                    // Release the client into the pool
                    JCO.releaseClient(client);
               catch (Exception ex) {
                    System.out.println("Caught an exception: \n" + ex);
         public static void main(String[] argv) {
              SalesOrder so = new SalesOrder();
              so.createSalesOrder("PO_NUMBER_JAVA02", "","0000000020000","121-223-2332-1231", "SOFTWARE SYSTEME GMBH-WE", "STREET-SH","US", "53125","SOFTWARE SYSTEME GMBH-WE", "STREET-SH","US", "53125");
              //so.listSalesOrders();     
    >>>>Please if any of SDN users can help in resolving this issue. It will be very helpful to my cousin.

    Before:
    //Populate the item detalis
    table_item.appendRow();
    table_item.setRow(1);
    table_item.setValue("000010","ITM_NUMBER");
    table_item.setValue("AA01","PO_ITM_NO");// can be changed
    table_item.setValue("IAD-SC3000","MATERIAL");
    table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
    table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
    table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
    table_item.appendRow();
    table_item.setRow(2);
    table_item.setValue("000020","ITM_NUMBER");
    table_item.setValue("AA01","PO_ITM_NO");// can be changed
    table_item.setValue("IAD-SC3000","MATERIAL");
    table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
    table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
    table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
    Try to add:
    //Populate the item detalis
    table_item.appendRow();
    table_item.setRow(2);
    table_item.setValue("000020","ITM_NUMBER");
    table_item.setValue("AA01","PO_ITM_NO");// can be changed
    table_item.setValue("IAD-SC3000","MATERIAL");
    table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
    table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
    table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
    table_item.appendRow();
    table_item.setRow(2);
    table_item.setValue("000020","ITM_NUMBER");
    table_item.setValue("AA01","PO_ITM_NO");// can be changed
    table_item.setValue("IAD-SC3000","MATERIAL");
    table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
    table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
    table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
    Regards.

  • Which table I can get sales order no from delivery numbar.

    Hi,
    I want sales order no from delivery no. right now I am using table VBFA where I am passing VBELN and POSNN and geting sales order no. but performance of select query is very poor bcouse I am not passing first two key fields in the select query.
    Is there any other tablefrom where we can get sales order no. from delivery no. so that performance of report can be improved.
    Thanks,

    hi,
    sales doc header ( table VBAK ) copy to Delivery header table( LIKP)
    sales doc item table ( VBAP) copy to Delivery item table( LIPS)
    you can see this in copy control VTLA ,
    now u want slaes doc no. from dilv doc. no.
    so go to t-code se11.....
    fill table LIKP u will get VBELN field for deliv doc no, & TERNR field for sales doc. no.
    so if u want to call sales doc no from dilv doc no.. u can use table LIKP in ur report.
    i hope it will help u.

  • Field Order is a required field for G/L account ....

    Hi Experts,
    I am getting following error while posting payroll to FI (tcode PC00_M99_CIPE - Create Posting Run).
    ================================================================================================
    Field Order is a required field for G/L account 1000 23107
         Message no. F5808
    Diagnosis
         The value for field "Order" in the interface to Financial Accounting is
         an initial value but you are required to make an entry in the field
         selection for G/L account "23107" in company code "1000" linked to the
         field selection for posting key "50".
    System Response
         Error
    Procedure
        It might be an error in the configuration of the G/L account field
        selection. The initial application, used to call up the interface must
        otherwise define a value for field "Order". If this is the case, contact
        the consultant responsible for the application used to call up the
        interface or get in contact with SAP directly.
    ================================================================================================
    Thanks for the solution in advance.
    Regards,
    Waqas Rashid

    Thanks Dilek for quick reply, but I am unable to find order field for my field status group in OBC4.
    Let me tell you the background of what I did ...
    I have one wage type 4113 which was linked to vendor account. I changed the link from vendor to balance sheet account and specified new GL 23206 for my symbolic account of wage type 4113.
    When I post the payroll result to FI after this change. I got this error.
    Regards,
    Waqas Rashid

  • In Project stock valuation during GR MAP is picked up from VMVER field

    Hi!
    We are facing an issue during the GR of Material in Production order.
    I will explain the scenario:
    The main material is valuated in MAP (Moving average price).
    On creation of the production order the planned value is coming ok ( summation of components).
    As it was a project valuation, the MAP values are getting stored in the table QBEW.
    The point of concern is at the time of doing GR the actual value is getting picked up from the field VMVER (=MAP/Period unit price in previous period)
    and not from the field VERPR (= MAP/Period unit price).
    As per the scenario the system must consider the latest MAP value that is from VERPR and not from VMVER.
    Can't find out what setting is affecting this selection.
    Abhra

    Hi,
    I am still having problems with this issue. The material is extended for plant 1200 and a valuation class and project stock valuation class have been set.
    Is there a configuration setting required?

  • Data from itab to be store in text file in desktop

    hi
    i am tyring to store the data from itab into a text file in desktop,but its now owrking.
    i am using open dataset statment,but no where data is storing.My code:
    TYPES : BEGIN OF ST_DEMO,
    REG_NO(10) TYPE C,
    NAME(20)   TYPE C,
    ADDR(20)   TYPE C,
    END OF ST_DEMO.
    DATA : WA_DEMO TYPE ST_DEMO,
    IT_DEMO TYPE TABLE OF ST_DEMO,
    L_FNAME TYPE dxfile-filename .
    PARAMETERS: P_FNAME(128) TYPE C DEFAULT '\usr\sap\put\vipin.txt' OBLIGATORY.
    L_FNAME = P_FNAME.
    WA_DEMO-REG_NO = '100001'.
    WA_DEMO-NAME = 'ANAND'.
    WA_DEMO-ADDR = 'NAGARKOVIL'.
    APPEND WA_DEMO TO IT_DEMO.
    OPEN DATASET L_FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    WRITE :5 'REG NUM',16 'NAME',37 'ADDRESS' .
    LOOP AT IT_DEMO INTO WA_DEMO.
      IF SY-SUBRC = 0.
        TRANSFER WA_DEMO TO L_FNAME.
        WRITE :/5 WA_DEMO-REG_NO,16 WA_DEMO-NAME,37 WA_DEMO-ADDR.
      ENDIF.
    ENDLOOP.
    close DATASET L_FNAME.
    please tell me where is the prob?I wan to schedule it for background job.
    regds
    vipin

    hi
    here is the code for :  "data from itab to be store in text file in desktop"
    TABLES: vbak.    " standard table
    *                           Type Pools                                 *
    TYPE-POOLS: slis.
    *                     Global Structure Definitions                     *
    *-- Structure to hold data from table CE1MCK2
    TYPES: BEGIN OF tp_itab1,
           vbeln LIKE vbap-vbeln,
           posnr LIKE vbap-posnr,
           werks LIKE vbap-werks,
           lgort LIKE vbap-lgort,
           END OF tp_itab1.
    *-- Data Declaration
    DATA: t_itab1 TYPE TABLE OF tp_itab1.
    DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
    *                    Selection  Screen                                 *
    *--Sales document-block
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
    SELECTION-SCREEN END OF  BLOCK b1.
    *--Display option - block
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
    PARAMETERS: alv_list RADIOBUTTON GROUP g1,
                alv_grid RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF  BLOCK b2.
    *file download - block
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
    PARAMETERS: topc AS CHECKBOX,
                p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF  BLOCK b3.
    *                      Initialization.                                *
    *                      At Selection Screen                            *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
        EXPORTING
          dynpfield_filename = 'P_FILE'
          dyname             = sy-cprog
          dynumb             = sy-dynnr
          filetype           = 'P'      "P-->Physical
          location           = 'P'     "P Presentation Srever
          server             = space.
    AT SELECTION-SCREEN ON s_vbeln.
      PERFORM vbeln_validate.
    *                           Start Of Selection                         *
    START-OF-SELECTION.
    *-- Fetching all the required data into the internal table
      PERFORM select_data.
    *                           End Of Selection                           *
    END-OF-SELECTION.
      IF t_itab1[] IS NOT INITIAL.
        IF topc IS NOT INITIAL.
          PERFORM download.
          MESSAGE 'Data Download Completed' TYPE 'S'.
        ENDIF.
        PERFORM display.
      ELSE.
        MESSAGE 'No Records Found' TYPE 'I'.
      ENDIF.
    *                           Top Of Page Event                          *
    TOP-OF-PAGE.
    *& Form           :      select_data
    * Description     : Fetching all the data into the internal tables
    *  parameters    :  none
    FORM select_data .
      SELECT vbeln
         posnr
         werks
         lgort
         INTO CORRESPONDING  FIELDS OF TABLE t_itab1
         FROM vbap
         WHERE  vbeln IN s_vbeln.
      IF sy-subrc <> 0.
        MESSAGE 'Enter The Valid Sales Document Number'(t04) TYPE 'I'.
        EXIT.
      ENDIF.
    ENDFORM.                    " select_data
    *& Form        : display
    *  decription  : to display data in given format
    * parameters   :  none
    FORM display .
      IF alv_list = 'X'.
        PERFORM build_fieldcat TABLES i_fieldcat[]
                               USING :
    *-Output-field Table      Len  Ref fld Ref tab Heading    Col_pos
       'VBELN'       'T_ITAB1'     10   'VBAP'  'VBELN'    ''            1,
       'POSNR'       'T_ITAB1'     6    'VBAP'  'POSNR'    ''            2,
       'WERKS'       'T_ITAB1'     4    'VBAP'  'WERKS'    ''            3,
       'LGORT'       'T_ITAB1'     4    'VBAP'  'LGORT'    ''            4.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program       = sy-repid
    *        i_callback_pf_status_set = c_pf_status
            i_callback_user_command  = 'USER_COMMAND '
    *        it_events                = t_alv_events[]
            it_fieldcat              = i_fieldcat[]
          TABLES
            t_outtab                 = t_itab1[]
          EXCEPTIONS
            program_error            = 1
            OTHERS                   = 2.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
      IF alv_grid = 'X'.
        PERFORM build_fieldcat TABLES i_fieldcat[]
                                 USING :
    *-Output-field Table      Len  Ref fld Ref tab Heading    Col_pos
         'VBELN'       'T_ITAB1'     10   'VBAP'  'VBELN'    ''            1,
         'POSNR'       'T_ITAB1'     6    'VBAP'  'POSNR'    ''            2,
         'WERKS'       'T_ITAB1'     4    'VBAP'  'WERKS'    ''            3,
         'LGORT'       'T_ITAB1'     4    'VBAP'  'LGORT'    ''            4.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program       = sy-repid
    *        i_callback_pf_status_set = c_pf_status
            i_callback_user_command  = 'USER_COMMAND '
            it_fieldcat              = i_fieldcat
          TABLES
            t_outtab                 = t_itab1[]
        EXCEPTIONS
       program_error                     = 1
       OTHERS                            = 2.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " display
    *& Form        : vbeln_validate
    *  description : to validate sales document number
    * parameters   :  none
    FORM vbeln_validate .
      DATA: l_vbeln TYPE vbak-vbeln.
      SELECT SINGLE vbeln
        FROM vbak
        INTO l_vbeln
        WHERE vbeln IN s_vbeln.
      IF sy-subrc NE 0.
        MESSAGE 'ENTER THE VALID SALES DOCUMENT NO:' TYPE 'I'.
        EXIT.
      ENDIF.
    ENDFORM.                    " vbeln_validate
    *& Form       :build_fieldcat
    * Description : This routine fills field-catalogue
    *  Prameters  : none
    FORM build_fieldcat TABLES  fpt_fieldcat TYPE slis_t_fieldcat_alv
                        USING   fp_field     TYPE slis_fieldname
                                fp_table     TYPE slis_tabname
                                fp_length    TYPE dd03p-outputlen
                                fp_ref_tab   TYPE dd03p-tabname
                                fp_ref_fld   TYPE dd03p-fieldname
                                fp_seltext   TYPE dd03p-scrtext_l
                                fp_col_pos   TYPE sy-cucol.
    *-- Local data declaration
      DATA:   wl_fieldcat TYPE slis_fieldcat_alv.
    *-- Clear WorkArea
      wl_fieldcat-fieldname       = fp_field.
      wl_fieldcat-tabname         = fp_table.
      wl_fieldcat-outputlen       = fp_length.
      wl_fieldcat-ref_tabname     = fp_ref_tab.
      wl_fieldcat-ref_fieldname   = fp_ref_fld.
      wl_fieldcat-seltext_l       = fp_seltext.
      wl_fieldcat-col_pos         = fp_col_pos.
    *-- Update Field Catalog Table
      APPEND wl_fieldcat  TO  fpt_fieldcat.
    ENDFORM.                    "build_fieldcat
    *& Form        : download
    *  description : To Download The Data
    *  Parameters  :  none
    FORM download .
      DATA: l_file TYPE string.
      l_file = p_file.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_file
          filetype                = 'ASC'
        TABLES
          data_tab                = t_itab1
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " download
    hope it will help you
    regards
    rahul

  • Find Sales order number from IDOC number

    I have a bunch of SO idocs, in status 64. They are then posted and Sales orders are created.
    How can I programatically find the Sales order Number from the Sales Order idoc number once it is in status 53 (other than going to EDIDS and checking if status = '53' and grabbing the 'STAPA2' field there ).

    Look at table EDIDS for sales order idocs and you can see SO number in any of STAPA1/2/3/4 variable for specific message id and message number.

  • Function Modul for Order Number from VA02

    Hallo
    i have a delivery number and want read the order number from VA02.
    Of course, select the database from LIKP --> LIPS --> VBKD is possible but 
    maybe it has function modul for read the order number from transaction VA02.
    THX ANU

    Hi,
    I think is better recover the data directly from DB tables (in table LIPS you have the fields VGBEL, VGPOS, VGTYP ) if you only want the order number.
    With the delivery number you only need to acces 1 table. If you use a FM, you will recover this data and a few fields that is not interesting for you. The access to table LIPS is using table index (delivery number)
    Regards,
    Pepe

  • How to capture Purchase order text from MM02

    Hi Friends ,
    i have a requirement like i have  to capture the purchase order text from MM02
    from one program.
    Pls give helpful code .
    Thanks & Regards
    Jagadeeshwar.Bachu

    hi
    check this code
    Hi,
    declare the paramters like:
    To fetch Long Text lines for READ_TEXT function module
    DATA:BEGIN OF dt_lines OCCURS 0.
    INCLUDE STRUCTURE tline. " Long Text
    DATA:END OF dt_lines.
    Variable declarations for Read_TEXT function module
    DATA : dl_name TYPE thead-tdname, " Object Name
    dl_lan TYPE thead-tdspras. " Language
    Constants
    CONSTANTS:
    Object ID for Long Text of Sales Item Text
    c_best TYPE thead-tdid value 'Z026', ID
    c_object TYPE thead-tdobject . " Object
    Object will be VBBK, and the Object name will be the concatenation of Sales order and Item No(for Item texts) and only Sales order for Header texts.
    Language will be default sy-Langu.
    In the loop of Sales orders call this fun module and use by passing all the above 4 paramters ID,OBJECT,NAME and LANG.
    You double click on that text
    GOTO -> header you will know the all above paramters.
    READ_TEXT
    READ_TEXT provides a text for the application program in the specified work areas.
    The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.
    After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.
    If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.
    Function call:
    CALL FUNCTION 'READ_TEXT'
    EXPORTING CLIENT = SY-MANDT
    OBJECT = ?...
    NAME = ?...
    ID = ?...
    LANGUAGE = ?...
    ARCHIVE_HANDLE = 0
    IMPORTING HEADER =
    TABLES LINES = ?...
    EXCEPTIONS ID =
    LANGUAGE =
    NAME =
    NOT_FOUND =
    OBJECT =
    REFERENCE_CHECK =
    WRONG_ACCESS_TO_ARCHIVE =
    Export parameters:
    CLIENT
    Specify the client under which the text is stored. If you omit this parameter, the system uses the current client as default.
    Reference field: SY-MANDT
    Default value: SY-MANDT
    OBJECT
    Enter the name of the text object to which the text is allocated. Table TTXOB contains the valid objects.
    Reference field: THEAD-TDOBJECT
    NAME
    Enter the name of the text module. The name may be up to 70 characters long. Its internal structure depends on the text object used.
    Reference field: THEAD-TDNAME
    ID
    Enter the text ID of the text module. Table TTXID contains the valid text IDs, depending on the text object.
    Reference field: THEAD-TDID
    LANGUAGE
    Enter the language key of the text module. The system accepts only languages that are defined in table T002.
    Reference field: THEAD-TDSPRAS
    ARCHIVE_HANDLE
    If you want to read the text from the archive, you must enter a handle here. The system uses it to access the archive. You can create the handle using the function module ACHIVE_OPEN_FOR_READ.
    The value '0' indicates that you do not want to read the text from the archive.
    Reference field: SY-TABIX
    Default value: 0
    Import parameters:
    HEADER
    If the system finds the desired text, it returns the text header in this parameter.
    Structure: THEAD
    Table parameters:
    LINES
    The table contains all text lines that belong to the text read.
    Structure: TLINE
    Exceptions:
    ID
    The text ID specified in the parameter ID does not exist in table TTXID. It must be defined there together with the object of the text module.
    LANGUAGE
    The parameter LANGUAGE contains a language key that does not exist in table T002.
    NAME
    The parameter NAME contains the name of a text module that does not correspond to the SAPscript conventions.
    Possible errors:
    The field contains only blanks.
    The field contains the invalid characters ‘*’ or ‘,’.
    OBJECT
    The parameter OBJECT contains the name of a text object that does not exist in table TTXOB.
    NOT_FOUND
    The system did not find the specified text module.
    REFERENCE_CHECK
    The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists.
    WRONG_ACCESS_ TO_ARCHIVE
    The exception WRONG_ACCESS_TO_ARCHIVE is triggered if an archive is accessed using an incorrect or non-existing archive handle or an incorrect mode (that is, read if the archive is open for writing or vice versa).
    regards
    siva

  • Send orders idoc from sender

    Experts 
    tell me which tcode is used to send the sales order data from sender to receiver.
    Example  : we use the following tcode to send the master data idocs like
    SEND MATERIAL MASTER: BD10
    SEND VENDOR MASTER:   BD12
    1)is there any tcode to send the sales order data also like this.
    2)if tcode not there then tell me which function module is used in the sender system to fill the segments of order01 idoc.
    3) I want to fill the sales order data in the segments , the following data i need to fill
    sales area , document type , customer numeber , payment terms , material , net price , quantity , order data , po number.
    tell me which segments are used for this.
    4)where to see the segments of the idoc and its fields.
    5) if any one having sample code to fill the orders idoc , please give me the link

    prabhu
    send data through Message control ? means how to send .
    My requirement is to fill the idoc segments and then to post.
    Which tcode is used to see the segment fileds  both header and item other than we60 , we61.
    For orders01 idoc how to identify which segment fields are used for sales area , customer , payment term etc  becasue po fields are also there, so confusing

  • CRM order details from database and buffer

    Hi,
    I am working on a scenario where i need to read the order details from buffer and database also to compare the changed values in one of the action class. I have tried with CRM_ORDER_READ and CRM_ORDER_READ_OW. CRM_ORDER_READ is giving the details from buffer and CRM_ORDER_READ_OW is not giving me any resluts. To compare the old and new values i need to read the details from buffer and database also. Please suggest me the function modules to use.
    Thanks,
    Rajinikanth G

    I'm using similap comparion for some opportunity fields. There I'm using function modules 'CRM_OPPORT_H_READ_DB' and 'CRM_OPPORT_H_READ_OW and it's working fine.
    So I guess _DB and OW function modules should be ok. I'm not sure, but I think I also had problems a while ago with using module CRMORDER_READ_OW. Maybe try to find some other OW function that could give you wanted values. CRMORDER_READ_OW is very large fm, so try using CRM_ORDERADM_H_READ_OW for header data and CRM_SCHEDLIN_I_READ_OW for items and so on. There are function modules for nearly all data groups.
    Regards.

  • Select only first 10 chars from the field in a table while writlng a selec

    hi experts,
    In a table  one field contains a value of above 10 characters (ex 10 or 15 or 20 characters).But i want to select
    only first 10 characters from this field while writing a select statement.
    This logic should be included in select statement.
    please gime immediate solution.
    My question is understood.

    Hi,
    Try this one
    data : begin of itab occurs 0,
            maktx(10) type c,
    end of itab.
    " though the length of MAKTX is 40 you only get 10 chars
    select maktx from makt into table itab up to 10 rows.
    if sy-subrc is initial.
    endif.
    " Suppose the field name of table you want to select is MAKTX then declare
    " Your internal table in the above manner, it will automatically fit into it and will get 10 Chars only
    " Instead of burding the select query / DB interface use the above.
    Cheerz
    Ram

Maybe you are looking for

  • Can anyone help??  - Can't access the ITunes store

    Hi I downloaded Itunes 9 on 17/09/09 and as a result I can no longer access the Itunes Store. *I have tried the following*: * Turning off my Windows Firewall and CA Security Firewall and ensuring that neither is blocking anything Apple related * Turn

  • A new Account

    Hello, I have a problem with Itunes 7,02. I created a Apple ID and would creat me a Account for buying music in the itunesstore. I have write full the option of account but if i will used "click and buy" as terms of payment then the creat button go n

  • Sap bi authorizations issue with query designer..

    i am using bw 3.x and bi 7 query designer with different kind of probs?... i am able to see the info provider  in query desinger 3.x. but i can see only cubes .i am not able to find dso or infosets or multiprovider.. can anyone suggest is there any a

  • PinListener triggers many times with same value, then segfaults

    Hi. Trying a simple button listener with RPi connected to a gertboard, whenever I press the button connected to configured GPIO (GPIO3 in this case, since only GPIO2 and GPIO3 seem suitable in order to use internal pullups) I get many notifications.

  • Table for capacity alt.uom

    Hi , For a work center the capacity is maintained in "time" and the alt unit of measure maintained is "MW" . I tried to see in number of tables, but this "MW" is not seen in any table. Can you pls suggest the table in which i need to look in. Regards