Not diaplsy buttons on alv grid display

Hi,
In the below code,i dont understand where i made a mistake,i used a user command on alv it's working but not display the buttons on a output.Please check the below code and solve it.
REPORT  Y_ALV_VERSION.
TYPE-POOLS : SLIS.
DATA : BEGIN OF ITAB OCCURS 0,
       MATNR LIKE MARC-MATNR,       "Plant Data for Material-Material Number
       WERKS LIKE MARC-WERKS,       "Plant Data for Material-Plant
       EKGRP LIKE MARC-EKGRP,       "Plant Data for Material-Purchasing Group
       END OF ITAB.
DATA : BEGIN OF ITAB1 OCCURS 0,
       MATNR LIKE MARD-MATNR,       "Storage Location Data for Material-Material Number
       WERKS LIKE MARD-WERKS,       "Storage Location Data for Material-Plant
       LGORT LIKE MARD-LGORT,       "Storage Location Data for Material-Storage Location
       END OF ITAB1.
DATA : REPID LIKE SY-REPID.
DATA : V_LINE TYPE SY-TABIX.
DATA : X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA : I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : I_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
DATA : X_ALV_EVENTS TYPE SLIS_ALV_EVENT.
DATA : T_ALV_EVENTS TYPE SLIS_T_EVENT.
DATA : X_ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
*********************START-OF-SELECTION***************
START-OF-SELECTION.
  PERFORM SUB_SELECT_RECORD.
  PERFORM SUB_PREPARE_FIELDCATALOG.
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
   EXPORTING
     I_LIST_TYPE           = 0
   IMPORTING
     ET_EVENTS             = T_ALV_EVENTS
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 T_ALV_EVENTS INTO X_ALV_EVENTS WITH KEY NAME = 'USERCOMMAND'.
  IF SY-SUBRC = 0.
    X_ALV_EVENTS-FORM = 'USER_ACTION'.
    MODIFY T_ALV_EVENTS FROM X_ALV_EVENTS INDEX SY-TABIX.
  ENDIF.
  READ TABLE T_ALV_EVENTS INTO X_ALV_EVENTS WITH KEY NAME = 'PF_STATUS_SET'.
  IF SY-SUBRC = 0.
    X_ALV_EVENTS-FORM = 'PF_STATUS'.
    MODIFY T_ALV_EVENTS FROM X_ALV_EVENTS INDEX SY-TABIX.
  ENDIF.
  PERFORM SUB_DETERMINE_ALV_LAYOUT.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
  I_INTERFACE_CHECK                 = ' '
  I_BYPASSING_BUFFER                = ' '
  I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = REPID
   I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS'
   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
  I_CALLBACK_TOP_OF_PAGE            = ' '
  I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
  I_CALLBACK_HTML_END_OF_LIST       = ' '
  I_STRUCTURE_NAME                  =
  I_BACKGROUND_ID                   = ' '
  I_GRID_TITLE                      =
  I_GRID_SETTINGS                   =
      IS_LAYOUT                         = X_ALV_LAYOUT
      IT_FIELDCAT                       = I_FIELDCAT[]
  IT_EXCLUDING                      =
  IT_SPECIAL_GROUPS                 =
  IT_SORT                           =
  IT_FILTER                         =
  IS_SEL_HIDE                       =
   I_DEFAULT                         = 'X'
   I_SAVE                            = 'A'
  IS_VARIANT                        =
      IT_EVENTS                         = T_ALV_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
  I_HTML_HEIGHT_TOP                 = 0
  I_HTML_HEIGHT_END                 = 0
  IT_ALV_GRAPHICS                   =
  IT_HYPERLINK                      =
  IT_ADD_FIELDCAT                   =
  IT_EXCEPT_QINFO                   =
  IR_SALV_FULLSCREEN_ADAPTER        =
IMPORTING
  E_EXIT_CAUSED_BY_CALLER           =
  ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = ITAB
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.
*&      Form  PF_STATUS
      text
     -->RT_EXTAB   text
FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
  SET PF-STATUS 'ALV_PF_STATUS'.  " excluding rt_extab.
ENDFORM.                    "PF_STATUS
*&      Form  user_action
      text
     -->R_UCOMM      text
     -->RS_SELFIELD  text
FORM USER_ACTION USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
  DATA : OKCODE TYPE SY-UCOMM.
  OKCODE = R_UCOMM.
  CLEAR R_UCOMM.
  V_LINE = RS_SELFIELD-TABINDEX.
  CASE OKCODE.
    WHEN 'PICK'.
      READ TABLE ITAB INDEX V_LINE.
      PERFORM SUB_SELECT_RECORD1.
      PERFORM SUB_PREPARE_FIELDCATALOG1.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
  I_INTERFACE_CHECK                 = ' '
  I_BYPASSING_BUFFER                = ' '
  I_BUFFER_ACTIVE                   = ' '
     I_CALLBACK_PROGRAM                = 'REPID'
  I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS-SET'
  I_CALLBACK_USER_COMMAND           = ' '
  I_CALLBACK_TOP_OF_PAGE            = ' '
  I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
  I_CALLBACK_HTML_END_OF_LIST       = ' '
  I_STRUCTURE_NAME                  =
  I_BACKGROUND_ID                   = ' '
  I_GRID_TITLE                      =
  I_GRID_SETTINGS                   =
  IS_LAYOUT                         =
  IT_FIELDCAT                       =
  IT_EXCLUDING                      =
  IT_SPECIAL_GROUPS                 =
  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
  I_HTML_HEIGHT_TOP                 = 0
  I_HTML_HEIGHT_END                 = 0
  IT_ALV_GRAPHICS                   =
  IT_HYPERLINK                      =
  IT_ADD_FIELDCAT                   =
  IT_EXCEPT_QINFO                   =
  IR_SALV_FULLSCREEN_ADAPTER        =
IMPORTING
  E_EXIT_CAUSED_BY_CALLER           =
  ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = ITAB1
EXCEPTIONS
  PROGRAM_ERROR                     = 1
  OTHERS                            = 2
      IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    WHEN 'EXIT'.
      RS_SELFIELD-EXIT = 'X'.
  ENDCASE.
ENDFORM.                    "user_action
*&      Form  SUB_PREPARE_FIELDCATALOG
      text
-->  p1        text
<--  p2        text
FORM SUB_PREPARE_FIELDCATALOG .
  X_FIELDCAT-SELTEXT_L = 'MATERIAL'.
  X_FIELDCAT-DATATYPE = 'CHAR'.
  X_FIELDCAT-OUTPUTLEN = 18.
  X_FIELDCAT-FIELDNAME = 'MATNR'.
  X_FIELDCAT-HOTSPOT = 'X'.
  APPEND X_FIELDCAT TO I_FIELDCAT.
  CLEAR X_FIELDCAT.
  X_FIELDCAT-SELTEXT_L = 'PLANT'.
  X_FIELDCAT-DATATYPE = 'CHAR'.
  X_FIELDCAT-OUTPUTLEN = 4.
  X_FIELDCAT-FIELDNAME = 'WERKS'.
  APPEND X_FIELDCAT TO I_FIELDCAT.
  CLEAR X_FIELDCAT.
  X_FIELDCAT-SELTEXT_L = 'PUR.GROUP'.
  X_FIELDCAT-DATATYPE = 'CHAR'.
  X_FIELDCAT-OUTPUTLEN = 4.
  X_FIELDCAT-FIELDNAME = 'EKGRP'.
  X_FIELDCAT-EDIT = 'X'.
  APPEND X_FIELDCAT TO I_FIELDCAT.
  CLEAR X_FIELDCAT.
ENDFORM.                    " SUB_PREPARE_FIELDCATALOG
*&      Form  SUB_SELECT_RECORD
      text
-->  p1        text
<--  p2        text
FORM SUB_SELECT_RECORD.
  SELECT MATNR WERKS EKGRP FROM MARC INTO TABLE ITAB UP TO 10 ROWS WHERE WERKS = '1000'.
ENDFORM.                    " SUB_SELECT_RECORD
*&      Form  SUB_DETERMINE_ALV_LAYOUT
      text
-->  p1        text
<--  p2        text
FORM SUB_DETERMINE_ALV_LAYOUT .
  X_ALV_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  X_ALV_LAYOUT-F2CODE = 'PICK'.
  X_ALV_LAYOUT-WINDOW_TITLEBAR = 'PLANT DATA'.
  X_ALV_LAYOUT-KEY_HOTSPOT = 'X'.
ENDFORM.                    " SUB_DETERMINE_ALV_LAYOUT
*&      Form  SUB_PREPARE_FIELDCATALOG1
      text
