Displaying custom graph in ALV report

Hi
Can you tell me how to display a custom graph for a column in a alv report.
That is adding a seperate button in the report and display a graph for a column when the button is clicked.
If 'Graph_2d' function module is used can anybody tell how to pass values to the function module and display the graph using the function module.
Thanks & regards
Saravanakumar

Hi,
  check out the standard program GRDEMO_D for more understanding of teh usage of FM GRAPH_2D
regards,
theja

Similar Messages

  • 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.

  • 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 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

  • Displaying data on an ALV report

    Hi Abaper's
    I have data that is stored in an internal table and I want to display it in an ALV report, How can I achieve this?
    Thanx in advance
    Thandie

    Hi,
    Try to run the following code you will find the Ans.
    TABLES : ekpo.
    TYPE-POOLS : slis.
    TYPES : BEGIN OF t_ekpo,
            ebeln TYPE ekpo-ebeln,
            ebelp TYPE ekpo-ebelp,
            matnr TYPE ekpo-matnr,
            werks TYPE ekpo-werks,
            menge TYPE ekpo-menge,
            END OF t_ekpo.
    *VARIABLES
    DATA : check(1),
           rep_id TYPE sy-repid.
    *INTERNAL TABLE TYPE OF ZEKPO
    DATA : it_ekpo TYPE STANDARD TABLE OF t_ekpo WITH HEADER LINE.
    *FIELD CATALOG
    DATA : it_field TYPE slis_t_fieldcat_alv,
           wa_field TYPE slis_fieldcat_alv.
    *SORTING
    DATA : it_sort TYPE slis_t_sortinfo_alv,
           wa_sort TYPE slis_sortinfo_alv.
    INITIALIZATION.
      check = 'X'.
      rep_id = sy-repid.
    START-OF-SELECTION.
      SELECT ebeln
             ebelp
             matnr
             werks
             menge
             FROM ekpo
             INTO CORRESPONDING FIELDS OF TABLE it_ekpo.
    *          FIELD CATALOG
      wa_field-fieldname = 'EBELN'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 10.
      wa_field-seltext_l = 'PO #'.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
      wa_field-fieldname = 'EBELP'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 10.
      wa_field-seltext_l = 'Line Item'.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
      wa_field-fieldname = 'MATNR'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 15.
      wa_field-seltext_l = 'Material'.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
      wa_field-fieldname = 'WERKS'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 6.
      wa_field-seltext_l = 'Plant'.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
      wa_field-fieldname = 'MENGE'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 10.
      wa_field-seltext_l = 'Qty.'.
    *  wa_field-outputlen = 17.
    *  wa_field-edit = 'X'.
      wa_field-do_sum = check.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
    *          SORT W.R.T. PURCHASE ORDER NUMBER
      wa_sort-spos = 1.
      wa_sort-fieldname = 'EBELN'.
      wa_sort-tabname = 'IT_EKPO'.
      wa_sort-up = check.
      wa_sort-subtot = check.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
    *          DISPLAY RECORDS IN ALV GRID
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = rep_id
          it_fieldcat        = it_field
          it_sort            = it_sort
        TABLES
          t_outtab           = it_ekpo
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
      IF sy-subrc = 0.
      ENDIF.
    Kind Regards,
    Faisal

  • How to include Barcharts/graphs in alv report

    Hi,
    I need to create a graph with the help of ALV Grid control. I could able to activate the graphical option through clicking the 'GRAPH' icon in the ALV display.
    But i am in need of changing the properties of graph(chart type / gridlines / chart options etc.,) display and also it have to be displayed automatically on executing the report. More than I need the graphical output in a single page with maximized window size.
    Like Sub-Total / Sorting options are possible thru REUSE_ALV_GRID_DISPLAY i am in need of activating the Graph(chart) options automatically.
    Thanks in Advance

    Hi Subhakar,
           Step by step procedure.
    1) Create a PF status and call it, create a button for the Displaying Graph/Bar Chart.
    2) In the main program include this code to handle cliking of your graph button.
    3) Include the code like the below pseudo code.
    data: begin of itab_graph occurs 0,
           status_text(10) type c,
           count1 type i,
           count2 type i,
           count3 type i,
          end of itab_graph.
    data: begin of i_graph_opt occurs 1,
               c(80) type c,
            end of i_graph_opt
    form user_command using r_ucomm like sy-ucomm
                      rs_selfield type slis_selfield.
    case r_ucomm.
    when '&DIS'.
          write 'P2TYPE = PI' to i_graph_opt .append i_graph_opt.
          write 'P2SCAL = X' to i_graph_opt .append i_graph_opt.
          write 'P2PCNT = X' to i_graph_opt .append i_graph_opt.
          write 'CLPALT = C' to i_graph_opt .append i_graph_opt.
          write 'P3CTYP = CO' to i_graph_opt .append i_graph_opt.
          write 'P3SCAL = X' to i_graph_opt .append i_graph_opt.
          write 'P3LINS = X' to i_graph_opt .append i_graph_opt.
          write 'TIFULL = X' to i_graph_opt .append i_graph_opt.
          write 'TISIZE = 3' to i_graph_opt .append i_graph_opt.
          write 'CLBACK = X' to i_graph_opt .append i_graph_opt.
    " above few lines are options for setting the graph - customizing the view....
    " Say P2TYPE = PI calls a Pie chart.
          itab_graph-status_text = 'No of Jobs'.
          itab_graph-count1 = count_1.  "( may be ur totals and subtotals )
          itab_graph-count2 = count_2.
          itab_graph-count3 = count_3.
          append itab_graph.
          call function 'GRAPH_MATRIX_3D'
            exporting
              col1 = 'Text1'
              col2 = 'Text2'
              col3 = 'Text3
              titl = 'Title of graph'
            tables
              data = itab_graph
              opts = i_graph_opt.
          clear itab_graph[].
    endform.
    Also refer function module documentatoon for complete understanding and usage.
    Thanks,
    Srinivas.

  • Issue in displaying header details in ALV report

    Hi,
    I have used slis_t_listheader and REUSE_ALV_COMMENTARY_WRITE to display the header details in ALV report.I want the details to be displayed as below.
    Requester : ----------------------                                                                               Page: 1
    Program: -----------------------                                                                                Date:---------
                                                                     Title of Report
    But when I use the structure slis_t_listheader to display the header details,all the fields are coming one below the other.
    How can I get the fields as shown in the above format
    Edited by: Abaper12345 on Jun 25, 2009 7:54 AM

    Hi,
    Go through following code... its showing the data exactly the way you want....
    REPORT  TEST3.
    TYPE-POOLS:slis.
    TABLES:MARA.
    *Type Declaration
    TYPES:BEGIN OF t_mara,
          matnr TYPE mara-matnr,
          ersda TYPE mara-ersda,
          ernam TYPE mara-ernam,
          END OF t_mara.
    *Internal Table
    data:it_mara type standard table of t_mara.
    *Work Area
    data:wa_mara type t_mara.
    DATA:i_repid TYPE sy-repid .
    i_repid = sy-repid.
    *Declaration for field catalog
    DATA : fcat TYPE slis_t_fieldcat_alv,
           wa_fcat TYPE slis_fieldcat_alv.
    *Declaration for Layout
    data : WA_LAYOUT type SLIS_LAYOUT_ALV.
    *Initializing ColumnWidth_Optimize For Layout
      WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    START-OF-SELECTION
    START-OF-SELECTION.
    *Fetching data into internal tables
      PERFORM get_data.
    *Buil Fieldcatalog
      PERFORM build_fcat.
    *Display ALV Report
      PERFORM alv_display.
    *Build Fieldcat
    FORM build_fcat .
      wa_fcat-tabname = 'IT_MARA'.
      wa_fcat-fieldname = 'MATNR'.
      wa_fcat-inttype = 'C'.
      wa_fcat-seltext_m = 'Material Number'.
      wa_fcat-outputlen = 25.
      wa_fcat-col_pos = 1.
      APPEND wa_fcat TO fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'IT_MARA'.
      wa_fcat-fieldname = 'ERSDA'.
      wa_fcat-inttype = 'C'.
      wa_fcat-seltext_m = 'Date'.
      wa_fcat-outputlen = 25.
      wa_fcat-col_pos = 1.
      APPEND wa_fcat TO fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'IT_MARA'.
      wa_fcat-fieldname = 'ERNAM'.
      wa_fcat-inttype = 'C'.
      wa_fcat-seltext_m = 'User'.
      wa_fcat-outputlen = 25.
      wa_fcat-col_pos = 1.
      APPEND wa_fcat TO fcat.
      CLEAR wa_fcat.
      endform.
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    form GET_DATA .
    select matnr ersda ernam from mara into table it_mara.
    endform.                    " GET_DATA
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    form ALV_DISPLAY .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = i_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
       I_CALLBACK_HTML_TOP_OF_PAGE       = 'HTML_TOP_OF_PAGE'
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = fcat
      TABLES
        t_outtab                          = it_mara
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.                    " ALV_DISPLAY
    *&      Form  html_top_of_page " I_CALLBACK_HTML_TOP_OF_PAGE  "
    FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
    CALL METHOD document->add_text
      EXPORTING
        text          = 'Program'
        sap_color     = document->list_group
        sap_fontstyle = document->standard
       sap_emphasis  = document->strong.
    CALL METHOD document->new_line
      EXPORTING
        repeat = 1
    CALL METHOD document->add_text
      EXPORTING
        text          = 'Requester'
        sap_color     = document->list_group
        sap_fontstyle = document->standard
       sap_emphasis  = document->strong.
    CALL METHOD document->new_line
      EXPORTING
        repeat = 1
    CALL METHOD document->add_gap
      EXPORTING
         width      = 125
    CALL METHOD document->add_text
      EXPORTING
        text          = 'This Is Test Data'
        sap_color     = document->list_group
       sap_fontsize  = document->LARGE
       sap_fontstyle = document->standard
       sap_emphasis  = document->strong.
    ENDFORM.                    "HTML_TOP_OF_PAGE
    Thanks & Regards
    Ashu SIngh

  • Is it possible to display Suffix values in ALV Report

    Hi,
    Is it possible to display a suffix value in the output of ALV Report? If so how I can proceed? Please let me know an example.
    Thanks,
    Sekhar.J

    Hi Siddarth,
    I am sorry for the typo. It shold be Sub Script, Not a Suffix.
    Let  us take an example H2O, If we print it in this way it won't be meaning full, So i want to display this like
    H Subscript 2 O. I have a requirement for a column to always to display this kind of values, Is it Possible?
    Thanks,
    Sekhar.J

  • To display the date in ALV report

    Hi All,
    In the header part of the ALV report, how to write a particular date by the day,month & year and simultaneously how to get the orders due for the week with displaying the weekend date..by the day, month & year.
    example :
                                        monday, december 16 2007
    orders for the weekend : sunday, december 22 2007.
    **and the orders will be displayed here..**
    How to get it? is there any function module to display as such, <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 21, 2008 10:42 AM

    Hi,
    Please refer to the below code:
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    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.
    *Use FM DATE_TO_DAY to get the day, month and year by specifying the date.
    *Date
      wa_header-typ  = 'H'.
      wa_header-info = <variable>.
      append wa_header to t_header.
      clear wa_header.
    * Time
      wa_header-typ  = 'H'.
      wa_header-info = <variable>.
      append wa_header to t_header.
      clear wa_header.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    Thanks,
    Sriram Ponna.

  • Display a cell in ALV report as Pushbutton

    Hi,
    I am having an ALV report. I want to display one cell of the ALV report as a Pushbutton. How is it possible ?
    Thanks and regards.

    Hi WTM,
      To display a cell as pushbutton in container display of a simple, two-dimensional table, use the cell type BUTTON.
    cell type -->
    In the content of your ALV output, you are able to display various elements in place of text. Some of these elements can be treated as a click area for the user. You are able to display the following elements:
    ·        Checkbox
    In list-type ALV ouputs, the checkbox is disabled. With the content of the column, you are only to display whether the checkbox is set or not.
    In the tree structure, however, you are able to handle users actions on this element using an event.
    ·        Pushbutton
    You are able to handle user actions on this element with an event.
    ·        Hyperlink
    You specify the Internet addresses (URLs). Users can then call up the corresponding page in the Internet browser by clicking on one of these Internet addresses.
    ·        Click Area
    You are able to handle user actions on this element with an event.
    Hope this helps u,
    Regards,
    Nagarajan.

  • How to display 3 level hierarchy alv report using SALV

    Hi ,
          I need to display a Hierarchy ALV report with 3 level.I thought of trying CL_SALV_HIERSEQ_TABLE but i am able to display only two level report.
          How can i display the 3 - level heirarchy report using SALV. I don't want to use SALV_TREE.
          Regards,
          Aditya Tanguturi.

    Hi Aditya,
    Please check this thread
    Is it possible to display more than 2 levels us... | SCN
    Thanks !
    Amit

  • Re: Display format in the ALV report output

    Hi Expert,
    In the alv report how to display below format in the output.
    Example:       Jan 2011                      feb 2011                        march 2011  .......................
                        no     amount                 no  amount                     no   amount
    As you seen in the above  output i need Below jan 2011 NO and AMOUNT similar for other months.
    Can any one throw some light...............
    Regards,
    Am.
    Edited by: anitha.mava on Nov 5, 2011 12:37 PM
    Moderator message : Spec dumping is not allowed, search for available information.  Thread locked.
    Edited by: Vinod Kumar on Nov 7, 2011 9:31 AM

    Hi,
    Are you able to populate NO ? If yes i don't see why u can't populate No Amount.
    If you are not able to populate No.. just pass the same based on the condition to the (string) field that column is referring to ..
    Or are u not able to align the columns ? If yes, you will have to do some hit and trial with write statement ..or better why not use grid display ..
    Please provide more details ..
    Regards,
    Pranav.

  • Displaying Header Text in ALV report.

    HI Gurus,
    I have one sales order which has header Text.
    I am displaying that Header Text in my ALV report.
    But while displaying in the ALV grid, the text is not coming full.
    I have taken the datatype of the column of the ALV grid is string, Still the Header text is not come full.
    Please help me.
    Thanks in advance.

    Hi,
        If the header text is morethan 60 characters, you can't print with REUSE_ALV_COMMENTARY_WRITE. To overcome above limit we can use dynamic document, which can be implemented through the class CL_DD_DOCUMENT. As dynamic documents use HTML viewer control so instead of triggering the TOP_OF_PAGE event we should trigger event of HTML TOP_OF_PAGE.
    First create a subroutine for top of page in HTML format and send that name in I_CALLBACK_HTML_TOP_OF_PAGE parameter of ALV function module. The input parameter for this subroutine will be a variable of class CL_DD_DOCUMENT.
    *       FORM html_top_of_page                                     *
    FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
      data: l_text(255) type c.
    l_text = '*******************************Hellooooooooooooooooooo************************'.
      CALL METHOD top->add_text EXPORTING text = 'Hello world '
                                          sap_style = 'heading' .
      CALL METHOD top->add_gap EXPORTING width = 200.
      CALL METHOD top->add_picture EXPORTING picture_id = 'ENJOYSAP_LOGO'.
      CALL METHOD top->NEW_LINE( ).
      CALL METHOD top->add_text EXPORTING
      text = l_text.
    ENDFORM.
    * Display ALV grid
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
              i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'     " Use this event
              i_callback_program          = g_repid
              i_structure_name            = 'STRUCTURE'
         TABLES
              t_outtab                    = gt_outtab.
    Regards
    Bala Krishna

  • Adding new rows after displaying subtotals in an ALV report by using OOABAP

    Dear All,
    I am creating an ALV report, displaying subtotals and total by using Classes. I have used classes CL_SALV_AGGREGATIONS (Method : add_aggregation) and CL_SALV_AGGREGATIONS (Method : add_sort) for sorting and doing subtotals.
    Output of my report as follows :- (I have used * for displaying spaces between fields)
    Materia*******Quantity**SerialNo*Equipment**Value***WBS Element
    ISM-DBSVR****1********12363****31872565***2165***Q-0040358945.001010
    ISM-DBSVR****1********12364****31872566***2165***Q-0040358945.001010
    **************************************Subtotal***********4330
    -> If the value of "Quantity" is greater than 1 then the value of subtotal for the field "Value" is to be divided by the Quantity for that line item and needs to be displayed Quantity, SerialNo, Value details information after subtotal .
    -> Basically I need to add few more rows for displaying above additional information in the ALV grid after displaying subtotal .
    Q: Do we have any methods for change the layout for the above requirement.
    I Appreciate your early response.
    Thank you.
    RajaSekhar.

    Hi,
    For such type of requirement you need to use ALV hierchical table.
    You can have your main table in master table.
    For quantity greater than 1 you need to move the data into a seperate internal table....this internal table will have material as the key between the main table and the second table.
    *... §2 create an ALV hierseq table
      try.
          cl_salv_hierseq_table=>factory(
            exporting
              t_binding_level1_level2 = lt_binding
            importing
              r_hierseq               = gr_hierseq
            changing
              t_table_level1           = gt_master
              t_table_level2           = gt_slave ).
        catch cx_salv_data_error cx_salv_not_found.
      endtry.
    you can display both the tables together with the subtotals also.
    please refer to program SALV_DEMO_HIERSEQ_SIMPLE to see how to display the hierarchical display.
    Plr reward points if found helpful.
    Regards,
    Mayank

  • Display tooltip on oops alv report data.

    hi friends,
    I have a requirement to display tooltip information on OOPS ALV Report data.
    I done tooltip for the header but i also want to do for it displaying data.
    Eg.
    10 material no. display in the list while i took cursor on 1st material no. then it will display me 1 st material description as tooltip.
    similarly, for 2, 3 and so on.
    Regards,
    Narendra

    hi,
    i think that´s not possible....
    but you can try to work with Drop Down fields....
    add to output table a table LVC_T_DROP  (like colours of a cell )
    Values  could be your material descriptions...
    maybe its also possible to click on a field ( GET_CURRENT_CELL )
    after react with same ucomm like Drop Down.....
    bestreg
    Robert

Maybe you are looking for

  • Purchase Order text field update in Material Mater

    Hi experts, Is't possible that we can give authorization to update ONLY Purchase Order text field under the Purchase Order text view in MM? But while giving authorization, I could only see "Maintenance statuses of Material" I could only see status co

  • Elements 11 can't see my home server (network drive)

    I just installed Elements 11 on a new computer.  When I try to import photos, the program cannot see my home server, which is where all the photo files are.  It is seeing that I'm on a network because all the other computers on my home network are vi

  • User Authentication Method not found?

    I'm using OSX but a co-worker is running 9.2.2 and is having trouble accessing a server on the corporate Microsoft network. I can get to the server using OSX but when she selects the server (which does show up in the Chooser list) she gets an error m

  • Lost my talk to text

    i recently traveled to mexico and while there i started having some issues with my iphone 4s. first off, i really couldn't make or receive calls, sometimes i could text and sometimes i could pick up the wifi. but while there i was getting "no caller

  • Cannot send messages in gmail after uploading Yosemite

    Like many others, I have not been able to send Gmail messages after uploading Yosemite 3 days ago.  The response is always the same, a server notification, Gmail (offline).  I've tried several different "fixes" on the Gmail side with no luck.  They i