FUNCTION 'REUSE_ALV_GRID_DISPLAY' - Fieldcat modify in user_command?

Hi,
with ALV function call, is it possible to modify the field catalog when processing the event form 'USER_COMMAND'?
The reason:
Before calling the display, I generate the field catalog. Then I set all unpopulated columns (field is initial in all lines) to 'TECH'. So I see only 'active' columns.
Now, the user can do some interaction which will change the lines values. In event routine for 'USER_COMMAND, I set the selfield-refresh = 'X'.
But now, for some fields, I want to remove the 'TECH' attribute of the field catalog because they get populated.
How to achieve this?
Regards,
Clemens

Ha!
Don't remember who gave me this hint - thank you so uch!
Function group SLVC_FULLSCREEN
hast the FMs
REUSE_ALV_GRID_DISPLAY,
REUSE_ALV_GRID_DISPLAY_LVC
and also
GET_GLOBALS_FROM_SLVC_FULLSCR
Here you have the exporting parameter E_GRID as a reference of current instance of CL_GUI_ALV_GRID.
You may use this to access all the methods as i.e. GET_FRONTEND_FIELDCATALOG and SET_FRONTEND_FIELDCATALOG
and whatever more you want.
Makes use of OO technology almost obsolete
Regards,
Clemens

Similar Messages

  • Displaying table using call function 'REUSE_ALV_GRID_DISPLAY'

    I have created a table which has product code, product description, and product level.  I am trying to display it using REUSE_ALV_GRID_DISPLAY.  When I Check it, I get the following error message: "PVS2" is not an internal table - the "Occurs n" specification is missing.
    Is it possible to copy PVS2 into another table, and then display that table using REUSE_ALV_GRID_DISPLAY?
    I have patched together code from sdn, a client program, and my own code and I am starting to get confused.  So, please help me.
    Regards,
    Al Lal
    REPORT  YABHINAV16.
    * program to display products at chosen level *
    Tables: T179, T179t.
    types:  begin of hierarchy,
            prodh type t179-prodh,
            vtext type t179t-vtext,
            stufe type t179-stufe,
            end of hierarchy.
    types: begin of text,
    prodh type t179t-prodh,
    vtext type t179t-vtext,
    end of text.
    data: pvs type standard table of hierarchy initial size 0.
    data: pvs2 type hierarchy.
    data: it_text type standard table of text,
    wa_text type text.
    TYPE-POOLS:SLIS.
    *For ALV
    DATA: GT_FLD TYPE SLIS_T_FIELDCAT_ALV,
          GT_EV TYPE SLIS_T_EVENT,
          GT_HDR TYPE SLIS_T_LISTHEADER,
          GT_SORT TYPE SLIS_T_SORTINFO_ALV.
    DATA: WA_FLD TYPE SLIS_FIELDCAT_ALV,
          WA_EV TYPE SLIS_ALV_EVENT,
          WA_HDR TYPE SLIS_LISTHEADER,
          WA_SORT TYPE SLIS_SORTINFO_ALV,
          WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DEFINE FLD.
      WA_FLD-FIELDNAME   = &1.
      WA_FLD-TABNAME     = &2.
      WA_FLD-OUTPUTLEN   = &3.
      WA_FLD-SELTEXT_L   = &4.
      WA_FLD-SELTEXT_M   = &5.
      WA_FLD-SELTEXT_S   = &6.
      WA_FLD-COL_POS     = &7.
      WA_FLD-FIX_COLUMN  = &8.
      WA_FLD-DO_SUM      = &9.
      APPEND WA_FLD TO GT_FLD.
      CLEAR WA_FLD.
    END-OF-DEFINITION.
    CONSTANTS: C_TOP TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
               C_USER_COMMAND            TYPE  SLIS_FORMNAME  VALUE 'USER_COMMAND'.
    DATA: MTRL LIKE SY-REPID,
          TITLE LIKE SY-TITLE.
    select-options level for t179-stufe no intervals.
    start-of-selection.
    Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
    select prodh vtext from t179t into corresponding fields of table it_text for all entries in pvs where prodh = pvs-prodh.
    end-of-selection.
    sort pvs by prodh.
    sort it_text by prodh.
    loop at pvs into pvs2.
      read table it_text into wa_text with key prodh = pvs2-prodh.
      if sy-subrc eq 0.
        pvs2-vtext = wa_text-vtext.
        write: / pvs2-prodh, pvs2-vtext, pvs2-stufe.
      endif.
    *  modify pvs2.
    endloop.
    perform BUILD_FIELDCAT.
    perform GRID_DISPLAY.
    form BUILD_FIELDCAT .
        FLD 'PRODH'   'PVS2'   '20'     'Product Hierarchy'        ' ' ' '  '1'  ''   '' .
        FLD 'VTEXT'   'PVS2'   '40'     'Description '        ' ' ' '  '3'  ''   '' .
        FLD 'STUFE'   'PVS2'    '5'    'Level'        ' ' ' '  '2'  ''   '' .
    endform.                    " BUILD_FIELDCAT
    form GRID_DISPLAY .
      call function 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM      = MTRL
          I_CALLBACK_USER_COMMAND = 'C_USER_COMMAND'
          I_CALLBACK_TOP_OF_PAGE  = C_TOP
          I_STRUCTURE_NAME        = 'PVS2'
          IS_LAYOUT               = WA_LAYOUT
          IT_FIELDCAT             = GT_FLD
          IT_SORT                 = GT_SORT
          I_DEFAULT               = 'X'
          I_SAVE                  = 'U'
          IT_EVENTS               = GT_EV
        TABLES
          T_OUTTAB                = PVS2[]
        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.
    endform.                    " GRID_DISPLAY

    TYPE-POOLS : SLIS.
    DATA : BEGIN OF WA_T001,
                 BUKRS LIKE T001-BUKRS,
                 BUTXT LIKE T001-BUTXT,
                 ORT01 LIKE T001-ORT01,
                 END OF WA_T001,
                 IT_T001 LIKE TABLE OF WA_T001.
    DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
                WA_FCAT LIKE LINE OF IT_FCAT.
    DATA : V_NAME LIKE  SY-REPID.
    SELECT BUKRS BUTXT ORT01 FROM T001 INTO TABLE IT_T001 UP TO 15 ROWS. V_NAME = SY-REPID.
    CALL FUCTION MODULE 'REUSE_ALV_FIELDCATLOG_MERGE. EXPORTING  I_CALBACK_PROGRAM =
    V_NAME I_INTERAL_TABNAME = 'WA_T001' I_INCLNAME = V_NAME CHANGING CT_FIELDCAT =
    IT_FCAT.
    CALL FUNCTION MODULE "REUSE_ALV_GRID_DISPLAY"
    EXPORTING
    I_CALLBACK_PROGRAM = V_NAME
    IT_FCAT = IT_FCAT.
    TABLES
         T_OUTTAB  = IT_T001
    SY-REPID IS THE SYSTEM VARIABLE WHICH IS HAVING THE ABAP PROGRAM 
    OR CURRENT MAIN PROGRAM.
    ----- Sample Progam -
    ***INCLUDE YRVR058_DEST_WISE_SUMMARY_DF01 .
    *&      Form  DISPLAY_DATA
          text      *-- Rajesh Vasudeva
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_DATA .
      IF ITAB[] IS NOT  INITIAL.
        PERFORM F_APPEND_BLOCK.
      ELSE.
        MESSAGE 'Data not found for the selection
    criteria' TYPE 'S'.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " display_data
    *&      Form  f_append_block
          text
    -->  p1        text
    <--  p2        text
    FORM F_APPEND_BLOCK .
      DATA : L_WA_SORT    TYPE SLIS_SORTINFO_ALV,   "For
    sort
             L_WA_EVENTS  TYPE SLIS_ALV_EVENT.      "For
    events
    Event (Top of List)
      CLEAR L_WA_EVENTS.
      L_WA_EVENTS-NAME = SLIS_EV_TOP_OF_LIST.
      L_WA_EVENTS-FORM = C_TOPOFPAGE.
      APPEND L_WA_EVENTS TO I_EVENTS_PART.
    Event (Top of Page)
      CLEAR L_WA_EVENTS.
      L_WA_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      L_WA_EVENTS-FORM = 'F_DISPLAY_HEADER_PARTA'(031).
      "f_display_header_part
      APPEND L_WA_EVENTS TO I_EVENTS_PART.
    Event (End of List)
      CLEAR L_WA_EVENTS.
      L_WA_EVENTS-NAME = SLIS_EV_END_OF_LIST.
      L_WA_EVENTS-FORM = C_END_OF_LIST.
      APPEND L_WA_EVENTS TO I_EVENTS_PART.
    Set Layout Zebra
      STRUCT_LAYOUT-ZEBRA          = 'X'.
      STRUCT_LAYOUT-NUMC_SUM       = 'X'.
      STRUCT_LAYOUT-TOTALS_TEXT    = 'TOTAL:'(032).
    set field catalog
      PERFORM F_FIELD_CATALOG_PART.
      ASSIGN ITAB[] TO <F_OUTTAB>.
      V_PART = 'A'.  "initiating list is A
      PERFORM F_DISPLAY_BLOCK USING STRUCT_LAYOUT
                                   I_FIELD_CAT_PART[]
                                   C_TAB
                                   I_EVENTS_PART[]
                                   I_SORT_PART[].
    ENDFORM.                    " f_append_block
    *&      Form  f_field_catalog_part
          text
    -->  p1        text
    <--  p2        text
    FORM F_FIELD_CATALOG_PART .
      REFRESH I_FIELD_CAT_PART.
      CLEAR I_FIELD_CAT_PART.
      PERFORM F_CREATE_CATALOG USING :
    *Month
    C_TAB 'MONTH'  'MONTH'      SPACE 'L' 7
    I_FIELD_CAT_PART[],
    *OBD
    *C_TAB 'VBELN'  'Delivery'      SPACE 'L' 12
    I_FIELD_CAT_PART[],
    *DATE
    C_TAB 'WADAT_IST'  'Date'      SPACE 'L' 10
    I_FIELD_CAT_PART[],
    *Destination
    C_TAB 'CITY1'  'Destination'      SPACE 'L' 25
    I_FIELD_CAT_PART[],
    *Qty By Road
    C_TAB 'NTGEW_ROAD'  'Road Quantity'   SPACE 'R' 16
    I_FIELD_CAT_PART[],
    *Rail Qty
    C_TAB 'NTGEW_RAIL'  'Rail Quantity'  SPACE 'R' 16 I_FIELD_CAT_PART[],
    *Total  Qty C_TAB 'TOT'  'Total Quantity'  SPACE 'R' 16 I_FIELD_CAT_PART[], *RR/Trk No.
      C_TAB 'EXTI2'  'Truck/RR No.' SPACE 'L' 17 I_FIELD_CAT_PART[].
    ENDFORM.                    " f_field_catalog_part
    *&      Form  f_DISPLAY_block
          text
         -->P_STRUCT_LAYOUT  text
         -->P_I_FIELD_CAT_PART[]  text
         -->P_C_TAB  text
         -->P_I_EVENTS_PART[]  text
         -->P_I_SORT_PART[]  text
    FORM F_DISPLAY_BLOCK  USING  FP_LAYOUT         TYPE
    SLIS_LAYOUT_ALV
                                 FP_I_FCAT         TYPE
    SLIS_T_FIELDCAT_ALV
                                 VALUE(FP_TABNAME) TYPE
    ANY
                                 FP_I_EVENTS       TYPE
    SLIS_T_EVENT
                                 FP_I_SORT         TYPE
    SLIS_T_SORTINFO_ALV.
      DATA: V_REPID  TYPE SYREPID,                 
    "current Program id
            C_SAVE       TYPE CHAR1 VALUE 'A'.     
    "variant save
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    *CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = V_REPID
          IS_LAYOUT          = FP_LAYOUT
          IT_FIELDCAT        = FP_I_FCAT[]
          IT_SORT            = FP_I_SORT[]
          I_SAVE             = C_SAVE             "variant
    save
          IT_EVENTS          = FP_I_EVENTS[]
        TABLES
          T_OUTTAB           = <F_OUTTAB>
        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.
    ENDFORM.                    " f_DISPLAY_block
    *&      Form  f_create_catalog
          text
         -->P_C_TAB  text
         -->P_0085   text
         -->P_0086   text
         -->P_SPACE  text
         -->P_0088   text
         -->P_5      text
         -->P_I_FIELD_CAT_PART[]  text
    FORM F_CREATE_CATALOG  USING  FP_I_TABNAME   TYPE
    SLIS_TABNAME
                                  FP_I_FIELDNAME TYPE SLIS_FIELDNAME
                                  FP_I_SELTEXT   TYPE
    SCRTEXT_L
                                  FP_I_DOSUM     TYPE
    CHAR1
                                  FP_I_JUST      TYPE C
                                  FP_I_OUTPUTLEN TYPE
    OUTPUTLEN
                                  FP_I_FCAT      TYPE
    SLIS_T_FIELDCAT_ALV.
    Record for field catalog
      DATA: L_REC_FCAT TYPE SLIS_FIELDCAT_ALV.
      L_REC_FCAT-TABNAME   = FP_I_TABNAME.
      L_REC_FCAT-FIELDNAME = FP_I_FIELDNAME.
      L_REC_FCAT-SELTEXT_L = FP_I_SELTEXT.
      L_REC_FCAT-DO_SUM    = 'X'.
    *l_rec_fcat-do_sum    = ' '.
      L_REC_FCAT-JUST      = FP_I_JUST.
      L_REC_FCAT-OUTPUTLEN = FP_I_OUTPUTLEN.
      L_REC_FCAT-DECIMALS_OUT = '2'.
      L_REC_FCAT-KEY          = '1'.
      APPEND L_REC_FCAT TO FP_I_FCAT.
    ENDFORM.                    " f_create_catalog
         Subroutines for Headings
    *&      Form  f_display_header_partA
          Display header for report for Part A
    *&      Form  top_of_page
          text
    -->  p1        text
    <--  p2        text
    FORM TOP_OF_PAGE .
      SKIP 1.
      WRITE:/25 ' Name of Company ',80 'RUN DATE' ,
    SY-DATUM.
    SKIP 1.
    WRITE:/60 'RUN DATE' , SY-DATUM.
      SKIP 1.
      DATA: YR(4) TYPE N,
             FIN_PRD(10) TYPE C.
      IF S_DTABF-LOW+4(2) LT '04'.
        YR = S_DTABF-LOW+0(4) - 1.
        CONCATENATE YR '-' S_DTABF-LOW+2(2) INTO FIN_PRD.
      ELSE.
        YR = S_DTABF-LOW+0(4) + 1.
        CONCATENATE S_DTABF-LOW0(4) '-' YR2(2) INTO
    FIN_PRD.
      ENDIF.
      WRITE:/5 'DETAILS OF THE MONTH/DATE WISE DESPATCHES
    MADE BY ROAD/RAIL DURING THE YEAR ' , FIN_PRD  .
      SKIP 1.
    WRITE :/ 'SALES OFFICE : ' , P_SALES,' ' , RNAME.
    SKIP 1.
    ENDFORM.                    " DISPLAY_DATA
    Award Points If Useful...

  • Function REUSE_ALV_GRID_DISPLAY

    Hi !
    I wanted to ask few questions concern a standard sap ALV report created by the function REUSE_ALV_GRID_DISPLAY :
    1. How to  make columns editable, and to enable the user to change values of the columns ?
    2. How to make drop down list to a column ?
    3. How to add a function code to the ALV toolbar ?
    4. When i use the abap commands at event handler user_command_l :
      READ TABLE object_tab INDEX p_selfield-tabindex INTO l_struct.
      IF sy-subrc EQ 0.
        SET PARAMETER ID: 'QPN' FIELD l_struct-field1 .
        CALL TRANSACTION 'QPR2' AND SKIP FIRST SCREEN.
       endif.
    Then abap navigate to 'QPR2' transaction however i get the error mesage "field1 is already being processed by my user". My question is how to enable using field1 before the navigation ?
    Please give additional  material besides the documentation of the REUSE_ALV_GRID_DISPLAY function.
    Thanks
    Moshe

    Hi Mohse,
    1.How to make columns editable, and to enable the user to change values of the columns
    use layout.
    layout-EDIT = 'X'.
    and pass this layout while calling FM.
    2. How to make drop down list to a column ?
       If the field in the internal table
       is assigned to table-field name,eg. t001-bukrs,
      then ,probably, it will come automatically!
    ( i doubt)
    3. How to add a function code to the ALV toolbar ?
      a) from se80, function group salv,
        copy the gui status 'STANDARD'
        (by right clicking)
        to your program
       with the name say , 'STANDARD_COPY'
       B) WRITE ONE FORM.
      FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'STANDARD_COPY'.
    ENDFORM.                    "SET_PF_STATUS
      C) WHILE CALLING fm reuse_alv_list_display
        also pass this  parameter :
           i_callback_pf_status_set = 'SET_PF_STATUS'
      MAKE SURE YOUR GUI STATUS IS ACTIVE IN UR PROGRAM.
    PS
    4.
    Then abap navigate to 'QPR2' transaction however i get the error mesage "field1 is already being processed by my user". My question is how to enable using field1 before the navigation ?
    This is becuase, in another session,
    u must have opened this tcode
    with the same value.
    Hence, it tries to tell that,
    two users cannot access/modify it simulataenouslyy.
    This is not alv problem, but general
    security /locking maintained by r3.
    Just close all other session of this tcode.
    and try agin. it will work.
    regards,
    amit m.
    Message was edited by: Amit Mittal
    Message was edited by: Amit Mittal

  • List error in Function REUSE_ALV_GRID_DISPLAY  /_\  (urgent)

    Hi All 
    My system is ECC6, unicode.
    I had created a filed text(50), and i put 50 word into the field.
    text = '&#65297;&#65298;&#65299;&#65300;&#65301;&#65302;&#65303;&#65304;&#65305;&#65313;&#65297;&#65298;&#65299;&#65300;&#65301;&#65302;&#65303;&#65304;&#65305;&#65314;&#65297;&#65298;&#65299;&#65300;&#65301;&#65302;&#65303;&#65304;&#65305;&#65315;&#65297;&#65298;&#65299;&#65300;&#65301;&#65302;&#65303;&#65304;&#65305;&#65316;&#65297;&#65298;&#65299;&#65300;&#65301;&#65302;&#65303;&#65304;&#65305;&#65317;'
    When I used the function 'REUSE_ALV_GRID_DISPLAY' to list data
    It only list 42 word on screen.
    text = '&#65297;&#65298;&#65299;&#65300;&#65301;&#65302;&#65303;&#65304;&#65305;&#65313;&#65297;&#65298;&#65299;&#65300;&#65301;&#65302;&#65303;&#65304;&#65305;&#65314;&#65297;&#65298;&#65299;&#65300;&#65301;&#65302;&#65303;&#65304;&#65305;&#65315;&#65297;&#65298;&#65299;&#65300;&#65301;&#65302;&#65303;&#65304;&#65305;&#65316;&#65297;&#65298;'
    How to resolve it ???
    Please help me..  Thanks in advance...
    Regards,DDT

    Hi
    Where are you displaying text ? is that part of the column of the record or displaying on the header ?
    I am able to display by setting like that .
    [Check the screen shot.|http://bp1.blogger.com/_O5f8iAlgdNQ/SAD_cVWiN8I/AAAAAAAAA-U/VW2fzLZ1yIA/s1600-h/grid-744999.JPG]
    and program for that .
    REPORT  zvenkat_alv_grid.
    TABLES:t001.
    "Types
    TYPES:
          BEGIN OF t_1001,
            bukrs TYPE t001-bukrs,
            butxt TYPE t001-butxt,
            ort01 TYPE t001-ort01,
            land1 TYPE t001-land1,
            text  TYPE string,
          END OF t_1001.
    "Work area
    DATA:
          w_t001 TYPE t_1001.
    "Internal table
    DATA:
          i_t001 TYPE STANDARD TABLE OF t_1001.
    " ALV Declarations
    * Types Pools
    TYPE-POOLS:
       slis.
    * Types
    TYPES:
       t_fieldcat         TYPE slis_fieldcat_alv,
       t_events           TYPE slis_alv_event,
       t_layout           TYPE slis_layout_alv.
    * Workareas
    DATA:
       w_fieldcat         TYPE t_fieldcat,
       w_events           TYPE t_events,
       w_layout           TYPE t_layout.
    * Internal Tables
    DATA:
       i_fieldcat         TYPE STANDARD TABLE OF t_fieldcat,
       i_events           TYPE STANDARD TABLE OF t_events.
    *&    start of selection
    START-OF-SELECTION.
      PERFORM get_data.
    *&    end-of-selection.
    END-OF-SELECTION.
      PERFORM build_fieldcatlog.
      PERFORM build_events.
      PERFORM build_layout.
      PERFORM list_display.
    *&      Form  get_data
    FORM get_data .
      SELECT bukrs
             butxt
             ort01
             land1
        FROM t001
        INTO TABLE i_t001
        UP TO 30 ROWS.
    w_t001-text = 'aaaaaaaaa1aaaaaaaaa2aaaaaaaaa3aaaaaaaaa4aaaaaaaaa5aaaaaaaaa6aaaaaaaaa7aaaaaaaaa8aaaaaaaaa9aaaaaaaa10'.
    modify i_t001 FROM w_t001 INDEX 1.
    ENDFORM.                    " get_data
    *&      Form  build_fieldcatlog
    FORM build_fieldcatlog .
      CLEAR:w_fieldcat,i_fieldcat[].
      PERFORM build_fcatalog USING:
               'BUKRS' 'I_T001' 'BUKRS',
               'BUTXT' 'I_T001' 'BUTXT',
               'ORT01' 'I_T001' 'ORT01',
               'LAND1' 'I_T001' 'LAND1',
               'TEXT'  'I_T001' 'TEXT'.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  BUILD_FCATALOG
    FORM build_fcatalog USING l_field l_tab l_text.
      w_fieldcat-fieldname      = l_field.
      w_fieldcat-tabname        = l_tab.
      w_fieldcat-seltext_m      = l_text.
      IF l_field = 'TEXT'.
        w_fieldcat-outputlen      = '120'..
      ENDIF.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " build_fieldcatlog
    *&      Form  build_events
    *       text
    FORM build_events.
      CLEAR :
            w_events, i_events[].
      w_events-name = 'TOP_OF_PAGE'."Event Name
      w_events-form = 'TOP_OF_PAGE'."Callback event subroutine
      APPEND w_events TO i_events.
      CLEAR  w_events.
    ENDFORM.                    "build_events
    *&      Form  build_layout
    FORM build_layout .
      w_layout-colwidth_optimize = 'X'.
      w_layout-zebra             = 'X'.
    ENDFORM.                    " build_layout
    *&      Form  list_display
    FORM list_display .
      DATA:
            l_program TYPE sy-repid.
      l_program = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = l_program
          is_layout          = w_layout
          it_fieldcat        = i_fieldcat
          it_events          = i_events
        TABLES
          t_outtab           = i_t001
        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.
    ENDFORM.                    " list_display
    *&      Form  top_of_page
    FORM top_of_page.
      DATA :
       li_header TYPE slis_t_listheader,
       w_header  LIKE LINE OF li_header.
      DATA:
            l_date TYPE char10.
      WRITE sy-datum TO l_date.
      w_header-typ  = 'H'.
      CONCATENATE sy-repid ':' 'From Date' l_date INTO w_header-info SEPARATED BY space.
      APPEND w_header TO li_header.
      CLEAR w_header.
      w_header-typ  = 'S'.
      w_header-info = sy-title.
      APPEND w_header TO li_header.
      CLEAR w_header.
      w_header-typ  = 'A'.
      w_header-info = sy-uname.
      APPEND w_header TO li_header.
      CLEAR w_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = li_header.
    *  w_fieldcat-fieldname      = 'TEXT'.
    *  w_fieldcat-tabname        = 'ITAB'.
    *  w_fieldcat-seltext_m      = 'Text Description'. "Column heading.
    *  w_fieldcat-outputlen      = '120'.              "Max length 120
    *  APPEND w_fieldcat TO i_fieldcat.
    *  CLEAR w_fieldcat.
    ENDFORM.                    "
    Regards,
    Venkat.O

  • CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    Dear Experts,
    I hv created a report using ALV.
    Problem is ,  until I call "CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'" function module, my internal table is sorted fine. but after this function module ( i hv seen in debug mode) , the sort order is getting changed.
    I hv not used any kind of sort in update catalog funcion.
    w_repid = sy-repid.
      PERFORM update_catalog.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                 = w_repid
         I_CALLBACK_USER_COMMAND            = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE             = 'TOP-OF-PAGE'
         IT_FIELDCAT                        = i_fcat[]
         I_SAVE                             = 'X'
        TABLES
          T_OUTTAB                          = i_faglflexa_all
    *  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.
    can any one suggest something.
    Regards,
    maverick

    Thanks for ur reply.
    itab_open.
    status doc no 
    open     101
    open     102
    open     103
    itab_all.
    append itab_open[] to itab_all.
    sort itab_all by date.
    itab_clear
    status doc no 
    clear     104
    clear     105
    claer     106
    loop at itab_clear.
      append itab_clear to itab_all.
    endloop.
    i hv sorted my internal table itab_all based on date only once after copying the data from itab_open. Then i appended the data from itab_clear.
    now  I call CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                 = w_repid
         I_CALLBACK_USER_COMMAND            = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE             = 'TOP-OF-PAGE'
         IT_FIELDCAT                        = i_fcat[]
         I_SAVE                             = 'X'
         IT_SORT                            = ''
        TABLES
          T_OUTTAB                          = itab_all
    *  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.
    and i get the following output.
    status doc no 
    open     101
    open     102
    clear     104
    clear     105
    claer     106
    open     103
    tha's the problem.  why one open item is displayed at the end.  i sorted itab_all after  copying the data from itab_open and after itab_clear.
    regards,
    Maverick

  • FUNCTION 'REUSE_ALV_GRID_DISPLAY': KEYBOARD ENTER

    Hi ALV Experts,
    in a user dialog, I call FUNCTION 'REUSE_ALV_GRID_DISPLAY' as a POPUP screen to show relevant data.
    The User can leave the grid by closing the window (ALT-F4 or mouse-click on top-right-corner) or click the ENTER green hook in the menu bar below the grid.
    Now they asked me why it does not react to hitting the ENTER key on the keyboard.
    Actually, I know that SAP has problems with fully integrating some kind of standard, but I don't know if it is possible to make this ALV-popup sensible to detect the ENTER key.
    Thank you to all readers,
    also for all answers not related to the question
    Regards,
    Clemens

    Thank you all,
    it does not help. I do not use an own status and will not implement it.
    OK, I implemented a call-back-functionality.
    So, if the user doubleclicks on the information, the call-backk user_command is called and I set the parameter structure field selfield-exit = 'X'.
    This way the grid is closed as well.
    The thing is that the enter button of the status is set to application function &ONT. This function is not set as default. Hitting ENTER will not trigger anything at all.
    Regards,
    Clemens
    P.S. How to award points to myself? <grin>

  • FUNCTION 'REUSE_ALV_GRID_DISPLAY' with checkbox

    Hello,
    A short question.
    I'm using the function 'REUSE_ALV_GRID_DISPLAY'. One of the columns is a character field which is displayed as a checkbox in the ALV by enabling the key "checkbox" and I also enable the "edit" key in the field catalog structure. So far so good.
    But my question is the following:
    When I set the key "edit" to false the ALV grid is displayed in a nice color grid. But when I enable the edit key the whole grid is showed in gray without the checkbox. Is it possible to set the checkbox to edit mode and also display the ALV grid in color?
    An other question I have is the following:
    Who could give me an example to use the grid in combination with special groups.
    Kind regards,
    Richard Meijn

    I'll put the most important parts of my code here:
    When I anable the line "ls_fieldcat-edit = abap_true."
    for the field 'ATB_SEL' the grid is showed in gray?
    REPORT  YMM_ATB_LIJST_GOEDGEKEURD2  no standard page heading
            message-id ycdg.
    TYPE-POOLS: SLIS,
                sdydo,
                abap,                "ABAP reporting types / constants
                icon.                "Possible icons
    DATA: fieldcatalog  TYPE slis_t_fieldcat_alv ,
          gd_tab_group  TYPE slis_t_sp_group_alv,
          gd_layout     TYPE slis_layout_alv,
          gd_repid      LIKE sy-repid.
    Internal tables, needed for ALV formatting
    DATA: ta_comment        TYPE slis_t_listheader. "Top of page of the ALV
    INCLUDE <icon>.
    $$----
    *-- Constants
    $$----
    CONSTANTS:
      co_background_alv     TYPE  sdydo_key VALUE 'ALV_WALLPAPER',
      co_save               TYPE c          VALUE 'A',
      co_msgty_inf          TYPE symsgty    VALUE 'I'.
    Constants for interactive functions of an ALV
    CONSTANTS:
      co_double_click       TYPE syucomm   VALUE '&IC1',  "CHOOSE / F2
    Customer interactive functions for the ALV
      co_sec_list
         TYPE syucomm   VALUE 'SEC_LIST'.
    "Secundary list
    Names of the routines to be called dynamically from the ALV function
    CONSTANTS:
      co_rout_pf_stat       TYPE char30    VALUE 'R0_SET_PF_STATUS',
      co_rout_ucomm         TYPE char30    VALUE 'R1_PROCESS_USER_COMMAND',
      co_rout_top_of_page   TYPE char30    VALUE 'R2_SET_TOP_OF_PAGE',
      co_rout_html_top      TYPE char30    VALUE 'R3_SET_HTML_TOP_OF_PAGE',
      co_rout_html_end      TYPE char30    VALUE 'R4_SET_HTML_END_OF_LIST',
      co_rout_pf_stat_sec   TYPE char30    VALUE 'R5_SET_PF_STATUS_SEC',
      co_rout_ucomm_sec     TYPE char30    VALUE 'R6_PROCESS_UCOMM_SEC',
      co_rout_top_page_sec  TYPE char30    VALUE 'R7_SET_TOP_OF_PAGE_SEC'.
    CONSTANTS:
      co_struc              TYPE tabname   VALUE '/CTAC/S_ALV_STRUCTURE',
      co_struc_sec          TYPE tabname   VALUE '/CTAC/S_ALV_STRUC_SEC'.
    CONSTANTS: line_feed(2) TYPE x VALUE '0D0A'.
    FIELD-SYMBOLS <crlf> TYPE x.
    DATA: w_crlf(2)  TYPE c.
    ASSIGN w_crlf TO <crlf> CASTING.
    <crlf> = line_feed.
    DATA:
    BEGIN OF IT_EBAN occurs 0,
            ATB_SEL(1)     TYPE C,   " Selectie optie om geselecteerde
                                     " ATB's uit te printen.
            ATB_FORM(4),             " ATB icon om ingevoerd ATB-formulier
                                     " te tonen.
            banfn LIKE EBAN-banfn,   " Aanvraag-tot-bestellen-nummer
            bnfpo LIKE EBAN-bnfpo,   " Positienummer van
                                     " aanvraag tot bestellen
            txz01 LIKE EBAN-txz01,   " Korte tekst
            matkl LIKE MARA-matkl,   " Goederengroep
            lifnr LIKE EBAN-lifnr,   " Gewenste leverancier
            name1 LIKE lfa1-name1,   " Gewenste leverancier
            lfdat LIKE EBAN-lfdat,   " Leveringsdatum van de positie
            opm(1) TYPE C,
            bijlage(1) TYPE C,
            controle(1) TYPE C,      " Advies geselecteerd
            onvolledig(1) TYPE C,     "Om aan te geven dat er
                                     " ongekeurde regels
                                     " zijn
            c_koptekst(1) TYPE C,      " Om aan te geven dat er
                                     " kopteksten zijn
            badat LIKE EBAN-badat,   " Aanvraagdatum
            kritisch(1) TYPE C,      " Om aan te geven dat de bestelling
                              " kritisch is
            workflow(1) TYPE C,      "Om aan te geven dat er nog een WF
                                     " voor loopt
            wf_old(1)   TYPE C,       "Er is een afgesloten WF of lopende WF
            wi_id TYPE sww_wiid,
            ernam LIKE eban-ernam,    " Naam van de medewerker die
                                      " het object heeft toegevoegd
            preis LIKE EBAN-preis,    " Prijs in de aanvraag tot bestellen
            peinh LIKE EBAN-peinh,    " Prijseenheid
            menge LIKE EBAN-menge,    " ATB-hoeveelheid
            totaal TYPE GSWRT,
            waers LIKE EBAN-waers,    " Valutacode
            koptekst TYPE string,
      END OF it_eban.
    *DATA: it_eban TYPE TABLE OF t_eban ,
    DATA:     wa_eban like it_eban.
    *TYPES: BEGIN OF T_EBAN2,
    DATA:
    BEGIN OF IT_EBAN2 occurs 0,
            BANFN LIKE EBAN-BANFN,   " Aanvraag-tot-bestellen-nummer
            BNFPO LIKE EBAN-BNFPO,   " Positienummer van
                                     " aanvraag tot bestellen
            TXZ01 LIKE EBAN-TXZ01,   " Korte tekst
            MATKL LIKE MARA-MATKL,   " Goederengroep
            LIFNR LIKE EBAN-LIFNR,   " Gewenste leverancier
            NAME1 LIKE LFA1-NAME1,   " Gewenste leverancier
    END OF it_eban2.
    *DATA: IT_EBAN2 TYPE TABLE OF T_EBAN2 with header line.
    DATA:      wa_eban2 like it_eban2.
    DATA voor uitprinten rapporten
    DATA: PARAMS   LIKE PRI_PARAMS,
          DAYS(1)  TYPE N VALUE 2,
          COUNT(3) TYPE N VALUE 1,
          VALID    TYPE C,
          E_USR01  LIKE USR01.
    DATA: BEGIN OF kopteksten OCCURS 1.
            INCLUDE STRUCTURE tline.
    DATA: END OF kopteksten.
    DATA: BEGIN OF atb_kopteksten OCCURS 1,
                  banfn TYPE banfn.
            INCLUDE STRUCTURE tline.
    DATA: END OF atb_kopteksten.
    DATA: line(256) TYPE c,
          text_tab  LIKE STANDARD TABLE OF line.
    DATA: BEGIN OF atb_nummers OCCURS 1,
                  banfn type thead-tdname,
          END OF atb_nummers.
    DATA: BEGIN OF tlinetab OCCURS 10.
            INCLUDE STRUCTURE tline.
    DATA: END OF tlinetab.
    DATA: BEGIN OF teksten OCCURS 10,
            id(1),
            veld(25),
            waarde(40).
    DATA: END OF teksten.
    ******************Workflow********************************************
    DATA: worklist TYPE TABLE OF swr_wihdr,
          wa_worklist TYPE swr_wihdr,
          ibf_object TYPE sibflporb.
    DATA: prev_banfn type banfn.
    DATA: theader LIKE thead,
          name_atb LIKE thead-tdname,
          bedrijfsnr  LIKE pa0001-bukrs.
    DATA: ok_code LIKE sy-ucomm,
          save_ok LIKE sy-ucomm.
    DATA: lpos   TYPE I.
    DATA: box(1) TYPE c.
    DATA: lines  TYPE I.
    DATA: veld(20),
          G_REPID  LIKE SY-REPID,
          init,
          container  TYPE REF TO cl_gui_custom_container,
          editor     TYPE REF TO cl_gui_textedit.
    DATA: banfn_vorige TYPE banfn.
    DATA: P_BANFN TYPE BANFN.
    DATA: BUKRS LIKE PA0001-BUKRS.
    DATA: Radio1, RADIO2, RADIO3.
    Lijst kolomnamen
    DATA: H1(6) VALUE 'ATB-nr',
          H2(40) VALUE 'Omschrijving',
          H3(2)  VALUE 'GG',
          H4(5)  VALUE 'Levnr',
          H5(35) VALUE 'Leverancier',
          H6(10) VALUE 'Lev. Datum',
          H7(6)  VALUE '!BOCAT',
          H8(10) VALUE 'Aanvr dat.',
          H9(12) VALUE 'Invoerder',
          H10(13) VALUE '       Totaal',
          H11(3) VALUE 'Val'.
    DATA: X TYPE I.
    CALL screen 100.
    INITIALIZATION.
      PERFORM personeelsgegevens.
      g_repid = sy-repid.
    Part tor collect the data
    *&      Form  BUILD_ALV_REPORT
          text
    FORM BUILD_ALV_REPORT.
      perform build_field_cat CHANGING fieldcatalog[].
    After building the field catalog (e.g., from a DDIC structure), we can
    modify these settings in the following subroutine.
      PERFORM modify_fieldcatalog    CHANGING fieldcatalog[].
      IF Not fieldcatalog is initial.
        perform collect_data.
        perform build_layout CHANGING gd_layout.
    Table ta_comment is used to display header information in the
    top-of-page of the ALV output.
        PERFORM build_comment CHANGING ta_comment[].
    Table gd_tab_group wordt gebruikt om een groepering op te bouwen.
        PERFORM build_group CHANGING gd_tab_group[].
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
       I_INTERFACE_CHECK                 = ' '
       I_BYPASSING_BUFFER                = ' '
       I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = g_repid
       I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = co_rout_ucomm
        I_CALLBACK_TOP_OF_PAGE            = co_rout_top_of_page
       I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
       I_CALLBACK_HTML_END_OF_LIST       = ' '
       I_STRUCTURE_NAME                  =
        I_BACKGROUND_ID                   = co_background_alv
        I_GRID_TITLE                      = 'Lijst goedgekeurde ATBs'
       I_GRID_SETTINGS                   =
          IS_LAYOUT                         = gd_layout
          IT_FIELDCAT                       = fieldcatalog
       IT_EXCLUDING                      =
        IT_SPECIAL_GROUPS                 = gd_tab_group[]
       IT_SORT                           =
       IT_FILTER                         =
       IS_SEL_HIDE                       =
       I_DEFAULT                         = 'X'
       I_SAVE                            = ' '
       IS_VARIANT                        =
       IT_EVENTS                         =
       IT_EVENT_EXIT                     =
       IS_PRINT                          =
       IS_REPREP_ID                      =
        I_SCREEN_START_COLUMN             = 0
       I_SCREEN_START_LINE               = 0
       I_SCREEN_END_COLUMN               = 0
       I_SCREEN_END_LINE                 = 0
       IT_ALV_GRAPHICS                   =
       IT_HYPERLINK                      =
       IT_ADD_FIELDCAT                   =
       IT_EXCEPT_QINFO                   =
       I_HTML_HEIGHT_TOP                 =
       I_HTML_HEIGHT_END                 =
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER           =
       ES_EXIT_CAUSED_BY_USER            =
          TABLES
            T_OUTTAB                          = it_eban
    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.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    ENDFORM.  " BUILD_ALV_REPORT
    *&      Form  build_field_cat
          text
    -->  p1        text
    <--  p2        text
    FORM build_field_cat CHANGING cta_fcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat       TYPE slis_fieldcat_alv.
    DATA: ls_fieldcat type slis_t_fieldcat_alv with header line.
      refresh fieldcatalog.
      clear fieldcatalog.
    ls_fieldcat-fieldname    = 'BANFN'.
    ls_fieldcat-ref_tabname      = 'eban'.
    ls_fieldcat-ref_fieldname = 'banfn'.
    ls_fieldcat-checkbox = abap_true.
    fieldcatalog-seltext_m    = 'Aanvr nr'.
    ls_fieldcat-col_pos      = 0.
    fieldcatalog-outputlen    = 8.
    ls_fieldcat-emphasize    = abap_true.
    ls_fieldcat-key          = abap_true.
    append ls_fieldcat to fieldcatalog.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         I_PROGRAM_NAME               = g_repid
         I_INTERNAL_TABNAME           = 'IT_EBAN'
        I_STRUCTURE_NAME             = 'IT_EBAN2'
      I_CLIENT_NEVER_DISPLAY       = abap_true
         I_INCLNAME                   = g_repid
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
        CHANGING
          CT_FIELDCAT                  = fieldcatalog
       EXCEPTIONS
         INCONSISTENT_INTERFACE       = 1
         PROGRAM_ERROR                = 2
         OTHERS                       = 3
      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.                    " build_field_cat
    *&      Form  modify_fieldcatalog
          Modify the field catalog for the primary list, if needed!
          You can set attributes for every column in the ALV output by
          selecting the fieldname belonging to the column.
          For an overview of the attributes available, see the
          online documentation of function module REUSE_ALV_GRID_DISPLAY.
    FORM modify_fieldcatalog  CHANGING cta_fcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat       TYPE slis_fieldcat_alv.
    Modify the field catalog according to the requirements.
    Some examples are shown below.
      LOOP AT cta_fcat INTO ls_fieldcat.
        CASE ls_fieldcat-fieldname.
          WHEN 'ATB_SEL'.
            ls_fieldcat-seltext_m = 'ATB check'.
            ls_fieldcat-outputlen = 2.
            ls_fieldcat-edit = abap_true.
            ls_fieldcat-input = 'X'.
            ls_fieldcat-checkbox = abap_true.
          WHEN 'ATB_FORM'.
            ls_fieldcat-seltext_m = 'ATB formulier'.
            ls_fieldcat-hotspot = abap_true.
           ls_fieldcat-seltext_s = icon_protocol.
            ls_fieldcat-outputlen = 2.
            ls_fieldcat-icon = abap_true.
          WHEN 'BANFN'.
            ls_fieldcat-hotspot = abap_true.
          WHEN  'NAME1'.
            ls_fieldcat-ddictxt       = 'S'.
           ls_fieldcat-emphasize    = abap_true.
           ls_fieldcat-key          = abap_true.
          WHEN 'OPM'.
            ls_fieldcat-seltext_m    = 'O'.
            ls_fieldcat-outputlen = 1.
          WHEN 'BIJLAGE'.
            ls_fieldcat-seltext_m    = 'B'.
            ls_fieldcat-outputlen = 1.
          WHEN 'CONTROLE'.
            ls_fieldcat-seltext_m    = 'C'.
            ls_fieldcat-outputlen = 1.
          WHEN 'ONVOLLEDIG'.
            ls_fieldcat-seltext_m    = abap_true.
            ls_fieldcat-outputlen = 1.
          WHEN 'C_KOPTEKST'.
            ls_fieldcat-seltext_m    = 'T'.
            ls_fieldcat-hotspot = abap_true.
            ls_fieldcat-outputlen = 1.
          WHEN 'KRITISCH'.
            ls_fieldcat-seltext_m    = '!'.
            ls_fieldcat-outputlen = 1.
          WHEN 'WORKFLOW'.
            ls_fieldcat-seltext_m    = 'W'.
            ls_fieldcat-outputlen = 1.
          WHEN 'WF_OLD'.
            ls_fieldcat-seltext_m    = 'A'.
            ls_fieldcat-hotspot = abap_true.
            ls_fieldcat-sp_group = 'A'.
            ls_fieldcat-outputlen = 1.
          WHEN 'KOPTEKST'.
            ls_fieldcat-seltext_m    = 'Koptekst'.
            ls_fieldcat-hotspot = abap_false.
            ls_fieldcat-outputlen = 25.
        ENDCASE.
        MODIFY fieldcatalog from  ls_fieldcat.
        clear ls_fieldcat.
      endloop.
    ENDFORM.                    " modify_fieldcatalog
    *&      Module  USER_COMMAND_0500  INPUT
          text
    MODULE USER_COMMAND_0500 INPUT.
      IF 500 = 500.
      ENDIF.
    ENDMODULE.                 " USER_COMMAND_0500  INPUT
    *&      Module  USER_COMMAND_0510  INPUT
          text
    MODULE USER_COMMAND_0510 INPUT.
      IF 510 = 510.
      ENDIF.
    ENDMODULE.                 " USER_COMMAND_0510  INPUT
    *&      Form  r1_process_user_command
          This routine deals with the "non-standard" GUI-functions.
          It enables you to do the following:
          - Double-click or click on a hotspotted field
          - Implement your own GUI-functions
          You'll find some predefined examples in this routine.
    FORM r1_process_user_command                                "#EC CALLED
         USING utp_ucomm    TYPE syucomm
               utp_selfield TYPE slis_selfield.
    DATA: lta_list_sec         TYPE TABLE OF /ctac/s_alv_struc_sec.
      DATA: ltp_repid            TYPE syrepid.
    DATA: ltp_ebeln_num(10)    TYPE n.
    DATA: ltp_ebeln            TYPE ebeln.
    DATA: ltp_matnr            TYPE matnr.
    DATA: ltp_matnr_char(18)   TYPE c.
    Handle the specific user-commands.
      CASE utp_ucomm.
    Handle double click or hotspot on a specific field.                  *
    These are some examples                                              *
        WHEN co_double_click.
          read table IT_EBAN index utp_selfield-tabindex.
          CASE utp_selfield-fieldname.
            WHEN 'ATB_FORM'.
              SUBMIT ymm_atb_formulierprint AND RETURN
                 WITH sel_atb = it_eban-banfn. " utp_selfield-value.
            WHEN 'BANFN'.
             CHECK NOT wa_eban IS INITIAL.
              SET PARAMETER ID 'BAN' FIELD it_eban-banfn.
              CALL FUNCTION 'ENQUEUE_EMEBANE'
                EXPORTING
                  banfn = it_eban-banfn
                  bnfpo = it_eban-bnfpo.
              IF sy-subrc = 0.
                CALL FUNCTION 'DEQUEUE_EMEBANE'
                  EXPORTING
                    banfn = it_eban-banfn
                    bnfpo = it_eban-bnfpo.
                CALL TRANSACTION 'ME53N' AND SKIP FIRST SCREEN.
          WAIT UP TO 1 SECONDS.
          LEAVE TO TRANSACTION 'YME60_INK'.
              ENDIF.
            WHEN 'WF_OLD'.
              ibf_object-catid = 'BO'.
              ibf_object-typeid = 'ZBUS2105'.
              ibf_object-instid(3) = '000'.
              WRITE it_eban-banfn TO ibf_object-instid+3.
              CALL FUNCTION 'SWI_WF_CONNECTIONS_DISPLAY'
                EXPORTING
                  ibf_object = ibf_object
                  popup      = space.
            WHEN 'C_KOPTEKST'.
              CALL SCREEN 510.
            WHEN OTHERS.
          ENDCASE.
    Handle your own GUI functions here                                  *
    For example, handle a secondary ALV List                            *
        WHEN co_sec_list.
         PERFORM build_sec_list   TABLES   lta_list_sec.
         PERFORM display_sec_list TABLES   lta_list_sec
                                  CHANGING utp_selfield.
    Or some other GUI-functions                                         *
       WHEN 'OKCODE_01'.
         Actions for this okcode
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    "R1_PROCESS_USER_COMMAND
    *&      Form  build_comment
          Create the internal table that is going to be the TOP-OF-PAGE
          of the ALV grid or list.
    FORM build_comment CHANGING cta_top_of_page TYPE slis_t_listheader.
      DATA: lwa_line TYPE slis_listheader.
      REFRESH cta_top_of_page.
    LIST HEADING LINE: TYPE H
    CLEAR lwa_line.
    lwa_line-typ  = 'H'.
    LLINE-KEY:  NOT USED FOR THIS TYPE
    lwa_line-info = text-100.
    APPEND lwa_line TO cta_top_of_page.
    STATUS LINE: TYPE S
      CLEAR lwa_line.
      lwa_line-typ  = 'S'.
      lwa_line-key  = text-101.
      lwa_line-info = text-102.
      APPEND lwa_line TO cta_top_of_page.
      lwa_line-key = ' '.
    lwa_line-key  = text-103.
      lwa_line-info = text-103.
      APPEND lwa_line TO cta_top_of_page.
    ACTION LINE: TYPE A
    CLEAR lwa_line.
    lwa_line-typ  = 'A'.
    LLINE-KEY:  NOT USED FOR THIS TYPE
    lwa_line-info = text-105.
    APPEND lwa_line TO cta_top_of_page.
    ENDFORM.                    " build_comment
          FORM R2_SET_TOP_OF_PAGE                                       *
          Put the content of table TA_COMMENT on the top of the ALV     *
    FORM r2_set_top_of_page.                                    "#EC CALLED
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = ta_comment
        EXCEPTIONS
          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.
    ENDFORM.                    "R2_SET_TOP_OF_PAGE
    *&      Form  build_group
          text
         <--P_TA_SP_GROUP[]  text
    FORM build_group  CHANGING P_TA_SP_GROUP TYPE slis_t_sp_group_alv.
      DATA: ls_sp_group TYPE slis_sp_group_alv.
      clear ls_sp_group.
      ls_sp_group-sp_group = 'A'.
      ls_sp_group-text = 'ATBs ter goedkeuring bij adviseur'.
      append ls_sp_group to P_TA_SP_GROUP.
      ls_sp_group-sp_group = 'B'.
      ls_sp_group-text = 'ATBs goedgekeurd'.
      append ls_sp_group to P_TA_SP_GROUP.
    ENDFORM.                    " build_group
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    form build_layout changing gd_layout type slis_layout_alv.
      gd_layout-no_input = 'X'.
    *gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_only = 'X'.
      gd_layout-totals_text = 'Totaal'(201).
    *gd_layout-group_change_edit = 'X'.
    *gd_layout-GROUP_BUTTONS = 'A'.
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
      gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    endform. " BUILD_LAYOUT
    I'll hope this is anough code?
    Kind regards,
    Richard Meijn

  • Popup with the function 'Reuse_alv_grid_display'

    Hello everyone,
    I have a problem when I use the function module as pop_up where you can edit your input.
    The table, after the function module was called, not always contains the values that the user typed.
    An example is:
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZZBSEG'
        CHANGING
          ct_fieldcat      = gt_fieldcat[].
      READ TABLE gt_fieldcat WITH KEY fieldname = 'AUFNR'.
      IF sy-subrc = 0.
        gt_fieldcat-input = 'X'.
        gt_fieldcat-edit = 'X'.
        MODIFY gt_fieldcat INDEX sy-tabix.
      ENDIF.
      SELECT * INTO TABLE tab
      FROM zzbseg
      WHERE belnr = '0100000018'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
             EXPORTING
            I_INTERFACE_CHECK        = ' '
               i_structure_name         = 'ZZBSEG'
                i_buffer_active        = ' '
                 is_layout                = l_layout
                it_fieldcat              = gt_fieldcat[]
            IT_EXCLUDING             =
            IT_SPECIAL_GROUPS        =
            IT_SORT                  =
            IT_FILTER                =
            IS_SEL_HIDE              =
            I_DEFAULT                = 'X'
                i_save                   = space
            IS_VARIANT               = ' '
            IT_EVENTS                =
            IT_EVENT_EXIT            =
            IS_PRINT                 =
            IS_REPREP_ID             =
           i_screen_start_column    = 10
           i_screen_start_line      = 1
           i_screen_end_column      = 100
             i_screen_end_line        = 10
         IMPORTING
            E_EXIT_CAUSED_BY_CALLER  =
            ES_EXIT_CAUSED_BY_USER   =
              TABLES
                 t_outtab                 = tab
         EXCEPTIONS
            PROGRAM_ERROR            = 1
              OTHERS                   = 2
      BREAK-POINT.

    If anyone else is interested:
    SAP resolved an error in the coding,
    now the IT_ALV_GRAPHICS can also be used
    in REUSE_ALV_GRID_DISPLAY.
    As for the line feed:
    Use the constant
    cl_abap_char_utilities=>cr_lf
    in the CONCATENATE command.

  • Function module to modify the vendor confirmation data

    Hi,
    I am using ME_CONFIRMATION_UPODATE to add a new record to table EKES, ie I am able to see the vendor confirmation in purchase order. Can I use the same function module to modify the same record in above table EKES or anyother function module is there? My requirment is to change the delivery date once again in confirmation tab in purchase order.
    Please help,
    Thanks,
    Vengal Rao.

    Hi All,
    I could use the same function module and change the delivery date, i thing I changed is the data in field KZ , instead of 'I'  used 'U'.   to update the existing data.
    Thanks,
    Vengal Rao.

  • How to adjust column length in function REUSE_ALV_GRID_DISPLAY

    Hi,
    I am using this function REUSE_ALV_GRID_DISPLAY to display .Please tell how to adjust the column length in  this function, so that it is set to default field name size.
    thanks

    Hi anu,
    The column width can be adjusted by using the following method:
    -> define layout of the type.
                data: it_layout type slis_layout_alv.
    -> call the reuse alv... by using the is_layout field name with the above defined variable.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_CALLBACK_PROGRAM                =  <program that calls reuse>
        I_CALLBACK_PF_STATUS_SET          = < form to set pf-status>
        I_CALLBACK_USER_COMMAND           = <form to catch user command>
        I_STRUCTURE_NAME                  = < structure to be passed>
        I_GRID_TITLE            = < any title to appear on top of the grid display>
        IS_LAYOUT                         = it_layout
        IT_FIELDCAT                       = IT_FIELDCAT[]
        IT_EVENTS                         =
        IT_EVENT_EXIT                     = I_EVENT_EXIT  < to capture exit event>
      I_SCREEN_START_COLUMN             = 0 <screen settings>
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
       TABLES
        T_OUTTAB                          = IT_INACT_OBJ
       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.
    ENDFORM.                 
    -> write a form to set the layout of the grid...
    *&      Form  build_layout
          text
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
      gd_layout-info_fieldname =      'LINE_COLOR'.
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for double click or "click(press f2)
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " build_layout
    endform.   
    This will optimize the output of the grid display.
    Hope this helps!!!
    Revert if any queries!!!
    regards,
    Naveenan.

  • Function module to modify the user roles & profiles

    Hi All,
    I am working on user maintenance and i need a function module to modify the user roles & profiles.
    Thanks in Advance.
    Phani.

    i used the below fms
    BAPI_USER_ACTGROUPS_ASSIGN for assigning the roles.
    delete the profiles of the user qnd assign the profiles to the user:
    BAPI_USER_PROFILES_DELETE
    BAPI_USER_PROFILES_ASSIGN
    i used the above FMs for my requirement.
    Regards,
    Phani.

  • Is there any method or function to update/modify an existing trip data?

    Hey, ABAP  gurus,
    Is there any method or function to update/modify an existing trip (PR05) receipts data and cost distribution data?
    Thanks in advance!
    Fisher

    Hi Fisher,
    Please try HRTRV_IF_MODIFY_TRIP.
    Regards,
    Dilek

  • Call function 'REUSE_ALV_GRID_DISPLAY' display like list alv

    Hi experts,
    I checked a standard tcode-IDCP.
    It will be displayed like grid alv if I run it directly. However, it will be displayed like list alv if I call the tcode using BDC in a z-report even it call function 'REUSE_ALV_GRID_DISPLAY'.
    Does anyone know why?
    Kindly help.

    Hi Franklin,
    I think when alv grid is running in background, it will be switched to basic list.
    Here I list a part of code in FM 'REUSE_ALV_GRID_DISPLAY' (From Line 106 in ECC6EHP5):
    if ( is_layout-allow_switch_to_list ne space
       and boolean eq if_salv_c_bool_sap=>true )
       or ( sy-binpt eq abap_true ).
         perform globals_push.
         call function 'REUSE_ALV_LIST_DISPLAY'
    endif.
    Thanks,
    Sam

  • Function REUSE_ALV_GRID_DISPLAY, events and global variables

    Hi everybody,
    in a report I use FM REUSE_ALV_GRID_DISPLAY with a registered callback for event 'USER_COMMAND'.
    In the callback-form I want to change the internal table, which I provided for displaying to REUSE_ALV_GRID_DISPLAY.
    How can I access the internal table in the callback-form without using global variables?.
    Kind regards,
    Hubert
    Edited by: Hubert Heitzer on Feb 23, 2011 4:13 PM
    This is not the solution I asked for, but I found a workaround.
    I created a function group, which encapsulates the internal table.
    A function provides the service for colleting data for the internal table and displays the ALV.
    The callback-form is also a member of my function group and is therefore able to access the internal table.

    Hi everybody,
    in a report I use FM REUSE_ALV_GRID_DISPLAY with a registered callback for event 'USER_COMMAND'.
    In the callback-form I want to change the internal table, which I provided for displaying to REUSE_ALV_GRID_DISPLAY.
    How can I access the internal table in the callback-form without using global variables?.
    Kind regards,
    Hubert
    Edited by: Hubert Heitzer on Feb 23, 2011 4:13 PM
    This is not the solution I asked for, but I found a workaround.
    I created a function group, which encapsulates the internal table.
    A function provides the service for colleting data for the internal table and displays the ALV.
    The callback-form is also a member of my function group and is therefore able to access the internal table.

  • Function Module to modify provider specific settings in rsdichapro

    Hi guys,
    does anybody know the function module used to modify the provider specific settings for an InfoCube.
    Thanks in advance.
    Alex

    Hi there!
    For me it worked just by going to se16 and changing the records one by one. I wanted to modify the provider-specific properties and in specific the constant that restricts the infocube values and is used for logical partitioning (RSDICHAPRO-CHACONST) and it worked from there.
    Br
    Angelo

Maybe you are looking for

  • Missing information with Address Book

    I've got a Centro, run Mac OS X 10.4.11, and managed to get iSync to play nice with my new Centro (palm os 5.4.9) and transfer over the years of information I have stocked up in iCal and Address Book.app. Everything seemed fine on the surface, but wh

  • How to embed a viedo from youtube?

    hi there. i have been stuck on this problem for about 2 days now and have no idea. can anyone tell me how i can embed a youtube video in my flash website (AS3, CS4) If that is not possible i have found a program called videolightbox, but that is in h

  • GROUP MESSAGING ON iPHONE??

    Hello to all. I been looking around to try to find a "topic" associated with "group messaging" but no luck. My questions is does iPhone have "Group Messaging". So I can send 1 message to about 4 different people in my contact list? I know you can do

  • Hello Login Help Required

    Hello Everyone, Can anyone help me out to login in sqlplus environment as sysdba. Regds Amar

  • Files will not open - program error popup

    I am running CS3 on a site-based license in a high school - we are all on a server. When I try to open files - PSD, JPEG, GIF, etc., a notice pops up saying "Could not complete your request because of a program error." My technology department here r