-->  p1        text
<--  p2        text
FORM SUB_PREPARE_FIELDCATALOG1 .
  X_FIELDCAT-SELTEXT_L = 'MATERIAL'.
  X_FIELDCAT-DATATYPE = 'CHAR'.
  X_FIELDCAT-OUTPUTLEN = 18.
  X_FIELDCAT-FIELDNAME = 'MATNR'.
  X_FIELDCAT-HOTSPOT = 'X'.
  APPEND X_FIELDCAT TO I_FIELDCAT1.
  CLEAR X_FIELDCAT.
  X_FIELDCAT-SELTEXT_L = 'PLANT'.
  X_FIELDCAT-DATATYPE = 'CHAR'.
  X_FIELDCAT-OUTPUTLEN = 4.
  X_FIELDCAT-FIELDNAME = 'WERKS'.
  APPEND X_FIELDCAT TO I_FIELDCAT1.
  CLEAR X_FIELDCAT.
  X_FIELDCAT-SELTEXT_L = 'Storage Location'.
  X_FIELDCAT-DATATYPE = 'CHAR'.
  X_FIELDCAT-OUTPUTLEN = 4.
  X_FIELDCAT-FIELDNAME = 'LGORT'.
  X_FIELDCAT-EDIT = 'X'.
  APPEND X_FIELDCAT TO I_FIELDCAT1.
  CLEAR X_FIELDCAT.
ENDFORM.                    " SUB_PREPARE_FIELDCATALOG1
*&      Form  SUB_SELECT_RECORD1
      text
-->  p1        text
<--  p2        text
FORM SUB_SELECT_RECORD1 .
  SELECT MATNR WERKS LGORT FROM MARD INTO TABLE ITAB1 WHERE MATNR = ITAB-MATNR AND WERKS = ITAB-WERKS.
  REFRESH I_FIELDCAT1.
ENDFORM.                    " SUB_SELECT_RECORD1
thanks and regards

Consider this logic.
DATA:
  g_exclude                  TYPE slis_t_extab.
*       FORM display_alv_report                                       *
FORM display_alv_report.
  PERFORM fieldcat_init      USING g_fieldcat[].
  PERFORM build_sort_fields  USING g_sort[].
  PERFORM eventtab_build     USING g_events[]
                                   g_events_ex[].
  PERFORM layout_build       USING g_layout.
  PERFORM exclude_icons.
  PERFORM list_view.
ENDFORM.                    " display_alv_report.
*      Form  exclude_icons
FORM exclude_icons.
  APPEND '&ETA' TO g_exclude.     "Details
*  APPEND '&OUP' TO g_exclude.     "Sort Up
*  APPEND '&ODN' TO g_exclude.     "Sort Down
  APPEND '&ILT' TO g_exclude.     "Set Filter
  APPEND '&UMC' TO g_exclude.     "Sum
  APPEND '&RNT_PREV' TO g_exclude.     "Print preview
*  APPEND '&VEXCEL' TO g_exclude.     "Excel
  APPEND '&AQW' TO g_exclude.     "Word processing
  APPEND '%PC' TO g_exclude.     "Local File
  APPEND '%SL' TO g_exclude.     "Mail recepient
  APPEND '&ABC' TO g_exclude.     "ABC Analysis
  APPEND '&GRAPH' TO g_exclude.     "Graphic
*  APPEND '&OL0' TO g_exclude.     "Change layout
*  APPEND '&OAD' TO g_exclude.     "Select layout
  APPEND '&AVE' TO g_exclude.     "Save Layout
  APPEND '&INFO' TO g_exclude.  "Information
ENDFORM.                    " exclude_icons
FORM list_view.
  g_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program = g_repid
            is_layout          = g_layout
            it_sort            = g_sort[]
            it_events          = g_events[]
            it_fieldcat        = g_fieldcat[]
            i_save             = g_save
            it_excluding       = g_exclude     "<== Exclude
       TABLES
            t_outtab           = it_work
       EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
  IF sy-subrc <> 0.
    MESSAGE e208(00) WITH 'Error: ALV Grid'.
  ENDIF.
ENDFORM.                    " layout_build

