Skip to Content

I found the below steps very useful to sort the table maintenance before display.

  • Go to SE11 and enter table name(eg. ZTEST) ->Display
  • Click UTILITIES menu->Table Maintenance Generator
  • Click on ENVIRONMENT menu->Modification->Maintenance screens->Double click on record in the popup.
  • Write one MODULE SORT_EXTRACT (in PBO of the maintenance view screen) to sort exactly before Table Control loop statement(LOOP AT EXTRACT WITH CONTROL)
  • Write the below piece of code at SORT_EXTRACT to sort Table Maintenance.

    MODULE SORT_EXTRACT OUTPUT.

    DATA : IT_ZTEST LIKE ZTEST OCCURS 1WITHHEADER LINE .

    IF NOT SY-UCOMM = ‘NEWL’.

    IT_ZTEST[] = EXTRACT[].

    SORT IT_ZTEST BY F1 F2 F3.

    EXTRACT[] = IT_ZTEST[].

    ENDIF.

    ENDMODULE” SORT_EXTRACT OUTPUT


    Source: An SAP Consultant: SAP ABAP – sorting Table maintenance

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Jƶrg Sauterleute

    I have “optimized” the MODULE Content, to be able to use it more than once

    CODE:

    CASE objh-objectname.    “global field šŸ™‚

      WHEN ‘<YOUR_MAINTVIEW>’. 

        DATA : IT_ZTEST LIKE <YOUR_MAINTVIEW> OCCURS 1 WITH HEADER LINE .

         […]

    ENDCASE.

    (0) 
  2. Former Member

    Hello Chitra, it doesn’t work, I’ve a dumpĀ  OBJECTS_TABLES_NOT_COMPATIBLE ( description: Two internal tables are not compatible or convertible )

    (0) 
  3. Manoj Mohanty

    HiĀ Chitra / Leanid,

    I have modified above code for better performance.

      DATA lt_tab_agent TYPE STANDARD TABLE OF <YOUR TABLE NAME>.
    
      FIELD-SYMBOLS: <lfs_xfrom> TYPE x, "Hexadecimal value of from value
                     <lfs_xto>   TYPE x. "Hexadecimal value of to value
    
      IF NOT sy-ucomm = 'NEWL'.
    
        CLEAR lt_tab_agent[].
    
        LOOP AT extract.
    
          APPEND INITIAL LINE TO lt_tab_agent ASSIGNING <lfs_xto> CASTING.
          ASSIGN extract TO <lfs_xfrom> CASTING.
    
          <lfs_xto> = <lfs_xfrom>.
    
        ENDLOOP.
    
        SORT lt_tab_agent BY <REQUIRED FIELDS>.
    
        REFRESH extract.
        LOOP AT lt_tab_agent INTO <YOUR TABLE NAME>.
    
          APPEND INITIAL LINE TO extract ASSIGNING <lfs_xto> CASTING.
          ASSIGN <YOUR TABLE NAME> TO <lfs_xfrom> CASTING.
    
          <lfs_xto> = <lfs_xfrom>.
    
        ENDLOOP.
    
      ENDIF.

     

     

    (1) 
    1. Manoj Mohanty

      Hi Helen,

      Try like this.

        DATA: lt_tab_agent TYPE STANDARD TABLE OF zbc_mail_support,
              lrt_ucomm    TYPE RANGE OF sy-ucomm INITIAL SIZE 0,
              lwa_ucomm    LIKE LINE OF lrt_ucomm.
      
        FIELD-SYMBOLS: <lfs_xfrom> TYPE x, "Hexadecimal value of from value
                       <lfs_xto>   TYPE x. "Hexadecimal value of to value
      
        REFRESH lrt_ucomm.
        CLEAR lrt_ucomm[].
      
      * Prepare exclude list range for user command
        lwa_ucomm-sign = 'I'.   lwa_ucomm-option = 'EQ'.
        lwa_ucomm-low = 'NEWL'. lwa_ucomm-high = ''.
        APPEND lwa_ucomm TO lrt_ucomm. CLEAR lwa_ucomm.
      
        lwa_ucomm-sign = 'I'.   lwa_ucomm-option = 'EQ'.
        lwa_ucomm-low = 'DELE'. lwa_ucomm-high = ''.
        APPEND lwa_ucomm TO lrt_ucomm. CLEAR lwa_ucomm.
      
        lwa_ucomm-sign = 'I'.   lwa_ucomm-option = 'EQ'.
        lwa_ucomm-low = 'KOPE'. lwa_ucomm-high = ''.
        APPEND lwa_ucomm TO lrt_ucomm. CLEAR lwa_ucomm.
      
        lwa_ucomm-sign = 'I'.   lwa_ucomm-option = 'EQ'.
        lwa_ucomm-low = 'ORGI'. lwa_ucomm-high = ''.
        APPEND lwa_ucomm TO lrt_ucomm. CLEAR lwa_ucomm.
      
        lwa_ucomm-sign = 'I'.   lwa_ucomm-option = 'EQ'.
        lwa_ucomm-low = 'MKAL'. lwa_ucomm-high = ''.
        APPEND lwa_ucomm TO lrt_ucomm. CLEAR lwa_ucomm.
      
        lwa_ucomm-sign = 'I'.   lwa_ucomm-option = 'EQ'.
        lwa_ucomm-low = 'MKBL'. lwa_ucomm-high = ''.
        APPEND lwa_ucomm TO lrt_ucomm. CLEAR lwa_ucomm.
      
        lwa_ucomm-sign = 'I'.   lwa_ucomm-option = 'EQ'.
        lwa_ucomm-low = 'MKLO'. lwa_ucomm-high = ''.
        APPEND lwa_ucomm TO lrt_ucomm. CLEAR lwa_ucomm.
      
        IF NOT sy-ucomm IN lrt_ucomm.
      
        <Write your logic Here>
      
        ENDIF.

       

      Thanks,

      Manoj

       

      (0) 

Leave a Reply