Need a perfect example program for ALV GRID LIST

first hi to all,i am new to this community.i am still in learning process of SAP.one of my friend suggeted this community and i think this is the perfect place to learn and excel my skill in SAP.so my requirement is a perfect example program for ALV GRID LIST DISPLAY.while i am trying another program,the sysntax is ok but i am not getting any output and it is not showing any error also.hope i will get an answer asap.thank you.

Check [OO ALV Guide Simple|http://wiki.sdn.sap.com/wiki/display/ABAP/OBJECTORIENTEDALV+Guide] and [Easy Reference to ALV|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]

Similar Messages

  • I need model program for alv grid control

    hi all,
    i need example program and detailed description of alv grid control . what is the features of alv grid control over normal alv.

    Hi,
    Check out the below sample code.I have pasted even the include programs, u can copy the program.
    SAP-User       : BWR2KOR                                             *
    Author (name)  : Bharadwaja R                                        *
    Created on/in  : 07.02.2006                                          *
    Description    : Report for Listing IDOC-Informations for the given  *
                     segment on the selection screen                     *
    Changes:       - for each change: add chapter                        *
                   - changes get a changes number (ascending)            *
                   - source code has to be marked with SAP-user-name     *
                     change date and number                              *
    Change number       :                                                *
    Enhance/Change numer: 90xxxx    (900001-909999) -> /RB11/YBF_MODIF   *
    SAP-User            :                                                *
    Author (name)       :                                                *
    Created on/in       :                                                *
    Reason for the change:                                               *
    REPORT Y16S_VIEW_IDOC_CONTENT  LINE-SIZE 230
                                   NO STANDARD PAGE HEADING.
    Data declarations
    INCLUDE Y16S_VIEW_IDOC_CONTENT_D01I.
    Selection screen
    INCLUDE Y16S_VIEW_IDOC_CONTENT_S01I.
    Events
    INCLUDE Y16S_VIEW_IDOC_CONTENT_E01I.
    Routines for program
    INCLUDE Y16S_VIEW_IDOC_CONTENT_F01I.
    START-OF-SELECTION.
    Get the fieldcatalog
    PERFORM get_fcat.
    **Method for getting the reference for the structure
    CALL METHOD cl_alv_table_create=>create_dynamic_table
                EXPORTING it_fieldcatalog = g_t_fieldcat
                IMPORTING ep_table = dref.
    **Passing the reference of the structure to field-symbol of type table
    ASSIGN dref->* TO .
    Fill IDoc data
    PERFORM fill_data.
    Display ALV
    perform display_grid.
      INCLUDE Y16S_VIEW_IDOC_CONTENT_D01I                                *
    Data declaration : Tables used                                       *
    TABLES : edidd,           "Data record (IDoc)
             edidc,           "Control record (IDoc)
             edid4,           "IDoc Data Records from 4.0 onwards
             dd03d,           "Dynpro fields for table fields
             edsappl,         "EDI: IDoc Segment Application Structure
             int_seg,         "Data record details display
             dd03l,           "Table Fields
             edisegment.      "IDoc Development : IDoc Segment
    Name of segment
    DATA : g_f_segment LIKE dntab-tabname.
    *--Data Declaration.
    FIELD-SYMBOLS :  TYPE ANY.
    DATA : BEGIN OF g_t_edid OCCURS 0,
            docnum LIKE edid4-docnum,
            segnum  LIKE edid4-segnum,
            sdata   LIKE edid4-sdata,
          END OF g_t_edid.
    *DATA : g_t_edid LIKE edid4 OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF g_t_edidc OCCURS 0,
            docnum  LIKE edidc-docnum,
            credat  LIKE edidc-credat,
            mestyp  LIKE edidc-mestyp,
          END OF g_t_edidc.
    DATA : BEGIN OF g_t_appl OCCURS 0,
            fieldname  LIKE edsappl-fieldname,
           END OF g_t_appl.
    DATA : g_v_tabix LIKE sy-tabix.
    ALV Declarations
    *Declaration of type groups
    TYPE-POOLS :
       slis.                    "Globale Typen für generische Listbausteine
    DATA: g_f_okcode LIKE sy-ucomm,
          g_container TYPE scrfname VALUE 'G_C_ALV',
          grid1  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container.
    FIELD-SYMBOLS: .
    Class
    CLASS: g_cl_event DEFINITION DEFERRED.
    Alv Grid Constants
    DATA : g_c_handle(4) TYPE c VALUE '0100',
           g_c_save(1) TYPE c VALUE 'A',
           g_c_exit(4) TYPE c VALUE 'EXIT'.
    DATA:  g_v_layout  TYPE lvc_s_layo,
           g_f_print   TYPE lvc_s_prnt,
           g_f_variant TYPE disvariant,
           g_v_recv    TYPE REF TO g_cl_event.
    CONSTANTS : gc_ucomm_sel_criteria(12)        VALUE 'SEL_CRITERIA'.
          CLASS G_Cl_EVENT DEFINITION
          Class to handle GRID Events                                   *
    CLASS g_cl_event DEFINITION.
      PUBLIC SECTION.
        METHODS:
         constructor IMPORTING value(grid_name) TYPE REF TO
             cl_gui_alv_grid,
        handle_toolbar
              FOR EVENT toolbar OF cl_gui_alv_grid
                IMPORTING e_object e_interactive,
        handle_user_command
              FOR EVENT user_command OF cl_gui_alv_grid
                  IMPORTING e_ucomm.
      PRIVATE SECTION.
        DATA: g_v_alv TYPE REF TO cl_gui_alv_grid.
    ENDCLASS.                    "g_cl_event DEFINITION
          CLASS g_cl_events IMPLEMENTATION
          Class to handle GRID Events                                   *
    CLASS g_cl_event IMPLEMENTATION.
    Handling methods
      METHOD constructor.
        g_v_alv = grid_name.
      ENDMETHOD.                    "constructor
    Tool bar
      METHOD handle_toolbar.
        CONSTANTS:
          lc_quickinfo_sel_criteria(111) VALUE 'Show Selection Criteria'.
        DATA:
          l_toolbar            TYPE stb_button.
        CLEAR l_toolbar.
        MOVE 0                          TO l_toolbar-butn_type.
        MOVE gc_ucomm_sel_criteria      TO l_toolbar-function.
        MOVE icon_select_with_condition TO l_toolbar-icon.
        MOVE lc_quickinfo_sel_criteria  TO l_toolbar-quickinfo.
        MOVE space                      TO l_toolbar-disabled.
        APPEND l_toolbar                TO e_object->mt_toolbar.
      ENDMETHOD.                    "handle_toolbar
    User Command
      METHOD handle_user_command.
        CASE e_ucomm.
    When Exit button is used
          WHEN 'EXIT'.
            PERFORM exit_program.
          WHEN OTHERS.
        ENDCASE.
      ENDMETHOD.                    "handle_user_command
    ENDCLASS.                    "g_cl_event IMPLEMENTATION
      INCLUDE Y16S_VIEW_IDOC_CONTENT_S01I                                *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    Creation Date of IDoc
    SELECT-OPTIONS : s_date FOR  edidc-credat.
    IDoc Number
    SELECT-OPTIONS : s_idocnm FOR edidc-docnum.
    Basic IDoc type
    SELECT-OPTIONS : s_idoctp FOR edidc-idoctp.
    *Message type
    SELECT-OPTIONS : s_mestyp  FOR edidc-mestyp.
    Segment name
    PARAMETERS : p_segnam LIKE edisegment-segtyp OBLIGATORY.
    Field name
    SELECT-OPTIONS : s_fldnam FOR dd03d-fieldname NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
    Field name
    PARAMETERS : p_fldnam LIKE dd03d-fieldname.
    Field contents of a field of an IDoc segment
    SELECT-OPTIONS : s_fldval FOR int_seg-string.
    SELECTION-SCREEN END OF BLOCK b2.
      INCLUDE Y16S_VIEW_IDOC_CONTENT_E01I                                *
    Check for IDoc number on selection screen
    AT SELECTION-SCREEN ON s_idocnm.
      IF NOT s_idocnm IS INITIAL.
    Data fetch : Control record (IDoc)
        SELECT COUNT( * ) FROM edidc
                     WHERE docnum IN s_idocnm.
        IF sy-subrc NE 0.
          MESSAGE e429(mo).
        ENDIF.
      ELSE.
    message for required entry.
        MESSAGE e055(00).
      ENDIF.
    Check for segment name on selection screen
    AT SELECTION-SCREEN ON p_segnam.
    Check segment name is an input on selection screen
      IF NOT p_segnam IS INITIAL.
    Data fetch : Table Fields
        SELECT SINGLE  *  FROM dd03l
                       WHERE tabname EQ p_segnam.
        IF sy-subrc NE 0.
          MESSAGE e429(mo).
        ENDIF.
      ENDIF.
    F4 help for fieldname
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_fldnam-low.
      DATA : l_rc LIKE sy-subrc.
    Check segment name on selection screen is not empty
      IF NOT p_segnam IS INITIAL.
        PERFORM get_f4help USING l_rc.
        IF l_rc = 0.
    Fill the selected field name
          READ TABLE g_t_appl INDEX g_v_tabix.
          CHECK sy-subrc = 0.
          s_fldnam-low = g_t_appl-fieldname.
          s_fldnam-sign = 'I'.
          s_fldnam-option = 'EQ'.
          APPEND s_fldnam.
        ENDIF.
      ENDIF.
    Check for field name on selection screen
    AT SELECTION-SCREEN ON s_fldnam.
      IF NOT p_fldnam IS INITIAL.
    Data fetch : Table Fields
        SELECT SINGLE  *  FROM dd03l
                     WHERE tabname   EQ p_segnam
                     AND   fieldname IN s_fldnam.
        IF sy-subrc NE 0.
          MESSAGE e429(mo).
        ENDIF.
      ENDIF.
    F4 help for fieldname
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fldnam.
      DATA : l_rc LIKE sy-subrc.
    Check segment name on selection screen is not empty
      IF NOT p_segnam IS INITIAL.
    F4 Help for fieldname
        PERFORM get_f4help USING l_rc.
        IF l_rc = 0.
    Fill the selected field name
          READ TABLE g_t_appl INDEX g_v_tabix.
          CHECK sy-subrc = 0.
          p_fldnam = g_t_appl-fieldname.
        ENDIF.
      ENDIF.
    Check for field name on selection screen
    AT SELECTION-SCREEN ON p_fldnam.
      IF NOT p_fldnam IS INITIAL.
    Data fetch : Table Fields
        SELECT SINGLE  *  FROM dd03l
                     WHERE tabname   EQ p_segnam
                     AND   fieldname EQ p_fldnam.
        IF sy-subrc NE 0.
          MESSAGE e429(mo).
        ENDIF.
      ENDIF.
    Check for field name on selection screen
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_fldval-low.
    Check field name is an input on selection screen
      IF NOT p_fldnam IS INITIAL.
    Get the domain values as F4 help
        PERFORM get_domain_value.
      ENDIF.
    *Check for Message type on selection screen
    AT SELECTION-SCREEN ON s_mestyp.
      IF NOT s_mestyp IS INITIAL.
    Data fetch : Logical message types
        SELECT COUNT( * ) FROM edmsg
                     WHERE msgtyp IN s_mestyp.
        IF sy-subrc NE 0.
          MESSAGE e429(mo).
        ENDIF.
      ENDIF.
    *Check for Basic type on selection screen
    AT SELECTION-SCREEN ON s_idoctp.
      IF NOT s_idoctp IS INITIAL.
    Data fetch : Basic types
        SELECT COUNT( * ) FROM edbas
                     WHERE idoctyp IN s_idoctp.
        IF sy-subrc NE 0.
          MESSAGE e429(mo).
        ENDIF.
      ENDIF.
    *&      Form  GET_F4HELP
          text
         -->P_L_RC  text
    FORM get_f4help USING    p_l_rc LIKE sy-subrc.
      DATA : l_v_segment LIKE edsappl-segtyp.
      DATA : l_t_help_value LIKE help_value OCCURS 0 WITH HEADER LINE.
    Segment name
      l_v_segment = p_segnam.
    Data fetch : EDI: IDoc Segment Application Structure
      SELECT pos fieldname FROM edsappl
                       INTO CORRESPONDING FIELDS OF TABLE g_t_appl
                       WHERE segtyp = l_v_segment
                       ORDER BY pos.
    Popup having data
      CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
           EXPORTING
                endpos_col   = 110
                endpos_row   = 16
                startpos_col = 90
                startpos_row = 1
                titletext    = text-001
           IMPORTING
                choise       = g_v_tabix
           TABLES
                valuetab     = g_t_appl
           EXCEPTIONS
                break_off    = 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.
    Return code
      p_l_rc = sy-subrc.
    ENDFORM.                    " GET_F4HELP
    *&      Form  GET_DOMAIN_VALUE
          text
         -->P_L_RC  text
    FORM get_domain_value.
    DD: Domain header with text
      DATA : l_s_dd01v LIKE dd01v.
    Value table
      DATA : l_v_valuetab LIKE l_s_dd01v-entitytab.
    RFC Table Read: Description of Fields to Retrieve
      DATA : l_t_db_fld LIKE rfc_db_fld OCCURS 0 WITH HEADER LINE.
    RFC Table Read: Select Options / WHERE Clause
      DATA : l_t_options LIKE rfc_db_opt OCCURS 0 WITH HEADER LINE.
    Table with a 512 byte field
      DATA : l_t_valuetab  LIKE tab512 OCCURS 0 WITH HEADER LINE.
    *Data Dictionary access routines
      CALL FUNCTION 'G_DOMAIN_READ'
           EXPORTING
                domain      = p_fldnam
                langu       = sy-langu
           IMPORTING
                domain_attr = l_s_dd01v
           EXCEPTIONS
                not_found   = 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.
      l_v_valuetab = l_s_dd01v-entitytab.
      l_t_db_fld-fieldname = p_fldnam.
      APPEND l_t_db_fld.
    External access to R/3 tables via RFC
      CALL FUNCTION 'RFC_READ_TABLE'
           EXPORTING
                query_table          =  l_v_valuetab
            DELIMITER            = ' '
            NO_DATA              = ' '
            ROWSKIPS             = 0
            ROWCOUNT             = 0
           TABLES
                options              = l_t_options
                fields               = l_t_db_fld
                data                 = l_t_valuetab
          EXCEPTIONS
               table_not_available  = 1
               table_without_data   = 2
               option_not_valid     = 3
               field_not_valid      = 4
               not_authorized       = 5
               data_buffer_exceeded = 6
               OTHERS               = 7
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CLEAR g_v_tabix.
      IF NOT l_t_valuetab[] IS INITIAL.
    Popup having data
        CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
             EXPORTING
                  endpos_col   = 110
                  endpos_row   = 16
                  startpos_col = 90
                  startpos_row = 1
                  titletext    = text-001
             IMPORTING
                  choise       = g_v_tabix
             TABLES
                  valuetab     = l_t_valuetab
             EXCEPTIONS
                  break_off    = 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 l_t_valuetab INDEX g_v_tabix.
        CHECK sy-subrc = 0.
    Fill the select-options of Fieldvalue
        s_fldval-low = l_t_valuetab-wa.
        s_fldval-sign = 'I'.
        s_fldval-option = 'EQ'.
        APPEND s_fldval.
      ENDIF.
    ENDFORM.                    " GET_DOMAIN_VALUE
      INCLUDE Y16S_VIEW_IDOC_CONTENT_F01I                                *
    *&      Module  STATUS_0100  OUTPUT
          ALV grid output
    MODULE status_0100 OUTPUT.
    *set the screen elements
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'TITLE100'.
    *instantiation
      IF g_custom_container IS INITIAL.
        g_v_layout-zebra  =  'X'.
        g_v_layout-sel_mode  =  'A'.
    Create custom container
        CREATE OBJECT g_custom_container
                EXPORTING  container_name = g_container.
    Create ALV grid
        CREATE OBJECT grid1
               EXPORTING  i_parent = g_custom_container.
        CREATE OBJECT g_v_recv EXPORTING grid_name = grid1.
    Display ALV grid
        CALL METHOD grid1->set_table_for_first_display
          EXPORTING
            i_save          = g_c_save
            is_layout       = g_v_layout
            is_print        = g_f_print
            is_variant      = g_f_variant
          CHANGING
            it_fieldcatalog = g_t_fieldcat
            it_outtab       = refresh_table_display.
      ENDIF.
    User command
      SET HANDLER g_v_recv->handle_user_command FOR grid1.
      CALL METHOD grid1->set_toolbar_interactive.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          User actions on grid
    MODULE user_command_0100 INPUT.
    Dispatch the okcode
      CALL METHOD cl_gui_cfw=>dispatch.
      CASE g_f_okcode.
        WHEN g_c_exit.
          PERFORM exit_program.
        WHEN OTHERS.
    *do nothing
      ENDCASE.
      CLEAR g_f_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  EXIT_PROGRAM
         Exit from the Grid
    -->  p1        text
    <--  p2        text
    FORM exit_program.
    Container for Custom Controls in the Screen Area
      CALL METHOD g_custom_container->free.
    *Control Framework Basic Class
      CALL METHOD cl_gui_cfw=>flush.
    Call the selection screen
      SET SCREEN 0.
      LEAVE SCREEN.
    ENDFORM.                    " EXIT_PROGRAM
    *&      Form  GET_FCAT
         Field catalog fill
    -->  p1        text
    <--  p2        text
    FORM get_fcat.
    *Segment details regarding fields
      PERFORM get_segment_details.
    Populate the Fieldcatalog
      PERFORM fill_fieldcat.
      IF g_f_variant-variant IS INITIAL.
    Get the default variant
        g_f_repid = sy-repid.
        CLEAR : g_f_variant.
        g_f_variant-report = g_f_repid.
        g_r_x_variant = g_f_variant.
    Get default variant
        CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
             EXPORTING
                  i_save     = g_c_save
             CHANGING
                  cs_variant = g_r_x_variant
             EXCEPTIONS
                  not_found  = 2.
        g_f_variant = g_r_x_variant.
        g_f_variant-variant = 'X'.
      ENDIF.
    ENDFORM.                    " GET_FCAT
    *&      Form  FILL_DATA
         Fill the output internal table
    -->  p1        text
    <--  p2        text
    FORM fill_data.
      FIELD-SYMBOLS  TYPE ANY.
      DATA : l_rc LIKE sy-subrc.
    *Get the IDoc data
      PERFORM get_data.
      LOOP AT g_t_edid.
    *Check for filtering the values
        IF ( NOT ( p_fldnam IS INITIAL AND s_fldval[] IS INITIAL ) ).
    Field value check
          PERFORM check_fieldvalue USING l_rc.
          IF l_rc NE 0.
            CONTINUE.
          ENDIF.
        ENDIF.
        ASSIGN LOCAL COPY OF g_t_edid TO .
      ENDLOOP.
    ENDFORM.                    " FILL_DATA
    *&      Form  DISPLAY_GRID
          Display ALV grid
    -->  p1        text
    <--  p2        text
    FORM display_grid.
    Call ALV grid
      CALL SCREEN 100.
    ENDFORM.                    " DISPLAY_GRID
    *&      Form  CHECK_FIELDVALUE
          Check the fieldvalue
         -->P_L_RC  text
    FORM check_fieldvalue USING    p_l_rc LIKE sy-subrc.
    Segment data
      ASSIGN g_t_edid-sdata TO  CASTING TYPE (p_segnam).
    Segment fields
      LOOP AT g_t_segment WHERE fieldname = p_fldnam.
        ASSIGN COMPONENT g_t_segment-fieldname
                         OF STRUCTURE  IN s_fldval.
          p_l_rc = 0.
        ELSE.
          p_l_rc = 4.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " CHECK_FIELDVALUE
    *&      Form  GET_DATA
        Get the IDoc data
    -->  p1        text
    <--  p2        text
    FORM get_data.
    *Clear the header line of the internal table
      CLEAR   : g_t_edid,
                g_t_edidc.
    Clear the body of the internal table
      REFRESH : g_t_edid,
                g_t_edidc.
    *Data fetch : Control record (IDoc)
      SELECT docnum credat mestyp FROM edidc
                                  INTO TABLE g_t_edidc
                                  WHERE docnum IN s_idocnm AND
                                        credat IN s_date   AND
                                        mestyp IN s_mestyp AND
                                        idoctp IN s_idoctp.
    *Date/Message type if not initial
      IF (  ( NOT ( s_date[] IS INITIAL ) )
         OR ( NOT ( s_mestyp[] IS INITIAL ) )
         OR ( NOT ( s_idoctp[] IS INITIAL ) ) ).
    Check the control record of the IDoc
        PERFORM check_control_data.
      ELSE.
    Data fetch : IDoc Data Records from 4.0 onwards
        SELECT docnum segnum sdata FROM edid4 INTO TABLE g_t_edid
                                   WHERE docnum IN s_idocnm AND
                                         segnam EQ p_segnam.
      ENDIF.
    ENDFORM.                    " GET_DATA
    *&      Form  CHECK_CONTROL_DATA
        Check the control data of IDoc
    -->  p1        text
    <--  p2        text
    FORM check_control_data.
      CHECK NOT g_t_edidc[] IS INITIAL.
    Data fetch : IDoc Data Records from 4.0 onwards
      SELECT docnum segnum sdata FROM edid4 INTO TABLE g_t_edid
                                 WHERE docnum IN s_idocnm AND
                                       segnam EQ p_segnam.
      LOOP AT g_t_edid.
        READ TABLE g_t_edidc WITH KEY docnum = g_t_edid-docnum.
    *Check for the correct MT
        IF sy-subrc = 0.
          CONTINUE.
        ELSE.
    *Delete, if unsuccessful
          DELETE g_t_edid.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " CHECK_CONTROL_DATA
    *&      Form  GET_SEGMENT_DETAILS
        Segment details regarding fields
    -->  p1        text
    <--  p2        text
    FORM get_segment_details.
    Segment name
      g_f_segment = p_segnam.
      CALL FUNCTION 'NAMETAB_GET'
           EXPORTING
             langu               = sy-langu
                tabname             = g_f_segment
           TABLES
                nametab             = g_t_segment
           EXCEPTIONS
                internal_error      = 1
                table_has_no_fields = 2
                table_not_activ     = 3
                no_texts_found      = 4
                OTHERS              = 5.
      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.                    " GET_SEGMENT_DETAILS
    *&      Form  FILL_FIELDCAT
        Populate the Fieldcatalog
    -->  p1        text
    <--  p2        text
    FORM fill_fieldcat.
      DATA : lv_pos TYPE i.
    IDoc number in the catalog
      lv_pos = 1.
      g_r_fieldcat-fieldname = 'DOCNUM'.
      g_r_fieldcat-ref_table = 'EDID4'.
      g_r_fieldcat-ref_field = 'DOCNUM'.
      g_r_fieldcat-key       =  'X'.
      g_r_fieldcat-col_pos   =  lv_pos.
      g_r_fieldcat-outputlen =  '10'.
      APPEND g_r_fieldcat TO g_t_fieldcat.
    Segment number in the catalog
      ADD 1 TO lv_pos.
      g_r_fieldcat-fieldname = 'SEGNUM'.
      g_r_fieldcat-ref_table = 'EDID4'.
      g_r_fieldcat-ref_field = 'SEGNUM'.
      g_r_fieldcat-key       =  'X'.
      g_r_fieldcat-col_pos   =  lv_pos.
      g_r_fieldcat-outputlen =  '10'.
      g_r_fieldcat-colddictxt = 'X'.
    g_r_fieldcat-reptext   = text-002.
      APPEND g_r_fieldcat TO g_t_fieldcat.
    **Populating fieldcatalog with segment field
      LOOP AT g_t_segment .
        ADD 1 TO lv_pos.
        CLEAR g_r_fieldcat.
        g_r_fieldcat-fieldname = g_t_segment-fieldname .
        g_r_fieldcat-ref_table = p_segnam.
        g_r_fieldcat-ref_field = g_t_segment-fieldname .
        g_r_fieldcat-key             =  'X'.
        g_r_fieldcat-col_pos         =  lv_pos.
        g_r_fieldcat-outputlen       =  '10'.
    Check for given fields on the selection screen
        IF NOT g_t_segment-fieldname IN s_fldnam.
          g_r_fieldcat-no_out = 'X'.
        ENDIF.
    *Column text
        IF g_t_segment-fieldtext IS INITIAL.
    *Get the DDIC texts for columns
          PERFORM get_ddic_texts.
        ENDIF.
        APPEND g_r_fieldcat TO g_t_fieldcat.
      ENDLOOP.
    ENDFORM.                    " FILL_FIELDCAT
    *&      Form  GET_DDIC_TEXTS
         Get the DDIC texts
    -->  p1        text
    <--  p2        text
    FORM get_ddic_texts.
      DATA : l_f_descr TYPE string.
    Get the texts for the data element
      CALL FUNCTION 'TB_DATAELEMENT_GET_TEXTS'
           EXPORTING
                name         = g_t_segment-fieldname
          IMPORTING
               description   = l_f_descr
               LENGTH_FIELD  =
               LENGTH_HEADER =
               LENGTH_LONG   =
               LENGTH_MIDDLE =
               LENGTH_SHORT  =
               TEXT_HEADER   =
               TEXT_LONG     =
               TEXT_MIDDLE   =
               TEXT_SHORT    =
       EXCEPTIONS
            not_found     = 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.
    *Add DDIC text..
      g_r_fieldcat-colddictxt = 'X'.
      g_r_fieldcat-reptext = l_f_descr.
    ENDFORM.                    " GET_DDIC_TEXTS

  • Report program for alv grid in hierarchial manner

    I have a requirement where I need to display values in hierarchial fashion. can anyone send me some sample program for the same.
    thanks,
    hema sundar.

    hi, chk this.
    Check this code. this might help in solving your problem.
    >********************************************************************
    This report displays data from SAP tables (like SE16) *
    FM : REUSE_ALV_GRID_DISPLAY
    DATA:
    g_mandt TYPE mandt.
    SELECTION-SCREEN :
    BEGIN OF LINE, COMMENT 6(33) v_1 FOR FIELD p_table. "#EC NEEDED
    PARAMETERS p_table TYPE dd03l-tabname OBLIGATORY MEMORY ID dtb.
    SELECTION-SCREEN : END OF LINE, SKIP.
    SELECTION-SCREEN :
    BEGIN OF LINE, COMMENT 6(30) v_2 FOR FIELD s_mandt. "#EC NEEDED
    SELECT-OPTIONS s_mandt FOR g_mandt DEFAULT sy-mandt
    MATCHCODE OBJECT ddsef4clnt.
    SELECTION-SCREEN : END OF LINE, SKIP.
    SELECTION-SCREEN :
    SKIP , BEGIN OF LINE, COMMENT 6(33) v_3 FOR FIELD p_max. "#EC NEEDED
    PARAMETERS p_max(3) TYPE n DEFAULT '200' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    AT SELECTION-SCREEN.
    PERFORM f_check_table.
    INITIALIZATION.
    v_1 = 'Table'.
    v_2 = 'Client'.
    v_3 = 'Maximum of records'.
    START-OF-SELECTION.
    PERFORM f_display_data.
    Form F_DISPLAY_DATA
    FORM f_display_data.
    TYPE-POOLS: slis. " ALV Global Types
    DATA:
    lp_table TYPE REF TO data, " Pointer to dynamic table
    ls_layout TYPE slis_layout_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv.
    FIELD-SYMBOLS :
    <lt_data> TYPE STANDARD TABLE. " Data to display
    Create internal table
    CREATE DATA lp_table TYPE STANDARD TABLE OF (p_table)
    WITH NON-UNIQUE DEFAULT KEY.
    ASSIGN lp_table->* TO <lt_data>.
    Field MANDT exists ?
    SELECT SINGLE tabname
    INTO p_table
    FROM dd03l
    WHERE tabname = p_table
    AND fieldname = 'MANDT'
    AND as4local = 'A'
    AND as4vers = '0000'
    AND position = '0001'
    AND rollname = 'MANDT'.
    IF sy-subrc EQ 0.
    Read data
    SELECT * UP TO p_max ROWS
    FROM (p_table) CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE <lt_data>
    WHERE mandt IN s_mandt
    ORDER BY PRIMARY KEY.
    ELSE.
    Field CLIENT exists ?
    SELECT SINGLE tabname
    INTO p_table
    FROM dd03l
    WHERE tabname = p_table
    AND fieldname = 'CLIENT'
    AND as4local = 'A'
    AND as4vers = '0000'
    AND position = '0001'
    AND rollname = 'MANDT'.
    IF sy-subrc EQ 0.
    Read data
    SELECT * UP TO p_max ROWS
    FROM (p_table) CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE <lt_data>
    WHERE client IN s_mandt
    ORDER BY PRIMARY KEY.
    ELSE.
    Read data
    SELECT * UP TO p_max ROWS
    FROM (p_table)
    INTO CORRESPONDING FIELDS OF TABLE <lt_data>
    ORDER BY PRIMARY KEY.
    ENDIF.
    ENDIF.
    IF <lt_data>[] IS INITIAL.
    No table entries found for specified key
    MESSAGE i429(mo).
    EXIT.
    ENDIF.
    Build Field catalog
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = p_table
    i_client_never_display = ''
    CHANGING
    ct_fieldcat = lt_fieldcat
    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.
    ls_layout-zebra = 'X'.
    ls_layout-colwidth_optimize = 'X'.
    Display ALV List
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    is_layout = ls_layout
    it_fieldcat = lt_fieldcat
    TABLES
    t_outtab = <lt_data>.
    ENDFORM. " F_DISPLAY_DATA
    Form F_CHECK_TABLE
    FORM f_check_table.
    DATA :
    l_tabclass TYPE tabclass, " Table category
    l_viewclass TYPE viewclass. " View Type
    Read table category
    SELECT SINGLE tabclass viewclass
    INTO (l_tabclass, l_viewclass)
    FROM dd02l
    WHERE tabname = p_table
    AND as4local = 'A'
    AND as4vers = '0000'.
    IF sy-subrc NE 0.
    Table & is not active in the Dictionary
    MESSAGE e402(mo) WITH p_table.
    ELSEIF l_tabclass = 'INTTAB'.
    & is a structure, not a table
    MESSAGE e403(mo) WITH p_table.
    ELSEIF l_tabclass = 'VIEW' AND l_viewclass NE 'D'.
    Only use views of type "Maintenance view"
    MESSAGE e309(sv).
    ENDIF.
    ENDFORM. " F_CHECK_TABLE
    with regards,
    madhavi.

  • Hotspot click  in methods for alv grid list

    Hi all ,
    i written a program for grid display and hotspot click.
    but it is not capturing the value at the event hotspot click,
    please anybody help me in capturing the value in the following code.
    it will be great will it happens soon.
    REPORT zag_tables MESSAGE-ID zag .
    DATA : gt_tables TYPE TABLE OF  zag_tables,
           gs_tables type zag_tables.
    DATA : gt_cust_cont TYPE REF TO cl_gui_custom_container       ,
           gt_alv_grid TYPE REF TO cl_gui_alv_grid,
           gt_cont TYPE scrfname VALUE 'ZAG_TABLES'.
    *data declarations for grid layout
    DATA : gt_fieldcat TYPE lvc_t_fcat,
           gs_fieldcat TYPE lvc_s_fcat,
           gs_layout TYPE lvc_s_layo,
           gs_variant TYPE disvariant.
    DATA : gv_repid TYPE syrepid,
            okcode TYPE syucomm..
    *data : gs_row_id type lvc_s_row,
          gs_col_id type lvc_s_col,
          gs_row_no type lvc_s_roid.
    data : e_row_id type lvc_s_row,
           gs_col_id type lvc_s_col,
           gs_row_no type lvc_s_roid.
    *CLASS DEFINITIONS
    CLASS cl_event_handler  DEFINITION.
      PUBLIC SECTION.
    CLASS-METHODs  : cm_hotspot_click FOR EVENT  hotspot_click OF
                      cl_gui_alv_grid IMPORTING
                      e_row_id e_column_id es_row_no .
    ENDCLASS.
          CLASS cl_event_handler IMPLEMENTATION
    CLASS cl_event_handler IMPLEMENTATION.
      METHOD : cm_hotspot_click .
      PERFORM hotspot_click.
    ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
      PERFORM select_data.
    END-OF-SELECTION.
      CALL SCREEN 100.
    *&      Form  select_data
          text
    -->  p1        text
    <--  p2        text
    FORM select_data.
      SELECT  *  FROM zag_tables INTO TABLE gt_tables.
    ENDFORM.                    " select_data
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZAG_TABLES'.
      SET TITLEBAR 'ZAG_TABLES'.
      gv_repid  = sy-repid.
      IF gt_cust_cont IS INITIAL.
        CREATE OBJECT gt_cust_cont
          EXPORTING
            container_name              = gt_cont
          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.
        ENDIF.
        CREATE OBJECT gt_alv_grid
          EXPORTING
       I_SHELLSTYLE      = 0
       I_LIFETIME        =
            i_parent          = gt_cust_cont
       I_APPL_EVENTS     = space
       I_PARENTDBG       =
       I_APPLOGPARENT    =
       I_GRAPHICSPARENT  =
       I_USE_VARIANT_CLASS = SPACE
       I_NAME            =
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            others            = 5
        IF sy-subrc <> 0.
        ENDIF.
      ELSE.
        CALL METHOD gt_alv_grid->refresh_table_display
          EXCEPTIONS
            finished       = 1
            OTHERS         = 2
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    *perform layout changing gs_layout.
      PERFORM  fieldcat CHANGING gt_fieldcat.
    *perform variant changing gs_variant.
      gs_layout-zebra   = 'X'.
      gs_layout-sel_mode = 'A'.
      gs_variant-report = gv_repid.
      SET HANDLER cl_event_handler=>cm_hotspot_click FOR gt_alv_grid.
      CALL METHOD gt_alv_grid->set_table_for_first_display
        EXPORTING
       I_BYPASSING_BUFFER            =
       I_BUFFER_ACTIVE               =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
          is_variant                    = gs_variant
          i_save                        = 'A'
          i_default                     = 'X'
          is_layout                     = gs_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
        CHANGING
          it_outtab                     = gt_tables
          it_fieldcatalog               = gt_fieldcat
       IT_SORT                       =
       IT_FILTER                     =
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4
      IF sy-subrc <> 0.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Form  fieldcat
          text
         <--P_GS_fieldcat  text
    FORM fieldcat CHANGING gt_fieldcat  TYPE lvc_t_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
      I_BUFFER_ACTIVE              =
         i_structure_name             = 'ZAG_TABLES'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_BYPASSING_BUFFER           =
        CHANGING
          ct_fieldcat                  = gt_fieldcat
       EXCEPTIONS
         inconsistent_interface       = 1
         program_error                = 2
         OTHERS                       = 3
      IF sy-subrc <> 0.
      ENDIF.
      LOOP AT gt_fieldcat INTO gs_fieldcat.
        gs_fieldcat-fieldname = 'MANDT'.
        gs_fieldcat-no_out     = ''.
        MODIFY gt_fieldcat  FROM gs_fieldcat.
        gs_fieldcat-fieldname = 'Z_TABLES'.
        gs_fieldcat-hotspot     = 'X'.
        MODIFY gt_fieldcat  FROM gs_fieldcat.
      ENDLOOP.
    ENDFORM.                    " fieldcat
    *&      Form  layout
          text
    -->  p1        text
    <--  p2        text
    *form layout changing gs_layout.
    *gs_layout-zebra = 'X'.
    *gs_layout-sel_mode = 'A'.
    *endform.                    " layout
    *&      Form  variant
          text
         <--P_GS_variant  text
         <--P_ENDMODULE  text
    *form variant changing gs_variant
      gs_variant-report = gv_repid.
    *endform.                    " variant
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      TRANSLATE okcode TO UPPER CASE.
      CASE okcode.
        WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
          LEAVE TO  SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  hotspot_click
          text
    -->  p1        text
    <--  p2        text
    FORM hotspot_click ."importing gs_row_id type lvc_s_row.
    data : lv_prog type syrepid,
           lv_tcode type tcode.
    read table gt_tables into gs_tables index e_row_id-index.
    if sy-subrc eq 0 and gs_col_id-fieldname = 'ZTABLES'.
    move gs_tables-z_tables to lv_prog.
    translate lv_prog to upper case.
    select single tcode from tstc into lv_tcode where pgmna = lv_prog.
    call transaction lv_tcode.
    endif.
    ENDFORM.                    " hotspot_click
    thanks in advance..
    pls

    Hi  ,
    please  go through this  Program   it was  handled  by Hot spot  only  .
    report zbnstest.
    * TABLES AND DATA DECLARATION.
    *TABLES: mara,makt.",marc.
    data syrepid like sy-repid.
    data sydatum(10). " LIKE sy-datum.
    data sypagno(3) type n.
    * WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE
    * GROUP (TYPE-POOLS--------->SLIS)
    type-pools : slis.
    * INTERNAL TABLE DECLARATION.
    * INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE
    data: begin of t_mara occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    mtart like mara-mtart,
    matkl like mara-matkl,
    end of t_mara.
    * INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE
    data : begin of t_marc occurs 0,
    matnr like mara-matnr,
    werks like marc-werks,
    minbe like marc-minbe.
    data: end of t_marc.
    * INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.
    data : begin of t_makt occurs 0,
    matnr like mara-matnr,
    maktx like makt-maktx,
    spras like makt-spras,
    end of t_makt.
    * INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.
    data: begin of itab1 occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    maktx like makt-maktx,
    spras like makt-spras,
    werks like marc-werks,
    minbe like marc-minbe,
    end of itab1.
    * THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT
    * AND THE LAYOUT FOR THE ALV.
    * HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE
    * WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT
    * OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.
    * THIS IS DONE TO MAKE THE CODE SIMPLER.
    * OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP
    * PROGRAMS.
    * IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR
    * MORE TABLES AND CREATE A STRUCTURE
    * IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS
    * LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    fieldlayout type slis_layout_alv.
    * DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE
    * TOP-OF-PAGE ETC.
    data : eventstab type slis_t_event with header line.
    * DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE
    data : heading type slis_t_listheader with header line.
    data : heading1 type slis_t_listheader with header line.
    data : heading2 type slis_t_listheader with header line.
    data : heading3 type slis_t_listheader with header line.
    data : heading4 type slis_t_listheader with header line.
    data : heading5 type slis_t_listheader with header line.
    data : heading6 type slis_t_listheader with header line.
    data : heading7 type slis_t_listheader with header line.
    data : heading8 type slis_t_listheader with header line.
    * STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.
    data : colorstruct type slis_coltypes.
    * INITIALIZATION. *
    initialization.
    syrepid = sy-repid.
    sypagno = sy-pagno.
    clear fieldcatalog.
    * START-OF-SELECTION. *
    start-of-selection.
    * SUBROUTINE TO POPULATE THE COLORSTRUCT
    perform fill_colorstruct using colorstruct.
    * SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE
    perform populate_fieldcatalog.
    * SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE
    * INTERNAL TABLE.
    perform selectdata_and_sort.
    * SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.
    perform populate_layout using fieldlayout.
    * SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
    perform merge_fieldcatalog.
    * SUBROUTINE TO POPULATE THE EVENTSTAB.
    perform fill_eventstab tables eventstab.
    * SUBROUTINE TO POPULATE THE HEADING TABLES.
    perform fill_headingtable tables heading using 'HEADING'.
    perform fill_headingtable tables heading1 using 'HEADING1'.
    perform fill_headingtable tables heading2 using 'HEADING2'.
    perform fill_headingtable tables heading3 using 'HEADING3'.
    perform fill_headingtable tables heading4 using 'HEADING4'.
    perform fill_headingtable tables heading5 using 'HEADING5'.
    perform fill_headingtable tables heading6 using 'HEADING6'.
    perform fill_headingtable tables heading7 using 'HEADING7'.
    perform fill_headingtable tables heading8 using 'HEADING8'.
    * SUBROUTINE TO DISPLAY THE LIST.
    perform display_alv_list.
    * FORMS
    * IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES
    * OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND
    * COLUMN JUSTIFICATION.
    form populate_fieldcatalog.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATNR' 'X' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MEINS' ' '.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MAKTX' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MTART' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATKL' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'SPRAS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'WERKS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MINBE' ' ' .
    endform. " POPULATE_FIELDCATALOG
    * FORM FILL_FIELDS_OF_FIELDCATALOG *
    * --> FIELDCATALOG *
    * --> P_TABNAME *
    * --> P_FIELDNAME *
    * --> P_KEY *
    * --> P_KEY *
    form fill_fields_of_fieldcatalog tables fieldcatalog
    structure fieldcatalog
    using p_tabname
    p_fieldname
    p_key.
    * p_no_out.
    fieldcatalog-tabname = p_tabname.
    fieldcatalog-fieldname = p_fieldname.
    fieldcatalog-key = p_key.
    fieldcatalog-emphasize = '1234'.
    *fieldcatalog-no_out = p_no_out.
    append fieldcatalog.
    endform. " FILL_FIELDSOFFIELDCATALOG
    * FORM POPULATE_LAYOUT *
    * --> FIELDLAYOUT *
    form populate_layout using fieldlayout type slis_layout_alv.
    fieldlayout-f2code = '&ETA' .
    fieldlayout-zebra = 'X'.
    * FOR THE WINDOW TITLE.
    fieldlayout-window_titlebar = 'ALV with Events'.
    fieldlayout-colwidth_optimize = 'X'.
    fieldlayout-no_vline = ' '.
    *fieldlayout-no_input = 'X'.
    fieldlayout-confirmation_prompt = ''.
    fieldlayout-key_hotspot = 'X'.
    * This removes the column headings if the flag is set to 'X'
    fieldlayout-no_colhead = ' '.
    *fieldlayout-hotspot_fieldname = 'MAKTX'.
    fieldlayout-detail_popup = 'X'.
    * fieldlayout-coltab_fieldname = 'X'.
    endform. " POPULATE_LAYOUT
    * FORM SELECTDATA_AND_SORT *
    form selectdata_and_sort.
    select matnr meins mtart matkl from mara
    into corresponding fields of t_mara
    up to 500 rows .
    select matnr maktx spras from makt
    into corresponding fields of t_makt
    where matnr = t_mara-matnr and
    spras = sy-langu.
    select matnr werks minbe from marc
    into corresponding fields of t_marc
    where matnr = t_mara-matnr.
    append t_marc.
    endselect.
    append t_makt.
    endselect.
    append t_mara.
    endselect.
    perform populate_itab1.
    sort itab1 by matnr.
    endform. " SELECTDATA_AND_SORT
    * FORM MERGE_FIELDCATALOG *
    form merge_fieldcatalog.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
    i_program_name = syrepid
    i_internal_tabname = 'ITAB1'
    * i_structure_name = 'COLORSTRUCT'
    * I_CLIENT_NEVER_DISPLAY = 'X'
    i_inclname = syrepid
    changing
    ct_fieldcat = fieldcatalog[]
    exceptions
    inconsistent_interface = 1
    program_error = 2
    others = 3.
    endform. " MERGE_FIELDCATALOG
    * IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS
    * FOLLOWS:-
    * i_callback_program --> CALLING PROGRAM NAME
    * i_structure_name --> STRUCTURE NAME.
    * is_layout --> LAYOUT NAME.
    * it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE
    form display_alv_list.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    * I_INTERFACE_CHECK = ' '
    i_callback_program = syrepid
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
    i_structure_name = 'ITAB1'
    is_layout = fieldlayout
    it_fieldcat = fieldcatalog[]
    * IT_EXCLUDING =
    * IT_SPECIAL_GROUPS =
    * IT_SORT =
    * IT_FILTER =
    * IS_SEL_HIDE =
    * I_DEFAULT = 'X'
    * THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD
    * TOOL BAR
    i_save = 'A'
    * IS_VARIANT = ' '
    it_events = eventstab[]
    * IT_EVENT_EXIT =
    * IS_PRINT =
    * 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 = itab1
    exceptions
    program_error = 1
    others = 2.
    endform. " DISPLAY_ALV_LIST
    *& Form POPULATE_ITAB1
    * text
    * --> p1 text
    * <-- p2 text
    form populate_itab1.
    loop at t_mara.
    loop at t_makt where matnr = t_mara-matnr.
    loop at t_marc where matnr = t_mara-matnr.
    move-corresponding t_mara to itab1.
    move-corresponding t_makt to itab1.
    move-corresponding t_marc to itab1.
    append itab1.
    endloop.
    endloop.
    endloop.
    endform. " POPULATE_ITAB1
    *& Form FILL_EVENTSTAB
    * text
    * -->P_EVENTSTAB text *
    form fill_eventstab tables p_eventstab structure eventstab.
    * WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE
    * INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.
    * AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14
    * EVENTS NAME.
    call function 'REUSE_ALV_EVENTS_GET'
    exporting
    i_list_type = 0
    importing
    et_events = p_eventstab[]
    exceptions
    list_type_wrong = 1
    others = 2.
    * BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH
    * THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.
    * WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.
    * FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM
    * IS DYNAMICALY CALLED.
    read table p_eventstab with key name = slis_ev_top_of_page.
    if sy-subrc = 0 .
    move 'TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_coverpage.
    if sy-subrc = 0 .
    move 'TOP_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_coverpage .
    if sy-subrc = 0 .
    move 'END_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_top_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_end_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_list_modify.
    if sy-subrc = 0 .
    move 'LIST_MODIFY' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_list.
    if sy-subrc = 0 .
    move 'TOP_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_page.
    if sy-subrc = 0 .
    move 'END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_list .
    if sy-subrc = 0 .
    move 'END_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    endform. " FILL_EVENTSTAB
    *& Form FILL_HEADINGTABLE
    * text
    * -->P_HEADING text *
    form fill_headingtable tables p_heading structure heading
    using tablename.
    case tablename.
    when 'HEADING'.
    p_heading-typ = 'H'.
    concatenate
    ' REPORT NAME:-' syrepid
    ' ABB Industry Pte Ltd' into p_heading-info.
    append p_heading.
    write sy-datum using edit mask '__/__/____' to sydatum.
    concatenate
    ' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno
    into p_heading-info.
    append p_heading.
    when 'HEADING1'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING2'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING3'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-TOP-OF-PAGE'.
    append p_heading.
    when 'HEADING4'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-END-OF-PAGE'.
    append p_heading.
    * WHEN 'HEADING5'.
    * P_HEADING-TYP = 'H'.
    * P_HEADING-INFO = 'LIST-MODIFY'.
    * APPEND P_HEADING.
    when 'HEADING6'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-PAGE'.
    append p_heading.
    when 'HEADING7'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-LIST'.
    append p_heading.
    when 'HEADING8'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-LIST'.
    append p_heading.
    endcase.
    endform. " FILL_HEADINGTABLE
    * FORM TOP_OF_PAGE *
    form top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading[]
    exceptions
    others = 1.
    endform.
    *& Form FILL_COLORSTRUCT
    * text
    * -->P_COLORSTRUCT text *
    form fill_colorstruct using p_colorstruct type slis_coltypes .
    p_colorstruct-heacolfir-col = 6.
    p_colorstruct-heacolfir-int = 1.
    p_colorstruct-heacolfir-inv = 1.
    endform. " FILL_COLORSTRUCT
    * FORM TOP_OF_COVERPAGE *
    form top_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading1[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_COVERPAGE *
    form end_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading2[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_TOP_OF_PAGE *
    form foreign_top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading3[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_END_OF_PAGE *
    form foreign_end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading4[]
    exceptions
    others = 1.
    endform.
    * FORM LIST_MODIFY *
    *FORM LIST_MODIFY.
    * CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    * EXPORTING
    * IT_LIST_COMMENTARY = HEADING5[]
    * EXCEPTIONS
    * OTHERS = 1.
    *ENDFORM.
    * FORM END_OF_PAGE *
    form end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading6[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_LIST *
    form end_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading7[]
    exceptions
    others = 1.
    endform.
    * FORM TOP_OF_LIST *
    form top_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading8[]
    exceptions
    others = 1.
    endform.
    *--- End of Program
    Reward  points  if it is usefull ..
    Girish

  • I need simple example for alv grid

    hi
    i need code for simple example for alv grid.
    thanks.

    hi bharat,
                  this is report with most of the functionality.
    report zus_alv_demo_grid .
    tables:     ekko.
    type-pools: slis.
    types: begin of t_ekko,
    ebeln type ekpo-ebeln,
    ebelp type ekpo-ebelp,
    statu type ekpo-statu,
    aedat type ekpo-aedat,
    matnr type ekpo-matnr,
    menge type ekpo-menge,
    meins type ekpo-meins,
    netpr type ekpo-netpr,
    peinh type ekpo-peinh,
    line_color(4) type c, "Used to store row color
    end of t_ekko.
    data: it_ekko type standard table of t_ekko initial size 0,
           wa_ekko type t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    Data declaration for EVENT and PRINT PARAMETER.
    data: gt_events type slis_t_event,
           gd_prntparams type slis_print_alv.
    data declaration for sorting.
    data : it_sortcat   type slis_sortinfo_alv occurs 1,
           wa_sort like line of it_sortcat.
    data :  i_list_comments type slis_t_listheader.
    start-of-selection.
      perform data_retrieval.
    perform user_command.
      perform build_fieldcatalog.
      perform build_layout.
      perform build_events.
      perform build_print_params.
      perform build_sortcat.
      perform display_alv_report.
    end-of-selection.
    *TOP-OF-PAGE.
    PERFORM top-of-page.
    end-of-page.
    *&      Form  build_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    form build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      fieldcatalog-do_sum = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " build_fieldcatalog
    *&      Form  build_layout
          text
    -->  p1        text
    <--  p2        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
    *when double
                                            "click(press f2)*
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " build_layout
    *&      Form  data_retrieval
          text
    -->  p1        text
    <--  p2        text
    form data_retrieval.
      data: ld_color(1) type c.
      select ebeln ebelp statu aedat matnr menge meins netpr
    peinh from ekpo  into table it_ekko.
    *Populate field with color attributes
      loop at it_ekko into wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
              i.e. wa_ekko-line_color = 'C410'
        ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
        if ld_color = 8.
          ld_color = 1.
        endif.
        concatenate 'C' ld_color '10' into wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
        modify it_ekko from wa_ekko.
      endloop.
    endform.                    " data_retrieval
    *&      Form  display_alv_report
          text
    -->  p1        text
    <--  p2        text
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = gd_repid
                is_layout                = gd_layout
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                i_callback_user_command  = 'USER_COMMAND'
                i_callback_pf_status_set = 'SET_PF_STATUS'
                it_event                 = gt_events
                is_print                 = gd_prntparams
                it_fieldcat              = fieldcatalog[]
                it_sort                 = it_sortcat
                i_save                   = 'X'
           tables
                t_outtab                 = it_ekko
           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.              " DISPLAY_ALV_REPORT
    *&      Form  user_command
          text
    -->  p1        text
    <--  p2        text
    *&      Form  top-of-page
          text
    -->  p1        text
    <--  p2        text
    form top-of-page.
    *ALV Header declarations
      data: t_header type slis_t_listheader,
            wa_header type slis_listheader,
            t_line like wa_header-info,
            ld_lines type i,
            ld_linesc(10) type c.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      concatenate  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
       sy-datum(4) into wa_header-info."todays date
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
         into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
           it_list_commentary = t_header
           i_logo             = 'GANESH_LOGO'.
    endform.                    " top-of-page
          FORM user_command                                             *
    -->  R_UCOMM                                                       *
    -->  RS_SELFIELD                                                   *
    form user_command using r_ucomm like sy-ucomm
    rs_selfield type slis_selfield.
      case r_ucomm.
        when '&IC1'.
          if rs_selfield-fieldname = 'EBELN'.
            read table it_ekko into wa_ekko index rs_selfield-tabindex.
            set parameter id 'BES' field wa_ekko-ebeln.
            call transaction 'ME23N' and skip first screen.
          endif.
        when 'ULHAS'.
          if rs_selfield-fieldname = 'EBELN'.
            read table it_ekko into wa_ekko index rs_selfield-tabindex.
            set parameter id 'BES' field wa_ekko-ebeln.
            call transaction 'ME23N' and skip first screen.
          endif.
      endcase.
    endform.
          FORM set_pf_status                                            *
    -->  RT_EXTAB                                                      *
    form set_pf_status using rt_extab type slis_t_extab.
      set pf-status 'ZNEWSTATUS'.
    endform.
    *&      Form  build_events
          text
    -->  p1        text
    <--  p2        text
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
       exporting
         i_list_type           = 0
       importing
         et_events             = gt_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 gt_events with key name =  slis_ev_end_of_page
                  into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
      read table gt_events with key name =  slis_ev_end_of_list
                  into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " build_events
    *&      Form  build_print_params
          text
    -->  p1        text
    <--  p2        text
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " build_print_params
          FORM END_OF_PAGE                                              *
    form end_of_page.
      data: listwidth type i,
      ld_pagepos(10) type c,
      ld_page(10)    type c.
      write: sy-uline(50).
      skip.  write:/40 'Page:', sy-pagno .
    endform.
          FORM END_OF_LIST                                              *
    form end_of_list.
      data: listwidth type i,
      ld_pagepos(10) type c,
      ld_page(10)    type c.
      skip.  write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  build_sortcat
          text
    -->  p1        text
    <--  p2        text
    form build_sortcat.
    wa_sort-spos      = 1.
    wa_sort-fieldname = 'EBELN'.
    append wa_sort to it_sortcat.
    wa_sort-spos      = 2.
    wa_sort-fieldname = 'EBELP'.
    append wa_sort to it_sortcat.
    endform.                    " build_sortcat
    Rewards if helpfull
    regards
    vijay dwivedi

  • Need a Free designing program. for example: something to help me make shirt

    Need a Free designing program. for example: something to help me make shirt graphics, posters, and other designs. i do not think my mac came with any such program. i have ilife 08 but i dont think anything there can help me?

    Got to VersionTracker or MacUpdate and search.

  • Need an example program for function module

    Hi ,
    I am new to ABAP. Can you please give a simple example program to extract the data from a table using Function module.
    Thanks for your help in advace.
    Regards,
    Vishnu

    hi vishnu,
    See the following Sample Program;
    REPORT demo_mod_tech_fb_read_spfli.
    PARAMETERS carrier TYPE s_carr_id.
    DATA: jtab TYPE spfli_tab,
          wa   LIKE LINE OF jtab.
    CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
         EXPORTING
              id        = carrier
         IMPORTING
              itab      = jtab
         EXCEPTIONS
              not_found = 1
              OTHERS    = 2.
    CASE sy-subrc.
      WHEN 1.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
      WHEN 2.
        MESSAGE e888(sabapdocu) with 'Error in  function module'.
    ENDCASE.
    LOOP AT jtab INTO wa.
      WRITE: /  wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDLOOP.
    Also you can find example programs for all in tcode ABAPDOCU in your SAP system itself, explore ABAPDOCU to find more sample programs....
    Regards
    Karthik D

  • F.01 Summary Report for ALV grid

    Hi all,
    We have defined our financial statement version (FSV). We have been running tests in transaction F.01, when we choose ALV Tree output the transaction works perfectly.
    However, if we choose ALV grid output and then choose "1" in the Summary Report field (highest summary level, only main points of Balance sheet P&L statement should be displayed) the output is not summarized at all.
    In short, no matter what number we put in the Summary Report field we always get the same output.
    What needs to be done in order to be able to use this summarization control?
    Any help will be appreciated.
    Juan
    Edited by: Juan Carlos Mier Giraud on Jul 8, 2008 4:50 PM

    Renata,
    Thanks for your help. I am going to need a bit of help to develop the solutions described in the notes you pointed out.
    Have you successfully created a summarization for ALV grid output?
    I just want to know if it is worthy to devote time to it or just use classic list or ALV tree when appropiate.
    Regards

  • Send some sample program for ALV reports

    Hi all ,
    send some sample program for ALV reports for learing purpose
    tahnks.

    Hi ,
    Resource Master
    Program                     YPPCRR                  *
    Program type                Report Program                     *
    Title                       Resource Master Dara for Updation  *
    Author                      Naga Raju                          *
    Requested By                Balaji                             *
    Date Written                24.05.2007                         *
    Specification Id            F2-DP-FS-2-0002                    *
    Transport Request                                              *
    On-line Documentation
    Description
    This Program updates the Location Mater through the Transaction
    /SAPAPO/LOC3 Based on the User Selection
    Update
    Reset
    No Action
    Output
    ALV List output of the main Program
    ALV List output of the Error Log
    REPORT  YPPCRR NO STANDARD PAGE HEADING
                   LINE-SIZE 120
                   LINE-COUNT 62(4)
                   MESSAGE-ID yap..
    Global data
    Include where all the data declarations are coded.
      INCLUDE YPPCRR_data.
    *Initialization
    INITIALIZATION.
    perform init_variant.
    Constants
    CONSTANTS: c_formname_top_of_page TYPE slis_formname
    VALUE 'F_TOP_OF_PAGE'.
    Selection-Screen
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-040.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:p_prs RADIOBUTTON GROUP ztyp USER-COMMAND ucom DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 3(28) text-003.
    position 40.
    parameters: p_file1 TYPE rlgrap-filename.
    SELECTION-SCREEN END OF LINE.
    skip 5.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: p_aps RADIOBUTTON GROUP ztyp.
    SELECTION-SCREEN COMMENT 3(28) text-004.
    position 40.
    parameters: p_file2 type rlgrap-filename.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
       EXPORTING
         program_name        = syst-repid
      DYNPRO_NUMBER       = SYST-DYNNR
         field_name          = p_file1
      STATIC              = ' '
      MASK                = ' '
        CHANGING
          file_name           = p_file1
    EXCEPTIONS
      MASK_TOO_LONG       = 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.
    START-OF-SELECTION.
    if p_prs = 'X'.
         PERFORM f_read_datum1 TABLES t_res_head
                          USING p_file1
                          CHANGING w_subrc.
      elseif p_aps = 'X'.
         PERFORM f_read_datum2 TABLES t_res_head
                          USING p_file2
                          CHANGING w_subrc.
    endif.
    IF w_subrc = 0.
    Validations
    PERFORM VALIDATION.
    PERFORM display_alv.
    IF SY-UCOMM = '&F03'
    or SY-UCOMM = '&F12'
    or SY-UCOMM = '&F15'.
    LEAVE LIST-PROCESSING.
    ELSE.
    ENDIF.
    ELSE.
    Message s100 with text-002.
    ENDIF.
    END-OF-SELECTION.
    Forms part*
    INCLUDE YPPCRR_forms.
    *&  Include           YPPCRR_DATA
    Type-Pools
      TYPE-POOLS: slis.
    *TYPES
    DATA:  BEGIN OF tl_res_head.
            INCLUDE STRUCTURE ypp_res_head.
    DATA:  END OF tl_res_head.
    DATA:  BEGIN OF tl_res_head_val.
            INCLUDE STRUCTURE ypp_resv.
    DATA:  END OF tl_res_head_val.
    DATA : BEGIN OF ty_errlog ,
             counter type i,
             type(2) ,
             name(10) TYPE c,
             vrsioid(22) TYPE c,
             restype TYPE c,
             message(80) TYPE c,
           END OF ty_errlog.
    Global Variables
    DATA : gc_flag(1) TYPE c,
           w_val_err_flag(1) type c.
    DATA: w_filename TYPE rlgrap-filename,
          w_subrc TYPE sy-subrc,
          w_t_res_head TYPE slis_t_fieldcat_alv,
          wa_t_res_head TYPE slis_fieldcat_alv.
    DATA :  wa_date(10) TYPE c,
            wa_time(10) TYPE c,
           wa_title(40) TYPE c,
           wa_type(4) TYPE c  .
    DATA: BAPI_RUN_YES_NO TYPE C.
    *Structure
    *INTERNAL TABLES USED BY ALV
    DATA:
    it_fieldcat_alv  TYPE slis_t_fieldcat_alv,
    IT_FIELDCAT_ALV_ERR  TYPE SLIS_T_FIELDCAT_ALV,
    it_status TYPE slis_formname VALUE 'F_MAIN',
    it_user_command TYPE slis_formname VALUE 'F_USER_COMMAND',
    it_events        TYPE slis_t_event,
    it_event_exit    TYPE slis_t_event_exit,
    it_list_comments TYPE slis_t_listheader,
    it_excluding     TYPE slis_t_extab,
    it_sort          TYPE slis_t_sortinfo_alv.
    *Internal Table Declarations
    DATA : BEGIN OF t_imex OCCURS 0 ,
                    string(256) TYPE c,
           END OF t_imex.
    DATA : fcode TYPE TABLE OF sy-ucomm.
    DATA : fcode_bdc TYPE TABLE OF sy-ucomm.
    DATA : fcode_error TYPE TABLE OF sy-ucomm.
    DATA : fcode_final TYPE TABLE OF sy-ucomm.
    STRUCTURE and WORKARES
    *Internal Table Declarations
    DATA : t_res_head  like  tl_res_head occurs 0 WITH HEADER LINE.
    DATA : t_res_head_val like tl_res_head_val occurs 0 with header line.
    data :l_res_head LIKE LINE OF t_res_head.
    DATA : w_file TYPE string.
    *DATA : wa_vrsioid(22) type c,
          wa_locno(20) type c,
          wa_calendar(2) type c,
          wa_planner(3) type c.
    DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA: RESOURCE_HEAD LIKE BAPI10004RESHEAD OCCURS 0 WITH HEADER LINE,
          RESOURCE_HEAD_X LIKE BAPI10004RESHEADX OCCURS 0 WITH HEADER LINE,
          RESOURCE_TEXT LIKE BAPI10004RESTEXT OCCURS 0 WITH HEADER LINE,
          RESOURCE_TEXT_X LIKE BAPI10004RESTEXTX OCCURS 0 WITH HEADER LINE.
    data : t_errlog like ty_errlog occurs 0 with header line.
    DATA : wk_lines TYPE i,
           wk_errlines TYPE i,
           wk_count TYPE i.
    DATA:   g_tabname TYPE slis_tabname VALUE 'T_RES_HEAD'.
    Variables to be used by ALV
    DATA:
      wk_variant          LIKE disvariant,
      wx_variant         LIKE disvariant,
      wk_variant_save(1)  TYPE c,
      wk_exit(1)          TYPE c,
      wk_repid            LIKE sy-repid,
      wk_user_specific(1) TYPE c,
      wk_callback_ucomm   TYPE slis_formname,
      wk_callback_status   TYPE slis_formname,
    wk_callback_status1  TYPE slis_formname,
      wk_print            TYPE slis_print_alv,
      wk_layout           TYPE slis_layout_alv,
      wk_html_top_of_page TYPE  slis_formname,
      wk_fieldcat_alv     LIKE LINE OF it_fieldcat_alv,
      wk_excluding        LIKE LINE OF it_excluding,
      wk_events           LIKE LINE OF it_events,
      wk_event_exit       LIKE LINE OF it_event_exit,
      wk_list_comments    LIKE LINE OF it_list_comments,
      wk_list1_comments    LIKE LINE OF it_list_comments,
      wk_list2_comments    LIKE LINE OF it_list_comments,
      wk_sort             LIKE LINE OF it_sort.
    *DATA :gc_delete_flag(1).
    *&  Include           YAPOLOC_FORMS
    FORM display_alv .
      PERFORM f_fieldcat_build.
      PERFORM f_event_build.
      PERFORM f_exclude_build.
      PERFORM f_print_build.
      PERFORM f_layout_build.
      PERFORM f_display_data.
    ENDFORM.                    " display_alv
    *&      Form  f_fieldcat_build
          text
    FORM f_fieldcat_build .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name   = wk_repid
          i_structure_name = 'YPP_RESV'
          i_inclname       = wk_repid
        CHANGING
          ct_fieldcat      = it_fieldcat_alv.
    ENDFORM.                    " F_FIELDCAT_BUILD
    *&      Form  F_EVENT_BUILD
          text
    >  p1        text*  <  p2        text
    FORM f_event_build .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = it_events.
      READ TABLE it_events WITH KEY
      name = slis_ev_top_of_page INTO wk_events.
      IF sy-subrc = 0.
        MOVE c_formname_top_of_page TO wk_events-form.
        MODIFY it_events FROM wk_events INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " F_EVENT_BUILD
    *&      Form  F_EXCLUDE_BUILD
          text
    -->  p1        text
    <--  p2        text
    FORM f_exclude_build .
      wk_excluding = '&GRAPH'. "Graphic
      APPEND wk_excluding TO it_excluding.
    ENDFORM.                    " F_EXCLUDE_BUILD
    *&      Form  F_PRINT_BUILD
          text
    -->  p1        text
    <--  p2        text
    FORM f_print_build .
      wk_print-no_print_listinfos = 'X'.
    ENDFORM.                    " F_PRINT_BUILD
    *&      Form  F_LAYOUT_BUILD
          text
    -->  p1        text
    <--  p2        text
    FORM f_layout_build .
      wk_layout-zebra                = 'X'.
    WK_LAYOUT-COLWIDTH_OPTIMIZE    = 'X'.
      wk_layout-detail_popup         = 'X'.
      wk_layout-detail_initial_lines = 'X'.
      wk_layout-detail_titlebar      = 'Details '.
    ENDFORM.                    " F_LAYOUT_BUILD
    *&      Form  F_DISPLAY_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM f_display_data .
      wk_callback_ucomm = 'CALLBACK_UCOMM'.
      IF sy-ucomm = 'UPD' OR sy-ucomm = space .
        wk_callback_status   = 'CALLBACK_STATUS'.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_background_id             = 'SIWB_WALLPAPER'
          i_callback_program          = wk_repid
         i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
          i_callback_pf_status_set    = wk_callback_status
          i_callback_user_command     = wk_callback_ucomm
          it_sort                     = it_sort
          i_default                   = 'X'
          i_save                      = 'A'
          is_variant                  = wk_variant
          is_layout                   = wk_layout
          it_fieldcat                 = it_fieldcat_alv
          it_events                   = it_events
          it_event_exit               = it_event_exit
          it_excluding                = it_excluding
          is_print                    = wk_print
        TABLES
          t_outtab                    = t_res_head_val.
    ENDFORM.                    " F_DISPLAY_DATA
    ALV for Error Log
    *&      Form  display_alv_ERR
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv_err .
      PERFORM f_fieldcat_build_err.
      PERFORM f_event_build_err.
      PERFORM f_exclude_build_err.
      PERFORM f_print_build_err.
      PERFORM f_layout_build_err.
      PERFORM f_display_data_err.
    ENDFORM.                    " display_alv_ERR
    *&      Form  F_FIELDCAT_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_fieldcat_build_err .
    BREAK-POINT.
      REFRESH it_fieldcat_alv.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name     = wk_repid
          i_internal_tabname = 'TY_ERRLOG'
      i_structure_name = 'YPP_ERR_LOG'
          i_inclname         = wk_repid
        CHANGING
          ct_fieldcat        = it_fieldcat_alv_err.
      LOOP AT it_fieldcat_alv INTO wk_fieldcat_alv.
        CASE wk_fieldcat_alv-fieldname.
          WHEN 'COUNTER'.
            wk_fieldcat_alv-seltext_s = text-023.
            wk_fieldcat_alv-seltext_m = text-023.
            wk_fieldcat_alv-seltext_l = text-023.
            wk_fieldcat_alv-reptext_ddic = text-023.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'TYPE'.
            wk_fieldcat_alv-seltext_s = text-009.
            wk_fieldcat_alv-seltext_m = text-009.
            wk_fieldcat_alv-seltext_l = text-009.
            wk_fieldcat_alv-reptext_ddic = text-009.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'NAME'.
            wk_fieldcat_alv-seltext_s = text-010.
            wk_fieldcat_alv-seltext_m = text-010.
            wk_fieldcat_alv-seltext_l = text-010.
            wk_fieldcat_alv-reptext_ddic = text-010.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'VRSIOID'.
            wk_fieldcat_alv-seltext_s = text-011.
            wk_fieldcat_alv-seltext_m = text-011.
            wk_fieldcat_alv-seltext_l = text-011.
            wk_fieldcat_alv-reptext_ddic = text-011.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'RESTYPE'.
            wk_fieldcat_alv-seltext_s = text-012.
            wk_fieldcat_alv-seltext_m = text-012.
            wk_fieldcat_alv-seltext_l = text-012.
            wk_fieldcat_alv-reptext_ddic = text-012.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'MESSAGE'.
            wk_fieldcat_alv-seltext_s = text-013.
            wk_fieldcat_alv-seltext_m = text-013.
            wk_fieldcat_alv-seltext_l = text-013.
            wk_fieldcat_alv-reptext_ddic = text-013.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN OTHERS.
        ENDCASE.
        MODIFY it_fieldcat_alv FROM wk_fieldcat_alv.
      ENDLOOP.
    ENDFORM.                    " F_FIELDCAT_BUILD_err
    *&      Form  F_EVENT_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_event_build_err .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = it_events.
      READ TABLE it_events WITH KEY name = slis_ev_top_of_page
                                   INTO wk_events.
      IF sy-subrc = 0.
        MOVE c_formname_top_of_page TO wk_events-form.
        MODIFY it_events FROM wk_events INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " F_EVENT_BUILD_err
    *&      Form  F_EXCLUDE_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_exclude_build_err .
      wk_excluding = '&GRAPH'. "Graphic
      APPEND wk_excluding TO it_excluding.
    ENDFORM.                    " F_EXCLUDE_BUILD_err
    *&      Form  F_PRINT_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_print_build_err .
      wk_print-no_print_listinfos = 'X'.
    ENDFORM.                    " F_PRINT_BUILD_err
    *&      Form  F_LAYOUT_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_layout_build_err .
      wk_layout-zebra                = 'X'.
    WK_LAYOUT-COLWIDTH_OPTIMIZE    = 'X'.
      wk_layout-detail_popup         = 'X'.
      wk_layout-detail_initial_lines = 'X'.
      wk_layout-detail_titlebar      = 'Details '.
    ENDFORM.                    " F_LAYOUT_BUILD_err
    *&      Form  F_DISPLAY_DATA_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_display_data_err .
      wk_callback_ucomm = 'CALLBACK_UCOMM'.
    IF SY-UCOMM ne '&F03'.
      wk_callback_status = 'CALLBACK_STATUS'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_background_id          = 'SIWB_WALLPAPER'
          i_callback_program       = wk_repid
          i_callback_pf_status_set = wk_callback_status
          i_callback_user_command  = wk_callback_ucomm
          it_sort                  = it_sort
          i_default                = 'X'
          i_save                   = 'A'
          is_variant               = wk_variant
          is_layout                = wk_layout
          it_fieldcat              = it_fieldcat_alv_err
          it_events                = it_events
          it_event_exit            = it_event_exit
          it_excluding             = it_excluding
          is_print                 = wk_print
        TABLES
          t_outtab                 = t_errlog.
        KEEP EERRLOG BUTTON
      SET PF-STATUS 'ZSTANDARD' EXCLUDING 'UPD' IMMEDIATELY.
    ENDFORM.                    "f_display_data_err
    **&      Form  F_TOP_OF_PAGE
          text
    FORM f_top_of_page.
      CLEAR: it_list_comments[],
             wk_list_comments,
             wk_list1_comments,
             wk_list2_comments.
      wk_list_comments-typ  = 'H'. "H=Header,S=Selection, A=Action
      wk_list_comments-key  = ''.
      CASE sy-ucomm.
        WHEN ''.
          wk_list_comments-info = text-030.
        WHEN 'UPD'.
          IF t_errlog[] IS INITIAL.
            wk_list_comments-info = text-031.
          ELSE.
            wk_list_comments-info = text-032.
          ENDIF.
        WHEN 'ERRLOG'.
          wk_list_comments-info = text-032.
        WHEN '&F03'.
          wk_list_comments-info = text-031.
        WHEN '&F15'.
          wk_list_comments-info = text-031.
        WHEN '&F12'.
          wk_list_comments-info = text-031.
      ENDCASE.
      APPEND wk_list_comments TO it_list_comments.
      WRITE sy-datum TO wa_date.
      WRITE sy-uzeit TO wa_time.
      wk_list_comments-typ  = 'S'. "H=Header, S=Selection, A=Action
      wk_list_comments-key  = ''.
      wk_list_comments-info = 'User:'.
      wk_list1_comments-info = sy-uname.
      CONCATENATE wk_list_comments wk_list1_comments
      INTO wk_list2_comments.
      APPEND wk_list2_comments TO it_list_comments.
      wk_list_comments-typ  = 'S'. "H=Header, S=Selection, A=Action
      wk_list_comments-key  = ''.
      wk_list_comments-info = '                   Run Date : '.
      wk_list1_comments-info = wa_date.
      CONCATENATE wk_list_comments wk_list1_comments
      INTO wk_list2_comments .
      APPEND wk_list2_comments TO it_list_comments.
      wk_list_comments-typ  = 'S'. "H=Header, S=Selection, A=Action
      wk_list_comments-key  = ''.
      wk_list_comments-info = 'Run Time : '.
      wk_list1_comments-info = wa_time.
      CONCATENATE wk_list_comments wk_list1_comments
      INTO wk_list2_comments .
      APPEND wk_list2_comments TO it_list_comments.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
         I_LOGO             = 'ENJOYSAP_LOGO'
          it_list_commentary =  it_list_comments.
    ENDFORM.                    "F_TOP_OF_PAGE
          FORM USER_COMMAND_SAMPLE                                  *
    -->  UCOMM                                                     *
    -->  SELFIELD                                                  *
    FORM callback_ucomm USING ucomm LIKE sy-ucomm
                         selfield TYPE slis_selfield.
      DATA: v_langu(2) ,
             v_loctype TYPE  /sapapo/c_loctype.
      data err_flg(1).
      IF  bapi_run_yes_no IS INITIAL.
        CASE sy-ucomm.
          WHEN 'UPD'.
            bapi_run_yes_no = 'X'.
            LOOP AT t_res_head_val  WHERE val_err_msg  EQ space.
              v_langu = 'EN'.
               refresh tables
              REFRESH : resource_head ,
                        resource_head_x ,
                        resource_text ,
                        resource_text_x,
                        t_return.
              CLEAR   : resource_head ,
                        resource_head_x ,
                        resource_text ,
                        resource_text_x,
                        t_return .
              resource_head-resource   = t_res_head-name .
              resource_head-restype    = t_res_head-restype.
              resource_head-location   = t_res_head-locno.
              CLEAR : v_loctype .
              SELECT SINGLE loctype  FROM  /sapapo/loc CLIENT SPECIFIED
                     INTO v_loctype
                     WHERE  mandt    = sy-mandt
                     AND    locno    = t_res_head-locno.
              resource_head-loctype  = v_loctype.
              resource_head-calendar   = t_res_head-calendar.
              resource_head-type       = t_res_head-type.
              IF t_res_head-type = '03'.
                resource_head-dimension_bucket = t_res_head-dimension_bucket.
              ELSE.
                resource_head-dimension_bucket = space.
              ENDIF.
              APPEND resource_head.
              CLEAR  resource_head.
              resource_head_x-resource = t_res_head-name.
              resource_head_x-restype  = 'X'.
              resource_head_x-location = 'X'.
              resource_head_x-loctype  = 'X'.
              resource_head_x-calendar = 'X'.
              resource_head_x-type     = 'X'.
              IF t_res_head-type = '03'.
                resource_head_x-dimension_bucket = 'X'.
              ELSE.
                resource_head_x-dimension_bucket = space.
              ENDIF.
              APPEND resource_head_x.
              CLEAR  resource_head_x.
              resource_text-resource = t_res_head-name.
              resource_text-langu    = v_langu.
              resource_text-res_short_text = t_res_head-text.
              APPEND resource_text.
              CLEAR  resource_text.
              resource_text_x-resource = t_res_head-name.
              resource_text_x-langu    = v_langu.
              resource_text_x-res_short_text = 'X'.
              APPEND resource_text_x.
              CLEAR  resource_text_x.
               call bapi
              CALL FUNCTION 'BAPI_RSSRVAPS_SAVEMULTI_30A'
                EXPORTING
                  logical_system                      = 'AD2CLNT200'
                 business_system_group               =  'BSG001'
                 commit_control                      = 'E'
               NO_CREATE                           = ' '
               TABLES
                 resource_head                       =  resource_head
                 resource_head_x                     =  resource_head_x
                 resource_text                       =  resource_text
                 resource_text_x                     =  resource_text_x
                 return                              =  t_return.
              IF sy-subrc = 0.
                LOOP AT t_return WHERE type = 'E'
                              OR type = 'A'.
                  MOVE t_res_head_val-counter TO t_errlog-counter.
                  MOVE t_res_head_val-type TO t_errlog-type.
                  MOVE t_res_head_val-name TO t_errlog-name.
                  MOVE t_res_head_val-vrsioid TO t_errlog-vrsioid.
                  MOVE t_res_head_val-restype TO t_errlog-restype.
                  MOVE t_return-message TO t_errlog-message.
                  APPEND t_errlog.
                  CLEAR t_errlog..
                ENDLOOP.
    IF not t_errlog[] is initial..
               IF sy-subrc = 0.
                ERROR POP UP
                  MESSAGE  text-007 type 'I'.
                ELSE.
                   err_flg = 'X'.
               SUCC POP UP
                 MESSAGE text-008 type 'I'.
                ENDIF.
              ELSE.                                             "NE 0
                LOOP AT t_return WHERE type = 'E'
                              OR type = 'A'.
                  MOVE t_res_head_val-counter TO t_errlog-counter.
                  MOVE t_res_head_val-type TO t_errlog-type.
                  MOVE t_res_head_val-name TO t_errlog-name.
                  MOVE t_res_head_val-vrsioid TO t_errlog-vrsioid.
                  MOVE t_res_head_val-restype TO t_errlog-restype.
                  MOVE t_return-message TO t_errlog-message.
                  APPEND t_errlog.
                  CLEAR t_errlog..
             ENDLOOP.
                IF sy-subrc = 0.
                ELSE.
                  MOVE t_res_head_val-counter TO t_errlog-counter.
                  MOVE t_res_head_val-type TO t_errlog-type.
                  MOVE t_res_head_val-name TO t_errlog-name.
                  MOVE t_res_head_val-vrsioid TO t_errlog-vrsioid.
                  MOVE t_res_head_val-restype TO t_errlog-restype.
                  MOVE 'Error in Creation' TO t_errlog-message.
                  APPEND t_errlog.
                  CLEAR t_errlog..
                ENDIF.
              ENDIF.
          ENDLOOP.
            gc_flag = 'X'.
            REFRESH fcode.
       if err_flg = 'X'.
                  MESSAGE text-008 type 'I'.
       endif.
        ENDCASE.
      ENDIF.
      IF NOT t_errlog[] IS INITIAL.
        wk_list_comments-info = text-032.
        APPEND wk_list_comments TO it_list_comments.
        APPEND 'UPD' TO fcode_error.
        APPEND 'ERRLOG' TO fcode_error.
        SET PF-STATUS 'ZSTANDARD' EXCLUDING fcode_error.
        PERFORM display_alv_err.
      ELSE.
      ENDIF.
    ENDFORM.                    "CALLBACK_UCOMM=
    *&      Form  CALLBACK_STATUS
          text
         -->RT_EXTAB   text
    FORM callback_status USING rt_extab TYPE slis_t_extab.
    IF  bapi_run_yes_no IS NOT INITIAL .
        IF t_errlog[] IS INITIAL.
          REFRESH fcode.
          APPEND 'UPD' TO fcode.
          APPEND 'ERRLOG' TO fcode.
            SET PF-STATUS 'ZSTANDARD' EXCLUDING 'ERRLOG'.
          SET PF-STATUS 'ZSTANDARD' EXCLUDING fcode IMMEDIATELY .
        ENDIF.
      ELSE.
        SET PF-STATUS 'ZSTANDARD' EXCLUDING 'ERRLOG' IMMEDIATELY .
      ENDIF.
    ENDFORM.                    "CALLBACK_STATUS
    *&      Form  CALLBACK_STATUS1
          text
         -->RT_EXTAB   text
    FORM callback_status1 USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD' EXCLUDING 'UPD'.
    ENDFORM. " CALLBACK_STATUS
    *&      Form  CALLBACK_STATUS2
          text
         -->RT_EXTAB   text
    FORM callback_status2 USING rt_extab TYPE slis_t_extab.
      REFRESH fcode_final.
      IF sy-ucomm NE '&F03'.
        APPEND 'UPD'  TO fcode_final.
        APPEND 'ERRLOG' TO fcode_final.
        SET PF-STATUS 'ZSTANDARD' EXCLUDING fcode_final.
      ELSE.
        SET PF-STATUS 'ZSTANDARD' EXCLUDING 'UPD'.
      ENDIF.
    ENDFORM.                    "CALLBACK_STATUS2
    *&      Form  callback_ucomm_E
          text
         -->UCOMM      text
         -->SELFIELD   text
    FORM callback_ucomm_e USING ucomm LIKE sy-ucomm
                         selfield TYPE slis_selfield.
      CASE sy-ucomm.
        WHEN 'ERRLOG' .
          PERFORM display_alv_err.
        WHEN '&F03'.
          SET PF-STATUS 'ZSTANDARD' EXCLUDING 'UPD' IMMEDIATELY .
          PERFORM display_alv .
      ENDCASE.
    ENDFORM.                    "CALLBACK_UCOMM=
    *&      Form  init_variant
          text
    -->  p1        text
    <--  p2        text
    FORM init_variant .
      CLEAR: wk_variant.
      wk_repid              = sy-repid.
      wk_variant-report     = wk_repid.
      wk_variant-username   = sy-uname.
      wk_variant_save       = 'A'. "All types
    ENDFORM.                    " init_variant
    *&      Form  f_read_datum1
          text
         -->P_T_RES_HEAD  text
         -->P_P_FILE1  text
         <--P_W_SUBRC  text
    FORM f_read_datum1  TABLES   p_t_res_head STRUCTURE ypp_res_head
                        USING    p_p_file1
                        CHANGING p_w_subrc.
      DATA : iexcel LIKE zexcel_read OCCURS 0 WITH HEADER LINE.
      CLEAR  p_w_subrc.
      CALL FUNCTION 'ZALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_p_file1
          i_begin_col             = 1
          i_begin_row             = 1
          i_end_col               = 62
          i_end_row               = 50000
        TABLES
          intern                  = iexcel
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        p_w_subrc = 0 .
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT iexcel WHERE row > 2.
        IF iexcel-col = '0001'.
          p_t_res_head-type = iexcel-value.
        ENDIF.
        IF iexcel-col = '0002'.
          p_t_res_head-name = iexcel-value.
        ENDIF.
        IF iexcel-col = '0003'.
          p_t_res_head-vrsioid = iexcel-value.
        ENDIF.
        IF iexcel-col = '0004'.
          p_t_res_head-restype = iexcel-value.
        ENDIF.
        IF iexcel-col = '0005'.
          p_t_res_head-locno = iexcel-value.
        ENDIF.
        IF iexcel-col = '0006'.
          p_t_res_head-tzone = iexcel-value.
        ENDIF.
        IF iexcel-col = '0007'.
          p_t_res_head-calendar = iexcel-value.
        ENDIF.
        IF iexcel-col = '0008'.
          p_t_res_head-planner = iexcel-value.
        ENDIF.
        IF iexcel-col = '0009'.
          p_t_res_h

  • I need some Important Trigger Programs for Objects

    I need some Important Trigger Programs for Objects.
    If the program includes the V-array appln, that would be better to.

    There are some drawbacks, running Windows 7 (only) on a Mac via Bootcamp yields less than stellar results, especially with the Retina display.
    And of your traveling, the Mac's high power needs (especially the Retina display) and lack of removable battery are going to be a serious issue. The Retina display is glossy, not ideal for viewing on the road and in varied environments.
    CS4 won't run on the OS X version that comes with a Mac, so your looking at purchasing CS6.
    Support for Windows is more widespread than for Mac's, also if you ever need to redownload OS X to fix a issue, requires a fast reliable Internet connection of the broadband kind.
    If your running Windows on your Mac, you can expect to be on your own and not get support as easily as if you were running it on a regular PC.
    If you can't afford to keep up with CS upgrades, then you shouldn't be considering a Mac because there are more paid upgrades on that than on Windows 7, it's like a annual nightmare.
    IMMO your still better off on a decent,  1920 x 1080 res, matte screen, removable battery (with extras), Win 7 Pro i7 machine (Pro+ runs XP programs) which will stay like it is and get security updates until 2020.
    OS X changes every year and if you don't upgrade, + all your third party software, then about 3 years later your left behind for updates.
    Also you will have to buy Win 7 to run on your Mac, the OEM disks won't work.
    If your trying to budget, then a Mac is certainly not for you.

  • Do I need to buy new programs for osx lion?

    Do I need to buy new programs for osx lion?

    First you need to make sure you have a supported machine, and all the current updates (Core 2 Duo, i3/5/7 and 10.6.8.)
    If you are using Microsoft Office 2004/8, then you will need to buy Office 2011. If you are using older versions of Adobe Photoshop before CS3 that are PPC only, then you will need to buy a newer Adobe CS.
    If you are running iWork 08, it will work, but there will be no support for full screen unless you have 09 version. If you use Apple software like Final Cut or Logic Studio, you will also need the latest versions to use full screen support.
    Basically, if you have any software installed that is more than 2 years old, you need to check if it is Intel, PPC or Universal. Because anthing that is listed as PPC will not work at all. And most Apple apps older than 2 years do not have any support for the new Full Screen or Versions features.
    If you want to see if you have any PPC apps that are not supported at all, simply click the Apple icon at the top, click about this Mac, then click more info. System Profiler will open, on the left side click on "Applications" and you will see a list of every installed app. The far right column will tell you KIND, Intel, Universal or PPC. Anything in the list that says PPC will not work after installing Lion.

  • ALV grid list  report when selected  from  selection screen

    Hi folks,
                I need to get ALV grid display in my list report when selected the interval values from  the selection screen. If I change the values in list of ALV grid it needs to be updated when I press UPDATE pushbutton. The output of list should be in ALV grid display.I need sorting ,flitering,totaling functionality in the list output.
    For example if I selected BUKRS = 100 and 200 in the selection screen ,I need to display the ALV grid list in below the selection screen as ALV grid display...
    Its urgent as  I am new to ALV grid functionality...
    Thanks in advance..

    hi raja,
    check with the folllowing code.
    REPORT zca0m_zca0fcstftop NO STANDARD PAGE HEADING
                                    MESSAGE-ID zcsv_usrtbl_maintain.
    Type pools                                                           *
    TYPE-POOLS : slis.                          " Used for ALV display
    Tables
    TABLES: zca0fcstftop,
            dd04t,                         "R/3 DD: Data element texts
            tactt.                         "Activities that can be protected
    internal tables
    DATA: BEGIN OF wa_zca0fcstftop .
            INCLUDE STRUCTURE zca0fcstftop.
    DATA: END OF wa_zca0fcstftop.
    DATA: t_zca0fcstftop LIKE STANDARD TABLE OF wa_zca0fcstftop.
    DATA: BEGIN OF i_fcode OCCURS 0,
            fcode LIKE sy-ucomm,
          END OF i_fcode.
    *Record for variant selection
    DATA : BEGIN OF ws_variant,
             selected TYPE c,
             variant  LIKE ltdx-variant,  "Variant name
             text     LIKE ltdxt-text,    "Variant description
           END OF ws_variant.
    *Table for variant selection
    data : itab_variant LIKE STANDARD TABLE OF ws_variant WITH HEADER LINE.
    Variant selection pop-up global variables
    DECLARATION OF TABLECONTROL 'VARIANT_CNTL' ITSELF
    CONTROLS: variant_cntl TYPE TABLEVIEW USING SCREEN 0200.
    LINES OF TABLECONTROL 'VARIANT_CNTL'
    DATA:     g_variant_cntl_lines  LIKE sy-loopc.
    DATA:grid1 TYPE REF TO  cl_gui_alv_grid ,
         g_custom_container TYPE REF TO cl_gui_custom_container.
    Work fields
    DATA: table_name LIKE dd02l-tabname,   "To store table name
          field_name LIKE dd03l-fieldname, "To Store Field Name
          act_auth LIKE tactz-actvt,       "To pass Activity ID
          tab_maint LIKE dd02l-tabname,    "To pass Table Name to be Maintd.
          wg_confirm_ind,                  "To trap User responses
          flag,                            "To trap changes made to an entry
          f_copy,                          "To Identify 'COPY' Command Use
          f_select,                        "To decide between Select-options
                                           " and Internal Table
          l_transaction_code LIKE tstc-tcode,
          v_langu LIKE sy-langu,
          v_repid LIKE sy-repid,
          s_variant TYPE disvariant.
    DATA: ok_code LIKE sy-ucomm.
    DATA:selected_rows TYPE lvc_t_row  ,
         sel_rows TYPE lvc_t_row WITH HEADER LINE.
    DATA:t_lines TYPE i.
    Constants                                                            *
    CONSTANTS :
               c_x TYPE c VALUE 'X',             " Constant 'X'.
               c_f TYPE c VALUE 'F'.             " Constant 'F'.
    Parameters and Selection Options
    *Selection Screen for table maintenance
    *Selection option for Plant
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-b01.
    PARAMETERS:  p_werks   LIKE zca0fcstftop-werks OBLIGATORY.
    SELECT-OPTIONS: s_prdfml  FOR zca0fcstftop-product_family,
                    s_bmach   FOR zca0fcstftop-base_machine,
                    s_factop FOR zca0fcstftop-factory_top,
                    s_optval  FOR zca0fcstftop-option_value,
                    s_week    FOR zca0fcstftop-week.
    SELECTION-SCREEN END OF BLOCK block1.
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-b02.
    PARAMETERS     : p_varant LIKE ltdx-variant.          " ALV variant
    SELECTION-SCREEN END OF BLOCK block2.
    At selection screen                                                  *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varant.
      PERFORM alv_variant_f4 CHANGING p_varant.
    AT SELECTION-SCREEN ON p_werks .
    Validating Plant on the selection screen
      PERFORM validate_plant.
    Initialization
    INITIALIZATION.
    Check Authorization for the Transaction
    Authorization Check For T Code
      SELECT tcode
         INTO l_transaction_code
         FROM tstc UP TO 1 ROWS
         WHERE pgmna = sy-repid.
      ENDSELECT.
      AUTHORITY-CHECK OBJECT 'S_TCODE'
                          ID 'TCD' FIELD l_transaction_code.
      IF sy-subrc NE 0.
        MESSAGE e001 WITH l_transaction_code.
      ENDIF.
      v_langu = sy-langu.                             " language
      v_repid = sy-repid .                            " abap Program name
    Start Of Selection
    START-OF-SELECTION.
      CALL SCREEN 0050.
    *&      Form  validate_plant                                           *
          Validating Plant on the selection screen                       *
    FORM validate_plant .
      DATA : l_werks LIKE t001w-werks.                          " Plant
      IF p_werks IS NOT INITIAL.
        SELECT SINGLE werks
            FROM t001w
            INTO l_werks
            WHERE werks EQ p_werks.
        IF sy-subrc NE 0.
          MESSAGE e100(ra) WITH text-001 .
        ENDIF.
      ENDIF.
      AUTHORITY-CHECK OBJECT 'Z_PP_PLANT'
               ID 'ACTVT' FIELD '03'
               ID 'WERKS' FIELD p_werks
               ID 'TCD' FIELD l_transaction_code.
      IF sy-subrc NE 0.
        MESSAGE e000(oo) WITH 'No authorization for plant:'(e80) p_werks.
      ENDIF.
    ENDFORM.                    " validate_plant
    *&      Form  get_data                                                 *
          Get data                                                       *
    FORM get_data .
      SELECT * FROM zca0fcstftop
        INTO TABLE t_zca0fcstftop
        WHERE werks           = p_werks
          AND product_family IN s_prdfml
          AND base_machine   IN s_bmach
          AND factory_top    IN s_factop
          AND option_value   IN s_optval
          AND week           IN s_week.
    ENDFORM.                    " get_data
    *&      Form  fill_fcode
    FORM fill_fcode USING    value(p_0029).
      i_fcode-fcode = p_0029.
      APPEND i_fcode.
      CLEAR i_fcode.
    ENDFORM.                               " fill_fcode
    *&      Module  STATUS_0100  OUTPUT
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'UPDATE'.
      CLEAR flag.
    ENDMODULE.                             " STATUS_0100  OUTPUT
    *&      Module  MODIFY_0100  OUTPUT
    MODULE modify_0100 OUTPUT.
      IF sy-ucomm = 'CHNG' OR
           sy-ucomm = 'PICK'.
        LOOP AT SCREEN.
          CHECK screen-group1 = 'CHG'.
          screen-required = '0'.
          screen-output   = '1'.
          screen-input    = '0'.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    Check if you are in create mode & if yes then set the screen elements
    as mandatory
      IF ok_code = 'CREA'.
        LOOP AT SCREEN.
          CHECK screen-group1 = 'CHG'.
          screen-required = '1'.
          screen-output   = '1'.
          screen-input    = '1'.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    ENDMODULE.                             " MODIFY_0100  OUTPUT
    *&      Module  Check_Exit  INPUT
          text
    MODULE check_exit INPUT.
      IF ( sy-ucomm = 'BACK' OR sy-ucomm = 'CANC' OR sy-ucomm = 'EXIT' ) AND
           ( flag = 'Y' ).
        CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
          EXPORTING
            defaultoption  = 'Y'
            textline1      = text-008
            textline2      = text-009
            titel          = text-004
            cancel_display = ' '
          IMPORTING
            answer         = wg_confirm_ind.
        CASE wg_confirm_ind.
          WHEN 'J'.                                             "Yes
            sy-ucomm = 'SAVE'.
            CLEAR flag.
          WHEN 'N'.                                             "No
            sy-ucomm = 'BACK'.
            CLEAR flag.
        ENDCASE.
      ENDIF.
    ENDMODULE.                             " Check_Exit  INPUT
    *&      Module  Exit_0100  INPUT
          text
    MODULE exit_0100 INPUT.
      SET SCREEN 0. LEAVE SCREEN.
    ENDMODULE.                             " Exit_0100  INPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'SAVE'.                       "Save
        Check to see if the user has the appropriate authorization
          IF p_werks NE zca0fcstftop-werks.
          could not update - not in selection
            MESSAGE e000(oo) WITH 'Entry not within selection'.
            SET SCREEN 0. LEAVE SCREEN.
            PERFORM get_data.
          ENDIF.
          IF f_copy = 'X'.
            INSERT zca0fcstftop.
            IF sy-subrc = 0.
              MESSAGE s004.
              PERFORM initialize.
              SET SCREEN 0. LEAVE SCREEN.
              PERFORM get_data.
            ELSE.
              MESSAGE w005.
            ENDIF.
          ELSE.
            MODIFY zca0fcstftop.
            IF sy-subrc = 0.
              MESSAGE s004.
              PERFORM initialize.
              SET SCREEN 0. LEAVE SCREEN.
              PERFORM get_data.
            ELSE.
              MESSAGE w005.
            ENDIF.
          ENDIF.
          PERFORM get_data.
        WHEN 'BACK'.                       "Back
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'CANC'.                       "Cancel
          SET SCREEN 0. LEAVE SCREEN.
        WHEN OTHERS.
      ENDCASE.
      COMMIT WORK.
    ENDMODULE.                             " USER_COMMAND_0100  INPUT
    *&      Form  Initialize
    FORM initialize.
      CLEAR :   table_name,
                field_name,
                wg_confirm_ind,
                f_copy,
                flag,
                t_zca0fcstftop,
                zca0fcstftop,
                wa_zca0fcstftop,
                i_fcode.
      REFRESH: t_zca0fcstftop.
    ENDFORM.                               " Initialize
    *&      Form  alv_variant_f4
          text
         <--P_VARIANT  text
    FORM alv_variant_f4  CHANGING variant.
      DATA: rs_variant LIKE disvariant.
      DATA nof4 TYPE c.
      CLEAR nof4.
      LOOP AT SCREEN.
        IF screen-name = 'VARIANT'.
          IF screen-input = 0.
            nof4 = 'X'.
          ENDIF.
        ENDIF.
      ENDLOOP.
      rs_variant-report   = sy-repid.
      rs_variant-username = sy-uname.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant = rs_variant
          i_save     = 'A'
        IMPORTING
          es_variant = rs_variant
        EXCEPTIONS
          OTHERS     = 1.
      IF sy-subrc = 0 AND nof4 EQ space.
        variant = rs_variant-variant.
      ENDIF.
    ENDFORM.                               " ALV_VARIANT_F4
    *&      Module  STATUS_0050  OUTPUT
          text
    MODULE status_0050 OUTPUT.
    In this module Initialize the container and put the grid in it
      DATA:grid_layout  TYPE lvc_s_layo,
           fieldcat TYPE lvc_t_fcat,
           wa_fieldcat LIKE LINE OF fieldcat.
      PERFORM set_auth.
      SET PF-STATUS 'UPD_0050' EXCLUDING i_fcode.
      SET TITLEBAR 'UPD_0050'.
      IF g_custom_container IS INITIAL .
        CREATE OBJECT g_custom_container
           EXPORTING
              container_name = 'FTDATA'.
        CREATE OBJECT grid1
           EXPORTING
            i_parent = g_custom_container.
      ELSE.
        CALL METHOD grid1->free.
        CALL METHOD g_custom_container->free.
        CREATE OBJECT g_custom_container
           EXPORTING
              container_name = 'FTDATA'.
        CREATE OBJECT grid1
           EXPORTING
            i_parent = g_custom_container.
      ENDIF.
    Every time refresh The variables
      PERFORM initialize.
      PERFORM get_data.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZCA0FCSTFTOP'
        CHANGING
          ct_fieldcat      = fieldcat.
      grid_layout-grid_title = text-t01.
      grid_layout-sel_mode = 'A'.
      grid_layout-stylefname = 'CT'.
      s_variant-report   = sy-repid.
      s_variant-username = sy-uname.
      s_variant-variant  = p_varant.
      CALL METHOD grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ZCA0FCSTFTOP'
          is_layout        = grid_layout
          is_variant       = s_variant
          i_save           = 'A'
        CHANGING
          it_outtab        = t_zca0fcstftop
          it_fieldcatalog  = fieldcat.
      Create Object to receive events and link them to handler methods.
      When the ALV Control raises the event for the specified instance
      the corresponding method is automatically called.
    CREATE OBJECT event_receiver.
    SET HANDLER event_receiver->handle_button_click FOR grid1.
    ENDMODULE.                 " STATUS_0050  OUTPUT
    *&      Module  USER_COMMAND_0050  INPUT
    MODULE user_command_0050 INPUT.
      CALL METHOD grid1->get_selected_rows
        IMPORTING
          et_index_rows = selected_rows.
      DESCRIBE TABLE selected_rows LINES t_lines.
      IF t_lines > 1 .
        MESSAGE e048(zcsv_sfdr).
      ENDIF.
    Clear Header
      CLEAR wa_zca0fcstftop.
      sel_rows[] = selected_rows .
      READ TABLE sel_rows INDEX 1.
      READ TABLE t_zca0fcstftop INTO wa_zca0fcstftop INDEX sel_rows-index.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN 'CREA'.
          CLEAR zca0fcstftop.
          ok_code = sy-ucomm.
          zca0fcstftop-werks = p_werks.
          CALL SCREEN 100.
        WHEN 'COPY'.
          MOVE wa_zca0fcstftop TO zca0fcstftop .
          CLEAR wa_zca0fcstftop.
          f_copy = 'X'.
          CALL SCREEN 100.
        WHEN 'CHNG'.
          CHECK NOT wa_zca0fcstftop IS INITIAL.
          MOVE wa_zca0fcstftop TO zca0fcstftop .
          CLEAR wa_zca0fcstftop.
          ok_code = sy-ucomm.
          CALL SCREEN 100.
        WHEN 'DELE'.
          CHECK NOT wa_zca0fcstftop IS INITIAL.
          CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
            EXPORTING
              defaultoption  = 'N'
              textline1      = text-005
              textline2      = text-006
              titel          = text-007
              cancel_display = ' '
            IMPORTING
              answer         = wg_confirm_ind.
          IF wg_confirm_ind EQ 'J'.
            DELETE zca0fcstftop FROM wa_zca0fcstftop .
            IF sy-subrc EQ 0.
              MESSAGE s004.
            ELSE.
              MESSAGE e005.
            ENDIF.
          ELSEIF wg_confirm_ind EQ 'N'.
          ENDIF.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                 " USER_COMMAND_0050  INPUT
    *&      Form  exit_program
    FORM exit_program .
      CALL METHOD g_custom_container->free.
      CALL METHOD cl_gui_cfw=>flush.
      SET SCREEN 0.
      LEAVE SCREEN.
    ENDFORM.                    " exit_program
    *&      Form  set_auth
    FORM set_auth.
      REFRESH: i_fcode.
    Check authorization for change
      MOVE '02' TO act_auth.        "02 --> Change
      MOVE 'ZCA0FCSTFTOP' TO tab_maint.
      AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
        ID 'ACTVT' FIELD act_auth
        ID 'TABLE' FIELD tab_maint.
      IF sy-subrc NE 0.
        PERFORM fill_fcode USING 'CHNG'.
      ENDIF.
    Check for authorization for create
      MOVE '01' TO act_auth.        "01 --> Create
      MOVE 'ZCA0FCSTFTOP' TO tab_maint.
      AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
        ID 'ACTVT' FIELD act_auth
        ID 'TABLE' FIELD tab_maint.
      IF sy-subrc NE 0.
        PERFORM fill_fcode USING 'CREA'.
        PERFORM fill_fcode USING 'COPY'.
      ENDIF.
    Check for authorization for delete
      MOVE '06' TO act_auth.        "06 --> Delete
      MOVE 'ZCA0FCSTFTOP' TO tab_maint.
      AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
        ID 'ACTVT' FIELD act_auth
        ID 'TABLE' FIELD tab_maint.
      IF sy-subrc NE 0.
        PERFORM fill_fcode USING 'DELE'.
      ENDIF.
    ENDFORM.                    " set_auth
    *&      Module  check_change  INPUT
    MODULE check_change INPUT.
      flag = 'Y'.
    ENDMODULE.                 " check_change  INPUT
    regards,
    vikas.
    plz reward if helpful

  • Editable field in ALV GRID/LIST

    Hi All,
    I developed an alv program in which 10 rows is there. In alv grid/list first column is check box. I want 1,5 and 10th row is editable for first column (check box) while rest is not editable. Can you please give solution for same. Please tell me simple method not oops methos
    coz I have taken FM REUSE_ALV_GRID_DISPLAY or REUSE_ALV_LIST_DISPLAY.
    Thanks,
    Rakesh

    goto se38.
    BCALVEDIT*
    press F4
    many examples are there..
    BCALV_GRID_EDIT try this...

  • Adding pushbutton  in alv grid list

    hai friends,
                     i have developed an alv grid list and i place a pushbutton called 'GETEXCEL'.when i click on 'GETEXCEL' it should generate an excel sheet and it should get placed in application server.
    for the reference plz check my code also.
    the issue is when i debug, the transfer statement is getting executed then it is going to the standard program(moduel pool) and then it is not going to application server.of course excel sheet is also getting generated.can anybody find the solution for this.
    *&      Form  events_get
          text
    -->  p1        text
    <--  p2        text
    FORM events_get .
    *DATA t_event TYPE slis_t_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = tab_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 tab_events INTO wa_events WITH KEY name = 'USER_COMMAND'.
      wa_events-form = 'USER_COMMAND'.
      MODIFY tab_events FROM wa_events TRANSPORTING form WHERE name =
      wa_events-name.
      READ TABLE tab_events INTO wa_events WITH KEY name = 'PF_STATUS_SET'.
      wa_events-form = 'PF_STATUS_SET'.
      MODIFY tab_events FROM wa_events TRANSPORTING form WHERE name =
      wa_events-name.
    ENDFORM.                    " events_get
    **& Form pf_status_set
    FORM pf_status_set USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'STATUS'.
    ENDFORM.                           " pf_status_set
    **& Form user_command
    FORM user_command
    USING u_comm TYPE sy-ucomm
    r_selfield TYPE slis_selfield.
    CASE u_comm.
        WHEN 'GETEXCEL'.
          PERFORM f400_column_headings.
          PERFORM f500_generate_excel_file.
          PERFORM f600_transfer_excel_file.
      ENDCASE.
    ENDFORM.                    "user_command
    then i am passing the parameters in grid fm also for user command and set pf status.

    Hi Mahesh,
    1. No need to populate the EVENTS table in your case, just pass the Subroutine names for PF status and USER_COMMAND to GRId Display
      I_CALLBACK_PFSTATUS  = 'PF_STATUS_SET'.
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    2. make sure you pass SY-REPID/SY-CPROG  to REUSE_ALV_GRID_DISPLAY  FM

  • How to create editable ALV grid/list

    Hi,
    I want to create editable ALV grid/list so that user can modify the data in the ALV.
    And when user presses save button data will get saved in Z table.
    I dont know how to create editable ALV so could anybody please help me regarding this?
    Thanks & regards,
    Sameer Dhuke

    HI
    check the demo programs BCALV_FULLSCREEN_GRID_EDIT
    BCALV_GRID_EDIT
    BCALV_TEST_GRID_EDIT_01
    BCALV_TEST_GRID_EDITABLE
    REUSE_ALV_GRID EDITABLE
    ALV Grid editable fields
    Just to make things a bit easy
    In the layout,there is a property called edit, make it 'X' for the particular field whichever you want to make editable.
    Hope this helps,
    Suruchi
    Message was edited by:
            Suruchi Mahajan

Maybe you are looking for