SORT ITAB BY VARIABLE_NAME

hi,
i want to sort the int table with variable parameters, like VKBUR, BUDAT, VKORG, MATNR, etc.
for that ive created a char variable of 5 length (say CRIT) and assigned value based on selection criteria by the user.
Then, im using SORT ITAB BY CRIT. Its not getting sorted properly.
Any suggestions,
Regards,
Naveen

You can easily achieve it by using filed symbols.
Assign the field (upon which you require sorting) to field symbol<Fs> and then sort the table with (<Fs>)reference.
Sample code is given below for your help.
DATA: BEGIN OF x1 OCCURS 0,
        t1 TYPE string,
        t2 TYPE string,
        t3 TYPE string,
       END OF x1.
FIELD-SYMBOLS: <fs> TYPE ANY.
x1-t1 = 'B'.
x1-t2 = 'D'.
x1-t3 = '9'.
APPEND x1.
x1-t1 = 'C'.
x1-t2 = 'X'.
x1-t3 = '4'.
APPEND x1.
x1-t1 = 'F'.
x1-t2 = 'Y'.
x1-t3 = '6'.
APPEND x1.
LOOP AT x1.
  WRITE: / x1-t1, '    ', x1-t2, '    ', x1-t3.
ENDLOOP.
SKIP 2.
* Sort by field T1
ASSIGN 't1' TO <fs>.
SORT x1 BY (<fs>).
LOOP AT x1.
  WRITE: / x1-t1, '    ', x1-t2, '    ', x1-t3.
ENDLOOP.
skip 2.
* Sort by field T3
ASSIGN 't3' TO <fs>.
SORT x1 BY (<fs>).
LOOP AT x1.
  WRITE: / x1-t1, '    ', x1-t2, '    ', x1-t3.
ENDLOOP.

