How to sort the fields in ABAP query.

Hi all
I am not able to drag the fields in Sort tool box.
Please help me how to add the fields in Sort tool bar.
Regards
Gangi

In SQ01, when we are creating a query, we can define the default sort sequence & Totals also.
This can be done when defining the basic list.

Similar Messages

  • How to hide some fields in ABAP Query

    Hi,
    My ABAP Query has a long list of extracted fields. I wanted to set some of these output to "HIDE".
    This allow User the flexibility to decide what fields to show.
    How can I set the field to "HIDE" in my query?
    Thanks
    bye

    Hi Tim,
    You can do this by setting the Report layout variant in following steps:
    1. First define the parameter on selection screent for report variant.
    2. Data decelaration for variant.
    3. Value request to get already present variants on report:
    4. If doesn't choose the layout take out the default report layout.
    5. Initialize the report variant.
    6. Apply the variant to the REUSE_ALV_GRID_DISPLAY funtion module.
             Here to generate report variant first to open report output and then as per according to user set the layout of report using the layout icon of ALV with summation on value fields (as required) and create layout name.
    *Data Deceleration as below:
    Data :g_save(1) TYPE c,
    **      g_default(1) TYPE c,
    g_exit(1) TYPE c,
    gx_variant TYPE disvariant,
    g_variant TYPE disvariant.
    *First Define the parameter to give layout of Report variant.
    SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE text-003.
    PARAMETERS: p_vari TYPE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK 3.
    * Process on value request
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    * Selection-Screen Checking
    AT SELECTION-SCREEN.
    PERFORM pai_of_selection_screen.
    INITIALIZATION.
    w_repid = sy-repid.
    PERFORM variant_init.
    * Get default variant
    gx_variant = g_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save     = g_save
    CHANGING
    cs_variant = gx_variant
    EXCEPTIONS
    not_found  = 2.
    IF sy-subrc = 0.
    p_vari = gx_variant-variant.
    ENDIF.
    FORM f4_for_variant .
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
    is_variant = g_variant
    i_save     = g_save
    IMPORTING
    e_exit     = g_exit
    es_variant = gx_variant
    EXCEPTIONS
    not_found  = 2.
    IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    **  ELSE.
    **    IF g_exit = space.
    **    ENDIF.
    ENDIF.
    ENDFORM.                    " f4_for_variant
    FORM pai_of_selection_screen .
    IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    EXPORTING
    i_save     = g_save
    CHANGING
    cs_variant = gx_variant.
    g_variant = gx_variant.
    ELSE.
    PERFORM variant_init.
    ENDIF.
    ENDFORM.                    " pai_of_selection_screen
    FORM variant_init .
    CLEAR g_variant.
    g_variant-report = w_repid.
    ENDFORM.                    " variant_init
    **While Showing report pass the variant :::
    g_save = 'A'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = w_repid
    i_structure_name   = 'IT_MAIN'
    is_layout          = i_layout
    is_print           = i_print
    it_fieldcat        = i_fieldcat[]
    it_events          = i_events[]
    i_save             = g_save
    is_variant         = g_variant
    TABLES
    t_outtab           = it_main
    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.
    Many Thanks / Himanshu Gupta

  • Query: How to add new fields in ABAP query?

    Hi All,
    Can any one tell me how to add new fields in the ABAP query output?
    We have to add the new fields using query design or we have
    to add those in the background program(automatically generated behind query) by selecting new fields in the code?

    What kind of report? Usually, you have to add the field in the table declaration and then also in the SQL query. After that, include the field in what kind of report you are using.

  • How to sort the content of a query

    HI guys,
    I need to know how can i short the result of a query.
    Here is my code.
    DATA qs     TYPE REF TO cl_crm_bol_dquery_service.
      DATA qr     TYPE REF TO if_bol_entity_col.
      qr ?= qs->get_query_result( ).
    i have seen that on the if_bol_entity_con there's a method but it's not implemented.
    Do i have to implement it.
    Thanks
    Jon

    hi,
    Please, use markup to explain your source   
    after, try just to call the method
    qr->IF_BOL_BO_COL~SORT(...)
    Rgds

  • How to move the TR for ABAP query from Dev to Qua

    Hello Experts,
    We are into suppoort project. I have requirement to add one field in the existing query ME80FN. I have copied the standard query in to "Z" and created transaction code for the same. When I move the transport request from dev to quality, only Info set got transported. Quary is not getting transported and also the transaction code as well. Could you please guide me is there any other method we need to use to move the transport request.
    Note: Created query in the global area.
    Regards
    Bala

    Hi,
    you can transport queries between systems in SQ02 (hit the lorry button) or run program RSAQR3TR.
    You download the infosets, queries etc into a file and load them into whichever system you wish.
    Just wanted to share my experience of transporting queries:
    I needed to move a user group, 2 infosets and 3 queries from a 4.6 system to a 4.7 system.
    When I tried doing this via the SQ* transactions I did not get the import/export option, so instead ran RSAQR3TR.
    Step 1. Run RSAQR3TR in 'old' system. Select EXPORT and specify the objects to be transported.
    (System includes these in an automatically created transport request)
    Step 2. Release this transport and request it be transported to 'new' system.
    (This results in the entries being populated in transport table AQTDB in 'new' system).
    Step 3. Run RSAQR3TR in 'new' system. Select IMPORT and tick the Overwrite checkbox. Specify the transport number in the field labelled 'dataset with imports'.
    (RSAQR3TR gives the message that stuff has been imported OK).
    Step 4. In my example I still couldn't find the queries, so ran RSAQR3TR one more time, this time specifying 'Copy Standard Area -> Global Area'.

  • How to document the fields in ABAP DICTIONARY

    Hai,
         For example,I will create one table zuserid_func with three fields ie Airline_id, currency and Area.ok fine.I want to document the two fields(Airline_id and Area).
         How to document this 2 fields,pls help me out

    Hi,
    Document will be created at Data Element level.  Please go to the data element you created.  Then Goto->Documentation->Change  and type your documentation you need.  Alternately you can press the pushbutton <Documentation>  to go into documentation and enter whatever you like.
    When you use this fields in any of your reports etc, you can press f1 to get the documentation you entered.  Hope this clarifies your question.
    Thanks,
    KasthuriRangan Srinivasan

  • Add fields in abap  query

    Hi,
      Please let me know , how to add two fields in ABAP Query.  Please it  showing  two fields in list fileds  but i want to add two into one.
    thanks,
    Sonar

    Thanks  for  Inf
    Here I want  to  print total  of two fields  into  one  field,  where  concatenate  should  be there
    mv_abrmenge, mn_abrmenge  
    select ebelnr, htariftyp, csparte, cvertrag, cvkont, mbelzart, cbegabrpe, cendabrpe, mv_abrmenge, mn_abrmenge, e~budat
    from erchc as e
    join dberchz1 as m
    on ebelnr = mbelnr
    join erch as c
    on mbelnr = cbelnr
    join ever as r
    on cvertrag = rvertrag
    join eanlh as h
    on hanlage = ranlage
    where h~tariftyp in @p1@
    and c~erchc_v = 'X'
    and c~simulation = space
    and c~tobreleasd = space
    and e~budat in @p2@
    and e~simulated = space
    Thanks,
    Sonar

  • How to add join conditions in ABAP Query.

    Hi,
    I need a help on "ABAP Query".
    How to add join conditions in ABAP Query.
    Thanks in advance.
    Thanks & Regards,
    Ramana

    Hi,
    See below code,
    *& Report  ZRNP_ALV_SO
    REPORT  zrnp_alv_so MESSAGE-ID z7rnp .
    INCLUDE zrnp_include .
    *SELECTION SCREEN                                                      *
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-004 .
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln ,
                    s_auart FOR v_auart ,
                    s_vkorg FOR v_vkorg ,
                    s_spart FOR v_spart ,
                    s_kunnr FOR v_kunnr ,
                    s_matnr FOR v_matnr .
    SELECTION-SCREEN END OF BLOCK blk1 .
    *AT SELECTION SCREEN                                                   *
    AT SELECTION-SCREEN.
      SELECT SINGLE vbeln
                     FROM vbak INTO vbak-vbeln
                     WHERE vbeln IN s_vbeln.
      IF sy-subrc <> 0.
        MESSAGE e202.
      ENDIF.
    *START OF SELECTION                                                    *
    START-OF-SELECTION .
      PERFORM data_select.
      PERFORM t_sort USING i_sort .
      PERFORM event_cat USING i_event .
      PERFORM fld_cat USING i_fldcat[] .
      PERFORM t_layout USING i_layout .
      PERFORM fld_cat2 USING i_fldcat2[] .
      PERFORM call_alv.
    * DATA SELECT                                                          *
    *&      Form  DATA_SELECT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM data_select .
      REFRESH: it_vbfa, it_so1, it_del_ful ,it_del1 .
      BREAK-POINT.
      *SELECT*
            *a~vbeln*
            *a~auart*
            *a~vkorg*
            *a~spart*
            *a~kunnr*
            *b~posnr*
            *b~matnr*
            *c~maktx*
            *b~kwmeng*
            *b~vrkme*
            *INTO TABLE it_so1 FROM vbak AS a*
                  *INNER JOIN vbap AS b ON b~vbeln = a~vbeln*
                  *INNER JOIN makt AS c ON c~matnr = b~matnr*
                  *AND c~spras = sy-langu*
                  *WHERE a~vbeln IN s_vbeln .*
      IF sy-subrc = 0.
        SORT it_so1 BY vbeln.
        DELETE ADJACENT DUPLICATES FROM it_so1.
      ENDIF.
    * COLURING DISPLAY                                                     *
      DATA: ld_color(1) TYPE  c .
    *  LOOP AT it_so1 INTO wa_so.
    * Populate color variable with colour properties
    * Char 1 = C (This is a color property)
    * Char 2 = 3 (Color codes: 1 - 7)
    * Char 3 = Intensified on/off ( 1 or 0 )
    * Char 4 = Inverse display on/off ( 1 or 0 )
    *           i.e. wa_ekko-line_color = 'C410'
    *    ld_color = ld_color + 1.
    * Only 7 colours so need to reset color value
    *    IF ld_color = 8.
    *      ld_color = 1.
    *    ENDIF.
    *    CONCATENATE 'C' ld_color '10' INTO wa_so-line_color.
    **  wa_ekko-line_color = 'C410'.
    *    MODIFY it_so1 FROM wa_so.
    *  ENDLOOP .
    *  IF sy-subrc = 0.
      IF NOT it_so1[] IS INITIAL.
        SELECT vbelv
               posnv
               vbeln
               posnn
               vbtyp_n
               INTO TABLE it_vbfa
               FROM vbfa
               FOR ALL ENTRIES IN it_so1
               WHERE vbelv = it_so1-vbeln
               AND   posnn = it_so1-posnr
               AND vbtyp_n ='J' .
        IF sy-subrc = 0.
          SELECT vbeln
                 posnr
                 matnr
                 werks
                 lgort
                 charg
                 lfimg
                 vrkme
                 FROM lips INTO TABLE it_del_ful
                 FOR ALL ENTRIES IN it_vbfa
                 WHERE vbeln = it_vbfa-vbeln
                 AND   posnr = it_vbfa-posnn.
        ENDIF.
      ENDIF.
    ENDFORM.                    " DATA_SELECT
    **************** EVENT CATALOG ****************************************
    *&      Form  EVENT_CAT
    *       text
    *      -->P_I_EVENT  text
    FORM event_cat  USING    p_i_event TYPE slis_t_event .
      REFRESH p_i_event .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    * EXPORTING
    *   I_LIST_TYPE           = 0
       IMPORTING
          et_events             = p_i_event
    * EXCEPTIONS
    *   LIST_TYPE_WRONG       = 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.
      READ TABLE p_i_event WITH KEY name = slis_ev_top_of_page INTO t_event.
      IF sy-subrc = 0.
        MOVE 'TOP_OF_PAGE' TO t_event-form.
        MODIFY p_i_event FROM t_event INDEX sy-tabix TRANSPORTING form.
      ENDIF.
      CLEAR t_event .
    ENDFORM.                    " EVENT_CAT
    **********FORM FOR EVENT TOP_OF_PAGE**********************************
    FORM top_of_page .
      REFRESH i_listheader.
      DATA: t_header TYPE slis_listheader.
      DATA: v_text(50).
      WRITE sy-datum TO v_text.
      CLEAR t_header.
      t_header-typ = 'S'.
      t_header-key = "Date".
      t_header-info = v_text.
      APPEND t_header TO i_listheader.
      CLEAR t_header.
      CLEAR v_text.
      WRITE:  'SALES ORDER & DELIVERY DETAILS REPORT  ' TO v_text .
      t_header-typ = 'S'.
      t_header-key = 'TITLE'.
      t_header-info = v_text.
      APPEND t_header TO i_listheader.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = i_listheader.
    *      I_LOGO             = 'ALV_BACKGROUND'.
    *   I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    ********  FIRST ALV GRID DISPLAY ***************************************
    FORM call_alv .
    * FORM TO MAKE THE CELL CONTENTS INVISIBLE.
    * PERFORM INVISIBLE_CELL_CONTENTS. *
    *EXCLUDE-DECLARATION.
      CLEAR wa_exclude.
      wa_exclude-fcode = '&VEXCEL'.
      APPEND wa_exclude TO i_exclude.
    *&      Form  CALL_ALV
    *       text
    *  -->  p1        text
    *  <--  p2        text
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = sy-repid
    *    I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
         i_callback_user_command           = 'USER_COMMAND1'
         i_callback_top_of_page            = 'TOP_OF_PAGE'
         i_background_id                   = 'ALV_BACKGROUND'
         is_layout                         = i_layout
         it_fieldcat                       = i_fldcat[]
         it_excluding                      = i_exclude
         it_sort                           = i_sort
         it_events                         = i_event
        TABLES
         t_outtab                          = it_so1
    *  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.                    " CALL_ALV
    ************** FIRST FIELDCATALOG *************************************
    *&      Form  FLD_CAT
    *       text
    *      -->P_I_FLDCAT[]  text
    FORM fld_cat  USING    p_i_fldcat TYPE slis_t_fieldcat_alv.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'."TABLE NAME
      i_fldcat-seltext_m   = 'SALES ORDER NO.'.
      i_fldcat-col_pos     = 1.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-hotspot     = 'X'.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'AUART'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'."TABLE NAME
      i_fldcat-seltext_m   = 'SALES DOC. TYPE'.
      i_fldcat-col_pos     = 2.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'VKORG'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'SALES ORG.'.
      i_fldcat-col_pos     = 3.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 12.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'SPART'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'DIVISION'.
      i_fldcat-col_pos     = 4.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 10.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'KUNNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'SOLD TO PARTY'.
      i_fldcat-col_pos     = 5.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'SALES DOC. ITEM'.
      i_fldcat-col_pos     = 6.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 17.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'MATERIAL NO.'.
      i_fldcat-col_pos     = 7.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'MAKTX'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'DESCRIPTION'.
      i_fldcat-col_pos     = 8.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'KWMENG'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'QUANTITY'.
      i_fldcat-col_pos     = 9.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-do_sum    = 'X'.        " For doing "SUM"
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'SALES UNIT'.
      i_fldcat-col_pos     = 10.       " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 10.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
    ENDFORM.                    " FLD_CAT
    ****************** ALV SORTING  ***************************************
    *&      Form  SORT
    *       text
    *      -->P_I_SORT  text
    FORM t_sort  USING    p_i_sort TYPE slis_t_sortinfo_alv .
      DATA: i_sort TYPE slis_sortinfo_alv .
      REFRESH p_i_sort .
      CLEAR i_sort.
      i_sort-spos = 1.
      i_sort-tabname = 'IT_SO1'.
      i_sort-fieldname = 'VBELN'.
      i_sort-up = 'X'.
      i_sort-subtot = 'X'.
      i_sort-group = '*'.
      APPEND i_sort TO p_i_sort.
    ENDFORM.                    " SORT
    *FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
    *  SET PF-STATUS 'ZSTANDARD'.
    *ENDFORM. "Set_pf_status
    ***********FORM FOR EVENT USER_COMMAND1********************************
    FORM user_command1 USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    *CASE R_UCOMM .
    *    WHEN '&IC1' .
    *    IF rs_selfield-FIELDNAME = 'VBELN' .
    *    ENDIF .
    * WHEN OTHERS .
    * ENDCASE .
      CLEAR wa_so.
      REFRESH: it_del1 .
      IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
      rs_selfield-value IS NOT INITIAL.
        READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
        IF sy-subrc = 0.
          LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = wa_so-vbeln
                                       AND   posnv = wa_so-posnr.
            READ TABLE it_del_ful INTO wa_it_del_ful
                 WITH KEY vbeln = wa_vbfa-vbelv
                          posnr = wa_vbfa-posnn.
            IF sy-subrc = 0.
              CLEAR wa_del.
              MOVE wa_it_del_ful TO wa_del.
              APPEND wa_del TO it_del1.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ********* SECOND ALV GRID DISPLAY ***********************************
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        i_callback_program                = sy-repid
    *   I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
        i_callback_user_command           = 'USER_COMMAND2'
        i_callback_top_of_page            = 'TOP_OF_PAGE'
        i_background_id                   = 'ALV_BACKGROUND'
        it_fieldcat                       = i_fldcat2[]
        it_sort                           = i_sort
        TABLES
        t_outtab                          = it_del_ful
    *  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 .                    "USER_COMMAND1
    ********** FORM FOR EVENT USER_COMMAND 2 ******************************
    FORM user_command2 USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CLEAR wa_so.
      REFRESH: it_del1 .
      IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
      rs_selfield-value IS NOT INITIAL.
        READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
    *    IF SY-SUBRC = 0.
    *       LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = WA_SO-vbeln
    *                                    AND   posnv = WA_SO-posnr.
        READ TABLE it_del_ful INTO wa_it_del_ful
             WITH KEY vbeln = rs_selfield-value
                     " vbeln = wa_vbfa-vbeln
                      posnr = wa_vbfa-posnn.
        IF rs_selfield-fieldname = 'VBELN'.
          SET PARAMETER ID 'VL' FIELD wa_vbfa-vbeln .
          CALL TRANSACTION 'VL03' AND SKIP FIRST SCREEN.
        ENDIF .
    *       ENDLOOP.
    *    ENDIF.
      ENDIF.
    ENDFORM .                    "USER_COMMAND2
    ********* SECOND FIELDCATALOG ******************************************
    *&      Form  FLD_CAT2
    *       text
    *      -->P_I_FLDCAT2[]  text
    FORM fld_cat2  USING    p_i_fldcat2 TYPE slis_t_fieldcat_alv .
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-tabname     = 'IT_DEL_FUL'."TABLE NAME
      i_fldcat2-seltext_m   = 'DELIVERY NO.'.
      i_fldcat2-col_pos     = 1.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-hotspot     = 'X'.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'DELIVERY ITEM'.
      i_fldcat2-col_pos     = 2.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'MATERIAL NO.'.
      i_fldcat2-col_pos     = 3.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'WERKS'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'PLANT.'.
      i_fldcat2-col_pos     = 4.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'LGORT'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'ST. LOCATION'.
      i_fldcat2-col_pos     = 5.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'CHARG'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'BATCH NO.'.
      i_fldcat2-col_pos     = 6.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'LFIMG'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'ACT. DEL. QTY.'.
      i_fldcat2-col_pos     = 7.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'SALES UNIT.'.
      i_fldcat2-col_pos     = 8.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
    ENDFORM.                                                    " FLD_CAT2
    ***************** ALV LAYOUT *******************************************
    *&      Form  LAYOUT
    *       text
    *      -->P_I_LAYOUT  text
    FORM t_layout  USING    p_i_layout TYPE slis_layout_alv .
      p_i_layout-zebra  = 'X'.
      p_i_layout-totals_text = 'GRAND TOTAL ='.
    *  p_i_layout-CONFIRMATION_PROMPT = 'X'.
    *  p_i_layout-DEF_STATUS  = ' '.
      p_i_layout-info_fieldname = 'LINE_COLOR'.
    ENDFORM.                    " LAYOUT

  • Creation of local field in ABAP Query

    Hi
    Please let me know how to create a local field in ABAP query. I am finding the option inactive in SQ01.
    Regards
    Priyadarshini

    hi priya,
         *__Adding u201CLocal Fieldu201D (user defined field) in SAP Query_ :
    There is also facility to add the user defined fields in SAP query output. Also we can provide calculation formula for calculating values for this user defined field.
    Calculation formula consists of standard fields from standard SAP tables. So the values fetched for particular standard SAP fields from standard SAP tables get calculated as per the calculation formula defined for the user defined field and displays the value accordingly.
    To do this first go to change mode for Query which automatically takes you to screen shown below and click on icon   , as below :
    Then further screen will appears. So select the Field group and again click on the same icon button   .
    Then switch on the Short names for the fields and give the short names to fields which we need to use in Calculation formula.
    Give the short names and then created u201CLocal Fieldu201D, as shown in below screen shot. Also Short names are given to fields, which can be used further for calculation.
    Defining Local Field u201CREM_QTYu201D along with its field type and Calculation formula.
      In this case we have 
      defined field type for new  
      field as similar to
      ORD_QTY and
      Calculation formula is  
      defined.
    Also its possible to have Conditional logic for Local field by putting Condition in u201CConditionu201D line.
    Now activate this newly added Local field for coming it in output screen. To do the same again go to u201CBasic Listu201D and activate the Local Field as shown below :
    i think this will help u
    regards,
    sindhu.

  • Addition of checkbox and 2 fields in ABap query selection screen

    Hi
    I need to add chack boxes and 2 fields in ABAP query which is using LDB QMI. can u pls let me know how to do that.

    Hi Tarun,
    I am still not clear with the problem..I guess you require plant in your selection screen which you have.
    i guess if you go to sq01tcode there is a option infoset query from where you can give your selection options and value.
    have you selected all the fields in infoset and made a selection screen?
    When you have done with your infoset you just need to diplay the fields and there is a automatic program generated.
    Let me know...
    Regards,
    Nihkil.

  • Including MANDT field in ABAP Query Report as output field

    Hi All,
    I need to display the client(MANDT) field in the ABAP Query Report as an output field.
    But in SQ01 where we select the fields to be displayed as output in query , this field is not visible.
    I later checked in the Infoset. Even in the infoset the field MANDT is greyed out and all other fields are active.
    Can someone tell me how to include the field MANDT in the output of the ABAP Query Report.

    self resolved

  • How to save the data of ABAP report into a notepad in desktop location???

    HI all,
    Can any one tell me how to transfer the data of ABAP report into a Notepad.
    Actually I have to schedule a ABAP report in background on daily basis and I want to transfer the
    whole record into Notepad.
    If any program is available for this..please clearify the relevent code for transferring.
    Thanks
    Rajeev

    declare a character type internal table.
    now move your data from it_data ( internal table with data ) into table itab.
    since you are running this report in background, you cannot save it to the desktop. Instead give any app server location
    data: itab(400) occurs 0 with header line.
    field-symbols: <fs1> type any.
    data: gv_file type rlgrap-filename default 'TEST.TXT'.
    data: gv_filepath type rlgrap-filename default <path>.
    LOOP AT it_data.
        DO 100 TIMES.
          ASSIGN COMPONENT sy-index OF STRUCTURE it_data TO <fs1>.
          IF sy-subrc = 0.
            CONCATENATE itab <fs1> INTO itab SEPARATED BY ' '.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
        SHIFT itab LEFT DELETING LEADING ' '.
        APPEND itab.
        CLEAR itab.
      ENDLOOP.
      concatenate gv_filepath '/' gv_file into gv_file.
      OPEN DATASET gv_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc = 0.
        LOOP AT itab.
          TRANSFER itab TO gv_file.
        ENDLOOP.
        CLOSE DATASET gv_file.
      ENDIF.

  • What is the use of abap query?

    hi sap gurus,
    good morning to all,
    what is the actual relecance of abap query ?
    i know that we can generate simple reports
    but
    what kind of reports ?
    give some examples plz.
    regards,
    balaji.t
    09990019711

    Hi Balaji,
    Here is the details of ABAP Query
    ABAP Query
    An ABAP Workbench tool that enables users without knowledge of the ABAP programming language to define and execute their own reports.
    In ABAP Query, you enter texts and select fields and options to determine the structure of the reports. Fields are selected from functional areas and can be assigned a sequence by numbering.
    ABAP Query offers the following types of reports:
    Basic lists
    Statistics
    Ranked lists
    I hope it will clear for you,
    Regards,
    Murali.

  • HI All, How to improve the performance in given query?

    HI All,
    How to improve the performance in given query?
    Query is..
    PARAMETERS : p_vbeln type lips-vbeln.
    DATA : par_charg TYPE LIPS-CHARG,
    par_werks TYPE LIPS-WERKS,
    PAR_MBLNR TYPE MSEG-MBLNR .
    SELECT SINGLE charg
    werks
    INTO (par_charg, par_werks)
    FROM lips
    WHERE vbeln = p_vbeln.
    IF par_charg IS NOT INITIAL.
    SELECT single max( mblnr )
    INTO par_mblnr
    FROM mseg
    WHERE bwart EQ '101'
    AND werks EQ par_werks (index on werks only)
    AND charg EQ par_charg.
    ENDIF.
    Regards
    Steve

    Hi steve,
    Can't you use the material in your query (and not only the batch)?
    I am assuming your system has an index MSEG~M by MANDT + MATNR + WERKS (+ other fields). Depending on your system (how many different materials you have), this will probably speed up the query considerably.
    Anyway, in our system we ended up by creating an index by CHARG, but leave as a last option, only if selecting by matnr and werks is not good enough for your scenario.
    Hope this helps,
    Rui Dantas

  • How to validate the fields  and how to display the error messagein presenta

    Hi,
    I am new to OBPM 10g, pls tell me how to validate the fields in a presentation.
    for example if we take login presentation if user enters his user name and password wrongle and submit the form. Then we need to display error message right side of the each field i.e user name and passowrd is wrong and try again.
    Regards
    jaya
    Edited by: 12345 on Aug 12, 2010 10:38 PM

    Hi Jaya,
    You can initially set the validation for empty values.. that is when the user dint enters any value and clicks on submit.
    for these vadliations you need to write a method and call it on submit button click!!
    secondly, you can validate for the format if required.
    thirdly, you can validate against a database for the credentials. For this you need to fetch list of usernames from database and search for user entered value in that list.
    Optimal query would be : if user name not null, query for pwd of the entered user name from database or file storage. if you dont get any value for pwd of given username, its incorrect user name. if you get some pwd value for username, then check against the one user entered in pwd field..
    Write all this logic in a method and call on submit button click event of the login form!!
    HTH
    Sharma

