Display of minus in ALV

Hi  ..
How can I avoid displaying sign in ALV . For example    - 12.00 must be displayed 12.00 but as a quantity it is already -12.00

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'MAIN_100'.
  g_repid = sy-repid.
  IF custom_container1 IS INITIAL.
    CREATE OBJECT custom_container1
        EXPORTING
            container_name = container.
    CREATE OBJECT grid1
           EXPORTING i_parent = custom_container1.
    gs_layout-sel_mode = 'A'.
    gs_variant-report   = sy-repid.
    gs_variant-username = sy-uname.
    PERFORM fill_field_cat  CHANGING gt_fieldcat  .
    CALL METHOD grid1->set_table_for_first_display
      EXPORTING
        i_save          = 'A'
        is_variant      = gs_variant
        is_layout       = gs_layout
      CHANGING
        it_fieldcatalog = gt_fieldcat
        it_outtab       = gt_itab_t[].
    SET HANDLER lcl_event_receiver=>handle_double_click FOR grid1.
    CALL METHOD grid1->set_toolbar_interactive.
  ENDIF.
ENDMODULE .
FORM fill_field_cat CHANGING gt_fieldcat TYPE lvc_t_fcat .
  DATA gs_fieldcat TYPE lvc_s_fcat .
  DATA : fname(10) TYPE c .
  DATA : fname2(10) TYPE c .
  CLEAR   gs_fieldcat .
  gs_fieldcat-key = 'X' .
  gs_fieldcat-no_sign = 'X' .
  add-fieldcat 'BUKRS' 'GT_ITAB_T' 'BUKRS'  'Sirket Kodu'    .
  add-fieldcat 'KUNNR'  'GT_ITAB_T'       'KUNNR'          'Musteri' .
  add-fieldcat 'NAME1'  'GT_ITAB_T'       'NAME1'          'Musteri Unvani' .
  add-fieldcat 'PROJEKOD'  'GT_ITAB_T'       'PROJEKOD'          'Proje Numarası' .
  add-fieldcat 'PROJE_TUTARI'   'GT_ITAB_T'       'PROJE_TUTARI'          'Proje Tutarı' .
  add-fieldcat 'PROJE_BAK'   'GT_ITAB_T'       'PROJE_BAK'          'Proje Bakiyesi' .
ENDFORM.
Message was edited by:
        yusuf tunay çilesiz