Similar Messages

  • Sort  itab by using field symbol

    All,
    I have a field symbol  that pointing to a field value in work area of an internal table i_sort ( For example work area that contains the field name having a value MATNR' ( this decides only at runtime) )
    My requirement is i need to sort another table for example i_tab (structure same as records in i_sort) using this field symbol.
    Any Info?

    Hi,
    Check the below report sorting table VBAP based on field VBELN dynamically.
    Let me know if u need any clarification.
    REPORT  ZTEST1.
    tables: dd03l.
    field-symbols: <fs1> type any,
                   <fs2> type any.
    data:
       wa_1 type vbak,
       w_index type sy-index.
    data:
      itab like standard table of vbap,
      ftab like standard table of dd03l.
      select * from vbap into table itab
               up to 10 rows.
    select single * from vbak into wa_1 where vbeln ne space.
    assign wa_1-vbeln to : <fs1>,
                           <fs2>.
    do.
      assign component sy-index of structure wa_1 to <fs1>.
      if <fs1> = <fs2>.
        w_index = sy-index.
        exit.
      endif.
    enddo.
    select *
      from DD03L
      into table ftab
    where TABNAME eq 'VBAK'.
    sort ftab by position.
    read table ftab with key position = w_index into dd03l.
    sort itab by (dd03l-FIELDNAME).
    Thanks,
    - Ram

  • Sort itab by select-options

    Hi,
    i have this code:
    SELECT-OPTIONS:   S_MATNR   FOR MARA-MATNR.
      SELECT  * FROM MARA WHERE MATNR IN S_MATNR.
        CLEAR: WA_ITAB.
        WA_ITAB-MATNR = MARA-MATNR.
        WA_ITAB-MTART = MARA-MTART.
        WA_ITAB-MATKL = MARA-MATKL.
        APPEND WA_ITAB TO IT_ITAB.
      ENDSELECT.
    now i want to sort the it_itab by the given select-options. Is this possible?
    ( select-options can have single valuse, ranges, meta characters)
    Or is it possible to use select from table mara in order by select-options?
    Regards, Dieter

    Hi,
    First of all please avoid such a select statement. It causes a lot of performance problem.
    Code like this
    SELECT  *  FROM MARA
    INTO CORRESPONDING FIELDS OF TABLE IT_ITAB
    WHERE MATNR IN S_MATNR.
    Secondly what do you mean by SORT ITAB by SELECT_OPTIONS S_MATNR.
    You yourself have said that the select-option can contain single values or multiple values or ranges.
    So how should the SORT be?
    Kinldy check with the requirment. It seems a little weird.
    Regards,
    Ankur Parab

  • Ways of building sort itabs

    eg. is this way of doing correct for building sorted table?
    will this lose the binary properties for quick access?
    sort standard_itab by a b c.
    sorteditab[] = standard_itab[]
    or should it be this way? using insert?
    loop at standard_itab into wa.
      insert wa into sorteditab.
    endloop.

    Hi Charles,
    This link: http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb34d0358411d1829f0000e829fbfe/content.htm
    soesn't specify anything about the type of tables when assigning.
    So, your first code looks ok.
    This code works fine for me:
    REPORT ZTEST.
    DATA: ftab TYPE SORTED TABLE OF f
               WITH NON-UNIQUE KEY table_line,
          itab TYPE standard TABLE OF i ,
          fl   TYPE f.
      DO 3 TIMES.
      INSERT sy-index INTO TABLE itab.
      ENDDO.
    sort itab.
    LOOP AT itab INTO fl.
      WRITE: / fl.
    ENDLOOP.
    ftab[] = itab[].
    LOOP AT ftab INTO fl.
      WRITE: / fl.
    ENDLOOP.
    Regards,
    Ravi
    Message was edited by:
            Ravi Kanth Talagana

  • Sort itab stable

    Hi,
    can you please  explain me diffrence between Sort itab stable and sort itab using simple example.
    Regards,
    Suresh.

    1  3
    2  2
    1  3
    1  2
    2  3
    SORT ITAB STABLE always gives the output same
    1  2
    1  3
    1  3
    2  2
    2  3
    but SORT ITAB gives
    1  2
    1  3
    1  3
    2  2
    2  3
    or
    1  3
    1  3
    1  2
    2  2
    2  3
    or
    1  3
    1  2
    1  3
    2  3
    2  2

  • Sort itab by another itab?

    Hi,
    i have 2 itabs: itab0 with matnr and lgpbe. itab1 with matnr matkl brgew.
    it sort itab0 by lgpbe.
    Is it possiple to sort itab1 like itab0 without having lgpbe and without changing
    the entries of itab1?
    i look for any like "sort itab1 by itab0-matnr"???
    Regards, Dieter

    HI,
      you cannot use sort statement like this..
      how ever.. just do this way.
       loop at itab0.
       loop at itab1 where matnr  = itab0=matnr.
       itab2 = itab1.
       append itab2.
       endloop.
       endloop.
    at end of this itab2 will have ur sorted data.

  • Runtime error in sorted itab

    Q2]]  A runtime error occurs if you violate the sort order of a sorted table by appending to it -
    WHY?

    Hi,
    First of all you should try and understand the meaning of Append and Insert.
    Append always adds a new line to the end of the internal table.If the table is empty,then it would add it as the first line.
    Insert always inserts the row according to the sorting or if you have given any condition then accordingly.
    Modify can play the role of either the Append or Insert depending on the type of the table.
    Hence,if you try to use Append in a sorted table, it adds a new row at the end of the table and disturbs the sorting.Insert on the other hand includes the row at a place according to the sorting.
    In case you have any further clarifications,do let me know.
    Regards,
    Puneet Jhari.

  • Standard and sorted itab

    what is the diff between standard and sorted itab

    Hi Abhay,
    check the following explanation.
    <b>Standard tables</b>
    This is the most appropriate type if you are going to address the individual table entries using the index. Index access is the quickest possible access. You should fill a standard table by appending lines (ABAP APPENDstatement), and read, modify and delete entries by specifying the index (INDEX option with the relevant ABAP command). The access time for a standard table increases in a linear relationship with the number of table entries. If you need key access, standard tables are particularly useful if you can fill and process the table in separate steps. For example, you could fill the table by appending entries, and then sort it. If you use the binary search option (BINARY) with key access, the response time is logarithmically proportional to the number of table entries.
    <b>Sorted tables</b>
    This is the most appropriate type if you need a table which is sorted as you fill it. You fill sorted tables using the INSERTstatement. Entries are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the table key in the WHEREcondition.
    Hope this helps.
    Regards,
    kinshuk

  • Sort Itab - Ignoring Case

    Hi,
    I need to sort an Internal Table by name field by ignoring the CASE.
    One way is: Convert the Name into Upper or Lower case and do the sorting.
    However, is there any other way we could handle this?  Do we have SORT which can ignore the case?
    Thanks for the reply.
    Thanks,
    Sandeep

    Hi Sandeep,
    I think that is the way to do that. Make that as either upper /lower case and do sorting. Normally when we sort upper case will come first & lower case will come next.
    refer this thread:
    http://scn.sap.com/thread/1309978
    Regards,
    Poornima

  • Sort itab

    I need to do the following sort:
    SORT it_header BY lifnr xblnr belnr ASCENDING.
    Only I also want it sorted by CHECF descending.  Basically, I need it to be ascending except I want all records, with a blank CHECF, last (within it's own vendor, lifnr, section). 
    Example:
    LIFNR  XBLNR  BELNR  CHECF
    00001  001000  000100 
    00002 012000   000111 
    00002 012340   012300  000034
    00001  001100  000110  000001
    Would be, after all sorts:
    LIFNR  XBLNR  BELNR  CHECF
    00001  001100  000100  000001
    00001  001000  000100 
    00002 012340   012300  000034
    00002 012000   000111                "If no CHECF then it should be the last entry for the vendor, no matter the other fields.
    Is there a way to do this without looping through the table?

    Davis,
    I have question .
    i used as you suggested by your last reply. but i am thinking the output is not coming as per your first reply
    Here is code
    report zaRs.
    data : begin of it_header occurs 0,
           field1(5) type c,
           field2(6) type c,
           field3(6) type c,
           field4(6) type c.
    data : end of it_header.
    move '00001001000000100' to it_header. append it_header.
    move '00002012000000111' to it_header. append it_header.
    move '00002012340012300000034' to it_header. append it_header.
    move '00001001100000110000001' to it_header. append it_header.
    sort it_header by field1 ascending field4 descending field2 field3 ascending.
    loop at it_header.
      write :/ it_header.
    endloop.
    After running this report i got the output like the following
    00001001100000110000001
    00001001000000100
    00002012340012300000034
    00002012000000111

  • Sorting the itab

    hi,
    sorting the itab and if the no of lines equals to 98 we have to 
    create a new purch req.
    each requisition is limited by 98 line items.
    this is the flat file i am getting.
    0001|100041003|P100001|00010|01005100601054015510
    0001|100041003|F100001|00010|01005100601054015510
    0001|100041004|P100002|00025|01005100601054015510
    0008|100041005|P100002|00020|01005100601054015510
    0008|100041005|F100002|00020|01005100601054015510
    0032|100041006|P100003|00035|01005100601054015510
    0032|100041006|F100003|00020|01005100601054015510
    0040|100041007|P100004|00005|01005100601054015510
    0040|100041007|F100004|00015|01005100601054015510
    0041|100041008|P100005|00021|01005100601054015510
    0041|100041008|F100005|00015|01005100601054015510
    thanks regards
    suman chekuri

    Hi,
    Try this,
    First upload your flat file into an internl table,
    Suppose you name your 'serial no' as 'ser_no' in your interna table,
    then you can try like this.
    SORT itab BY ser_no.
    LOOP at itab into work_area.
    count = count + 1.
    if count = 98.
    PERFORM create_po.
    ENDIF.
    ENDLOOP.

  • CM25: Sort standard table based on custom table.

    Hi Experts,
    I need to sort the CM25 capacity table based on a ZTABLE where we will define the sequence number of each material. So when CM25 is executed the material should get sorted based on sequence number maintained in Ztable. Now the challenge is how to achieve this sorting before we display the capacity table.
    anybody has faced such scenerio please help us.
    There are few user exits available but not able to find out how to achieve the required functionality.
    Regards,
    Raghav
    Edited by: Julius Bussche on Jul 30, 2009 9:29 AM
    In future threads with meaningless subject titles will simply be deleted as you appear to be doing this intentionally

    First, let me say that I have no experience with this CM25 table and where/how it is used or displayed, but here's how I look at it:
    But what is the real problem?
    1. Don't know the user exit / BAdI to be used?
    2. Don't know how to do the sorting?
    3. .....?
    Answer:
    1. This will be a matter of trying I would say and reading the documentation of the exit/BAdI.
    2. You can do dynamic sorting of an internal table (if it is an internal table that is used before displaying it).
    DATA: lv_sort1 TYPE CHAR10 VALUE 'NAME_OF_COLUMN_FROM_ZTABLE',
               lv_sort2 TYPE CHAR10 VALUE 'NAME_OF_OTHER_COLUMN_FROM_ZTABLE'.
    SORT itab BY (lv_sort1) ASCENDING (lv_sort2) DESCENDING.
    Edited by: Micky Oestreich on Jul 30, 2009 7:34 AM

  • Table Control Sort doesnt  work , plz check my code

    Hello
      Flag is defined thr in TCL1 attribute list(checked) w/selColumn & value is FLAG ,also defined as char in prog
      But syntax error is "No component exist with the name FLAg "
       Plz correct me .
       REPORT ZSD_REP_ORDER_BANK_CHANGE NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES: VBAK,VBAP,VBRK,ZSD_TABL_ORDBANK,MARA,KONV.
    CONTROLS: TCL1 TYPE TABLEVIEW USING SCREEN 0200.
    DATA: ITAB LIKE ZSD_TABL_ORDBANK OCCURS 0 WITH HEADER LINE,
          WA_ITAB LIKE ZSD_TABL_ORDBANK,
          OK_CODE LIKE SY-UCOMM,
          SAVE_OK_CODE LIKE SY-UCOMM,
          ANSWER TYPE C,
          I LIKE SY-LOOPC ,
          J LIKE SY-LOOPC,
          V_LINES LIKE SY-LOOPC,
          LINE_COUNT LIKE SY-LOOPC,
          STS  TYPE N,
          FLAG,
          EMGRP LIKE MARA-EXTWG,
          QTY LIKE ZSD_TABL_ORDBANK-QTY,
          UPRICE LIKE ZSD_TABL_ORDBANK-UPRICE,
          TOT LIKE ZSD_TABL_ORDBANK-TOT,
          INO LIKE VBAP-POSNR.
    FIELD-SYMBOLS:
         <FS_ITAB> LIKE LINE OF ITAB,
         <FS_TCL1> LIKE LINE OF TCL1-COLS.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
      SELECT-OPTIONS: S_CCODE FOR ZSD_TABL_ORDBANK-CCODE
                              NO INTERVALS NO-EXTENSION  OBLIGATORY,
                      S_SORG  FOR ZSD_TABL_ORDBANK-SORG
                              NO INTERVALS NO-EXTENSION  OBLIGATORY,
                      S_DCHAN FOR ZSD_TABL_ORDBANK-DISTCHAN,
                      S_DIV FOR ZSD_TABL_ORDBANK-DIV,
                      S_MATNO FOR ZSD_TABL_ORDBANK-MATNO,
                      S_CUSTNO FOR ZSD_TABL_ORDBANK-CUSTNO ,
                      S_QTNO FOR ZSD_TABL_ORDBANK-QTNO,
                      S_QTDAT FOR ZSD_TABL_ORDBANK-QTDAT,
                      S_QTVDAT FOR ZSD_TABL_ORDBANK-QTVALDAT,
                      S_SONO   FOR ZSD_TABL_ORDBANK-SONO.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN.
       SELECT * FROM  ZSD_TABL_ORDBANK
                   INTO  TABLE ITAB
                   WHERE CCODE IN S_CCODE
                     AND SORG IN  S_SORG
                     AND DISTCHAN IN  S_DCHAN
                     AND DIV IN S_DIV
                     AND MATNO IN  S_MATNO
                     AND CUSTNO IN  S_CUSTNO
                     AND QTNO IN  S_QTNO
                     AND QTDAT IN  S_QTDAT
                     AND QTVALDAT IN  S_QTVDAT
                     AND SONO IN  S_SONO .
          IF SY-SUBRC EQ 0.
             REFRESH ITAB.
             CALL SCREEN 0200.
          ELSE.
             MESSAGE E012(ZQOTBANK) .
          ENDIF.
    *&      Module  SET_STATUS  OUTPUT
          text
    MODULE SET_STATUS OUTPUT.
      SET PF-STATUS '0200'.
      SET TITLEBAR '0200'.
          SELECT * FROM  ZSD_TABL_ORDBANK
                   INTO  TABLE ITAB
                   WHERE CCODE IN S_CCODE
                     AND SORG IN  S_SORG
                     AND DISTCHAN IN  S_DCHAN
                     AND DIV IN S_DIV
                     AND MATNO IN  S_MATNO
                     AND CUSTNO IN  S_CUSTNO
                     AND QTNO IN  S_QTNO
                     AND QTDAT IN  S_QTDAT
                     AND QTVALDAT IN  S_QTVDAT
                     AND SONO IN  S_SONO .
          IF SY-SUBRC EQ 0.
            DESCRIBE TABLE ITAB LINES V_LINES.
            TCL1-LINES = V_LINES.
          ENDIF.
          LOOP AT ITAB.
             QTY = ITAB-QTY.
             UPRICE  = ITAB-UPRICE.
             TOT = QTY * UPRICE .
             ITAB-TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-CGL_QTY.
             UPRICE  = ITAB-CGL_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-CGL_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-BHEL_QTY.
             UPRICE  = ITAB-BHEL_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-BHEL_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-ALSTOM_QTY.
             UPRICE  = ITAB-ALSTOM_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-ALSTOM_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-SIEMENS_QTY.
             UPRICE  = ITAB-SIEMENS_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-SIEMENS_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-TELK_QTY.
             UPRICE  = ITAB-TELK_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-TELK_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-OTH_QTY.
             UPRICE  = ITAB-OTH_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-OTH_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             MODIFY ITAB.
          ENDLOOP.
    ENDMODULE.                 " SET_STATUS  OUTPUT
    *&      Module  SET_LINE_COUNT  INPUT
          text
    MODULE SET_LINE_COUNT OUTPUT.
      LINE_COUNT = SY-LOOPC.
    ENDMODULE.                 " SET_LINE_COUNT  INPUT
    *&      Module SCROLL INPUT
          text
    MODULE SCROLL_SORT INPUT.
    SAVE_OK_CODE = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK_CODE.
      WHEN 'P--'.
          TCL1-TOP_LINE = 1.
      WHEN 'P-'.
          TCL1-TOP_LINE = TCL1-TOP_LINE - LINE_COUNT.
          IF TCL1-TOP_LINE LE 0.
             TCL1-TOP_LINE = 1.
          ENDIF.
      WHEN 'P+'.
          I = TCL1-TOP_LINE + LINE_COUNT.
          J = TCL1-LINES - LINE_COUNT + 1.
          IF J LE 0.
             J = 1.
          ENDIF.
          IF I LE J.
             TCL1-TOP_LINE = I.
          ELSE.
             TCL1-TOP_LINE = J.
          ENDIF.
      WHEN 'P++'.
          TCL1-TOP_LINE = TCL1-LINES - LINE_COUNT + 1.
          IF TCL1-TOP_LINE LE 0.
              TCL1-TOP_LINE = 1.
          ENDIF.
      WHEN 'SORTUP'.
          READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY FLAG = 'X'.
          IF SY-SUBRC = 0.
              SORT ITAB ASCENDING BY (<FS_TCL1>-screen-name+5).
          ENDIF.
      WHEN 'SORTDN'.
          READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY FLAG = 'X'.
          IF SY-SUBRC = 0.
              SORT ITAB DESCENDING BY (<FS_TCL1>-screen-name+5).
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND  INPUT
    *&      Module  UPDATE_MOD  INPUT
          text
    MODULE UPDATE_MOD INPUT.
    CASE OK_CODE.
    WHEN 'SAVE'.
          UPDATE ZSD_TABL_ORDBANK FROM ITAB .
          STS = SY-SUBRC .
          IF STS NE 0.
               MESSAGE E003(ZQOTBANK) .
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " UPDATE_MOD  INPUT
    *&      Module  EXIT_COMAND  INPUT
          text
    MODULE EXIT_COMAND INPUT.
    CASE OK_CODE.
        WHEN 'BACK'.
          CALL FUNCTION 'POPUP_TO_CONFIRM'
            EXPORTING
              TITLEBAR       = 'Order Bank Entry'
              TEXT_QUESTION  = 'Do you want to Go BacK ?'
              TEXT_BUTTON_1  = 'Yes'
              TEXT_BUTTON_2  = 'No'
              DEFAULT_BUTTON = '2'
            IMPORTING
              ANSWER         = ANSWER.
          IF ANSWER = '1'.
            LEAVE TO SCREEN 0.
          ELSE.
          ENDIF.
        WHEN '%EX'.
          CALL FUNCTION 'POPUP_TO_CONFIRM'
            EXPORTING
              TITLEBAR       = 'Order Bank Entry'
              TEXT_QUESTION  = 'Do you want to Exit ?'
              TEXT_BUTTON_1  = 'Yes'
              TEXT_BUTTON_2  = 'No'
              DEFAULT_BUTTON = '2'
            IMPORTING
              ANSWER         = ANSWER.
          IF ANSWER = '1'.
            LEAVE TO SCREEN 0.
          ELSE.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " EXIT_COMAND  INPUT
    Tnx advance

    Hi Moni,
    The Problem is with the READ statement.
    READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY FLAG = 'X'.
    The structure of TCL1 is different from what you think. TCL1 will be a deep structure with an internal table COLS. Now this internal table COLS will have the  standard structure:
    SCREEN
    INDEX
    SELECTED
    VISLENGTH
    INVISIBLE
    The Read statement tries to find a field of name FLAG in the TCL1-COLS structure. Therefore you get the error.
    Try to read the COLS table with a correct key.
    Regards,
    Anand Mandalika.

  • Problem in SORT statement

    Hi Gurus,
    I have this problem, I am trying to sort a internal table with the syntax after endselect statement and before read table statement
    SORT ITAB_SBOOK BY NAME
    name is a field in the table of type CHAR length 25 in actual table and here is how i am declaring name
    in internal table
    name LIKE stravelag-name
    but the sort statement is not executing properly, names are being printed on the screen but they are not
    being formated.
    can some one tell me whare am i wrong ?
    thanks.
    Moderator Message: Please use more descriptive subject line in future post.
    Edited by: Suhas Saha on Dec 25, 2011 7:55 PM

    Hi
    as per my knowledge there is slight diff between type and like keywords
    type key refer the data type of a field where as like key refer the reference of existing  internal table in this just refer the data types not content(data)
    example:
    types:BEGIN OF ty_itab,
          matnr type mara-matnr,
          matkl type mara-matkl,
          mbrsh type mara-mbrsh,
          ersda type mara-ersda,
      END OF ty_itab.
      data:itab type STANDARD TABLE OF ty_itab.
      data:wa_itab type ty_itab.
    we want to create one more internal table with the existing structure  at this time  we will go through the like keyword.
    jtab like itab occurs 10.
    and also check the following code.
    REPORT  sort.
    types:BEGIN OF ty_itab,
          matnr type mara-matnr,
          matkl type mara-matkl,
          mbrsh type mara-mbrsh,
          ersda type mara-ersda,
      END OF ty_itab.
    data:itab type STANDARD TABLE OF ty_itab.
      data:wa_itab type ty_itab.
      select matnr matkl mbrsh ersda from mara into wa_itab.
        APPEND wa_itab to itab.
    ENDSELECT.
    SORT itab by mbrsh.
    write:/ 'matno',' mat group','industry sector','created on'.
    loop at itab into wa_itab.
      write:/ wa_itab-matnr,wa_itab-matkl,wa_itab-mbrsh,wa_itab-ersda.
      endloop.
    best regards
    sreenivas p

  • Upgrade -- Sort sequence difference in ECC 6.0 and 4.7

    Hello friends,
    We are in an upgrade project where the upgrade is from 4.7 version to ECC 6.0 version.
    We are facing few problems on sort when testing our Z developments.
    Suppose the internal table in the program has fields A, B and C.
    We are using the sort statement --> sort itab by A.
    In 4.7, the sort statement sorts the internal table first by A and there is no specific sequence followed for B or C.
    Whereas in ECC 6.0, the sort happens by A followed by B and C.
    So, the final result is, for the user, the output appears different, although the data is the same.
    Please let me know how can we make the output in ECC 6.0 appear as in 4.7.
    Thanks & Regards
    Swapnil

    Hello Swapnil,
    Check for the SORT keyword in transaction abapdocu. You may see the changes made to the functionality in the newer versions.
    Thank You,
    Sai

Maybe you are looking for

  • Configuration issue with Response processor

    Please assist with my issue I am having the following issue with ALPPIM module: Response Processor Current system time is 17-FEB-2010 10:00:30 wferr: - 2008: Could not open unprocessed mail folder. - 2106: Could not open folder '&FOLDER'. NAME=/apps1

  • Lumia 800 bluetooth audio very quiet

    My Lumia 800 connects to a Bluetooth receiver for playing audio files, with no trouble. However the volume of the stream is very very low. I have to turn up the volume on the phone and stereo to max to hear anything. Any ideas anyone?

  • How do I find the app, Adobe flash reader

    I have tried to find this Adobe flash reader threw, APPS an GOOGLE. I hope some one can help me with my issue on getting it.   Thank You, Pockets7.

  • Lumia 1020 SIM card error after WP8.1 update

    I updated my wife's Lumia 1020 to WP8.1. Ever since there has been random SIM card errors. The phone just drops the network while it's idle (not during the phone calls) and gives an error message "SIM card error". Anybody who has experienced the simi

  • WSRP Portlet registration error

    Using the Portal Developer's guide, I created a Java/WSRP portlet and deployed it to a portlet_container. I am now trying to register the portlet and receive this error message from the Oracle Portlet Verification portal and my own Oracle Dev. Previe