Maybe you are looking for

  • Upgrade from Tiger 10.4.11 to Snow Leopard 10.6.5

    I have a MAC desktop with Tiger 10.4.11 and just recently bought another MAC desktop with Snow Leopard 10.6.5. I want to buy the Microsoft Office Home/Student 2011 for MAC 1 user with 3 license. Question: The older 10.4.11 will not support the 2011 e

  • InDesign stops working correctly on some files. Flashing UI and deselecting objects.

    I am using the latest version of InDesign (10.0.0.70) on the latest version of Mac OSX (10.9.4). Recently I have been having an issue with InDesign which only affects some documents. The interface sort of flashes every few seconds sort of like the ap

  • 1.4.2_x binary (jar) incompatibility

    I built an application with JDK 1.4.2_03. The application is put into a jar file. Whereas it runs with 1.4.2_03 and 1.4.2_04 but not with the runtime 1.4.2_09, which complains about an "Invalid or corrupt jarfile". I can run the application with the

  • Scale transform in AffineTransformOp produces row/column of dead pixels

    Hello, On JDK 1.4.1, both Windoze and Linux, the following code: double aScaleFactor = ((double) finalSize) / aSourceSize; AffineTransform aScaleTransform = AffineTransform.getScaleInstance(aScaleFactor, aScaleFactor); AffineTransformOp aScaleOp = ne

  • How to watch my presentation full screen on PC ?

    I have done a presentation in Kenote '05 and I want to watch on PC computer. The problem is that my school's computers doesn't have QT Pro so I won't be able to watch it on full screen. I have tried to export it as a PowerPoint presentation but all t