Similar Messages

  • Is it possible to display LOGO in simple ALV list?

    Hi Guys,
    Is it possible to display LOGO in simple ALV list. If yes plz explain in details.
    Thanks
    Sharat

    Yes it is possible to display logo at the top of the page.
    TYPE-POOLS: slis.
    *     Data Decalaration
    DATA: it_vbak TYPE TABLE OF vbak.
    DATA: g_repid TYPE sy-repid.
    DATA: it_listheader TYPE slis_t_listheader,
           wa_listheader TYPE slis_listheader.
    *     START-OF-SELECTION
    START-OF-SELECTION.
       g_repid = sy-repid.
       SELECT * FROM vbak INTO TABLE it_vbak.
       PERFORM build_alv_header.
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
           i_callback_program     = g_repid
           i_callback_top_of_page = 'TOP_OF_PAGE'
           i_structure_name       = 'vbak'
         TABLES
           t_outtab               = it_vbak.
    *&      Form  BUILD_ALV_HEADER
    FORM build_alv_header .
    *  Type H is used to display headers i.e. big font
       wa_listheader-typ  = 'H'.
       wa_listheader-info ='Flight Details'.
       APPEND wa_listheader TO it_listheader.
       CLEAR wa_listheader.
    *  Type S is used to display key and value pairs
       wa_listheader-typ = 'S'.
       APPEND wa_listheader TO it_listheader.
       CLEAR wa_listheader.
    *  Type A is used to display italic font
       wa_listheader-typ = 'A'.
       wa_listheader-key = 'Date    :' .
       wa_listheader-info ='SAP ALV Report'.
       APPEND wa_listheader TO it_listheader.
       CLEAR wa_listheader.
    ENDFORM.                    " BUILD_ALV_HEADER
    *&      Form  top_of_page
    FORM top_of_page.
       CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
         EXPORTING
           it_list_commentary = it_listheader
           i_logo         = 'PARI'.
    ENDFORM.                    "top_of_page

  • Displaying special characters in ALV report.

    Hi Experts,
    Can we display special characters in ALV reports? Special characters such as tick mark.(Like in character map(Font Bookshelf  Symbol 7) of windows ).
    I tried with icons in ALV report, I was able to display tick icon in the ALV report, but when we export the report in to a excel, the icons comes in as Hexadecimal code.
    Can any we display special characters like tick in ALV report or display the icons in excel aswell?
    I will be gratefull for the <urgency reduced by moderator> response.
    Regards,
    Sharath.
    Edited by: Thomas Zloch on May 10, 2011 10:26 AM

    Sharath,
    I think it is possible to do so.
    Please check this link.
    http://www.sapfans.com/forums/viewtopic.php?f=13&t=322569
    Thanks,
    Guru.

  • How to display the fields in ALV Output without using Field catalog?

    How to display the fields in ALV Output without using Field catalog?
    Could you pls tell me the coding?
    Akshitha.

    Hi,
    u mean without building field catalog. is it? I that case, we can use the FM REUSE_ALV_FIELDCATALOG_MERGE.
    data: itab type table of mara.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_structure_name = itab
    CHANGING
    ct_fieldcat = lt_fieldcat[]
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    *Pass that field catalog into the fillowing FM
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_grid_title            = 'REPORTING'
                is_layout              = gt_layout
                it_fieldcat             = lt_fieldcat[]
           tables
                t_outtab                = itab.

  • Problem in display of text in ALV report

    Dear experts,
    I am working on a MM Report in which I need to display Material Basic data text maintained in MM01,02 Tcodes through ALV report.
    I have declared a string type variable for the Basic data text in the Final Internal Table.
    For reading the Standard text I am using Read_Text FM, from which I am looping the Text internal table and concatenating it into
    String variable.
    What I notice is all the content beyond 255 chars is not getting displayed, Even when the ALV report is downloaded to Excel file.
    Can you suggest some approach to over come this issue.
    Regards,
    Murthy

    Hi,
    Use the below code
    Data : lt_content  TYPE TABLE OF tline,
              lw_content   TYPE tline.
    Data : lt_text Type Table of solisti1,
              lw_text TYPE solisti1.
    CALL FUNCTION 'READ_TEXT'
        EXPORTING
          client                  = sy-mandt
          id                        = lv_id
          language            = tdspras
          name                  = lv_name
          object                 = lv_object
          archive_handle  = 0
          local_cat            = ' '
        TABLES
          lines                   = lt_content
        EXCEPTIONS
          id                      = 1
          language          = 2
          name                = 3
          not_found        = 4
          object               = 5
          reference_check = 6
          wrong_access_to_archive = 7
          OTHERS                  = 8.
    loop at lt_content into lw_content.
      lw_text-line = lw_content-tdline.
      APPEND lw_text TO lt_text.
      CLEAR: lw_content, lw_text.
    endloop.
    Now your whole text is in "lt_text".
    Regards,
    Avish Mittal

  • How to change the text of item's displaying in the folowing ALV.

    Hi Experts,
    I want to change the text of item's displaying in the folowing ALV.
    Go to ME23N->Click 'Messages'->Click 'Further Data' -> Click 'Displ.Originals'.
    Here one small ALV grid is appearing.
    Currently it is showing same name's under the 'Title' column of that ALV. My requirement is to change the text coming under the column 'Title' in that display.
    Can any one throw some light in the issue.
    Thanks&Regards,
    Anversha

    Hi Anversha ,
    i think you need to use Enhancement point for it.
    check the program DV70AF0A-->ARCHIV_ANZEIGE(Subtoutine).
    i had similar kind of requirement ,while attaching the supporting documents to FI document , i need to update title field with File name , so i used EP and BADI to do so.
    regards
    Prabhu

  • Display Traffic Lights in ALV TREE

    Hi,
    I have to display traffic light in ALV tree but i am not able to find out what parameter i should pass like in ALV grid where we can set is_layout (BCALV_GRID_04).
    Thanks in advance.
    Regards,
    Harsh

    Hi,
    Please take a look at my code below. Hope it suits your requirement.
    P.S. Please award points if it helps...
    *& Report ZMM_R_PO_TO_IPURCH_XI
    *& PROGRAM TYPE  : Report
    *& RICEF ID      :
    *& TITLE         : ZMM_R_PO_TO_IPURCH_XI
    *& SAP Module    : MM
    *& CREATION DATE : 02/06/2008
    *& AUTHOR        : Aris Hidalgo
    *& DESIGNER      : Aris Hidalgo
    *& DESCRIPTION   :
    *$**********************************************************************
    *$     CHANGE HISTORY
    *$----------------------------------------------------------------------
    *$   DATE        | T-Num      | Description                  | Reference
    **               |            |                              |
    *$**********************************************************************
    REPORT  zmm_r_po_to_ipurch_xi
            NO STANDARD PAGE HEADING
            MESSAGE-ID zmm.
    * Data Dictionary Table/s                      *
    TABLES: edidc.
    * SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_credat FOR edidc-credat OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: rb_sum RADIOBUTTON GROUP grp1,
                rb_det RADIOBUTTON GROUP grp1.
    SELECTION-SCREEN END OF BLOCK b2.
    */ CLASS DEFINITION/S /*
    *       CLASS lcl_data_def DEFINITION
    CLASS lcl_data_def DEFINITION ABSTRACT.
      PUBLIC SECTION.
        TYPES: BEGIN OF t_edidc,
                docnum TYPE edidc-docnum,
                docrel TYPE edidc-docrel,
                status TYPE edidc-status,
                doctyp TYPE edidc-doctyp,
                direct TYPE edidc-direct,
                rcvpor TYPE edidc-rcvpor,
                rcvprt TYPE edidc-rcvprt,
                rcvprn TYPE edidc-rcvprn,
                rcvsad TYPE edidc-rcvsad,
                sndpor TYPE edidc-sndpor,
                sndprt TYPE edidc-sndprt,
                sndprn TYPE edidc-sndprn,
                sndsad TYPE edidc-sndsad,
                credat TYPE edidc-credat,
                cretim TYPE edidc-cretim,
                mestyp TYPE edidc-mestyp,
                idoctp TYPE edidc-idoctp,
               END OF t_edidc.
        TYPES: BEGIN OF t_output,
                exception TYPE char1,
                ebeln     TYPE ekko-ebeln,
                lifnr     TYPE lfa1-lifnr,
                name1     TYPE lfa1-name1,
                credat    TYPE edidc-credat,
                cretim    TYPE edidc-cretim,
               END OF t_output.
        TYPES: BEGIN OF t_ekko,
                ebeln TYPE ekko-ebeln,
                lifnr TYPE ekko-lifnr,
               END OF t_ekko.
        TYPES: BEGIN OF t_lfa1,
                lifnr TYPE lfa1-lifnr,
                name1 TYPE lfa1-name1,
               END OF t_lfa1.
        DATA: gt_edidc  TYPE STANDARD TABLE OF t_edidc,
              gt_output TYPE STANDARD TABLE OF t_output,
              wa_output LIKE LINE OF gt_output,
              gt_ekko   TYPE HASHED TABLE OF t_ekko
                        WITH UNIQUE KEY ebeln,
              gt_lfa1   TYPE HASHED TABLE OF t_lfa1
                        WITH UNIQUE KEY lifnr.
    ENDCLASS.                    "lcl_data_def DEFINITION
    CLASS lcl_alv_routines  DEFINITION DEFERRED.
    CLASS lcl_handle_events DEFINITION DEFERRED.
    *       CLASS lcl_get_data DEFINITION
    CLASS lcl_get_data DEFINITION INHERITING FROM lcl_data_def.
      PUBLIC SECTION.
        METHODS: get_idocs,
                 read_idocs,
                 process_data
                   IMPORTING
                     im_docnum TYPE edidc-docnum.
      PRIVATE SECTION.
        CONSTANTS: lc_mestyp     TYPE edidc-mestyp VALUE 'ZMARKETSITE_PURCHASE_ORDER',
                   lc_idoctp     TYPE edidc-idoctp VALUE 'ZMARKETSITE_PURCHASE_ORDER01',
                   lc_segnam     TYPE edid4-segnam VALUE 'ZMARKETSITE_ORDER_HEADER1'.
        CONSTANTS: lc_red        TYPE i VALUE 1,
                   lc_yellow     TYPE i VALUE 2,
                   lc_green      TYPE i VALUE 3.
        DATA: lv_stat_message    TYPE bdidocattr-message,
              o_lcl_alv_routines TYPE REF TO lcl_alv_routines.
        DATA: ls_idoc_control    TYPE edidc,
              lv_tot_data_recs   TYPE sy-dbcnt,                 "#EC NEEDED
              lv_tot_status_recs TYPE sy-dbcnt.                 "#EC NEEDED
        DATA: lt_edids TYPE STANDARD TABLE OF edids,
              lt_edidd TYPE STANDARD TABLE OF edidd.
    ENDCLASS.                    "lcl_get_data DEFINITION
    *       CLASS lcl_alv_routines DEFINITION
    CLASS lcl_alv_routines DEFINITION INHERITING FROM lcl_get_data.
      PUBLIC SECTION.
        DATA: lcl_table            TYPE REF TO cl_salv_table,
              lcl_container        TYPE REF TO cl_gui_custom_container,
              lcl_handle_events    TYPE REF TO lcl_handle_events,
              lcl_columns          TYPE REF TO cl_salv_columns_table,
              lcl_column           TYPE REF TO cl_salv_column_table,
              lcl_events2          TYPE REF TO cl_salv_events_table,
              lcl_display_settings TYPE REF TO cl_salv_display_settings,
              lcl_functions        TYPE REF TO cl_salv_functions_list,
              lcl_display          TYPE REF TO cl_salv_display_settings,
              lcl_aggregations     TYPE REF TO cl_salv_aggregations,
              lcl_sorts            TYPE REF TO cl_salv_sorts,
              lcl_content          TYPE REF TO cl_salv_form_element,
              lcl_header           TYPE REF TO cl_salv_form_header_info,
              ls_color             TYPE lvc_s_colo.
        DATA: lcl_grid            TYPE REF TO cl_salv_form_layout_grid,
              lcl_grid_1          TYPE REF TO cl_salv_form_layout_grid,
              lcl_grid_2          TYPE REF TO cl_salv_form_layout_grid,
              lcl_label           TYPE REF TO cl_salv_form_label,"#EC NEEDED
              lcl_text            TYPE REF TO cl_salv_form_text,
              gt_t247             TYPE STANDARD TABLE OF t247,
              wa_t247             LIKE LINE OF gt_t247,
              lv_text             TYPE string.
        METHODS: display_data
                   IMPORTING
                     im_output LIKE gt_output,
                 display_top_of_page.
      PRIVATE SECTION.
        DATA: lv_string TYPE string,
              lv_date1  TYPE c LENGTH 10,
              lv_time   TYPE c LENGTH 10,
              lv_title  TYPE string.
    ENDCLASS.                    "lcl_alv_routines DEFINITION
    *       CLASS lcl_handle_events DEFINITION
    CLASS lcl_handle_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          on_link_click FOR EVENT link_click OF cl_salv_events_table
            IMPORTING row column.
    ENDCLASS.                    "lcl_handle_events DEFINITION
    */ IMPLEMENTATION/S /*
    *       CLASS lcl_get_data IMPLEMENTATION
    CLASS lcl_get_data IMPLEMENTATION.
    * METHOD get_idocs
      METHOD get_idocs.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
    *       PERCENTAGE       = 0
            text             = text-p01.
        SELECT docnum docrel status doctyp
               direct rcvpor rcvprt rcvprn
               rcvsad sndpor sndprt sndprn
               sndsad credat cretim mestyp
               idoctp
          FROM edidc
          INTO TABLE gt_edidc
         WHERE mestyp = lc_mestyp
           AND idoctp = lc_idoctp
           AND credat IN s_credat.
        IF gt_edidc[] IS NOT INITIAL.
    *     Get IDOC details
          CALL METHOD me->read_idocs.
        ENDIF.
      ENDMETHOD.                    "get_idocs
    * METHOD read_idocs
      METHOD read_idocs.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
    *       PERCENTAGE       = 0
            text             = text-p02.
        FIELD-SYMBOLS: <fs_edidc>  LIKE LINE OF gt_edidc,
                       <fs_output> LIKE LINE OF gt_output,
                       <fs_ekko>   LIKE LINE OF gt_ekko,
                       <fs_lfa1>   LIKE LINE OF gt_lfa1.
        LOOP AT gt_edidc ASSIGNING <fs_edidc>.
          CLEAR ls_idoc_control.
          REFRESH: lt_edids, lt_edidd.
    *     Get status text of IDOC
          CALL FUNCTION 'IDOC_GET_MESSAGE_ATTRIBUTE'
            EXPORTING
              idoc_number  = <fs_edidc>-docnum
            IMPORTING
              idoc_message = lv_stat_message.
    *     Get IDOC details
          CALL FUNCTION 'IDOC_READ_COMPLETELY'
            EXPORTING
              document_number          = <fs_edidc>-docnum
            IMPORTING
              idoc_control             = ls_idoc_control
              number_of_data_records   = lv_tot_data_recs
              number_of_status_records = lv_tot_status_recs
            TABLES
              int_edids                = lt_edids
              int_edidd                = lt_edidd
            EXCEPTIONS
              document_not_exist       = 1
              document_number_invalid  = 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.
    *     Pass data to output table
          CALL METHOD me->process_data
            EXPORTING
              im_docnum = <fs_edidc>-docnum.
        ENDLOOP.
        DELETE gt_output WHERE ebeln IS INITIAL.
        IF gt_output[] IS NOT INITIAL.
    *     Get vendor for fetched POs
          SELECT ebeln lifnr
            FROM ekko
            INTO TABLE gt_ekko
             FOR ALL ENTRIES IN gt_output
           WHERE ebeln = gt_output-ebeln.
          IF gt_ekko[] IS NOT INITIAL.
    *       Get name of vendors
            SELECT lifnr name1
              FROM lfa1
              INTO TABLE gt_lfa1
               FOR ALL ENTRIES IN gt_ekko
             WHERE lifnr = gt_ekko-lifnr.
          ENDIF.
    *     Pass vendor details to output table
          LOOP AT gt_output ASSIGNING <fs_output>.
            READ TABLE gt_ekko ASSIGNING <fs_ekko>
                               WITH TABLE KEY ebeln = <fs_output>-ebeln.
            IF sy-subrc = 0.
              READ TABLE gt_lfa1 ASSIGNING <fs_lfa1>
                                 WITH TABLE KEY lifnr = <fs_ekko>-lifnr.
              IF sy-subrc = 0.
                <fs_output>-lifnr = <fs_lfa1>-lifnr.
                <fs_output>-name1 = <fs_lfa1>-name1.
              ENDIF.
            ENDIF.
          ENDLOOP.
          CREATE OBJECT o_lcl_alv_routines.
          CALL METHOD o_lcl_alv_routines->display_data
            EXPORTING
              im_output = gt_output[].
        ENDIF.
      ENDMETHOD.                    "read_idocs
    * METHOD process_data
      METHOD process_data.
        FIELD-SYMBOLS: <fs_edidd> LIKE LINE OF lt_edidd.
        IF lv_stat_message CP 'ok' OR
           lv_stat_message CP 'positive'.
          wa_output-exception = lc_green.
        ELSEIF lv_stat_message CP 'error' OR
               lv_stat_message CP 'negative'.
          wa_output-exception = lc_red.
        ELSE.
          wa_output-exception = lc_yellow.
        ENDIF.
        READ TABLE lt_edidd ASSIGNING <fs_edidd>
                            WITH KEY docnum = im_docnum
                                     segnam = lc_segnam.
        IF sy-subrc = 0.
          wa_output-ebeln = <fs_edidd>-sdata+0(10).
        ENDIF.
        wa_output-credat = ls_idoc_control-credat.
        wa_output-cretim = ls_idoc_control-cretim.
        APPEND wa_output TO gt_output.
        CLEAR wa_output.
      ENDMETHOD.                    "process_data
    ENDCLASS.                    "lcl_get_data IMPLEMENTATION
    *       CLASS lcl_alv_routines IMPLEMENTATION
    CLASS lcl_alv_routines IMPLEMENTATION.
    * METHOD display_data
      METHOD display_data.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
            percentage = 0
            text       = text-p03.
        gt_output[] = im_output[].
        TRY.
            cl_salv_table=>factory(
              EXPORTING
                list_display = ''
              IMPORTING
                r_salv_table = lcl_table
              CHANGING
                t_table      = gt_output ).
          CATCH cx_salv_msg.                                "#EC NO_HANDLER
        ENDTRY.
        lcl_functions = lcl_table->get_functions( ).
    *   Set all standard ALV functions
        lcl_functions->set_all( abap_true ).
        lcl_columns = lcl_table->get_columns( ).
        lcl_columns->set_optimize( '' ).
    *   Set display to striped pattern
        lcl_display = lcl_table->get_display_settings( ).
        lcl_display->set_striped_pattern( cl_salv_display_settings=>true ).
    */Sort columns
        TRY.
            lcl_sorts = lcl_table->get_sorts( ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        lcl_sorts->set_group_active( ).
        TRY.
            lcl_sorts->add_sort(
              columnname = 'EBELN'
              subtotal   = '' ).
          CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error."#EC NO_HANDLER
        ENDTRY.
    */Set column names
        TRY.
            lcl_columns->set_exception_column( 'EXCEPTION' ).
          CATCH cx_salv_data_error.                         "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'EXCEPTION' ).
            lcl_column->set_short_text( text-h01 ).
            lcl_column->set_medium_text( text-h01 ).
            lcl_column->set_long_text( text-h01 ).
            lcl_column->set_output_length( '6' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'EBELN' ).
            lcl_column->set_short_text( text-h02 ).
            lcl_column->set_medium_text( text-h02 ).
            lcl_column->set_long_text( text-h02 ).
            lcl_column->set_output_length( '9' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'LIFNR' ).
    *        lcl_column->set_short_text( text-h03 ).
            lcl_column->set_medium_text( text-h03 ).
            lcl_column->set_long_text( text-h03 ).
            lcl_column->set_output_length( '11' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'NAME1' ).
    *        lcl_column->set_short_text( text-h04 ).
    *        lcl_column->set_medium_text( text-h04 ).
            lcl_column->set_long_text( text-h04 ).
            lcl_column->set_output_length( '30' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'CREDAT' ).
    *        lcl_column->set_short_text( text-h05 ).
    *        lcl_column->set_medium_text( text-h05 ).
            lcl_column->set_long_text( text-h05 ).
            lcl_column->set_output_length( '13' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'CRETIM' ).
    *        lcl_column->set_short_text( text-h06 ).
    *        lcl_column->set_medium_text( text-h06 ).
            lcl_column->set_long_text( text-h06 ).
            lcl_column->set_output_length( '13' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
    */Set aggregations
    *    TRY.
    *        lcl_aggregations = lcl_table->get_aggregations( ).
    *      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    *    ENDTRY.
    *    TRY.
    *        lcl_aggregations->add_aggregation( '' ).
    *      CATCH cx_salv_not_found cx_salv_data_error cx_salv_existing."#EC NO_HANDLER
    *    ENDTRY.
    */Hide columns
    *    TRY.
    *        lcl_column ?= lcl_columns->get_column( 'DESCRIPT' ).
    *        lcl_column->set_visible( if_salv_c_bool_sap=>false ).
    *      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    *    ENDTRY.
    */Display top of page
        CALL METHOD me->display_top_of_page.
        lcl_table->set_top_of_list( lcl_content ).
    */Handle ALV events
        lcl_events2 = lcl_table->get_event( ).
        CREATE OBJECT lcl_handle_events.
        SET HANDLER lcl_handle_events->on_link_click FOR lcl_events2.
        lcl_display_settings = lcl_table->get_display_settings( ).
        lcl_table->display( ).
      ENDMETHOD.                    "display_data
    * METHOD display_top_of_page
      METHOD display_top_of_page.
        CREATE OBJECT lcl_grid.
        lv_title = text-t01.
        lcl_grid->create_header_information(
                    row     = 1
                    column  = 1
                    text    = lv_title
                    tooltip = lv_title ).
        lcl_grid->add_row( ).
        lcl_grid_1 = lcl_grid->create_grid(
                       row    = 3
                       column = 1 ).
        CLEAR lv_string.
        CONCATENATE: sy-datum+4(2) '/' sy-datum+6(2) '/' sy-datum+0(4)
               INTO lv_date1.
        CONCATENATE: text-t02 lv_date1
               INTO lv_string
          SEPARATED BY space.
        lcl_label = lcl_grid_1->create_label(
                      row     = 1
                      column  = 1
                      text    = lv_string
                      tooltip = lv_string ).
        CLEAR lv_string.
        CONCATENATE: sy-uzeit+0(2) ':' sy-uzeit+2(2) ':' sy-uzeit+4(2)
               INTO lv_time.
        CONCATENATE: text-t03 lv_time
               INTO lv_string
          SEPARATED BY space.
        lcl_label = lcl_grid_1->create_label(
                      row     = 2
                      column  = 1
                      text    = lv_string
                      tooltip = lv_string ).
        lcl_content = lcl_grid.
      ENDMETHOD.                    "display_top_of_page
    ENDCLASS.                    "lcl_alv_routines IMPLEMENTATION
    *       CLASS lcl_handle_events IMPLEMENTATION
    CLASS lcl_handle_events IMPLEMENTATION.
    * METHOD on_link_click
      METHOD on_link_click.
      ENDMETHOD.                    "on_link_click
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION
    * START-OF-SELECTION                           *
    START-OF-SELECTION.
      DATA: o_lcl_get_data TYPE REF TO lcl_get_data.
      CREATE OBJECT o_lcl_get_data.
      CALL METHOD o_lcl_get_data->get_idocs.

  • Alv- displaying long text in alv output

    hi,
              as per my requirement, i need to be display long text (length >1000 characters) in alv list or alv grid.
    i get the entaire long text and keep it in final internal table and pass it to alv functional module,  but  it unable to display the compleate long text( in alv-grid).
    the alv list displays the complete long text but not in the row, it displays in the second rown and few field labes of long text and its previous field label are displayed in impro[per order.
    is there any possible way to display long text in alv.
    regards,
    revoori

    Hi Ashok,
    try to pass the below while filling your long text.
    wa_fieldcat-seltext_l  = 'Your Long Text'.
    wa_fieldcat-ddictxt = 'L'.
    for more info check below
    Long Text --- 1000 characters
    hope it works
    Thnaks!
    Edited by: Prasanth on Mar 8, 2009 4:03 PM

  • Display Standard Text in ALV

    Dear Experts,
    I have a requirement where the user wants me to display the standard text in SO10 using ALV.
    The text must be displayed exactly like how the user maintaned in SO10.
    What is the best way? The user do not want the solution to have a button in the text field, and pop up screen in alv to display the text.

    The problem not related to the data retrieval.
    Its about how to display the text in ALV. I dont wantto display the text in single line in alv coz it gonna be very long and will no longer in original format.
    Edited by: Castelloz Alfonso on Sep 24, 2009 7:59 AM

  • Displaying a header on alv list

    hi there,
    i want to display a header on alv list.
    i have already used
    call method alvgrid->set_table_for_first_display
    regrads

    Hi,
    use the TOP_OF_PAGE event and add the event to the IT_EVENTS internal table..
    In the subroutine that is assigned to the event..
    FORM top_of_page.
            CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
              EXPORTING
                it_list_commentary = heading.
    ENDFORM.
    Thanks,
    Naren

  • Display only cell in ALV Grid in OO

    Hi Folks,
    Hope someone can help me with this little issue.  I have a series of columns in my ALV grid that are editable, but I need to a) make some of the cells on specific lines uneditable and b) display time based fields on this line as blank (presently they shoe 00:00:00). 
    For problem a) I have set the layout style frame as 'cellstyles' 
        es_layout-stylefname = 'CELLSTYLES'.
    I have also set the edit flag in the field catalog for the individual columns to 'X' eg     
         WHEN 'CUSTTS_DATE_N'.
              ls_fieldcat-edit = 'X'.
    And coded:
           gwa_stylerow-fieldname = 'CUSTTS_DATE_N'.
          gwa_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
          APPEND gwa_stylerow TO gt_stylerow.
          wa_delivery_list-cellstyle[] = gt_stylerow[].
          APPEND wa_delivery_list TO it_delivery_list.
    Yet, the ALV cells are still being displayed as editable.  Can't for the life of me figure out what's missing.  The only other thought I had around this is that the wa_delivery_list-cellstyle table is being set in the data extraction code, before the ALV grid is built, and that the cell formats are being overwritten/on not being called by the field catalog entries.  Any thoughts on how to make these fields/cells display only when the ALV is first displayed would be greatly appreciated.
    As for option b) I'm clueless, as the cell style commands are not being picked up (see problem a.).  Again any thoughts would be appreciated, and points will be rewarded for solutions/suggestions that lead to solutions.
    Cheers,
    Stephen Keam

    Hello Stephen
    I have created a simple report ZUS_SDN_ALV_EDITABLE_1B which shows how to use editability on cell level.
    The crucial parts of the coding for your requirements are shown below, followed by the entire report.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'UPTIM'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
        ls_fcat-no_zero = abap_true.  " suppresses 00:00:00
        INSERT ls_fcat INTO gt_fcat INDEX 7.
      ENDIF.
    *&      Form  SET_CELL_EDITABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_cell_editable .
    * define local data
      DATA: ld_idx      TYPE i,
            ls_outtab   TYPE ty_s_outtab,
            ls_style    TYPE lvc_s_styl.
      LOOP AT gt_outtab INTO ls_outtab.
        ld_idx = syst-tabix.
        REFRESH: ls_outtab-celltab.
        " NOTE: if you change the year of column ERDAT to 2008 then two columns will become non-editable
        IF ( ls_outtab-erdat+0(4) = '2008' ).
          CLEAR: ls_style.
          ls_style-fieldname = 'UPDAT'.
          ls_style-style     = cl_gui_alv_grid=>mc_style_disabled.
          INSERT ls_style INTO TABLE ls_outtab-celltab.
          CLEAR: ls_style.
          ls_style-fieldname = 'UPTIM'.
          ls_style-style     = cl_gui_alv_grid=>mc_style_disabled.
          INSERT ls_style INTO TABLE ls_outtab-celltab.
        ELSE.
        ENDIF.
        MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
          TRANSPORTING celltab.
      ENDLOOP.
    ENDFORM.                    " SET_CELL_EDITABLE
    *& Report  ZUS_SDN_ALV_EDITABLE
    *& Thread: Display only cell in ALV Grid in OO
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="765083"></a>
    * Flow logic of screen '100' (no elements, ok-code => gd_okcode ):
    **PROCESS BEFORE OUTPUT.
    **  MODULE STATUS_0100.
    **PROCESS AFTER INPUT.
    **  MODULE USER_COMMAND_0100.
    *& GUI-Status: ok-codes BACK, EXIT, CANC
    REPORT  zus_sdn_alv_editable_1b.
    TYPE-POOLS: abap.
    CONSTANTS:
      gc_tabname       TYPE tabname  VALUE 'KNB1'.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE knb1 AS knb1.
    TYPES: celltab    TYPE lvc_t_styl.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syst-repid,
      gt_fcat          TYPE lvc_t_fcat,
      gs_layout        TYPE lvc_s_layo,
      gs_variant       TYPE disvariant,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid          TYPE REF TO cl_gui_alv_grid.
    DATA:
      gs_outtab        TYPE ty_s_outtab,
      gt_outtab        TYPE ty_t_outtab,
      gt_outtab_pbo    TYPE ty_t_outtab.
    DATA:
      gd_answer        TYPE c.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler  DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_data_changed
             FOR EVENT data_changed OF cl_gui_alv_grid
                 IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_data_changed.
        " Just trigger PAI followed by PBO
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'REFRESH'
    *        IMPORTING
    *          rc       =
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT * FROM  (gc_tabname) INTO CORRESPONDING FIELDS
                                  OF TABLE gt_outtab UP TO 99 ROWS.
      gt_outtab_pbo = gt_outtab.  " set PBO data
      PERFORM init_controls.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Form  INIT_CONTROLS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent = cl_gui_container=>screen0
          ratio  = 90
        EXCEPTIONS
          OTHERS = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create ALV grid
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = go_docking
        EXCEPTIONS
          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.
      " NOTE: not required
    *  set handler:
    *    lcl_eventhandler=>handle_data_changed for go_grid.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog.
      PERFORM set_layout_and_variant.
      PERFORM set_cell_editable.
    *§3.Optionally register ENTER to raise event DATA_CHANGED.
    *   (Per default the user may check data by using the check icon).
      CALL METHOD go_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.
      SET HANDLER: lcl_eventhandler=>handle_data_changed FOR go_grid.
    * Display data
      CALL METHOD go_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
          is_variant      = gs_variant
          i_save          = 'A'
        CHANGING
          it_outtab       = gt_outtab
          it_fieldcatalog = gt_fcat
        EXCEPTIONS
          OTHERS          = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * NOTE:
    * Documenation of I_SAVE ("An Easy Reference for ALV Grid Control")
    *I_SAVE
    *Determines the options available to the user for saving a layout:
    *? 'X': global saving only
    *? 'U': user-specific saving only
    *? 'A': corresponds to 'X' and 'U'
    *? SPACE: no saving
    * Link the docking container to the target dynpro
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      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.                    " INIT_CONTROLS
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      " NOTE: retrieve changed data from frontend (grid control) into
      "       the backend (itab in ABAP)
      go_grid->check_changed_data( ).
      CASE gd_okcode.
        WHEN 'BACK'  OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'REFRESH'.
          PERFORM set_cell_editable.
          " NOTE: Refresh required
          CALL METHOD go_grid->refresh_table_display
    *        EXPORTING
    *          is_stable      =
    *          i_soft_refresh =
    *        EXCEPTIONS
    *          finished       = 1
    *          others         = 2
          IF sy-subrc <> 0.
    *       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        WHEN 'SAVE'.
          IF ( gt_outtab = gt_outtab_pbo ).
            MESSAGE 'No data changed' TYPE 'S'.
          ELSE.
            CLEAR: gd_answer.
            CALL FUNCTION 'POPUP_TO_CONFIRM'
              EXPORTING
    *             TITLEBAR                    = ' '
    *             DIAGNOSE_OBJECT             = ' '
                text_question               = 'Save data?'
    *             TEXT_BUTTON_1               = 'Ja'(001)
    *             ICON_BUTTON_1               = ' '
    *             TEXT_BUTTON_2               = 'Nein'(002)
    *             ICON_BUTTON_2               = ' '
    *             DEFAULT_BUTTON              = '1'
    *             DISPLAY_CANCEL_BUTTON       = 'X'
    *             USERDEFINED_F1_HELP         = ' '
    *             START_COLUMN                = 25
    *             START_ROW                   = 6
    *             POPUP_TYPE                  =
    *             IV_QUICKINFO_BUTTON_1       = ' '
    *             IV_QUICKINFO_BUTTON_2       = ' '
              IMPORTING
                answer                      = gd_answer
    *           TABLES
    *             PARAMETER                   =
              EXCEPTIONS
                text_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.
            IF ( gd_answer = '1' ).  " yes
              MESSAGE 'Data successfully saved' TYPE 'S'.
              gt_outtab_pbo = gt_outtab.  " update PBO data !!!
            ELSE.
              MESSAGE 'Action cancelled by user'  TYPE 'S'.
            ENDIF.
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = gc_tabname
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ls_fcat-edit = abap_true.
      MODIFY gt_fcat FROM ls_fcat
          TRANSPORTING edit
        WHERE ( key NE abap_true ).
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'UPTIM'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
        ls_fcat-no_zero = abap_true.  " suppresses 00:00:00
        INSERT ls_fcat INTO gt_fcat INDEX 7.
      ENDIF.
      READ TABLE gt_fcat INTO ls_fcat
       WITH KEY fieldname = 'UPDAT'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
        INSERT ls_fcat INTO gt_fcat INDEX 7.
      ENDIF.
      LOOP AT gt_fcat INTO ls_fcat.
        ls_fcat-col_pos = syst-tabix.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
        IF ( syst-tabix > 10 ).
          DELETE gt_fcat INDEX syst-tabix.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SET_LAYOUT_AND_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_layout_and_variant .
      CLEAR: gs_layout,
             gs_variant.
      gs_layout-cwidth_opt = abap_true.
      gs_layout-zebra      = abap_true.
    *§3.Provide the fieldname of the celltab field by using field
    *   STYLEFNAME of the layout structure.
      gs_layout-stylefname = 'CELLTAB'.
      gs_variant-report = syst-repid.
      gs_variant-handle = 'GRID'.
    ENDFORM.                    " SET_LAYOUT_AND_VARIANT
    *&      Form  SET_CELL_EDITABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_cell_editable .
    * define local data
      DATA: ld_idx      TYPE i,
            ls_outtab   TYPE ty_s_outtab,
            ls_style    TYPE lvc_s_styl.
      LOOP AT gt_outtab INTO ls_outtab.
        ld_idx = syst-tabix.
        REFRESH: ls_outtab-celltab.
        IF ( ls_outtab-erdat+0(4) = '2008' ).
          CLEAR: ls_style.
          ls_style-fieldname = 'UPDAT'.
          ls_style-style     = cl_gui_alv_grid=>mc_style_disabled.
          INSERT ls_style INTO TABLE ls_outtab-celltab.
          CLEAR: ls_style.
          ls_style-fieldname = 'UPTIM'.
          ls_style-style     = cl_gui_alv_grid=>mc_style_disabled.
          INSERT ls_style INTO TABLE ls_outtab-celltab.
        ELSE.
        ENDIF.
        MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
          TRANSPORTING celltab.
      ENDLOOP.
    ENDFORM.                    " SET_CELL_EDITABLE
    Regards
      Uwe

  • How to display unicode string in alv

    Hi,guys, I came accross one problem on displaying unicode string in alv rows.
    some string like this: \u591c\u9e23\u732a  ,  They are displayed directly in alv. Actually, they are some chinese characters.
    Any one could help me? Should I invoke any function module to convert it ?
    Thanks.

    Hi,
    Kindly refer the link below:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1046905c-3acf-2b10-aea6-a70ade12c76f
    Hope this helps you.
    Regards,
    Tarun
    Edited by: Tarun Gambhir on Mar 22, 2009 9:49 AM

  • Display Deep structures in ALV

    Hi,
    We  have a requirement to display deep structures in ALV i.e. We have to show Sales Order texts in ALV and as you know it may extend to several lines and the user wants to see it at a glance for every item.I created a new internal table in the output table but field catalog is ignoring the same and not displaying in ALV.
    I am using CL_SALV_TABLE factory method but of no help.Please suggest to display the deep structure in ALV.
    Thanks in advance.
    Regards,
    Kranti Yamparala.

    Hi Kranthi,
    we handle such tasks by displaying an icon showing the user that there is something more, in your case the long text. Define this column as hotspot and in the respective event create a popup screen or dialog box with a text edit control or another SALV control showing the long text or other details.
    Users prefer a clear list not interrupted by any additional records but they will appreciate the functionality providing detalied information on request.
    And, by the way, what do you expect should a deep-structure-ALV look like, what would you do in Excel?
    Regards,
    Clemens

  • Display header along with  ALV

    Hi,
    i need to display a report using ALV in the following manner. im using reuse_alv_listdisplay and the display is fine . however, i need to add a header to the list and i need to display total for the currency fields. how can i do that. your help would be appreciated.
    Thanks,
    kranthi.
    ________some company header----
    alv report----
    display total for currency fields------
    i appreciate all of you for your quick response.
    i need to call a function module which uses couple of 'write' statements to create the header. is it possible to use that in this context.
    Thanks,
    Kranthi.
    Message was edited by: kranthi kumar

    *& Report  ZVENU_ALV                                                   *
    Program: ZZ_ALV_REPORT_STUB
    Author :
    Date   :
    Purpose: Report using ALV function
    Notes:
    1) Logos & wallpapers can be found in table BDS_CONN05
       with class = PICTURES
    2) Transaction OAER can be used to create PICTURES.
       Run transaction OAER with class name = PICTURES, Class type = OT,
       and Object key with whatever name you want to create.  In the
       next screen, right clicking on screen and import
                                 Revisions
    Name    :
    Date    :
    Comments:
    report zz_alv_report_stub
           no standard page heading
           line-size 200
           line-count 65
           message-id zz.
    Tables
    tables:
      ekpo,
      trdir.
    Global Types
    type-pools: slis.
    Global Internal Tables
    data:
      i_fieldcat_alv  type slis_t_fieldcat_alv,
      i_events        type slis_t_event,
      i_event_exit    type slis_t_event_exit,
      i_list_comments type slis_t_listheader,
      i_excluding     type slis_t_extab.
    Display data
    data: begin of i_data occurs 0,
            name    like trdir-name,
            clas    like trdir-clas,
            subc    like trdir-subc,
            cnam    like trdir-cnam,
            cdat    like trdir-cdat,
            myfield(1) type c,
          end of i_data.
    Global Variables
    data:
      w_variant          like disvariant,
      wx_variant         like disvariant,
      w_variant_save(1)  type c,
      w_exit(1)          type c,
      w_repid            like sy-repid,
      w_user_specific(1) type c,
      w_callback_ucomm   type slis_formname,
      w_print            type slis_print_alv,
      w_layout           type slis_layout_alv,
      w_html_top_of_page type  slis_formname,
      w_fieldcat_alv     like line of i_fieldcat_alv,
      w_excluding        like line of i_excluding,
      w_events           like line of i_events,
      w_event_exit       like line of i_event_exit,
      w_list_comments    like line of i_list_comments.
    Global Constants
    *constants:
    Selection Screen
    selection-screen begin of block blk_criteria with frame title text-f01.
    select-options:
      s_name for trdir-name.
    selection-screen end of block blk_criteria.
    selection-screen begin of block blk_params with frame title text-f02.
    parameters:
      p_vari like disvariant-variant.
    selection-screen skip 1.
    parameters:
      p_grid radiobutton group rb01 default 'X',
      p_html as checkbox.
    selection-screen skip 1.
    parameters:
      p_list radiobutton group rb01.
    selection-screen end of block blk_params.
    Initialization
    initialization.
      perform init_variant.
      perform variant_default using p_vari.
      clear: s_name[].
      s_name-sign   = 'I'.
      s_name-option = 'CP'.
      s_name-low    = 'Z*'.
      append s_name.
    At Selection Screen PBO
    at selection-screen output.
    At Selection Screen Value Request
    at selection-screen on value-request for p_vari.
      perform variant_f4 using p_vari.
    At Selection Screen
    at selection-screen.
      perform variant_fill.
    Start of Selection
    start-of-selection.
      perform get_data.
    end-of-selection.
      perform fieldcat_build.
      perform event_build.
      perform event_exit_build.
      perform exclude_build.
      perform print_build.
      perform layout_build.
      perform display_data.
    Top of Page
    top-of-page.
    Top of Page During Line Sel
    top-of-page during line-selection.
    At User Command
    at user-command.
    At Line Selection
    at line-selection.
    Macros
      define skip_1.
        write: /001 sy-vline,
                    at sy-linsz sy-vline.
      end-of-definition.
                                    Forms
    *&      Form  variant_f4
    form variant_f4 using p_variant.
      call function 'LVC_VARIANT_F4'
           exporting
                is_variant    = w_variant
                i_save        = w_variant_save
           importing
                e_exit        = w_exit
                es_variant    = wx_variant
           exceptions
                not_found     = 1
                program_error = 2
                others        = 3.
      if sy-subrc <> 0.
        message i000(zz) with text-g01.
      endif.
      if w_exit is initial.
        w_variant-variant = wx_variant-variant.
        p_variant         = wx_variant-variant.
      endif.
    endform.
    *&      Form  init_variant
    form init_variant.
      clear: w_variant.
      w_repid              = sy-repid.
      w_variant-report     = w_repid.
      w_variant-username   = sy-uname.
      w_variant_save       = 'A'. "All types
    endform.
    *&      Form  variant_default
    form variant_default using p_variant.
      wx_variant = w_variant.
      if not p_variant is initial.
        wx_variant-variant = p_variant.
      endif.
      call function 'LVC_VARIANT_DEFAULT_GET'
           exporting
                i_save        = w_variant_save
           changing
                cs_variant    = wx_variant
           exceptions
                wrong_input   = 1
                not_found     = 2
                program_error = 3
                others        = 4.
      case sy-subrc.
        when 0.
          p_variant = wx_variant-variant.
        when 2.
          clear: p_variant.
      endcase.
    endform.
    *&      Form  variant_fill
    form variant_fill.
      clear: w_variant.
      if p_vari is initial.
        w_variant-variant = 'STANDARD'.
        w_variant-report  = w_repid.
      else.
        w_variant-variant = p_vari.
        w_variant-report  = w_repid.
        call function 'LVC_VARIANT_EXISTENCE_CHECK'
             exporting
                  i_save     = w_variant_save
             changing
                  cs_variant = w_variant
             exceptions
                  others     = 01.
        if sy-subrc ne 0.
          message i000(zz) with text-g02.
        endif.
      endif.
    endform.
    *&      Form  fieldcat_build
    form fieldcat_build.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name     = w_repid
              i_structure_name   = 'TRDIR'
                i_internal_tabname = 'I_DATA'
                i_inclname         = w_repid
           changing
                ct_fieldcat        = i_fieldcat_alv.
    Modify displayed fields
      loop at i_fieldcat_alv into w_fieldcat_alv.
        case w_fieldcat_alv-fieldname.
          when 'NAME'.
            w_fieldcat_alv-hotspot   = 'X'.
          when 'MYFIELD'.
            w_fieldcat_alv-checkbox  = 'X'.
            w_fieldcat_alv-seltext_s = 'MyChkBox'.
          when others.
        endcase.
        modify i_fieldcat_alv from w_fieldcat_alv.
      endloop.
    endform.
    *&      Form  display_data
    form display_data.
      w_callback_ucomm   = 'CALLBACK_UCOMM'.
      case 'X'.
        when p_grid.
          if p_html = 'X'.
            w_html_top_of_page = 'HTML_TOP_OF_PAGE'.
          endif.
          call function 'REUSE_ALV_GRID_DISPLAY'
               exporting
                  i_background_id             = 'SIWB_WALLPAPER'
                    i_background_id             = 'SIWB_WALLPAPER'
                    i_callback_program          = w_repid
                    i_callback_html_top_of_page = w_html_top_of_page
                  i_structure_name            = 'TRDIR'
                    i_default                   = 'X'
                    i_save                      = 'A'
                    is_variant                  = w_variant
                    is_layout                   = w_layout
                    i_callback_user_command     = w_callback_ucomm
                    it_fieldcat                 = i_fieldcat_alv
                    it_events                   = i_events
                    it_event_exit               = i_event_exit
                    it_excluding                = i_excluding
                    is_print                    = w_print
                  i_screen_start_column       = 1
                  i_screen_start_line         = 1
                  i_screen_end_column         = 70
                  i_screen_end_line           = 30
               tables
                    t_outtab                    = i_data.
        when p_list.
          call function 'REUSE_ALV_LIST_DISPLAY'
               exporting
                   i_background_id         = 'ALV_BACKGROUND'
                    i_callback_program      = w_repid
                    i_default               = 'X'
                    i_save                  = 'A'
                    is_variant              = w_variant
                    is_layout               = w_layout
                    i_callback_user_command = w_callback_ucomm
                    it_fieldcat             = i_fieldcat_alv
                    it_events               = i_events
                    it_event_exit           = i_event_exit
                    is_print                = w_print
               tables
                    t_outtab                = i_data.
      endcase.
    endform.
          FORM user_command                                             *
    form callback_ucomm  using r_ucomm like sy-ucomm
                               rs_selfield type slis_selfield.
      message i000(zz) with r_ucomm.
      case r_ucomm.
        when '&IC1'.
          set parameter id 'RID' field rs_selfield-value.
          call transaction 'SE38'.
        when others.
      endcase.
    endform.
    *&      Form  get_data
    form get_data.
      select * up to 15 rows from trdir
             into corresponding fields of table i_data
             where name in s_name.
    endform.
          FORM ALV_TOP_OF_PAGE                                          *
    form alv_top_of_page.
      clear: i_list_comments[].
      w_list_comments-typ  = 'H'. "H=Header, S=Selection, A=Action
      w_list_comments-key  = ''.
      w_list_comments-info = 'Info 1'.
      append w_list_comments to i_list_comments.
      w_list_comments-typ  = 'A'. " H = Header, S = Selection, A = Action
      w_list_comments-key  = ''.
      w_list_comments-info = 'Begin of list'.
      append w_list_comments to i_list_comments.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                i_logo             = 'ENJOYSAP_LOGO'
                it_list_commentary = i_list_comments.
    endform.
    *&      Form  event_build
    form event_build.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = i_events.
      read table i_events
           with key name = slis_ev_top_of_page
           into w_events.
      if sy-subrc = 0.
        move 'ALV_TOP_OF_PAGE' to w_events-form.
        modify i_events from w_events index sy-tabix.
      endif.
      read table i_events
           with key name = slis_ev_end_of_list
           into w_events.
      if sy-subrc = 0.
        move 'ALV_END_OF_LIST' to w_events-form.
        modify i_events from w_events index sy-tabix.
      endif.
      read table i_events
           with key name = slis_ev_end_of_page
           into w_events.
      if sy-subrc = 0.
        move 'ALV_END_OF_PAGE' to w_events-form.
        modify i_events from w_events index sy-tabix.
      endif.
    endform.
          FORM alv_end_of_list                                          *
    form alv_end_of_list.
      clear: i_list_comments[].
      w_list_comments-typ = 'A'. "H = Header, S = Selection, A = Action
      w_list_comments-key = ''.
      w_list_comments-info = 'End of list'.
      append w_list_comments to i_list_comments.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = i_list_comments
                i_logo             = 'ZMYOBJECTKEY'
                i_end_of_list_grid = 'X'.
    endform.
          FORM alv_end_of_page                                          *
    form alv_end_of_page.
    endform.
    *&      Form  print_build
    form print_build.
      w_print-no_print_listinfos = 'X'.
    endform.
    *&      Form  layout_build
    form layout_build.
      w_layout-zebra                = 'X'.
      w_layout-no_vline             = 'X'.
      w_layout-colwidth_optimize    = 'X'.
      w_layout-detail_popup         = 'X'.
      w_layout-detail_initial_lines = 'X'.
      w_layout-detail_titlebar      = 'Detail Title Bar'.
    endform.
    *&      Form  event_exit_build
    form event_exit_build.
      clear: i_event_exit[].
    Pick
      w_event_exit-ucomm  = '&ETA'.
      w_event_exit-before = ' '.
      w_event_exit-after  = 'X'.
      append w_event_exit to i_event_exit.
    endform.
          FORM HTML_TOP_OF_PAGE                                         *
    form html_top_of_page using r_top type ref to cl_dd_document.
      data:
        text     type sdydo_text_element,
        s_table  type ref to cl_dd_table_element,
        col_key  type ref to cl_dd_area,
        col_info type ref to cl_dd_area,
        a_logo   type ref to cl_dd_area.
    Split TOP-Document
      call method r_top->vertical_split
                exporting split_area  = r_top
                          split_width = '30%'
                importing right_area  = a_logo.
    Fill TOP-Document
      call method r_top->add_text
                exporting text  = 'Example of a Heading'
                sap_style       = 'HEADING'.
      call method r_top->new_line.
      call method r_top->new_line.
      call method r_top->add_table
                exporting no_of_columns = 2
                          with_heading  = ' '
                          border        = '1'
                importing table         = s_table.
      call method s_table->add_column importing column = col_key.
      call method s_table->add_column importing column = col_info.
      text = 'A key value marked'.
      call method col_key->add_text
                exporting text         = text
                          sap_emphasis = 'Strong'.
      call method col_info->add_gap exporting width = 6.
      text = '600' .
      call method col_info->add_text
                exporting text      = text
                          sap_style = 'Key'.
      call method col_info->add_gap  exporting width = 3.
      text = 'Block brick units'.
      call method col_info->add_text exporting text  = text.
      call method s_table->new_row.
      text = 'Storage Bin'.
      call method col_key->add_text
                exporting text         = text
                          sap_emphasis = 'Strong'.
      call method col_info->add_gap exporting width = 7.
      text = 'C-A-004'.
      call method col_info->add_text exporting text = text.
      call method s_table->new_row.
      text = 'Warehouse number' .
      call method col_key->add_text
                exporting text         = text
                          sap_emphasis = 'Strong'.
      call method col_info->add_gap  exporting width = 6.
      text = '200' .
      call method col_info->add_text
                exporting text      = text
                          sap_style = 'Success'.
      call method col_info->add_gap  exporting width = 3.
      text = 'marked success'.
      call method col_info->add_text exporting text = text.
      call method s_table->new_row.
      call method r_top->new_line.
      text = 'This last line is a comment in italics.'.
      call method r_top->add_text
                exporting text         = text
                          sap_emphasis = 'EMPHASIS'.
      call method r_top->new_line.
      call method a_logo->add_picture
              exporting picture_id = 'ZZTESTBMP'.
                exporting picture_id = 'ENJOYSAP_LOGO'.
    endform.
    *&      Form  exclude_build
    form exclude_build.
      w_excluding = '&GRAPH'. "Graphic
      append w_excluding to i_excluding.
    endform.                    " exclude_build

  • How to display two lables in alv report

    Is there any chance to display two lables in alv report
    for example..
    AMOUNT
    Rs | Ps
       |
    like that this for an example.
    thanks,
    JB

    Hai Babu
    Go through the following Code
    using Classes & Methods
    try with the following Code( Just copy the code & try with in SE38 Tcode & Execute it that all)
    REPORT ZALV_SALES_HEADER_DETAIL MESSAGE-ID Z50650(MSG) .
    TABLES
    TABLES: VBAK . "SALES DOCUMENT HEADER
    DATA OBJECTS DECLARATION
    DATA: IT_VBAK TYPE STANDARD TABLE OF ZVBAK_STRUC,
    IT_VBAP TYPE STANDARD TABLE OF ZVBAP_STRUC,
    GS_LAYOUT TYPE LVC_S_LAYO,
    GS1_LAYOUT TYPE LVC_S_LAYO,
    GRID TYPE REF TO CL_GUI_ALV_GRID,
    CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
    VBAK_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
    VBAP_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
    WA_VBAK LIKE LINE OF IT_VBAK,
    WA_VBAP LIKE LINE OF IT_VBAP,
    SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
    TOP_OF_PAGE_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
    GRID_VBAP TYPE REF TO CL_GUI_ALV_GRID,
    TOP_PAGE TYPE REF TO CL_DD_DOCUMENT,
    FLAG(1).
    *"EVENT RECIEVER CLASS DEFINITION
    CLASS LCL_EVENT_RECIEVER DEFINITION DEFERRED.
    DATA: OBJ_EVENT TYPE REF TO LCL_EVENT_RECIEVER.
    SELECTION-SCREEN
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
    PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
    SELECTION-SCREEN: END OF BLOCK B1.
    CLASS DEFINITION AND DECLARATIONS
    CLASS LCL_EVENT_RECIEVER DEFINITION.
    PUBLIC SECTION.
    EVENTS:DOUBLE_CLICK,
    TOP_OF_PAGE.
    METHODS:HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
    IMPORTING E_ROW .
    METHODS: HANDLE_TOP_OF_PAGE FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID.
    ENDCLASS. "LCL_EVENT_RECIEVER DEFINITION
    CLASS LCL_EVENT_RECIEVER IMPLEMENTATION
    CLASS LCL_EVENT_RECIEVER IMPLEMENTATION.
    METHOD: HANDLE_DOUBLE_CLICK.
    READ TABLE IT_VBAK INDEX E_ROW-INDEX INTO WA_VBAK.
    PERFORM FETCH_ITEM_DETAILS USING WA_VBAK.
    PERFORM ALV_GRID.
    ENDMETHOD. "HANDLE_DOUBLE_CLICK
    METHOD: HANDLE_TOP_OF_PAGE.
    CALL METHOD TOP_PAGE->ADD_TEXT
    EXPORTING
    TEXT = 'SALES HEADER & ITEM DETAILS'.
    CALL METHOD TOP_PAGE->DISPLAY_DOCUMENT
    EXPORTING
    PARENT = TOP_OF_PAGE_CONTAINER.
    ENDMETHOD. "HANDLER_TOP_OF_PAGE
    ENDCLASS. "LCL_EVENT_RECIEVER IMPLEMENTATION
    AT SELECTION-SCREEN
    AT SELECTION-SCREEN.
    IF S_VBELN IS NOT INITIAL.
    SELECT COUNT(*)
    FROM VBAK
    WHERE VBELN IN S_VBELN.
    IF SY-DBCNT = 0.
    MESSAGE E000 WITH 'NO TABLE ENTRIES FOUND FOR LOW KEY SPECIFIED'.
    ENDIF.
    ENDIF.
    START-OF-SELECTION.
    START-OF-SELECTION.
    PERFORM FETCH_SALES_HEADER_RECORD.
    PERFORM CREATE_CALL. "CREATION OF OBJECTS & CALLING METHODS
    END-OF-SELECTION.
    END-OF-SELECTION.
    *& Module STATUS_0100 OUTPUT
    text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'ZSTATUS'.
    SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Form FETCH_SALES_HEADER_RECORD
    text
    --> p1 text
    <-- p2 text
    FORM FETCH_SALES_HEADER_RECORD .
    SELECT
    VBELN
    AUDAT
    VBTYP
    AUART
    AUGRU
    NETWR
    WAERK
    FROM VBAK
    INTO CORRESPONDING FIELDS OF TABLE IT_VBAK
    WHERE VBELN IN S_VBELN
    AND VBTYP = P_VBTYP.
    ENDFORM. " FETCH_SALES_HEADER_RECORD
    *& Form CREATE_CALL
    text
    --> p1 text
    <-- p2 text
    FORM CREATE_CALL .
    IF CUSTOM_CONTAINER IS INITIAL.
    CREATE OBJECT CUSTOM_CONTAINER
    EXPORTING
    PARENT =
    CONTAINER_NAME = 'CUSTOM_CONTAINER'
    STYLE =
    LIFETIME = lifetime_default
    REPID =
    DYNNR =
    NO_AUTODEF_PROGID_DYNNR =
    EXCEPTIONS
    CNTL_ERROR = 1
    CNTL_SYSTEM_ERROR = 2
    CREATE_ERROR = 3
    LIFETIME_ERROR = 4
    LIFETIME_DYNPRO_DYNPRO_LINK = 5
    OTHERS = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CREATE OBJECT SPLITTER
    EXPORTING
    TOP = 5
    PARENT = CUSTOM_CONTAINER
    ROWS = 3
    COLUMNS = 1
    EXCEPTIONS
    CNTL_ERROR = 1
    CNTL_SYSTEM_ERROR = 2
    OTHERS = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD SPLITTER->GET_CONTAINER
    EXPORTING
    ROW = 1
    COLUMN = 1
    RECEIVING
    CONTAINER = TOP_OF_PAGE_CONTAINER.
    CALL METHOD SPLITTER->GET_CONTAINER
    EXPORTING
    ROW = 2
    COLUMN = 1
    RECEIVING
    CONTAINER = VBAK_CONTAINER.
    CALL METHOD SPLITTER->GET_CONTAINER
    EXPORTING
    ROW = 3
    COLUMN = 1
    RECEIVING
    CONTAINER = VBAP_CONTAINER.
    CREATE OBJECT GRID
    EXPORTING
    I_SHELLSTYLE = 0
    I_LIFETIME =
    I_PARENT = VBAK_CONTAINER
    I_APPL_EVENTS = space
    I_PARENTDBG =
    I_APPLOGPARENT =
    I_GRAPHICSPARENT =
    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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    GS_LAYOUT-GRID_TITLE = 'SALES HEADER DETAILS.'(100).
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME = 'ZVBAK_STRUC'
    IS_VARIANT =
    I_SAVE =
    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 = IT_VBAK
    IT_FIELDCATALOG =
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 3
    OTHERS = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    CREATE OBJECT OBJ_EVENT .
    SET HANDLER OBJ_EVENT->HANDLE_DOUBLE_CLICK FOR GRID.
    SET HANDLER OBJ_EVENT->HANDLE_TOP_OF_PAGE FOR GRID.
    CREATE OBJECT TOP_PAGE
    EXPORTING
    STYLE = 'ALV_GRID'
    CALL METHOD TOP_PAGE->INITIALIZE_DOCUMENT.
    CALL METHOD GRID->LIST_PROCESSING_EVENTS
    EXPORTING
    I_EVENT_NAME = 'TOP_OF_PAGE'
    I_DYNDOC_ID = TOP_PAGE.
    CALL SCREEN 100.
    ENDFORM. " CREATE_CALL
    *& Module USER_COMMAND_0100 INPUT
    text
    MODULE USER_COMMAND_0100 INPUT.
    CASE SY-UCOMM.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Form FETCH_ITEM_DETAILS
    text
    --> p1 text
    <-- p2 text
    FORM FETCH_ITEM_DETAILS USING WA_VBAK TYPE ZVBAK_STRUC .
    SELECT
    VBELN
    POSNR
    MATNR
    MATWA
    PMATN
    CHARG
    FROM VBAP
    INTO TABLE IT_VBAP
    WHERE VBELN = WA_VBAK-VBELN.
    IF SY-SUBRC <> 0.
    MESSAGE E000 WITH 'NO RECORDS FOUND FOR SPECIFIED KEY'.
    ENDIF.
    ENDFORM. " FETCH_ITEM_DETAILS
    *& Module STATUS_0200 OUTPUT
    text
    MODULE STATUS_0200 OUTPUT.
    SET PF-STATUS 'ZSTATUS'.
    SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_0200 OUTPUT
    *& Module USER_COMMAND_0200 INPUT
    text
    MODULE USER_COMMAND_0200 INPUT.
    CASE SY-UCOMM.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    *& Form alv_grid
    text
    --> p1 text
    <-- p2 text
    FORM ALV_GRID .
    IF FLAG = ''.
    FLAG = 'X'.
    CREATE OBJECT GRID_VBAP
    EXPORTING
    I_SHELLSTYLE = 0
    I_LIFETIME =
    I_PARENT = VBAP_CONTAINER
    I_APPL_EVENTS = space
    I_PARENTDBG =
    I_APPLOGPARENT =
    I_GRAPHICSPARENT =
    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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    GS1_LAYOUT-GRID_TITLE = 'SALES ITEM DETAILS.'(100).
    CALL METHOD GRID_VBAP->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME = 'ZVBAP_STRUC'
    IS_VARIANT =
    I_SAVE =
    I_DEFAULT = 'X'
    IS_LAYOUT = GS1_LAYOUT
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    CHANGING
    IT_OUTTAB = IT_VBAP
    IT_FIELDCATALOG =
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 3
    OTHERS = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " alv_grid
    Thansk & regards
    Sreenivasulu P

Maybe you are looking for