Similar Messages

  • Push Button on Alv Grid display

    Hi experts,
       I strcuk in the middle of one program, i need to have push buttons on the output ALV Grid display, i have copied the standard status and used the same in the Function module for pf-status, iam able to get the output
    but my requirement is how to add the push buttons to the out put screen, as when iam clicking on status which i have copied iam unable to find where to add these push button in the application tool bar, iam unable to edit the push button can any body help me out, thanks in advance.

    Hello Madan
    I cannot help you with the FM-based ALV lists. However, for OO-based ALV grids (CL_GUI_ALV_GRID) I have a sample program that simulates radio buttons by using icons with hotspots.
    PROGRAM ZUS_SDN_BCALV_GRID_DEMO_2.
    * Based on: BCALV_GRID_DEMO.
    TYPE-POOLS: icon.
    TYPES: BEGIN OF ty_s_sflight.
    INCLUDE TYPE sflight.
    TYPES: button1    TYPE lvc_emphsz.
    TYPES: button2    TYPE lvc_emphsz.
    TYPES: button3    TYPE lvc_emphsz.
    TYPES: button4    TYPE lvc_emphsz.
    TYPES: END OF ty_s_sflight.
    DATA:
      gt_sflight    TYPE STANDARD TABLE OF ty_s_sflight,
      gt_fcat       TYPE lvc_t_fcat.
    DATA: ok_code LIKE sy-ucomm,
    *      gt_sflight TYPE TABLE OF sflight,
          g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
          grid1  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_cnt    TYPE i.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    * define local data
        FIELD-SYMBOLS:
          <ls_entry>    TYPE ty_s_sflight,
          <ld_fld>      TYPE ANY.
        READ TABLE gt_sflight ASSIGNING <ls_entry> INDEX es_row_no-row_id.
        CHECK ( <ls_entry> IS ASSIGNED ).
    *   Set all radio buttons "unselected"
        <ls_entry>-button1 =  icon_wd_radio_button_empty.
        <ls_entry>-button2 =  icon_wd_radio_button_empty.
        <ls_entry>-button3 =  icon_wd_radio_button_empty.
        <ls_entry>-button4 =  icon_wd_radio_button_empty.
        ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE <ls_entry>
                                                  TO <ld_fld>.
        IF ( <ld_fld> IS ASSIGNED ).
    *     Set selected radio button "selected".
          <ld_fld> = icon_wd_radio_button.
        ENDIF.
    *   Force PAI followed by refresh of table display in PBO
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'DUMMY'
    *      IMPORTING
    *        RC       =
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
    *       MAIN                                                          *
      PERFORM select_data.
      CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
               EXPORTING container_name = g_container.
        CREATE OBJECT grid1
               EXPORTING i_parent = g_custom_container.
        PERFORM build_fieldcatalog.
        CALL METHOD grid1->set_table_for_first_display
    *      EXPORTING
    *        i_structure_name = 'SFLIGHT'
          CHANGING
            it_fieldcatalog  = gt_fcat
            it_outtab        = gt_sflight.
    *   Set event handler for event TOOLBAR
        SET HANDLER:
          lcl_eventhandler=>handle_hotspot_click FOR grid1.
      else.
        CALL METHOD grid1->refresh_table_display
    *      EXPORTING
    *        IS_STABLE      =
    *        I_SOFT_REFRESH =
          EXCEPTIONS
            FINISHED       = 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.
    ENDMODULE.                    "PBO OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    *   to react on oi_custom_events:
      CALL METHOD cl_gui_cfw=>dispatch.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN OTHERS.
    *     do nothing
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                    "PAI INPUT
    *       FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    *  CALL METHOD G_CUSTOM_CONTAINER->FREE.
    *  CALL METHOD CL_GUI_CFW=>FLUSH.
      LEAVE PROGRAM.
    ENDFORM.                    "EXIT_PROGRAM
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat,
        ls_hype        TYPE lvc_s_hype.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'LVC_S_FCAT'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        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.
      DELETE gt_fcat WHERE ( fieldname <> 'EMPHASIZE' ).
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'SFLIGHT'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        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.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'EMPHASIZE'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
      ENDIF.
      ls_fcat-fieldname = 'BUTTON4'.
      ls_fcat-icon    = 'X'.
      ls_fcat-hotspot = 'X'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON3'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON2'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON1'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      LOOP AT gt_fcat INTO ls_fcat.
        ls_fcat-col_pos = syst-tabix.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SELECT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
    * define local data
      DATA:
        ls_sflight    TYPE ty_s_sflight.
      SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
      ls_sflight-button1 = icon_wd_radio_button.
      ls_sflight-button2 = icon_wd_radio_button_empty.
      ls_sflight-button3 = icon_wd_radio_button_empty.
      ls_sflight-button4 = icon_wd_radio_button_empty.
      MODIFY gt_sflight FROM ls_sflight
          TRANSPORTING button1 button2 button3 button4
        WHERE ( carrid IS NOT INITIAL ).
    ENDFORM.                    " SELECT_DATA
    Regards
    Uwe

  • Field symbol has not yet been defined-ALV Grid Display in Report

    Hi all,
              Iam calling a Function module for ALV grid display in Report programming. Its throwing the Error message Field Symbol has not yet defined. Can any one suggest what i have to do regarding it?

    Hi,
    <li> This is problem with fieldcatalog.
    <li> Check field names or table name in small letters in quotes while building fieldcatalog internal table
    <li> Check the fieldcatalog internal table , whether it has same fields as in data table which is shown using GRID_DISPLAY function module.
    Thanks
    Venkat.O

  • Push button in ALV Grid Display

    Hi all,
    I have a requirement wherin i need to place a button in the ALV Grid Display which should update all the records whatever are displayed in the specified infotype. This is to be done in a report.
    Can anybody give me any pointers or sample code for the above query.
    Regards,
    Amrita

    Simply add a button on your GUI status. Then when pushed, code your logic for update IT0008.
    AT USER-COMMAND event block will be triggered when you press your button.
    AT USER-COMMAND.
      if sy-ucomm = 'PUSHBUTTON'.    "here comes function code of your pushbutton
         "update your diplayed records
      endif.

  • TO enable the menu button in ALV Grid Display

    Hi Mates,
    I have a peculiar problem while doing ALV Grid display for screens.
    In the main Screen i have Three coloumns.The 1st coloum will interacted
    next screen 101 and 2nd coloum will interacted to screen 102.
    Now the problem is in the menu of ALV Grid display,the Total button was enabled for screen
    101 and same button is disabled in screen 102.
    But the code semms to be fine .
    Below i have pasted the code and please have a look and help to come out of this cris.
    My Code  :
    FORM CREATE_ALV_GRID USING R_SCREEN.
      DATA: LS_LAYOUT TYPE LVC_S_LAYO,
      ITAB_FUNCTIONS     TYPE UI_FUNCTIONS.   "MHTK903257(+)(add)
      CASE R_SCREEN.
    *--> SCREEN 9000
        WHEN C_SCREEN_9000.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' 'WADAT'     'Due date'(004)  'X' 'D' ' ' ' ' ' ' 'C100',
    *'ITAB_OVERVIEW' 'HU_UNLOAD' 'Unloaded HU'(005) 'X' 'I' '15' ' ' ' ' 'C500',  "MHTK903257(-)
    'ITAB_OVERVIEW' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    GMTK901103: REMOVE HOTSPOT ON ESTIMATED TO:
    'ITAB_OVERVIEW' 'EST_TO'    'Estim TO'(030)    ' ' 'I' ' '  ' ' ' ' 'C500'.
          LOOP AT ITAB_INB_LOC WHERE OUTPUT = 'X'.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_OVERVIEW' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC 'X' '' ' ' ' ' 'R' 'C500'.  "MHTK903418
            ENDLOOP.
          LOOP AT ITAB_STORAGE_TYPE WHERE OUTPUT = 'X'.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1000
            EXPORTING
              I_PARENT  = PT_DOCK_1000.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1000
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1000->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_OVERVIEW
              IT_FIELDCATALOG = ITAB_FIELDCAT_9000.
    *--> SCREEN 9100
        WHEN C_SCREEN_1100.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETIAL' 'WAUHR'     'Due time'(007)  ' ' 'T' ' ' 'X' ' ' 'C100',
    'ITAB_DETAIL' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    'ITAB_DETAIL' 'EST_TO'    'Estim TO'(030)   ' ' 'I' ' '  ' ' ' ' 'C500'.
       CLEAR ITAB_INB_LOC.
        LOOP AT ITAB_INB_LOC WHERE SELECTED = 'X'.
             CHECK SY-SUBRC EQ 0.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_DETAIL' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC '' '' ' ' ' ' 'R' 'C500'.
         ENDLOOP.
         CLEAR: ITAB_STORAGE_TYPE.
          LOOP AT ITAB_STORAGE_TYPE WHERE SELECTED = 'X'.
            CHECK SY-SUBRC EQ 0.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETAIL' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1100
            EXPORTING
              I_PARENT  = PT_DOCK_1100.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1100
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1100->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_DETAIL
              IT_FIELDCATALOG = ITAB_FIELDCAT_1100.
    screen 1300 TO detail.
    *--> SCREEN 9300
        WHEN C_SCREEN_1300.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1300
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_TO2' 'TANUM' 'TO'(020)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_TO2' 'NLPLA' 'Location'(021) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'LETY1' 'SUT'(013)  ' ' 'C'  ' ' ' ' ' ' 'C500',
    'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    *'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1300
            EXPORTING
              I_PARENT  = PT_DOCK_1300.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1300
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_TO2 BY TANUM VBELN POSNR.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1300->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_TO2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1300.
    screen 9400 Pre Processing detail.
    *--> SCREEN 9400
        WHEN C_SCREEN_9400.          "MHTK903418(BEgin Of change)
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1400
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_PRE_PROC2' 'Z_PRE_PROC' 'Pre Processing Number'(030)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'Z_PRE_PROC_LN' 'Pre Processing Number'(035) ' '   'C' ' '  ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'MATNR' 'Material'(035) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_PRE_PROC2' 'Z_PSH_QTY' 'Quantity'(035) ' '   'C' ' '  ' ' ' ' 'C500'.
    *'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    **'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1400
            EXPORTING
              I_PARENT  = PT_DOCK_1400.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1400
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_PRE_PROC2 BY Z_PRE_PROC.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1400->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_PRE_PROC2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1400.  "MHTK903418(End of change)
      ENDCASE.

    Hi
    U copy from standard program and paste ur report ...It will work..'
    Regards:
    Prabu

  • Remove buttons in ALV grid display in ABAP Web Dynpro

    Hi,
    Sub: ALV grid-->Web Dynpro ABAP.
    Request guidance to prevent display of the buttons "Microsoft Excel" and "Print Version" (which provide options to export the ALV grid output into an Excel format document).
    Is there a way we could hide this from being displayed on the ALV grid in a Web dynpro ABAP component output?
    Thanks very much.
    Best Regards,
    Adi

    Hi Adithya,
    really simple solution is to call cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs=>set_all( abap_false ). This deactivates all ALV functionality.
    For individual setting cl_salv_wd_config_table if_salv_wd_standard_functions~set_<x>_allowed.
    - Michelle

  • Custom buttons in ALV grid display

    I want to add custom buttons on application toolbar while displaying an ALV report using grid display.
    how can it be done?

    Hi
    In order to add user command functioality to the ALV grid you need to perform the following steps:
                        1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'USER_COMMAND' FORM
                    2. Create 'USER_COMMAND' FORM
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                I_callback_user_command = 'USER_COMMAND'   "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
          FORM USER_COMMAND                                          *
          --> R_UCOMM                                                *
          --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
      Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
        Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
        Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    In order modify PF_STATUS of ALV grid report you need to perform the following steps:
         1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include:
                        i_callback_pf_status_set = 'SET_PF_STATUS' statement.
         2. Create 'SET_PF_STATUS' FORM
         3. Create pf_status (i.e. 'ZNEWSTATUS').
              - It is recommend that you copy standard status'STANDARD' from function group SALV
                and modify it accordingly. ALV standard function codes always start with '&'.
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                i_callback_pf_status_set = 'SET_PF_STATUS'   "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
          FORM SET_PF_STATUS                                         *
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZNEWSTATUS'.
                      "Copy of 'STANDARD' pf_status from fgroup SALV
    ENDFORM.

  • Button in ALV grid display

    Hi frenz,
    I have a requirement in PS module.The problem is, i am fetching 'lessons learned from the project' from CJ20N tcode which i have to display in ALV.If it is one line or two line i can display in the ALV but if it is of 1 or 2 pages ? here i have to place an icon or button for that and upon clicking that it shud go to that long text(cj20n tcode).pls help me .
    reward is guaranteed.
    BR,
    ANIl.

    Hello Anil
    Here is an example of how to display the long text of a PSP project.
    *& Report  ZUS_SDN_PS_LONGTEXT_DISPLAY
    REPORT  zus_sdn_ps_longtext_display.
    DATA:
      go_docking     TYPE REF TO cl_gui_docking_container,
      go_textedit    TYPE REF TO cl_gui_textedit,
      gd_name        TYPE thead-tdname,
      gs_header      TYPE thead,
      gd_langu       TYPE thead-tdspras,
      gt_lines       TYPE STANDARD TABLE OF tline.
    PARAMETERS:
      p_pspnr    TYPE prps-pspnr.
    START-OF-SELECTION.
    * Get the text object
      gs_header-tdid = 'LTXT'.  " long text
      gs_header-tdspras = syst-langu.
      CONCATENATE syst-langu p_pspnr
          INTO gs_header-tdname.
      gs_header-tdobject = 'PMS'.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
    *     CLIENT                        = SY-MANDT
          id                            = gs_header-tdid
          language                      = gs_header-tdspras
          name                          = gs_header-tdname
          object                        = gs_header-tdobject
    *     ARCHIVE_HANDLE                = 0
    *     LOCAL_CAT                     = ' '
    *   IMPORTING
    *     HEADER                        =
        TABLES
          lines                         = gt_lines
        EXCEPTIONS
          id                            = 1
          language                      = 2
          name                          = 3
          not_found                     = 4
          object                        = 5
          reference_check               = 6
          wrong_access_to_archive       = 7
          OTHERS                        = 8.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
      IF ( go_textedit IS NOT BOUND ).
        CREATE OBJECT go_docking
           EXPORTING
             parent                      = cl_gui_container=>screen0
    *        REPID                       =
    *        DYNNR                       =
    *        SIDE                        = DOCK_AT_LEFT
    *        EXTENSION                   = 50
    *        STYLE                       =
    *        LIFETIME                    = lifetime_default
    *        CAPTION                     =
    *        METRIC                      = 0
            RATIO                       = 90
    *        NO_AUTODEF_PROGID_DYNNR     =
    *        NAME                        =
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
    *     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CREATE OBJECT go_textedit
          EXPORTING
    *        MAX_NUMBER_CHARS       =
    *        STYLE                  = 0
            wordwrap_mode          =
                c_textedit_control=>wordwrap_at_windowborder
    *        WORDWRAP_POSITION      =
            wordwrap_to_linebreak_mode =
               c_textedit_control=>true
    *        FILEDROP_MODE          = DROPFILE_EVENT_OFF
            parent                 = go_docking
    *        LIFETIME               =
    *        NAME                   =
          EXCEPTIONS
            error_cntl_create      = 1
            error_cntl_init        = 2
            error_cntl_link        = 3
            error_dp_create        = 4
            gui_type_not_supported = 5
            OTHERS                 = 6.
        IF sy-subrc <> 0.
    *     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CALL METHOD go_textedit->set_text_as_r3table
          EXPORTING
            table           = gt_lines
          EXCEPTIONS
            error_dp        = 1
            error_dp_create = 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.
        CALL METHOD go_textedit->set_enable
          EXPORTING
            enable            = CL_GUI_cfw=>false
           EXCEPTIONS
             CNTL_ERROR        = 1
             CNTL_SYSTEM_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.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      SET SCREEN 0. LEAVE SCREEN.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Dynpro '0100' has no elements with the following flow logic:
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    You simply add the button on your ALV list. When the user pushes this button you have to handle event BUTTON_CLICK. There you could call a function module containing the sample code above (has to be adjusted a little bit) which displays the long text.
    Regards
      Uwe

  • Error in clicking save to local file button in alv grid?

    Hi
    I am getting error , While clicking on some buttons like save as local file button in alv grid display
    How to rectify it
    Thanks in advance

    In your REUSE_ALV_GRID_DISPLAY 
    EXPORTING
          I_SAVE                  = 'U'
    put this field....and then check it will definitely work...

  • Problem with ALV Grid Display screen Back Button

    Dear Friends ,
    I have an ALV Grid Display,Here am facing a problem for my 'Back' button,i haven't defined any PF Status and is using the standard one.But after the Display when i press Back Button a blank Screen is appearing n then again i have to press back button to go to my Selection Screen.
    Please Suggest if i have to take care of something else.
    I want my Selection Screen when i press Back on my Display Screen.
    DATA:  IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
             I_BYPASSING_BUFFER          =
             I_BUFFER_ACTIVE             =
             I_INTERFACE_CHECK           = ' '
                 I_CALLBACK_PROGRAM          = 'ZRMMPD01A'
             I_CALLBACK_PF_STATUS_SET    = ' '
             I_CALLBACK_USER_COMMAND     = ' '
             I_CALLBACK_TOP_OF_PAGE      = ' '
             I_CALLBACK_HTML_TOP_OF_PAGE = ' '
             I_CALLBACK_HTML_END_OF_LIST = ' '
             I_STRUCTURE_NAME            =
             I_BACKGROUND_ID             = ' '
             I_GRID_TITLE                =
             I_GRID_SETTINGS             =
               IS_LAYOUT                     =  I_LAYOUT
               IT_FIELDCAT                 =  IT_FIELDCAT
             IT_EXCLUDING                =
             IT_SPECIAL_GROUPS           =
             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
        IMPORTING
             E_EXIT_CAUSED_BY_CALLER     =
             ES_EXIT_CAUSED_BY_USER      =
             TABLES
                  T_OUTTAB                    = IT_FINAL
            EXCEPTIONS
                 PROGRAM_ERROR               = 1
                 OTHERS                      = 2
    Thanks and Regards,
    Ashwini

    Hi Vijay ,
    No i dont have any write statement in my proggram.
    Here it is
    REPORT ZRMMPD01A  NO STANDARD PAGE HEADING.
    TABLES : EQUI,SER03,MKPF,OBJK.
    TYPE-POOLS : SLIS.
    DATA  IT_EQUI LIKE EQUI OCCURS 0 WITH HEADER LINE.
    DATA  IT_OBJK LIKE OBJK OCCURS 0 WITH HEADER LINE..
    DATA  IT_SER03 LIKE SER03 OCCURS 0 WITH HEADER LINE.
    DATA  IT_MKPF LIKE MKPF OCCURS 0 WITH HEADER LINE .
    DATA : BEGIN OF IT_DISPLAY OCCURS 0,
                MATNR LIKE EQUI-MATNR,
                SERNR LIKE EQUI-SERNR,
                BWART LIKE SER03-BWART,
                WERK LIKE SER03-WERK,
                CHARGE LIKE SER03-CHARGE,
                LAGERORT LIKE SER03-LAGERORT,
                MBLNR LIKE SER03-MBLNR,
                MJAHR LIKE SER03-MJAHR,
                ZEILE LIKE SER03-ZEILE,
                BUDAT LIKE MKPF-BUDAT,
                BKTXT LIKE MKPF-BKTXT,
                USNAM LIKE MKPF-USNAM,
                XBLNR LIKE MKPF-XBLNR,
            END OF IT_DISPLAY.
    DATA : WA_DISPLAY LIKE IT_DISPLAY.
    DATA  IT_FINAL LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
    DATA  IT_TEMP LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
    DATA:  IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA :I_LAYOUT TYPE SLIS_LAYOUT_ALV,
          I_EVENTS TYPE SLIS_T_EVENT.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_MATNR FOR EQUI-MATNR MATCHCODE OBJECT MCD,"OBLIGATORY
                    S_SERNR FOR EQUI-SERNR, "MATCHCODE OBJECT MCD OBLIGATORY
                    S_MBLNR FOR SER03-MBLNR MATCHCODE OBJECT MCD,
                    S_BWART FOR SER03-BWART MATCHCODE OBJECT MCD,
                    S_WERK FOR SER03-WERK MATCHCODE OBJECT MCD,
                    S_LAGET FOR SER03-LAGERORT MATCHCODE OBJECT MCD,
                    S_BUDAT FOR MKPF-BUDAT MATCHCODE OBJECT MCD,
                    S_XBLNR FOR MKPF-XBLNR MATCHCODE OBJECT MCD.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X',
                 R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B2.
    START-OF-SELECTION.
    *Fetch Data.
      PERFORM GET_DATA.
    *Fill Display Fields.
      PERFORM FILL_TABLE.
    *Segregate data according to radio button selection.
      PERFORM SELECT_CONDITION.
    *Fill The Feild catalog.
      PERFORM FIELD_CATALOG.
    *Display Output.
      PERFORM OUTPUT_DISPLAY..
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA.
      SELECT * FROM EQUI INTO TABLE IT_EQUI
        WHERE MATNR IN S_MATNR
        AND SERNR IN S_SERNR.
      SELECT * FROM OBJK INTO TABLE IT_OBJK
      FOR ALL ENTRIES IN IT_EQUI
      WHERE EQUNR = IT_EQUI-EQUNR.
      SELECT * FROM SER03 INTO TABLE IT_SER03
      FOR ALL ENTRIES IN IT_OBJK
      WHERE OBKNR = IT_OBJK-OBKNR
      AND MBLNR IN S_MBLNR
      AND BWART IN S_BWART
      AND WERK IN S_WERK
      AND LAGERORT IN S_LAGET.
      SELECT * FROM MKPF INTO TABLE IT_MKPF
      FOR ALL ENTRIES IN IT_SER03
      WHERE MBLNR = IT_SER03-MBLNR
      AND BUDAT IN S_BUDAT
      AND XBLNR IN S_XBLNR.
    ENDFORM.                    " GET_DATA
    *&      Form  FILL_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM FILL_TABLE.
      LOOP AT IT_EQUI.
        LOOP AT IT_OBJK.
          IF IT_OBJK-EQUNR <> IT_EQUI-EQUNR.
            SKIP.
          ELSE.
            READ TABLE IT_SER03 WITH KEY OBKNR = IT_OBJK-OBKNR.
            IF SY-SUBRC = 0.
              WA_DISPLAY-MATNR = IT_EQUI-MATNR.
              WA_DISPLAY-SERNR = IT_EQUI-SERNR.
              WA_DISPLAY-BWART = IT_SER03-BWART.
              WA_DISPLAY-WERK = IT_SER03-WERK.
              WA_DISPLAY-CHARGE = IT_SER03-CHARGE.
              WA_DISPLAY-LAGERORT = IT_SER03-LAGERORT.
              WA_DISPLAY-MBLNR = IT_SER03-MBLNR.
              WA_DISPLAY-MJAHR = IT_SER03-MJAHR.
              WA_DISPLAY-ZEILE = IT_SER03-ZEILE.
             READ TABLE IT_MKPF WITH KEY MBLNR = IT_SER03-MBLNR.
              IF SY-SUBRC = 0.
                WA_DISPLAY-BUDAT = IT_MKPF-BUDAT.
                WA_DISPLAY-BKTXT = IT_MKPF-BKTXT.
                WA_DISPLAY-USNAM = IT_MKPF-USNAM.
                WA_DISPLAY-XBLNR = IT_MKPF-XBLNR.
              ENDIF.
            ENDIF.
          ENDIF.
          IF NOT WA_DISPLAY IS INITIAL.
            APPEND WA_DISPLAY TO IT_DISPLAY.
            CLEAR WA_DISPLAY.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " FILL_TABLE
    *&      Form  FIELD_CATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM FIELD_CATALOG.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'MATNR'.
      FIELDCAT-SELTEXT_M = 'Material Number'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'SERNR'.
      FIELDCAT-SELTEXT_M = 'Serial number'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'MBLNR'.
      FIELDCAT-SELTEXT_L = 'Number of material document'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'BWART'.
      FIELDCAT-SELTEXT_M = 'Movement type'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'WERK'.
      FIELDCAT-SELTEXT_M = 'Plant'.
      FIELDCAT-OUTPUTLEN =  5.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'CHARGE'.
      FIELDCAT-SELTEXT_M = 'Batch number'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'LAGERORT'.
      FIELDCAT-SELTEXT_M = 'Storage Location'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'MJAHR'.
      FIELDCAT-SELTEXT_M = 'Material doc. year'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'ZEILE'.
      FIELDCAT-SELTEXT_L = 'Item in material document'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'BUDAT'.
      FIELDCAT-SELTEXT_L = 'Posting date in the document'.
      FIELDCAT-OUTPUTLEN =  10.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'BKTXT'.
      FIELDCAT-SELTEXT_L = 'Document header text'.
      FIELDCAT-OUTPUTLEN =  25.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'USNAM'.
      FIELDCAT-SELTEXT_M = 'User name'.
      FIELDCAT-OUTPUTLEN =  15.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'XBLNR'.
      FIELDCAT-SELTEXT_L = 'Reference document number'.
      FIELDCAT-OUTPUTLEN =  25.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
    ENDFORM.                    " FIELD_CATALOG
    *&      Form  DISPLAY_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM OUTPUT_DISPLAY.
      IF R1 = 'X'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
              I_CALLBACK_PROGRAM          = 'ZRMMPD01A'
              IS_LAYOUT                   =  I_LAYOUT
              IT_FIELDCAT                 = IT_FIELDCAT
          TABLES
              T_OUTTAB                    = IT_DISPLAY
            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.
        REFRESH IT_DISPLAY.
        CLEAR IT_DISPLAY.
      ELSEIF R2 = 'X'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
                 I_CALLBACK_PROGRAM          = 'ZRMMPD01A'
                 IS_LAYOUT                     =  I_LAYOUT
                 IT_FIELDCAT                 =  IT_FIELDCAT
             TABLES
                  T_OUTTAB                    = IT_FINAL
            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.
        REFRESH IT_DISPLAY.
        CLEAR IT_DISPLAY.
      ENDIF.
    ENDFORM.                    " DISPLAY_OUTPUT
    *&      Form  SELECT_CONDITION
          text
    -->  p1        text
    <--  p2        text
    FORM SELECT_CONDITION.
      IF R2 = 'X'.
        CLEAR WA_DISPLAY.
        SORT IT_DISPLAY BY MATNR SERNR MBLNR ZEILE.
        DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
        LOOP AT IT_DISPLAY WHERE ZEILE = '0002'.
          READ TABLE IT_DISPLAY WITH KEY MATNR = IT_DISPLAY-MATNR
          SERNR = IT_DISPLAY-SERNR ZEILE = '0001'.
          IF SY-SUBRC = 0.
            DELETE IT_DISPLAY.
          ENDIF.
        ENDLOOP.
        SORT IT_DISPLAY BY MATNR SERNR BWART MBLNR.
        DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
        LOOP AT IT_DISPLAY.
          IF WA_DISPLAY IS INITIAL.
            WA_DISPLAY =  IT_DISPLAY.
          ENDIF.
          LOOP AT IT_DISPLAY WHERE MATNR = WA_DISPLAY-MATNR
          AND SERNR = WA_DISPLAY-SERNR.
            IF IT_DISPLAY-BUDAT > WA_DISPLAY-BUDAT.
              WA_DISPLAY = IT_DISPLAY.
            ELSE.
              DELETE IT_DISPLAY.
            ENDIF.
          ENDLOOP.
          APPEND WA_DISPLAY TO IT_TEMP.
          CLEAR WA_DISPLAY.
        ENDLOOP.
        DELETE ADJACENT DUPLICATES FROM IT_TEMP.
        IF NOT IT_TEMP[] IS INITIAL.
          IT_FINAL[] = IT_TEMP[].
        ENDIF.
      ENDIF.
    ENDFORM.                    " SELECT_CONDITION
    Regards,
    Ashwini

  • Not able to download all the rows to excel sheet from alv grid display

    Hi experts,
    I am not able to download all the rows which are displayed in alv grid display for some material numbers.
    for some materials i am able to download, i used two ways to download 1) from icon(local file) on grid 2) menu list->export.
    i checked in debugging till selecting the spread sheet pop up window, i am able to see all the data in internal table.
    Can you suggest me what will be the problem....
    thanks in advance,

    hi sandeep,
    sorry for didnt specify clearly.
    note: EX: "asaasdada  in this sentence i said  " this symbol is special character not the text.
    building final internal table code
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
        EXPORTING
          capid                 = p_capid
          datuv                 = sy-datum
          ehndl                 = '1'
          mktls                 = 'X'
          mehrs                 = 'X'
          mmory                 = '1'
          mtnrv                 = p_matnr
          stlal                 = '1'
          stpst                 = 0
          svwvo                 = 'X'
          werks                 = p_werks
          vrsvo                 = 'X'
        TABLES
          stb                   = i_stb
        EXCEPTIONS
          alt_not_found         = 1
          call_invalid          = 2
          material_not_found    = 3
          missing_authorization = 4
          no_bom_found          = 5
          no_plant_data         = 6
          no_suitable_bom_found = 7
          conversion_error      = 8
          OTHERS                = 9.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      i_stb1[] = i_stb[].
      IF NOT i_stb1[] IS INITIAL.
        SORT i_stb1 BY idnrk.
        DELETE ADJACENT DUPLICATES FROM i_stb1 COMPARING idnrk.
        SELECT bmatn ematn FROM ampl INTO TABLE i_ampl
          FOR ALL ENTRIES IN i_stb1
          WHERE bmatn = i_stb1-idnrk AND
                datuv LE sy-datum AND                          
                datub GE sy-datum.                              
        SELECT
        matnr
        bwkey
        verpr
        stprs
        bwprh
        FROM mbew
        INTO TABLE i_mbew
        FOR ALL ENTRIES IN i_stb1
        WHERE
            matnr EQ i_stb1-idnrk AND
            bwkey EQ i_stb1-werks.
        IF NOT i_stb1[] IS INITIAL.
          SELECT matnr werks beskz
                 dzeit webaz plifz                              
                 ekgrp                                         
          INTO TABLE i_marc
          FROM marc
          FOR ALL ENTRIES IN i_stb1
          WHERE matnr = i_stb1-idnrk
          AND werks = i_stb1-werks.
          SORT i_marc BY matnr werks.
        ENDIF.
        CLEAR i_ekpo.
        CLEAR i_vend.
        IF NOT i_stb1[] IS INITIAL.
          SELECT ebeln ebelp matnr werks loekz aedat
                 netpr peinh                                   
          INTO TABLE i_ekpo
          FROM ekpo
                FOR ALL ENTRIES IN i_stb1
                WHERE matnr = i_stb1-idnrk
                AND werks = i_stb1-werks.
          SORT i_ekpo BY matnr ASCENDING
                         aedat DESCENDING
                         ebeln DESCENDING
                         ebelp DESCENDING.
          IF NOT i_ekpo IS INITIAL.
            SELECT k~ebeln k~lifnr l~name1
            INTO TABLE i_vend
            FROM ekko AS k INNER JOIN lfa1 AS l
            ON k~lifnr EQ l~lifnr
            FOR ALL ENTRIES IN i_ekpo
            WHERE ebeln = i_ekpo-ebeln.
            SORT i_vend BY ebeln.
          ENDIF.
        ENDIF.
      ENDIF.
      i_ampl1[] = i_ampl[].
      IF NOT i_ampl1[] IS INITIAL.
        SORT i_ampl1 BY ematn.
        DELETE ADJACENT DUPLICATES FROM i_ampl1 COMPARING ematn.
        SELECT matnr mfrpn mfrnr FROM mara INTO TABLE i_mara
          FOR ALL ENTRIES IN i_ampl1
           WHERE matnr = i_ampl1-ematn.
      ENDIF.
      SORT i_ampl BY bmatn.
      IF NOT i_stb[] IS INITIAL.
        SELECT stlty stlnr stlkn stpoz idnrk potx1 potx2
        INTO TABLE i_stpo
        FROM stpo
        FOR ALL ENTRIES IN i_stb
        WHERE stlty = i_stb-stlty
          AND stlnr = i_stb-stlnr
          AND stlkn = i_stb-stlkn
          AND stpoz = i_stb-stpoz
          AND idnrk = i_stb-idnrk.
        SORT i_stpo BY stlty stlnr stlkn stpoz idnrk.
      ENDIF.
      LOOP AT i_stb INTO wa_stb.
        READ TABLE i_marc INTO wa_marc
        WITH KEY     matnr = wa_stb-idnrk
                     werks = wa_stb-werks
                     BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-beskz = wa_marc-beskz.
          wa_outtab-dzeit = wa_marc-dzeit.                      
          wa_outtab-webaz = wa_marc-webaz.                     
          wa_outtab-plifz = wa_marc-plifz.                     
          wa_outtab-ekgrp = wa_marc-ekgrp.                     
        ENDIF.
        READ TABLE i_ekpo INTO wa_ekpo
            WITH KEY matnr = wa_stb-idnrk.
        IF sy-subrc = 0.
          wa_outtab-netpr = wa_ekpo-netpr.                     
          wa_outtab-peinh = wa_ekpo-peinh.                     
          READ TABLE i_vend INTO wa_vend
          WITH KEY ebeln = wa_ekpo-ebeln
                   BINARY SEARCH.
          IF sy-subrc = 0.
            wa_outtab-lifnr = wa_vend-lifnr.
            wa_outtab-name_sup = wa_vend-name1.
          ENDIF.
        ENDIF.
        READ TABLE i_stpo INTO wa_stpo
        WITH KEY stlty = wa_stb-stlty
                 stlnr = wa_stb-stlnr
                 stlkn = wa_stb-stlkn
                 stpoz = wa_stb-stpoz
                 idnrk = wa_stb-idnrk
                 BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-potx1 = wa_stpo-potx1.
          wa_outtab-potx2 = wa_stpo-potx2.
        ENDIF.
        READ TABLE i_mbew INTO wa_mbew
        WITH KEY
        matnr = wa_stb-idnrk
        bwkey = wa_stb-werks.
        IF sy-subrc IS INITIAL.
          MOVE:
          wa_mbew-verpr TO wa_outtab-verpr,
          wa_mbew-stprs TO wa_outtab-stprs,
          wa_mbew-bwprh TO wa_outtab-bwprh.
        ENDIF.
        wa_outtab-matnr = p_matnr.
        wa_outtab-posnr = wa_stb-posnr.
        wa_outtab-stufe = wa_stb-stufe.
        wa_outtab-idnrk = wa_stb-idnrk.
        wa_outtab-ojtxb = wa_stb-ojtxp.
        wa_outtab-menge = wa_stb-menge.
        wa_outtab-meins = wa_stb-meins.
        MOVE: wa_stb-zzitem_draw_no TO wa_outtab-zzitem_draw_no.
        IF wa_stb-upskz = 'X'.
          SELECT * FROM stpu INTO TABLE i_stpu
                   WHERE  stlty = wa_stb-stlty AND
                          stlnr = wa_stb-stlnr AND
                          stlkn = wa_stb-stlkn AND
                          stpoz = wa_stb-stpoz.
        ENDIF.
        LOOP AT i_stpu INTO wa_stpu.
          wa_outtab-upmng = wa_stpu-upmng.
          wa_outtab-ebort = wa_stpu-ebort.
          wa_outtab-uposz = wa_stpu-uposz.
          CONCATENATE v_ebort wa_stpu-ebort      INTO v_ebort
          SEPARATED BY space.
        ENDLOOP.
        MOVE strlen( v_ebort ) TO v_len.
        MOVE: 0 TO x,
          128 TO y.
        DATA : lt_tab TYPE TABLE OF swastrtab.
        DATA : ls_tab LIKE LINE OF lt_tab.
        DATA : lv_ebort TYPE string.
        CLEAR lv_ebort. CLEAR lt_tab.
        MOVE v_ebort TO lv_ebort.
        CALL FUNCTION 'SWA_STRING_SPLIT'
          EXPORTING
            input_string                 = lv_ebort
            max_component_length         = 128
          TABLES
            string_components            = lt_tab
          EXCEPTIONS
            max_component_length_invalid = 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.
        IF lt_tab[] IS NOT INITIAL.
          LOOP AT lt_tab INTO ls_tab.
            CLEAR lv_ebort.
            MOVE: ls_tab-str TO lv_ebort.
            CONDENSE lv_ebort.
            MOVE lv_ebort TO wa_outtab-ebort.
            APPEND wa_outtab TO i_outtab.
            CLEAR:
            wa_outtab-matnr,
            wa_outtab-posnr,
            wa_outtab-zzitem_draw_no,
            wa_outtab-ojtxb,
            wa_outtab-menge,
            wa_outtab-meins,
            wa_outtab-uposz,
            wa_outtab-upmng,
            wa_outtab-verpr,
            wa_outtab-stprs,
            wa_outtab-bwprh,
            wa_outtab-lifnr,
            wa_outtab-name_sup,
            wa_outtab-potx1,
            wa_outtab-potx2,
            wa_outtab-netpr,
            wa_outtab-peinh.
    *        wa_outtab-idnrk.
          ENDLOOP.
        ELSE.
          APPEND wa_outtab TO i_outtab.
        ENDIF.
        CLEAR v_ebort.
        CLEAR: wa_stpu.
        REFRESH: i_stpu.
        LOOP AT i_ampl INTO wa_ampl WHERE bmatn = wa_stb-idnrk.
        READ TABLE i_mara INTO wa_mara WITH TABLE KEY matnr = wa_ampl-ematn.
          IF sy-subrc = 0.
            LOOP AT i_outtab INTO wa_outtab
            WHERE
            idnrk = wa_stb-idnrk AND
            flag NE 'X'.
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              MOVE 'X' TO wa_outtab-flag.
              MODIFY i_outtab FROM wa_outtab
              TRANSPORTING mfrpn mfrnr name1 flag.
              EXIT.
            ENDLOOP.
            IF sy-subrc <> 0.
              CLEAR:
              wa_outtab-matnr,
              wa_outtab-posnr,
              wa_outtab-zzitem_draw_no,
              wa_outtab-ojtxb,
              wa_outtab-ebort,
    *          wa_outtab-idnrk,
              wa_outtab-menge,
              wa_outtab-meins,
              wa_outtab-uposz,
              wa_outtab-upmng,
              wa_outtab-verpr,
              wa_outtab-stprs,
              wa_outtab-bwprh,
              wa_outtab-lifnr,                                 
              wa_outtab-name_sup,                              
              wa_outtab-potx1,                                 
              wa_outtab-potx2,                                 
              wa_outtab-netpr,                                 
              wa_outtab-peinh.                                 
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              APPEND wa_outtab TO i_outtab.
            ENDIF.
          ENDIF.
          REFRESH i_stpu.
          CLEAR i_stpu.
        ENDLOOP.    CLEAR: wa_matnr1, wa_mfrnr, wa_outtab.
      ENDLOOP.
    Edited by: srinivasareddy j on Mar 9, 2011 7:16 AM
    Edited by: srinivasareddy j on Mar 9, 2011 7:20 AM

  • ALV grid display the subtotal not getting for one column at the output

    Hi,
    I am working one report ALV grid display and subtotal is not getting for one paricular coulumn.
    Eventhough that column has some values.
    So can anyone give the proper solution.
    Waiting quick response.
    Best Regards,
    Bansi

    Hi
    see this link .
    https://wiki.sdn.sap.com/wiki/display/ABAP/SUBTOTALinALV
    or try this program.
    REPORT zalv.
    DATA:
    t_sflight TYPE TABLE OF sflight,
    fs_sflight TYPE sflight.
    DATA:
    r_container TYPE REF TO cl_gui_custom_container,
    r_grid TYPE REF TO cl_gui_alv_grid.
    *FIELD CATALOG
    DATA:
    t_fcat TYPE lvc_t_fcat,
    fs_fcat TYPE lvc_s_fcat.
    *SORTING THE BASIC LIST
    DATA:
    t_sort TYPE lvc_t_sort,
    fs_sort TYPE lvc_s_sort.
    fs_fcat-fieldname = 'PRICE'.
    fs_fcat-do_sum = 'X'.
    APPEND fs_fcat TO t_fcat.
    fs_sort-spos ='1'.
    fs_sort-fieldname = 'CARRID'.
    fs_sort-down = 'X'.
    fs_sort-group = '*'.
    fs_sort-subtot = 'X'.
    APPEND fs_sort TO t_sort.
    SELECT * FROM sflight INTO TABLE t_sflight.
    CALL SCREEN 100.
    *& Module STATUS_0100 OUTPUT
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'SCREEN1'.
    SET TITLEBAR 'TITLE1'.ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    MODULE user_command_0100 INPUT.
    CASE sy-ucomm.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    **& Module HANDLER OUTPUT
    MODULE list OUTPUT.
    CREATE OBJECT r_container
    EXPORTING
    container_name = 'CONTAINER'.
    CREATE OBJECT r_grid
    EXPORTING
    i_parent = r_container.
    CALL METHOD r_grid->set_table_for_first_display
    EXPORTING
    i_structure_name = 'SFLIGHT'
    CHANGING
    it_fieldcatalog = t_fcat
    it_outtab = t_sflight
    it_sort = t_sort.
    ENDMODULE. "list OUTPUT
    Regards
    Hareesh Menon

  • Wan to add push button in the output of ALV Grid display.

    Hi Friends,
    I wan to add a Push button in the output of ALV GRID display with STANDARD ikons.
    How to copy standard ikons of GRID output.
    How to apply the copied status into my code.
    Regards,
    Viji

    Hi,
    Goto SE41, create a pf-status for your alv report program.
    On the next screen, click menu EXTRAS --> click option ADJUST TEMPLATES and select radiobutton LIST VIEWER --> you will get all standard buttons of alv in the pf-status.
    Delete the unwanted buttons and also you can add new buttons if reqd.
    Activate pf-status --> and apply in alv program.
    Now to apply this pf-status in your alv report follow code:-
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = v_rep_id       " report id
         i_callback_pf_status_set          = 'PF'           " for PF-STATUS
         i_callback_user_command           = 'USER_COMMAND' " for User-Command
         is_layout                         = wa_layout      " for layout
         it_fieldcat                       = it_field       " field catalog
         it_sort                           = it_sort        " sort info
        TABLES
          t_outtab                          = it_final      " internal table
       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.
    *&      Form  pf
    *       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
    *       ON WHICH THE ALV GRID IS DISPLAYED
    *       -->RT_EXTAB
    FORM pf USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZTG_STAT'. "<--pass pf-status name here
    ENDFORM.                    "pf
    *&      Form  USER_COMMAND
    *       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
    *       AND EXECUTE THE APPROPIATE CODE
    *      -->LV_OKCODE   used to capture the function code
    *                     of the user-defined push-buttons
    *      -->L_SELFIELD   text
    FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
    * assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    * handle the code execution based on the function code encountered
      CASE lv_okcode.
        WHEN '<function_code>'. "<--to handle user actions
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Hope this helps you.
    Regards,
    Tarun

  • Kindly help to develop alv grid display

    Hi ,
    I have a requirement in which I need to display ALV GRID display and in its tool bar 4 butons are required. In the same view down to alv display i want to develop a tabstrip and its functionalities.I have designed classic alv using SALV_WD_TABLE component. I want a good GRID Display, not like flat field names that comes in list display, looking for bulged fields(like what comes for ALV GRID in normal abap)  display with print version etc hidden and buttons at the top of ALV.  Kindly help
    Highly rewarded
    Kindly help
    Regards,
    Lakshmi
    Edited by: Lakshmi Menon on Nov 27, 2008 4:49 PM

    Well Web Dynpro is generally output in HTML so the output formatting is never going to quite look like a desktop application (which is the case with the ALV Grid).  You have very little control over the look of the column headers.  In fact you can only manipulate what is available via the Portal Theme. 
    There is a new Tradeshow Plus theme available in NetWeaver 7.01 which uses a gradiant background for the column headers.  This gives them a little more depth:
    http://www.flickr.com/photos/tjung/3068850120/
    The other option is next year when NetWeaver Business Client version 3.0 comes out, you will be able to render Web Dynpro applications using the NWBC Smart Client Rendering.  This will render Web Dynpro applications using desktop libraries instead of HTML/Browser. This gives Web Dynpro a more SAPGUI/Desktop appears of course.
    http://www.flickr.com/photos/tjung/2685619882/in/set-72157606418550143/

  • Button in alv grid cell using REUSE_ALV_GRID_DISPLAY

    Hi all,
      I want to make the contents of 2 columns of my alv grid as push button with values as text on it. I am not using classes or methods but alv grid fm. On clicking the button one dialog box has to pop up which gives edit option for the values in that coloumn, my question is how to introduce button in alv grid cell? if i can use t_fieldcatalog-icon, then please give me the complete steps for that.
    Thanks.

    this may helps u
    u need to copy stadard screen elemetn to MARATAB1(at PF -STATUS)
    You should copy the 'STANDARD' GUI status from program <b>SAPLSLVC_FULLSCREEN</b>
    type this one in SE41 program name is:<b>SAPLSLVC_FULLSCREEN</b>
    status : <b>STANDARD_FULLSCREEN</b>
    and copy it ...
             Type-pool
    type-pools slis.
             Tables
    tables: mara,sscrfields.
           Selection screen
    select-options: s_matnr for mara-matnr.
    PARAMETERS: p_email TYPE somlreci1-receiver.
    TYPES: BEGIN OF t_charmara,
      matnr(18)  TYPE c,                   " Material Number
      ernam(12)  TYPE c,                   " Person Credited
      aenam(12)  TYPE c,                   " Person Changed Object
      pstat(15)  TYPE c,                   " Maintenance Status
    END OF t_charmara.
             Data Declarations
    data: rt_extab    type slis_t_extab,   " Table of inactive function
                                           codes
          wa_charmara TYPE t_charmara,     " work area of mara Table
          fs_fieldcat type slis_t_fieldcat_alv,
                                           " Field catalog with field
                                           descriptions
          t_fieldcat  like line of fs_fieldcat,
                                           " Table of Field catalog
          r_ucomm     like sy-ucomm,       " User Command
          rs_selfield TYPE slis_selfield.  " cursor position ALV
    data: filedlayout   type slis_layout_alv,
          heading       type slis_t_listheader with header line,
          t_event       type slis_t_event.
    data: fs_event      like line of t_event.
    data: fs_sort type slis_sortinfo_alv,
           t_sort type slis_t_sortinfo_alv.
    data: w_char(200) type c,
          w_matnr     type mara-matnr.
    fs_sort-fieldname = 'MATNR'.
    fs_sort-up        = 'X'.
    fs_sort-group     = '*'.
    append fs_sort to t_sort.
    clear fS_sort.
    DATA:   t_packing_list  LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents      LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            t_receivers     LIKE somlreci1  OCCURS 0 WITH HEADER LINE,
            t_attachment    LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            w_cnt           TYPE i,
            w_sent_all(1)   TYPE c,
            w_doc_data      LIKE sodocchgi1,
            gd_error        TYPE sy-subrc,
            gd_reciever     TYPE sy-subrc.
             Internal Tables
    data: begin of it_mara occurs 0,
            matnr like mara-matnr,         " Material Number
            ernam like mara-ernam,         " Person Credited
            aenam like mara-aenam,         " Person Changed Object
            pstat like mara-pstat,         " Maintenance Status
          end of it_mara.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    *at selection-screen on field event
    AT SELECTION-SCREEN on s_matnr.
    PERFORM f0100_VALIDATE_MATERIAL_NUMBER.
    start-of-selection.
    retrive Data from the data base table Mara
    perform retrive_data_from_mara.
    end-of-selection.
    *Field catalog with field descriptions
    perform fieldcat.
    *perform top_of_page.
    PERFORM EVENT_LIST.
    *ALV Grid Display
    perform alv_display.
    Creating one Push button ENTER
    perform maratab1 USING    RT_EXTAB.
    *&      Form  f0100_VALIDATE_MATERIAL_NUMBER
          text
    There are no interface parameters to be passed to this subroutine
    FORM F0100_VALIDATE_MATERIAL_NUMBER .
    select matnr                          " Material Number
       from mara
      up to 1 rows
       into mara-matnr
      where matnr in s_matnr.
      endselect.
    IF sy-subrc NE 0.
          clear sscrfields-ucomm.
          MESSAGE e000 WITH 'Enter valid Material number'(003).
        ENDIF.                             " IF sy-subrc NE 0
    ENDFORM.                               " f0100_VALIDATE_MATERIAL_NUMBER
    *&      Form  retrive_data_from_mara
          text
    *There are no interface parameters to be passed to this subroutine
    FORM retrive_data_from_mara .
    select   matnr                         " Material Number
             ernam                         " Person Credited
             aenam                         " Person Changed Object
             pstat                         " Maintenance Status
        from mara
        into table It_mara
       where matnr in s_matnr.
    IF sy-subrc NE 0.
          MESSAGE i001 WITH 'Records are not found'.
          exit.
          stop.
        ENDIF.                             " IF sy-subrc NE 0
    ENDFORM.                               " retrive_data_from_mara
    *&      Form  fieldcat
          text
    *There are no interface parameters to be passed to this subroutine
    FORM fieldcat .
    *field catalog for MATNR
      t_FIELDCAT-REF_TABNAME = 'MARA'.
      t_fieldcat-fieldname   = 'MATNR'.
      t_fieldcat-col_pos     = 1.
      append t_fieldcat to fs_fieldcat.
      clear t_fieldcat.
    *field catalog for ERNAM
      t_FIELDCAT-REF_TABNAME = 'MARA'.
      t_fieldcat-fieldname   = 'ERNAM'.
      t_fieldcat-col_pos     = 2.
      append t_fieldcat to fs_fieldcat.
      clear t_fieldcat.
    *field catalog for AENAM
      t_FIELDCAT-REF_TABNAME = 'MARA'.
      t_fieldcat-fieldname   = 'AENAM'.
      t_fieldcat-col_pos     = 3.
      append t_fieldcat to fs_fieldcat.
      clear t_fieldcat.
    *field catalog for PSTAT
      t_FIELDCAT-REF_TABNAME = 'MARA'.
      t_fieldcat-fieldname   = 'PSTAT'.
      t_fieldcat-col_pos     = 4.
      append t_fieldcat to fs_fieldcat.
      clear t_fieldcat.
    ENDFORM.                               " fieldcat
    *&      Form  EVENT_LIST
          text
    *There are no interface parameters to be passed to this subroutine
    FORM EVENT_LIST .
      fs_event-name ='TOP_OF_PAGE'.
      fs_event-form = 'TOP_PAGE'.
      append fs_event TO t_EVENT.
      CLEAR FS_EVENT.
      fs_event-name ='END_OF_PAGE'.
      fs_event-form = 'END_PAGE'.
      append fs_event TO t_EVENT.
      CLEAR FS_EVENT.
      fs_event-name ='END_OF_LIST'.
      fs_event-form = 'LIST_END'.
      append fs_event TO t_EVENT.
      CLEAR FS_EVENT.
    ENDFORM.                               " EVENT_LIST
    *&      Form  alv_display
          text
    *There are no interface parameters to be passed to this subroutine
    FORM alv_display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
       I_CALLBACK_PROGRAM             = SY-REPID
       I_CALLBACK_PF_STATUS_SET       = 'MARATAB1'
       I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      =
       IT_FIELDCAT                    = FS_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
       IT_SORT                        = T_SORT
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
       IT_EVENTS                      = T_EVENT
      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
      IR_SALV_LIST_ADAPTER           =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = IT_MARA[]
    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.                               " alv_display
    form TOP_PAGE.
      data:tbl_listheader type slis_t_listheader,
            wa_listheader type slis_listheader .
       wa_listheader-typ = 'S'.
       wa_listheader-info = 'Created by : Vijay Pawar'.
       append wa_listheader to tbl_listheader.
       wa_listheader-typ = 'S'.
       concatenate ' Date ' sy-datum into
                  wa_listheader-info separated by space.
        append wa_listheader to tbl_listheader.
       wa_listheader-typ = 'S'.
       concatenate ' From ' s_matnr-low '  To  ' s_matnr-high into
                           wa_listheader-info separated by space.
       append wa_listheader to tbl_listheader.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = tbl_listheader
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    endform.                               " form TOP_PAGE.
    form END_PAGE.
      STATICS W_PAGE TYPE I .
      data:tbl_listheader type slis_t_listheader,
            wa_listheader type slis_listheader .
      wa_listheader-typ   = 'S'.
      wa_listheader-info  = W_PAGE.
      append wa_listheader to tbl_listheader.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = tbl_listheader
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    add 1 to w_page.
    endform.                               " form END_PAGE.
    form list_end.
      data:tbl_listheader type slis_t_listheader,
      wa_listheader type slis_listheader .
      wa_listheader-typ = 'S'.
      wa_listheader-info = '......................................Last Page'
      append wa_listheader to tbl_listheader.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = tbl_listheader
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    endform.                               " form list_end.
    *&      Form  maratab1
          text
         -->P_RT_EXTAB  text
    FORM maratab1  USING    P_RT_EXTAB.
      SET PF-STATUS 'MARATAB1' EXCLUDING rt_extab.
    ENDFORM.                               " maratab1
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                         rs_selfield TYPE slis_selfield.
    case r_ucomm.
       when 'ENTER'.
       perform bulid_xls_data_table.
       PERFORM send_file_as_email_attachment
                                      tables it_message
                                             it_attach
                                       using p_email "'[email protected]'
                                    'Example .xls documnet attachment'
                                             'XLS'
                                             'filename'
                                    changing gd_error
                                             gd_reciever.
        perform populate_email_message_body.
        PERFORM initiate_mail_execute_program.
      endcase.                             " case r_ucomm.
    endform.                               " FORM user_command
    perform populate_email_message_body.
    PERFORM initiate_mail_execute_program.
         CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
    EXPORTING
       DATA_FILENAME             = 'MARA.XLS'
       DATA_PATH_FLAG            = 'W'
      DATA_ENVIRONMENT          =
       DATA_TABLE                = ITAB[]
      MACRO_FILENAME            =
      MACRO_PATH_FLAG           = 'E'
      MACRO_ENVIRONMENT         =
       WAIT                      = 'X'
      DELETE_FILE               = 'X'
    EXCEPTIONS
       NO_BATCH                  = 1
       EXCEL_NOT_INSTALLED       = 2
       INTERNAL_ERROR            = 3
       CANCELLED                 = 4
       DOWNLOAD_ERROR            = 5
       NO_AUTHORITY              = 6
       FILE_NOT_DELETED          = 7
       OTHERS                    = 8
       IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
       leave to list-processing.
    endcase.
    *&      Form  bulid_xls_data_table
          text
    *There are no interface parameters to be passed to this subroutine
    FORM bulid_xls_data_table .
    CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    constants:
        con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
        con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'matnr' 'ernam' 'aenam' 'pstat'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT It_mara INTO wa_charmara.
        CONCATENATE wa_charmara-matnr wa_charmara-ernam
                    wa_charmara-aenam wa_charmara-pstat
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.                             " LOOP AT it_mara INTO...
    ENDFORM.                               " bulid_xls_data_table
    *&      Form  send_file_as_email_attachment
       Send email
         -->P_IT_MESSAGE  text
         -->P_IT_ATTACH  text
         -->P_P_EMAIL  text
         -->P_0387   text
         -->P_0388   text
         -->P_0389   text
         -->P_0390   text
         -->P_0391   text
         -->P_0392   text
         <--P_GD_ERROR  text
         <--P_GD_RECIEVER  text
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error               TYPE sy-subrc,
            ld_reciever            TYPE sy-subrc,
            ld_mtitle              LIKE sodocchgi1-obj_descr,
            ld_email               LIKE  somlreci1-receiver,
            ld_format              TYPE  so_obj_tp ,
            ld_attdescription      TYPE  so_obj_nam ,
            ld_attfilename         TYPE  so_obj_des ,
            ld_sender_address      LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver            LIKE  sy-subrc.
      ld_email               = p_email.
      ld_mtitle              = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = pit_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin  = space.
      t_packing_list-head_start  = 1.
      t_packing_list-head_num    = 0.
      t_packing_list-body_start  = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type    = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver   = ld_email.
      t_receivers-rec_type   = 'U'.
      t_receivers-com_type   = 'INT'.
      t_receivers-notif_del  = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.                               " send_file_as_email_attachment
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                               " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test mara records'.
      APPEND it_message.
    endform.                               "form populate_email_message_bod
    rewards if it helps u

Maybe you are looking for

  • How to get Assignment id in SSHR page

    1. I am trying to create a Self-Service page. To do it I need to get assignment id of the person logged into the sshr appliccation. I searched for sshrparams and found your thread that says it worked in 11i (11.5.10.2) so I am trying to make your cod

  • The install thing freezes!

    I tried a lot of times to install but it just doesn't work. (I also always tried to uninstalled it) What I do: 1. I go to the download page and press the yellow button 2. The other page loads 3. Internet Explorer asks if I want to install it and I pr

  • No sound with iPhoto slideshow since Mavericks

    Since the update to Mavericks I have no sound anymore during the slide shows I made with iPhoto. Can anyone tell me why this is? iTunes works normally and I can play music also with AppleTV. Thanks.

  • Cannot upload QM Catalog long text

    All, Can you help with entering QM catalog code group long text into the Production System? It works correctly in the Test System but I cannot edit the catalog using QS41 in Production (basis will not grant QS41 edit permission for client). I underst

  • Hai! any body help me plz........

    dears i like to create one applet. like: http://www.technologo.com/tl/appletframes.asp?sku=BAR3458-3488&t=it&folder=1&orgn=tlc this same virtual sample applet tool. how can i create this applet builder. this is my practising purpose. but, this web pa