ALV Crytal Report Ehp 2.0

Hi All.
I was recently reading the book by Thomas and Rich - Next Generation ABAP.
In the ALV section, it says that with Ehp2.0, we can have crytal reports in ALV without any license or any additional server infrastructure.
We only need to download the Crystal Report Viewer which I have done.
But I still do not see the Crytal Report icon that is shown in the book example.
Any other setting that I need to do to get that?
I tried SALV_CRL, but could not find anything in that transaction. The default one is already there.
Thanks in adv.

Hi,
I connect via the button Open Report in BW. Then I recieve the SAP GUI Logon scrteen, where I maintain my datas. When I press OK, it hangs for a while, about 2 Minutes and then the follwing error pops up:
CExToolBar::GetRemoteFileCookie() HR = 0x80004005
Thanks
Laszlo

Similar Messages

  • How to enable excel downloading in ALV grid report.

    Hi all,
    How to enable excal downing in ALV grid report?
    Thanks in Advance.
    Siva Sankar.

    hi
    check the following code
    Example of a Simple ALV Grid Report
    REPORT  ZTUFI091                                .
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic requirement for this demo is to display a number of       *
    *& fields from the EKKO table.                                         *
    *REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    Form  TOP-OF-PAGE                                                 *
    ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
               i_logo             = 'Z_LOGO'.
    endform.
          FORM USER_COMMAND                                          *
          --> R_UCOMM                                                *
          --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
      Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
        Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
        Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
          Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
          Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    hope it will help you
    regards
    sreelatha gullapalli

  • Functionality of Checkbox in ALV Grid Report

    Hi Experts,
    I created a ALV grid report with the checkbox as my first coloum and other fields as shown below. Initially, my ALV report displays as below. It is working fine till here.
    checkbox       customer     material      quantity       UOM         Sales Order    Delivery
                           C1                  M1           1                  KG
                           C1                   M2           2                  KG
                            C2                   M1          1                   KG
                            C2                  M2           2                   KG
                           C3                   M1          1                   KG
                           C3                   M2          2                   KG
                           C3                   M3           3                 KG
                            C4                  M1           1                  KG
                           C5                   M5           1                  KG
    I have created a push button on application toolbar for creating sales order and delivery using bapi's. When I click on my pushbutton, as of now it creates the SO and delivery for the first customer C1 and updates my Internal table with the sales order number and delivery number. If I need to create sales order for the second customer I need to run my ALV report again and so on for 3rd, 4th and 5th customers. It is also working fine till here.
    checkbox       customer     material      quantity       UOM     Sales Order     Delivery
                           C1                  M1           1                  KG          SO1               DEL1
                           C1                   M2           2                  KG         SO1               DEL1
                            C2                   M1          1                   KG
                            C2                  M2           2                   KG
                           C3                   M1          1                   KG
                           C3                   M2          2                   KG
                           C3                   M3           3                 KG
                            C4                  M1           1                  KG
                           C5                   M5           1                  KG
    Need help on this:
    When I select the check boxes as shown below and when I click the push button to create SO and Delivery then my program should create sales order and delivery for all the checked ones as shown below. What is the condition do I need to put here for selecting the checkbox.
    checkbox       customer     material      quantity       UOM     Sales Order     Delivery
    X                      C1                  M1           1                  KG         SO1               DEL1
    X                     C1                   M2           2                  KG         SO1               DEL1
                            C2                   M1          1                   KG
                            C2                  M2           2                   KG
    X                     C3                   M1          1                   KG        SO3             DEL3
    X                     C3                   M2          2                   KG        SO3             DEL3
    X                     C3                   M3           3                 KG          SO3            DEL3
                            C4                  M1           1                  KG
    X                     C5                   M5           1                  KG          SO5            DEL5
    I would really appreciate if somebody could help me / guide me on this. I will also post my code if someone needs to understand what I am doing exactly.
    Thanks.

    You need to use OO ABAP
    Use Class the class  1)  CL_GUI_ALV_GRID, 2) CL_GUI_CUSTOM_CONTAINER
    Create Sceen and container on same screen.
    Check following COde it used for printing purpose.
    Using AFTER_USER_COMMAND  Event you will find Check box selected entries.
    Capture those in another internal Table and use it for SO Creation
    DATA:  O_GRID TYPE REF TO CL_GUI_ALV_GRID,
           O_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
           T_FCAT TYPE LVC_T_FCAT,
           CONTAINER(15) TYPE C VALUE 'ET_CONTAINER'.
          CLASS EVENT_CLASS DEFINITION
    CLASS EVENT_CLASS DEFINITION.
      PUBLIC SECTION.
        METHODS: BEFORE_COMMAND FOR EVENT AFTER_USER_COMMAND OF CL_GUI_ALV_GRID IMPORTING E_UCOMM,
                 DOUBLE_CLICK_N  FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN,
                 TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID IMPORTING E_OBJECT.
    ENDCLASS.                    "EVENT_CLASS DEFINITION
          CLASS EVENT_CLASS IMPLEMENTATION
    CLASS EVENT_CLASS IMPLEMENTATION.
      METHOD BEFORE_COMMAND.
        IF E_UCOMM = 'PRINT'.
          CLEAR : W_FLAG.
          T_FINAL2 = T_FINAL.
          SORT T_FINAL2 BY COL_CHK .
          DELETE   T_FINAL2 WHERE COL_CHK = ' '.
          IF NOT T_FINAL2 IS INITIAL.
            LOOP AT T_FINAL2 INTO WA_FINAL.
              IF W_FLAG IS INITIAL.
      Does some of modification/s in control parameters
                W_CONTROL_PARAM-NO_OPEN   = 'X'.
                W_CONTROL_PARAM-NO_CLOSE  = 'X'.
                W_CONTROL_PARAM-PREVIEW   = 'X'.
                W_CONTROL_PARAM-NO_DIALOG = SPACE.
                W_OUTPUT_OPTIONS-TDNEWID = 'X'.
                W_OUTPUT_OPTIONS-TDIMMED = SPACE.
      Opens the smartform print-job
                CALL FUNCTION 'SSF_OPEN'
                  EXPORTING
                    OUTPUT_OPTIONS     = W_OUTPUT_OPTIONS
                    CONTROL_PARAMETERS = W_CONTROL_PARAM
                  EXCEPTIONS
                    FORMATTING_ERROR   = 1
                    INTERNAL_ERROR     = 2
                    SEND_ERROR         = 3
                    USER_CANCELED      = 4
                    OTHERS             = 5.
                IF SY-SUBRC EQ 0.
                  W_FLAG = 'X'.
                ELSE.
                 LEAVE LIST-PROCESSING.
                ENDIF.
              ENDIF.
              IF W_FLAG = 'X'.
                CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
                  EXPORTING
                    FORMNAME           = 'ZFORM_BIW_PRINT'
                  IMPORTING
                    FM_NAME            = LF_FM_NAME
                  EXCEPTIONS
                    NO_FORM            = 1
                    NO_FUNCTION_MODULE = 2
                    OTHERS             = 3.
                IF SY-SUBRC <> 0.
                ENDIF.
                IF SY-SUBRC = 0.
                  CALL FUNCTION LF_FM_NAME
                    EXPORTING
                      CONTROL_PARAMETERS = W_CONTROL_PARAM
                     V_VBELN            = WA_FINAL-VBELN
                      WA_FINAL           = WA_FINAL.
                   TABLES
                     T_FINAL            = T_FINAL.
                ELSE.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                ENDIF.
              ENDIF.
            ENDLOOP.
           * Close the smartform print job
            IF W_FLAG EQ 'X'.
              CALL FUNCTION 'SSF_CLOSE'
                EXCEPTIONS
                  FORMATTING_ERROR = 1
                  INTERNAL_ERROR   = 2
                  SEND_ERROR       = 3
                  OTHERS           = 4.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDMETHOD.                    "BEFORE_COMMAND

  • Short dump when exporting the ALV grid report in to spread sheet

    HI,
    I am facing a problem when downloading ALV grid report in to spread sheet LIST>EXPORT>LOCAL FILE -->SPREADSHEET.
    in shotdump the cursor shows : "assign cline+cbegin(clength) to <field_cont>."
    In SAP internal table LIST,in the first record the value of the filed LENG is 0. when i have changed this value ex:10 etc it is coming properly.
    Kindly help me
    Nagendra

    Is this a standard SAP report, or your own? Can you tell what your report does, if it is a custom ALV report?

  • ALV Grid Report spool problem with column with no data

    Hello All,
    I have created a simple alv grid report the report has a description field of 40 ch for which I have made the display length as 20 ch . This works fine in the foreground but when I run the report in background when there is no data in this column this being overwritten with the next column. Which is causing a mismatch between the header and the data below it.
    Also when I try to download the report in foreground into excel the columns are not matching with the headers this again happens for columns when there is no data.
    Kindly please suggest what is going wrong.
    Thanks,
    ranjan

    Hi,
    For checking the output from background job, check the job and enter JDBG in the command bar and execute.
    Check the field catalog and the table contents in debugging just before display.
    Edited by: Jayanthi Jayaraman on Dec 2, 2010 4:09 AM

  • SAVE Layout Option in ALV list Report

    Hi Experts,
    Is it possible to SAVE the layout option for Block ALV list Reports?
    Thanks in Advance,
    Sivak.

    Hi,
    It is not possible to save layout in BLock ALV display but possible to change layout. There is no parameter to save. It is not possible to store the layout as it has several structure.
    Thanks & Regards
    Rocky

  • How to get the alv grid report in another screen when double click on basic

    Hi.
    I have created an alv report using class cl_gui_alv_grid.I got another report in the same screen,when double clicked on basic list(using double_click event).I want to get this report in another screen.What i have to do?(In classical reports i worked with sy-lsind = 1 ,but how to do here?)
    How to set color to the selected rows in the alv grid report?I worked with change_data_from_inside method of cl_gui_alv_grid.But it didn't work out..
    With Regards,
    Ramana.

    On double click event . you will have to call another screen say 9000.
    now within screen 900 PBO.. you will have to prepare the fieldcatalog/layout.. and the table to be displayed there.
    in PAI of screen 9000, you can return to the original ALV.
    method double_click.
    call screen 9000.
    endmethod.
    " now in PBO create a module display_alv2
    module display_alv2.
    'prepare the fieldcat/layout info for new alv
    'add the data to the new ALV table
    'instantiate the grid call.. etc
    'call the ALV
    endmodule
    "in PAI
    module exit.
    case sy-ucomm.
    when 'ENT1'.
      leave to screen 0.
    endcase.
    endmodule
    while preparing the field catalog you can mention the EMPHASIZE field, whish will give color to tht column
    E.g
    *--Service Order
        ls_fieldcat-tabname   = 'IT_FINAL_VALID'.
        ls_fieldcat-fieldname = 'AUFNR'.
        ls_fieldcat-scrtext_m = 'Service Order'.
        ls_fieldcat-ref_table = 'AUFK'.
        ls_fieldcat-ref_field = 'AUFNR'.
        ls_fieldcat-col_pos   = 1.
        ls_fieldcat-outputlen = 12.
        ls_fieldcat-emphasize = 'C400'.  "This will add color to the cell
        APPEND ls_fieldcat TO fcat_valid.
    Hope this helps.

  • Run-time error while executing alv grid report

    Hi everyone
    I m trying to run a alv grid report it is giving a run time error while executing the statement CALL METHOD V_ALV->SET_TOOLBAR_INTERACTIVE.
    Actually i added 2 buttons in the toolbar.after that when i execute the report i m getting errors.
    <b>Error Analysis</b>
    An exception occurred that is explained in detail below.                     
    The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not    
    caught in                                                                   
    procedure "TOOLBAR_MENUS_INIT" "(METHOD)", nor was it propagated by a RAISING
    clause.                                                                     
    Since the caller of the procedure could not have anticipated that the        
    exception would occur, the current program is terminated.                    
    The reason for the exception is:                                             
    You attempted to use a 'NULL' object reference (points to 'nothing')         
    access a component (variable: "ME->M_CL_MENU_BUTTON_VARIANT").               
    An object reference must point to an object (an instance of a class)         
    before it can be used to access components.                                  
    Either the reference was never set or it was set to 'NULL' using the         
    CLEAR statement.

    Hi Dinesh,
    Seems you have not initialised ( Instantiated in OO ) the object and / or the parent container.
    Check if you have create object for both the parent as well as the alv object.
    So when you instatntiate the object of ALV you pass the object ( instantiated before hand ) in the parent container position.
    Also you would have to register the events to the object using method. Then only the buttons will finction.
    eg :
    IF G_CUSTOM_CONTAINER IS INITIAL.
        CREATE OBJECT CUSTOM_CONTAINER_1
               EXPORTING CONTAINER_NAME = CONTAINER_1.
        CREATE OBJECT GRID1
               EXPORTING I_PARENT = CUSTOM_CONTAINER_1.
        CALL METHOD ALV_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
             EXPORTING I_STRUCTURE_NAME = 'VBAK
             CHANGING  IT_OUTTAB        = IT_VBAK.
    Reward points if useful.

  • Microsoft Excel Icon in ALV Grid Report

    Hi all,
    We have a customized report. When we execute that reports, it open in ALV Grid format. When we choose "Microsoft Excel" Icon to change layout to Excel, it then shows the report in excel without any data.
    Can any one please tell me that why there is no data? should i need to do any settings in excel for this?
    Please respond.
    Best Regards,
    AI

    Hi,
    Refer these:
    Microsoft Excel Icon in ALV Grid Report
    Re: Not able display the Excel Icon in ALV List Display
    Hope it helps
    Regards
    Mansi

  • Alv interactive report  for secondary list

    Hi All,
    This is my code for ALV interactive report. Its working Properly for me when i select material number iam able to display the secondary list properly . if i sorted the basic list other than material number for ex . created date . iam uable to display correct secondary list . Can any one help me in this issue?
    REPORT  ZWRLOMDMM_PMG_PHWEB_PLD   NO STANDARD PAGE HEADING
            LINE-SIZE 120
            LINE-COUNT 65
            MESSAGE-ID 00.
    TABLES                                                              *
    TABLES: MARA ,      "General Material Data
            ZWPBPH.     " Published Product Hierarchy
    TYPE-POOLS                                                          *
    TYPE-POOLS:SLIS .
    DATA:FIELDCATALOG_BASIC TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
         FIELDCATALOG_SECONDARY TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
         GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
         GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
         GD_REPID LIKE SY-REPID.
    INTERNAL TABLES                                                     *
    *Internal Tables to Get Data.
    *Internal Table For MARA Table.
    DATA:BEGIN OF T_MARA OCCURS 0 ,
            MATNR LIKE MARA-MATNR,
            MTART LIKE MARA-MTART,
            ERSDA LIKE MARA-ERSDA,
            ERNAM LIKE MARA-ERNAM,
            AENAM LIKE MARA-AENAM,
            SPART LIKE MARA-SPART,
         END OF T_MARA.
    *Internal Table For ZWPBPH Table.
    DATA:BEGIN OF T_ZWPBPH OCCURS 0 ,
           PBPINO LIKE ZWPBPH-PBPINO,
           PBPAPINO LIKE ZWPBPH-PBPAPINO,
         END OF T_ZWPBPH.
    *Internal Table For Basic List Field Catalog.
    DATA:BEGIN OF T_ALV OCCURS 0 ,
           MATNR LIKE MARA-MATNR,
           MTART LIKE MARA-MTART,
           ERSDA LIKE MARA-ERSDA,
           ERNAM LIKE MARA-ERNAM,
           SPART LIKE MARA-SPART,
           SPART1(3),
         END OF T_ALV.
    *Internal Table For Secondary List Field Catalog.
    DATA: BEGIN OF T_ALVS OCCURS 0 ,
            MATNR LIKE MARA-MATNR,
            AENAM LIKE MARA-AENAM,
            LAEDA LIKE MARA-LAEDA,
          END OF T_ALVS.
    *Internal Table For Model
    DATA:T_MODEL LIKE T_ZWPBPH OCCURS 0 WITH HEADER LINE.
    *Internal Table For Product
    DATA:T_PRODUCT LIKE T_ZWPBPH OCCURS 0 WITH HEADER LINE.
    *Internal Table For Family
    DATA:T_FAMILY LIKE T_ZWPBPH OCCURS 0 WITH HEADER LINE.
    *Internal Table For Line
    DATA:T_LINE LIKE T_ZWPBPH OCCURS 0 WITH HEADER LINE.
    *Internal Table For Type
    DATA:T_TYPE LIKE T_ZWPBPH OCCURS 0 WITH HEADER LINE.
    SELECTION SCREEN                                                    *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: P_MATN RADIOBUTTON GROUP R1  USER-COMMAND run default 'X'.
    SELECT-OPTIONS: P_MATNR FOR MARA-MATNR MODIF ID SC1 .
    PARAMETERS: P_DAT RADIOBUTTON GROUP R1  .
    SELECT-OPTIONS: : P_DATE FOR MARA-LAEDA  MODIF ID SC2.
    PARAMETERS: P_DIV RADIOBUTTON GROUP R1  .
    SELECT-OPTIONS: : P_DIVIS for mara-spart  MODIF ID SC3.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION                                                      *
    INITIALIZATION.
      REFRESH: T_MARA,
               T_ZWPBPH,
               T_ALV,
               T_ALVS,
               T_MODEL,
               T_PRODUCT,
               T_FAMILY,
               T_LINE,
               T_TYPE.
      CLEAR:   T_MARA,
               T_ZWPBPH,
               T_ALV,
               T_ALVS,
               T_MODEL,
               T_PRODUCT,
               T_FAMILY,
               T_LINE,
               T_TYPE.
      GD_REPID = SY-REPID.
    *AT SELECTION-SCREEN OUTPUT.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF P_MATN = 'X'.
          FREE : P_DIVIS,P_DATE.
          IF SCREEN-GROUP1 = 'SC2' or SCREEN-GROUP1 = 'SC3'.
            SCREEN-INPUT  = 0.
            MODIFY SCREEN.
            CONTINUE.
          ENDIF .
        ENDIF.
        IF P_DAT = 'X'.
          FREE : P_MATNR,P_DIVIS.
          IF SCREEN-GROUP1 = 'SC1' or  SCREEN-GROUP1 = 'SC3'.
            SCREEN-INPUT  = 0.
            MODIFY SCREEN.
            CONTINUE.
          ENDIF .
        ENDIF.
        IF P_DIV = 'X'.
          FREE : P_DATE,P_MATNR.
          IF SCREEN-GROUP1 = 'SC1' or SCREEN-GROUP1 = 'SC2'.
            SCREEN-INPUT = 0.
            MODIFY SCREEN.
            CONTINUE.
          ENDIF .
        ENDIF.
      ENDLOOP.
    START-OF-SELECTION                                                  *
    START-OF-SELECTION.
      PERFORM GET_FIELDCATALOG_BASIC.
      PERFORM GET_FIELDCATALOG_SECONDARY.
      PERFORM POPULATE_DATA.
    END-OF-SELECTION                                                    *
    END-OF-SELECTION.
    *&      FORM GET_FIELDCATALOG_BASIC.
    Get Fieldcatalog For Basic List
    FORM GET_FIELDCATALOG_BASIC.
      FIELDCATALOG_BASIC-FIELDNAME = 'MATNR'.
      FIELDCATALOG_BASIC-SELTEXT_M = 'Material Number'.
      FIELDCATALOG_BASIC-COL_POS   = 0.
      FIELDCATALOG_BASIC-OUTPUTLEN = 20.
      FIELDCATALOG_BASIC-HOTSPOT   = 'X'.
      FIELDCATALOG_BASIC-EMPHASIZE = 'X'.
      FIELDCATALOG_BASIC-KEY       = 'X'.
      APPEND FIELDCATALOG_BASIC TO FIELDCATALOG_BASIC.
      CLEAR FIELDCATALOG_BASIC.
      FIELDCATALOG_BASIC-FIELDNAME = 'MTART'.
      FIELDCATALOG_BASIC-SELTEXT_M = 'Material Type'.
      FIELDCATALOG_BASIC-COL_POS   = 0.
      FIELDCATALOG_BASIC-OUTPUTLEN = 20.
      FIELDCATALOG_BASIC-EMPHASIZE = 'X'.
      FIELDCATALOG_BASIC-KEY       = 'X'.
      APPEND FIELDCATALOG_BASIC TO FIELDCATALOG_BASIC.
      CLEAR FIELDCATALOG_BASIC.
      FIELDCATALOG_BASIC-FIELDNAME = 'ERSDA'.
      FIELDCATALOG_BASIC-SELTEXT_M = 'Created Date'.
      FIELDCATALOG_BASIC-COL_POS   = 0.
      FIELDCATALOG_BASIC-OUTPUTLEN = 12.
      FIELDCATALOG_BASIC-EMPHASIZE = 'X'.
      FIELDCATALOG_BASIC-KEY       = 'X'.
      APPEND FIELDCATALOG_BASIC TO FIELDCATALOG_BASIC.
      CLEAR FIELDCATALOG_BASIC.
      FIELDCATALOG_BASIC-FIELDNAME = 'ERNAM'.
      FIELDCATALOG_BASIC-SELTEXT_M = 'Created By'.
      FIELDCATALOG_BASIC-COL_POS   = 0.
      FIELDCATALOG_BASIC-OUTPUTLEN = 15.
      FIELDCATALOG_BASIC-EMPHASIZE = 'X'.
      FIELDCATALOG_BASIC-KEY       = 'X'.
      APPEND FIELDCATALOG_BASIC TO FIELDCATALOG_BASIC.
      CLEAR FIELDCATALOG_BASIC.
      FIELDCATALOG_BASIC-FIELDNAME = 'SPART'.
      FIELDCATALOG_BASIC-SELTEXT_M = 'Division PMG'.
      FIELDCATALOG_BASIC-COL_POS   = 0.
      FIELDCATALOG_BASIC-OUTPUTLEN = 14.
      FIELDCATALOG_BASIC-EMPHASIZE = 'X'.
      FIELDCATALOG_BASIC-KEY       = 'X'.
      APPEND FIELDCATALOG_BASIC TO FIELDCATALOG_BASIC.
      CLEAR FIELDCATALOG_BASIC.
      FIELDCATALOG_BASIC-FIELDNAME = 'SPART1'.
      FIELDCATALOG_BASIC-SELTEXT_M = 'Division PhWEB'.
      FIELDCATALOG_BASIC-COL_POS   = 0.
      FIELDCATALOG_BASIC-OUTPUTLEN = 14.
      FIELDCATALOG_BASIC-EMPHASIZE = 'X'.
      FIELDCATALOG_BASIC-KEY       = 'X'.
      APPEND FIELDCATALOG_BASIC TO FIELDCATALOG_BASIC.
      CLEAR FIELDCATALOG_BASIC.
    ENDFORM.                    "GET_FIELDCATALOG_BASIC
    *&      FORM GET_FIELDCATALOG_SECONDARY
    Get Fieldcatalog For Secondary List
    FORM GET_FIELDCATALOG_SECONDARY.
      FIELDCATALOG_SECONDARY-FIELDNAME = 'MATNR'.
      FIELDCATALOG_SECONDARY-SELTEXT_M = 'Material Number'.
      FIELDCATALOG_SECONDARY-COL_POS   = 0.
      FIELDCATALOG_SECONDARY-OUTPUTLEN = 20.
      FIELDCATALOG_SECONDARY-EMPHASIZE = 'X'.
      FIELDCATALOG_SECONDARY-KEY       = 'X'.
      APPEND FIELDCATALOG_SECONDARY TO FIELDCATALOG_SECONDARY.
      CLEAR FIELDCATALOG_SECONDARY.
      FIELDCATALOG_SECONDARY-FIELDNAME = 'AENAM'.
      FIELDCATALOG_SECONDARY-SELTEXT_M = 'Changed By'.
      FIELDCATALOG_SECONDARY-COL_POS   = 0.
      FIELDCATALOG_SECONDARY-OUTPUTLEN = 20.
      FIELDCATALOG_SECONDARY-EMPHASIZE = 'X'.
      FIELDCATALOG_SECONDARY-KEY       = 'X'.
      APPEND FIELDCATALOG_SECONDARY TO FIELDCATALOG_SECONDARY.
      CLEAR FIELDCATALOG_SECONDARY.
      FIELDCATALOG_SECONDARY-FIELDNAME = 'LAEDA'.
      FIELDCATALOG_SECONDARY-SELTEXT_M = 'Changed ON'.
      FIELDCATALOG_SECONDARY-COL_POS   = 0.
      FIELDCATALOG_SECONDARY-OUTPUTLEN = 20.
      FIELDCATALOG_SECONDARY-EMPHASIZE = 'X'.
      FIELDCATALOG_SECONDARY-KEY       = 'X'.
      APPEND FIELDCATALOG_SECONDARY TO FIELDCATALOG_SECONDARY.
      CLEAR FIELDCATALOG_SECONDARY.
    ENDFORM.                    "GET_FIELDCATALOG_SECONDARY
    *&      FORM POPULATE_DATA
    FORM POPULATE_DATA.
    *Get Data From MARA And ZWPBPH Tables
      IF P_MATN = 'X'.
    SELECT MATNR MTART ERSDA ERNAM AENAM SPART FROM MARA INTO TABLE T_MARA
    where MATNR IN P_MATNR .
        IF SY-SUBRC <> 0.
          MESSAGE E001(0) WITH 'Invalid Material Number'.
        ENDIF.
      ELSEIF P_DAT = 'X'.
    SELECT MATNR MTART ERSDA ERNAM AENAM SPART FROM MARA INTO TABLE T_MARA
    where LAEDA IN P_DATE .
        IF SY-SUBRC <> 0.
          MESSAGE E001(0) WITH 'Invalid Date Range'.
        ENDIF.
      ELSEIF P_DIV = 'X'.
    SELECT MATNR MTART ERSDA ERNAM AENAM SPART FROM MARA INTO TABLE T_MARA
    where SPART IN P_DIVIS .
        IF SY-SUBRC <> 0.
          MESSAGE E001(0) WITH 'Invalid Division'.
        ENDIF.
      ELSEIF P_MATN = ' ' AND P_DAT = ' ' AND  P_DIV = ' '.
    SELECT MATNR MTART ERSDA ERNAM AENAM SPART FROM MARA INTO TABLE T_MARA.
      ENDIF.
      DELETE ADJACENT DUPLICATES FROM T_MARA COMPARING MATNR.
      SORT T_MARA BY MATNR.
      IF T_MARA[] IS NOT INITIAL .
    SELECT PBPINO PBPAPINO FROM ZWPBPH INTO TABLE T_ZWPBPH FOR ALL ENTRIES
    IN T_MARA WHERE PBPINO = T_MARA-MATNR.
      ENDIF.
      IF SY-SUBRC = 0.
        LOOP AT  T_ZWPBPH.
          SELECT SINGLE PBPINO PBPAPINO FROM ZWPBPH INTO  T_MODEL   WHERE
          PBPINO = T_ZWPBPH-PBPAPINO.
          IF SY-SUBRC = 0.
          SELECT SINGLE PBPINO PBPAPINO FROM ZWPBPH  INTO T_PRODUCT   WHERE
          PBPINO
          = T_MODEL-PBPAPINO.
          ENDIF.
          IF SY-SUBRC = 0.
           SELECT SINGLE PBPINO PBPAPINO FROM ZWPBPH  INTO T_FAMILY   WHERE
           PBPINO = T_PRODUCT-PBPAPINO.
          ENDIF.
          IF SY-SUBRC = 0.
            SELECT SINGLE PBPINO PBPAPINO FROM ZWPBPH  INTO T_LINE   WHERE
            PBPINO = T_FAMILY-PBPAPINO.
          ENDIF.
          IF SY-SUBRC = 0.
       SELECT SINGLE PBPINO PBPAPINO FROM ZWPBPH INTO T_TYPE   WHERE PBPINO
        = T_LINE-PBPAPINO.
          ENDIF.
          IF SY-SUBRC = 0.
         SELECT SINGLE MTART ERSDA ERNAM SPART FROM MARA INTO CORRESPONDING
          FIELDS OF T_ALV WHERE MATNR = T_ZWPBPH-PBPINO AND SPART <>
        T_TYPE-PBPAPINO+1(2).
          ENDIF.
          IF SY-SUBRC = 0.
            MOVE T_ZWPBPH-PBPINO TO T_ALV-MATNR.
            MOVE T_TYPE-PBPAPINO+1(2) TO T_ALV-SPART1.
            APPEND T_ALV.
            SELECT SINGLE MATNR AENAM LAEDA FROM MARA INTO CORRESPONDING
            FIELDS OF T_ALVS WHERE MATNR = T_ZWPBPH-PBPINO.
            APPEND T_ALVS.
            CLEAR T_ALVS.
          ENDIF.
        ENDLOOP.
      ENDIF.
      SORT T_ALV BY MATNR.
      SORT T_ALVS BY MATNR.
      call function 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = GD_REPID
          i_callback_user_command = 'DISPLAY_DETAIL'
          it_fieldcat             = FIELDCATALOG_BASIC[]
          i_save                  = 'X'
        TABLES
          t_outtab                = T_ALV
        EXCEPTIONS
          program_error           = 1
          others                  = 2.
    ENDFORM.                    "POPULATE_DATA
    *&      Form  DISPLAY_DETAIL
          text
         -->UCOMM      text
         -->SELFIELD   text
    FORM DISPLAY_DETAIL USING UCOMM LIKE SY-UCOMM
    SELFIELD TYPE SLIS_SELFIELD.
    Select Material Number For Secondary List
      DATA: T_ALV_TEMP LIKE T_ALVS OCCURS 0 WITH HEADER LINE.
      IF UCOMM = '&IC1'.
        READ TABLE T_ALVS INDEX SELFIELD-TABINDEX.
        IF SY-SUBRC = 0.
          MOVE T_ALVS TO T_ALV_TEMP.
          APPEND T_ALV_TEMP.
        ENDIF.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program = GD_REPID
            it_fieldcat        = FIELDCATALOG_SECONDARY[]
          TABLES
            t_outtab           = T_ALV_TEMP.
      ENDIF.
    ENDFORM.                    "DISPLAY_DETAIL

    Hi,
    Try this in the routine display details
    READ TABLE T_ALV INDEX SELFIELD-TABINDEX.
    READ TABLE T_ALVS with key matnr = T_ALV-MATNR
    thanks

  • Displaying traffic lights in alv grid report?

    Hi everyone,
    I have an alv grid report.I m using the FM reuse_alv_grod_display to display my alv report.I am passing the fieldcatalogue automatically.I m getting the output perfectly.Now i have to add traffic lights to that alv report.
    Since i m passing the fieldcatalogue automatically i m confused to display the traffic lights?
    any suggestions please?
    Thank you.

    hi dp,
    look at the program i made... se the bold part you will be able to impelment lights easily,
    DECLARING TYPES POOL *
    All the definitions of internal tables, structures and constants
    are declared in a type-pool called SLIS.
    type-pools: slis.
    TABLES *
    tables: vbak,vbap,kna1.
    TYPES *
    *&--defining types for TABLE VBAK
    types: begin of t_vbak,
    vbeln type vbeln_va, "sales document
    kunnr type kunag,
    erdat type erdat,
    auart type auart,
    netwr type netwr_ak,
    waerk type waerk,
    vkorg type vkorg,
    vtweg type vtweg,
    spart type spart,
    name1 type name1_gp,
    stras type stras_gp,
    ort01 type ort01_gp,
    pstlz type pstlz,
    regio type regio,
    land1 type land1_gp,
    telf1 type telf1,
    end of t_vbak.
    *&--Defining types for TABLE VBAP
    types: begin of t_vbap,
    vbeln type vbeln_va,
    posnr type posnr_va,
    matnr type matnr,
    maktx type maktx,
    end of t_vbap.
    *&--MERGED FINAL SALES TABLE
    types: begin of t_sales_final,
    vbeln type vbeln_va,
    kunnr type kunag,
    posnr type posnr_va,
    erdat type erdat, "date of creation
    auart type auart,
    netwr type netwr_ak,
    waerk type waerk,
    vkorg type vkorg,
    vtweg type vtweg,
    spart type spart,
    name1 type name1_gp,
    v_lights type c,
    stras type stras_gp,
    ort01 type ort01_gp,
    pstlz type pstlz,
    regio type regio,
    land1 type land1_gp,
    telf1 type telf1,
    matnr type matnr,
    maktx type maktx,
    end of t_sales_final.
    defining wrokarea and IT.
    WORK AREA DECLARATION *
    *&---work area for Internal Tables
    data: wa_vbak type t_vbak.
    data: wa_vbap type t_vbap.
    data: wa_sales_final type t_sales_final.
    *&--work area for layout
    data: wa_layout type slis_layout_alv.
    INTERNAL TABLES DECLARATION *
    *&---Internal tables without Header Line.
    data : i_vbak type standard table of t_vbak,
    i_vbap type standard table of t_vbap,
    i_sales_final type standard table of t_sales_final.
    *&---Internal table for field catalog
    data : i_fieldcat type slis_t_fieldcat_alv,
    *&---Internal table for the sorting sequence.
    i_sortinfo type slis_t_sortinfo_alv,
    *&---Internal table for the event catalog.
    i_eventcat type slis_t_event,
    *&---Internal table for the top of page event
    i_listheader type slis_t_listheader.
    VARIABLE DECLARATION *
    data : v_progname like sy-repid, "Program name(system defined)
    v_gridtitle type lvc_title. "Grid Title
    INITIALIZATION EVENT *
    initialization.
    v_progname = sy-repid.
    refresh:i_vbak,
    i_vbap,
    i_sales_final,
    i_fieldcat,
    i_sortinfo,
    i_eventcat,
    i_listheader.
    clear: wa_vbak,
    wa_vbap,
    wa_sales_final,
    wa_layout.
    SELECTION SCREEN *
    SCREEN FOR ENTERING INFORMATION
    selection-screen begin of block b1 with frame title text-001.
    select-options: r_vbeln for wa_vbak-vbeln obligatory.
    select-options: r_erdat for wa_vbak-erdat obligatory.
    selection-screen end of block b1 .
    AT SELECTION SCREEN *
    at selection-screen.
    perform zf_validate_sales_doc_no.
    perform zf_validate_date.
    START OF SELECTION EVENT
    start-of-selection.
    perform zf_populate_header.
    perform zf_populate_detail.
    perform zf_append_sales_final.
    END OF SELECTION EVENT
    end-of-selection.
    *If Internal Table Is Populated Then Only Display Alv Report.
    if i_sales_final is not initial.
    Prepare fieldcatalog .
    perform zf_build_fieldcat using i_fieldcat.
    MODIFY the records IN the internal TABLE for the traffic lights.
    perform zf_modify_final.
    build event catalogue
    perform zf_eventcat using i_eventcat.
    build sorting
    perform zf_sorting using i_sortinfo.
    &---Build Listheader for TOP OF PAGE EVENT.
    perform zf_build_listheader using i_listheader.
    &---Build layout.
    perform zf_layout.
    &---Initializating Grid Title
    perform zf_build_grid_title.
    &---Display alv grid.
    perform zf_display_alv_grid.
    else.
    *If Table is not Populated ie Records Does not exist
    message 'Record Does Not Exist' type 'S'.
    endif.
    *& Form zf_validate_sales_doc_no
    text
    --> p1 text
    <-- p2 text
    form zf_validate_sales_doc_no .
    select single vbeln into wa_vbak-vbeln from vbak where vbeln in r_vbeln .
    if sy-subrc <> 0.
    message i101.
    endif.
    endform. " zf_validate_sales_doc_no
    *& Form zf_validate_date
    text
    --> p1 text
    <-- p2 text
    form zf_validate_date .
    if date is future
    if r_erdat-low >= sy-datum.
    message e102.
    elseif r_erdat-high >= sy-datum.
    message e103.
    endif.
    endform. " zf_validate_date
    *& Form zf_populate_header
    text
    --> p1 text
    <-- p2 text
    form zf_populate_header .
    select vbeln
    kunnr
    erdat
    auart
    netwr
    waerk
    vkorg
    vtweg
    spart
    into table i_vbak from vbak where vbeln in r_vbeln.
    if sy-subrc <> 0.
    message 'RECORD DOES NOT EXIST' type 'E'.
    endif.
    sort i_vbak by vbeln.
    *&--LOGIC TO GET FIELDS FROM TABLE KNA1 INTO INTERNAL TABLE I_VBAK
    loop at i_vbak into wa_vbak.
    select single name1 stras ort01 pstlz regio land1 telf1 into (wa_vbak-name1,
    wa_vbak-stras,
    wa_vbak-ort01,
    wa_vbak-pstlz,
    wa_vbak-regio,
    wa_vbak-land1,
    wa_vbak-telf1)
    from kna1
    where kunnr = wa_vbak-kunnr.
    modifying it_header.
    modify i_vbak from wa_vbak.
    clear wa_vbak.
    endloop.
    endform. " zf_populate_header
    *& Form zf_populate_detail
    text
    --> p1 text
    <-- p2 text
    form zf_populate_detail .
    if i_vbak[] is not initial.
    select vbeln
    posnr
    matnr
    into table i_vbap from vbap
    for all entries in i_vbak where vbeln = i_vbak-vbeln.
    endif.
    sort i_vbap by vbeln.
    sort i_vbap by posnr.
    *&--LOGIC TO GET FIELDS FROM TABLE MAKT INTO INTERNAL TABLE I_VBAP
    loop at i_vbap into wa_vbap.
    select single maktx into (wa_vbap-maktx)
    from makt where matnr = wa_vbap-matnr and spras = sy-langu.
    modifying it_header.
    modify i_vbap from wa_vbap.
    clear wa_vbap.
    endloop.
    endform. " zf_populate_detail
    *& Form zf_append_sales_final
    text
    --> p1 text
    <-- p2 text
    form zf_append_sales_final .
    sort i_vbak by vbeln.
    sort i_vbap by vbeln posnr.
    loop at i_vbak into wa_vbak.
    move-corresponding wa_vbak to wa_sales_final.
    read table i_vbap with key vbeln = wa_vbak-vbeln
    binary search transporting no fields.
    loop at i_vbap into wa_vbap from sy-tabix.
    if wa_vbap-vbeln <> wa_vbak-vbeln.
    exit.
    endif.
    move-corresponding wa_vbap to wa_sales_final.
    append wa_sales_final to i_sales_final.
    endloop.
    endloop.
    endform. " zf_append_sales_final
    *& Form zf_build_fieldcat
    text
    -->P_I_FIELDCAT text
    form zf_build_fieldcat using p_i_fieldcat type slis_t_fieldcat_alv.
    data: l_fieldcat type slis_fieldcat_alv. "local Workarea used
    clear l_fieldcat.
    FOR LIGHT IN COLUMN
    clear l_fieldcat.
    l_fieldcat-col_pos = '1'. " POSITION OF THE COLUMN.
    l_fieldcat-fieldname = 'V_LIGHTS'.
    " FIELD FOR WHICH CATALOG ID FILLED.
    *We are passing final internal table 'I_FINAL' to l_fieldcat(local
    *variable
    l_fieldcat-tabname = 'I_SALES_FINAL'.
    " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
    l_fieldcat-just = 'C'. " FOR JUSTIFICATION.
    l_fieldcat-outputlen = 20.
    " TO DEFINE OUTPUT LENGTH OF THE COLUMN.
    append l_fieldcat to p_i_fieldcat.
    FIRST COLUMN ********************************
    l_fieldcat-col_pos = '2'. " POSITION OF THE COLUMN
    l_fieldcat-fieldname = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED
    l_fieldcat-tabname = 'I_SALES_FINAL'. " INTERNAL TABLE BELONGS TO
    l_fieldcat-key = 'X'. " SO THAT this field is not scrollable hiddable.
    l_fieldcat-just = 'L'. " FOR JUSTIFICATION
    *l_fieldcat-hotspot = 'X'. " MARK THIS field as hotsopt
    l_fieldcat-lzero = 'X'. " OUTPUT WITH leading zeros.
    l_fieldcat-seltext_l = 'Sales Document'. " long text for header.
    l_fieldcat-seltext_m = 'Sales Doc'. " medium text for header.
    l_fieldcat-seltext_s = 'Sales Doc'. " sort text for header.
    l_fieldcat-outputlen = 20. " SET THE output length.
    l_fieldcat-ref_tabname = 'VBAK'. " FOR F1 & F4 help as
    append l_fieldcat to p_i_fieldcat.
    clear l_fieldcat.
    **************************SECOND COLUMN ********************************
    *l_fieldcat-col_pos = '3'. " POSITION OF THE COLUMN
    l_fieldcat-row_pos = '2'. " POSITION OF THE COLUMN
    l_fieldcat-fieldname = 'POSNR'. " FIELD FOR WHICH CATALOG ID FILLED
    l_fieldcat-tabname = 'I_SALES_FINAL'. " INTERNAL TABLE BELONGS TO
    l_fieldcat-key = 'X'. " SO THAT this field is not scrollable hiddable.
    l_fieldcat-just = 'L'. " FOR JUSTIFICATION
    l_fieldcat-hotspot = 'X'. " MARK THIS field as hotsopt
    l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.
    l_fieldcat-seltext_l = 'Sales Document Item'. " long text for header.
    l_fieldcat-seltext_m = 'Sales Document Item'. " medium text for header.
    l_fieldcat-seltext_s = 'Sales Document Item'. " sort text for header.
    l_fieldcat-outputlen = 20. " SET THE output length.
    l_fieldcat-ref_tabname = 'VBAP'. " FOR F1 & F4 help as
    append l_fieldcat to p_i_fieldcat.
    clear l_fieldcat.
    endform. " zf_build_fieldcat
    *& Form zf_eventcat
    text
    -->P_I_EVENTCAT text
    form zf_eventcat using p_i_eventcat type slis_t_event.
    data: l_eventcat type slis_alv_event.
    clear l_eventcat.
    call function 'REUSE_ALV_EVENTS_GET'
    exporting
    i_list_type = 0
    importing
    et_events = p_i_eventcat
    exceptions
    list_type_wrong = 1
    others = 2
    if sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    TOP OF PAGE FORM
    clear l_eventcat.
    read table p_i_eventcat into l_eventcat with key
    name = slis_ev_top_of_page.
    "(COMPONENT "NAME"of structure)
    if sy-subrc = 0. "if success
    move 'ZF_TOP_OF_PAGE' to l_eventcat-form.
    "matches name and moves form to workarea and modifies table
    modify p_i_eventcat from l_eventcat index sy-tabix
    transporting form.
    endif.
    PF_STATUS_SET FORM
    clear l_eventcat.
    read table p_i_eventcat into l_eventcat with key
    name = slis_ev_pf_status_set.
    if sy-subrc = 0.
    move 'ZF_PF_STATUS_SET' to l_eventcat-form.
    modify p_i_eventcat from l_eventcat index sy-tabix
    transporting form.
    endif.
    USER_COMMAND FORM
    clear l_eventcat.
    read table p_i_eventcat into l_eventcat with key
    name = slis_ev_user_command.
    if sy-subrc = 0.
    move 'ZF_USER_COMMAND' to l_eventcat-form.
    modify p_i_eventcat from l_eventcat index sy-tabix
    transporting form.
    endif.
    endform. " zf_eventcat
    *& Form zf_sorting
    text
    -->P_I_SORTINFO text
    form zf_sorting using p_i_sortinfo.
    endform. " zf_sorting
    *& Form zf_build_listheader
    text
    -->P_I_LISTHEADER text
    form zf_build_listheader using p_i_listheader type slis_t_listheader.
    data: l_listheader type slis_listheader.
    refresh p_i_listheader.
    clear l_listheader.
    HEADER
    l_listheader-typ = 'H'.
    l_listheader-info = 'FUJITSU CONSULTING INDIA LTD.'.
    append l_listheader to p_i_listheader.
    SELECTION
    l_listheader-typ = 'S'.
    l_listheader-key = 'Date:'.
    l_listheader-info = sy-datum.
    append l_listheader to p_i_listheader.
    ACTION
    l_listheader-typ = 'A'.
    *l_listheader-key =
    l_listheader-info = 'SALES ORDER ALV REPORT By Rohan Malik'.
    append l_listheader to p_i_listheader.
    endform. " zf_build_listheader
    *& Form zf_build_grid_title
    text
    --> p1 text
    <-- p2 text
    form zf_build_grid_title .
    v_gridtitle = 'List of Purchase Order'.
    endform. " zf_build_grid_title
    *& Form zf_display_alv_grid
    text
    --> p1 text
    <-- p2 text
    form zf_display_alv_grid .
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    i_callback_program = v_progname
    i_grid_title = v_gridtitle
    is_layout = wa_layout
    it_fieldcat = i_fieldcat
    it_sort = i_sortinfo
    it_events = i_eventcat
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    tables
    t_outtab = i_sales_final
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform. " zf_display_alv_grid
    *& Form zf_top_of_page
    text
    --> p1 text
    <-- p2 text
    form zf_top_of_page .
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = i_listheader
    i_logo = 'ENJOYSAP_LOGO'
    I_END_OF_LIST_GRID =
    endform. " zf_top_of_page
    *& Form zf_user_command
    text
    --> p1 text
    <-- p2 text
    form zf_user_command using r_ucomm like sy-ucomm
    rs_selfield type slis_selfield .
    case r_ucomm. "FCODE
    when 'VA03'.
    read table i_sales_final into wa_sales_final index rs_selfield-tabindex.
    set parameter id 'AUN' field rs_selfield-value.
    call transaction 'VA03' and skip first screen .
    message i102 with rs_selfield-value .
    when '&IC1'. "for hotspot with VBELN, POSNR, MATNR, KUNNR.
    if rs_selfield-fieldname = 'MATNR'.
    set parameter id 'MAT' field rs_selfield-value.
    call transaction 'MM03' and skip first screen.
    return.
    message i103 with rs_selfield-value .
    endif.
    if rs_selfield-fieldname = 'VBELN'.
    set parameter id 'AUN' field rs_selfield-value.
    call transaction 'VA03' and skip first screen.
    return.
    message i104 with rs_selfield-value .
    endif.
    endcase.
    endform. " zf_user_command
    *& Form ZF_PF_STATUS_SET
    text
    --> p1 text
    <-- p2 text
    form zf_pf_status_set using rt_extab type slis_t_extab.
    set pf-status 'Z11_RM_ALV_SO'.
    endform. " ZF_PF_STATUS_SET
    *& Form zf_layout
    text
    --> p1 text
    <-- p2 text
    form zf_layout .
    wa_layout-zebra = 'X'.
    wa_layout-lights_fieldname = 'V_LIGHTS'.
    wa_layout-lights_tabname = 'I_SALES_FINAL'.
    " 1, 2 or 3 for red, yellow and green respectively.
    endform. " zf_layout
    *& Form zf_modify_final
    text
    --> p1 text
    <-- p2 text
    form zf_modify_final .
    CODE TO EXECUTE LIGHTS
    *start of loop
    loop at i_sales_final into wa_sales_final.
    *giving conditions and modifying as we want to change many rows
    if wa_sales_final-netwr <= 10000.
    wa_sales_final-v_lights = '1'.
    modify i_sales_final from wa_sales_final transporting v_lights.
    elseif wa_sales_final-netwr > 10000 and wa_sales_final-netwr <= 100000.
    wa_sales_final-v_lights = '2'. " Exception.
    modify i_sales_final from wa_sales_final transporting v_lights.
    else.
    wa_sales_final-v_lights = '3'. " Exception.
    modify i_sales_final from wa_sales_final transporting v_lights.
    endif.
    endloop.
    reward point s if helpful
    rohan malik

  • How To Create Header in ALV List Report

    Hi All,
    I want to create a Header for <b>MY ALV List Report</b>!
    How can i achieve the same. It should come above <b>ALV</b>.
    ALV report i had already written and it is coming correctly.
    Heading should look like this:
    <i>1st Line</i>
    <b>PROGRAM NAME: XXXXXX      CLIENT: XXXXXXXXXX   PAGE:XX</b>
    <i>2nd Line</i>
    <b>RUN DATE/TIME: XXXXX - XXXX     REPORT NAME/HEADER</b>
    How can i acheive the same in <b>ALV List Report</b>!
    I am amking use of <b>REUSE_ALV_LIST_DISPLAY</b> Function module.
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Hi Prasad,
    Use the sample code specified below as the guideline. For more info. refer to the documentation of the FM 'REUSE_ALV_COMMENTARY_WRITE'.
    DATA: first(01) type c,
    events type slis_t_event,
    gt_list_top_of_page type slis_t_listheader,
    ls_event type slis_alv_event.
    initialization.
    call function 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = events
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2.
    read table events with key name = 'TOP_OF_PAGE'
    into ls_event.
    if sy-subrc = 0.
    move: 'TOP_OF_PAGE' to ls_event-form.
    append ls_event to events.
    clear ls_event.
    endif.
    End of additions
    Start-of-selection
    START-OF-SELECTION.
    Top-of-page
    TOP-OF-PAGE.
    PERFORM TOP_OF_PAGE.
    FORM TOP_OF_PAGE .
    data: ls_line type slis_listheader.
    if first is initial.
    ls_line-typ = 'S'.
    ls_line-key = 'Run Date :'.
    write: sy-datum to ls_line-key+10 mm/dd/yyyy.
    ls_line-info = 'Billing Date:'.
    write: s_fkdat-low to ls_line-info+15 mm/dd/yyyy.
    ls_line-info+28 = 'To'.
    write s_fkdat-high to ls_line-info+32 mm/dd/yyyy.
    append ls_line to gt_list_top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = gt_list_top_of_page.
    first = 'N'.
    else.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = gt_list_top_of_page.
    endif.
    ENDFORM. " top_of_page
    <b>Please mark helpful answer.</b>
    Regards,
    Amit Mishra

  • Hide/Remove Subtotal Icon in ALV Grid report output.

    Hi,
            Is ther a way to remove or hide the Subtotal icon in the ALV Grid report output?
    Thanks & Regards,
    Praveen.

    Hi,
    You can add names of the buttons(which you want to hide) to internal table and pass this internal table for tool bar excluding parameter while calling ALV.
    Here as shown in below code, 'Sorting, Ascending,Descending' buttons are removed from the tool bar list. 
    data : lt_exclude TYPE ui_functions.
    ls_exclude = cl_gui_alv_grid=>MC_FC_SORT.
      APPEND ls_exclude TO lt_exclude .
      ls_exclude = cl_gui_alv_grid=>MC_FC_SORT_ASC.
      APPEND ls_exclude TO lt_exclude .
      ls_exclude = cl_gui_alv_grid=>MC_FC_SORT_DSC.
      APPEND ls_exclude TO lt_exclude .
        CALL METHOD alvgd->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
         IT_TOOLBAR_EXCLUDING          = lt_exclude
    Regards,
    Maharshi Vyas

  • Time out error in production server  for alv grid report

    hi. i have developed alv grid report using nested select statments. when i testing in development  server it is giving the output but in production server if i give 4 months then it is showing time out error.please help me out..its urgent.
    Thanks in advance.

    Hi Manu,
    Don't use Nested selected statements.
    Use the Following  Performance Tuning Options that i have given below so that your problem can be solved.
    1)  Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
    2) Avoid for all entries in JOINS
    3) Try to avoid joins and use FOR ALL ENTRIES.
    4)   Try to restrict the joins to 1 level only ie only for tables
    5)   Avoid using Select *.
    6)   Avoid having multiple Selects from the same table in the same object.
    7)  Try to minimize the number of variables to save memory.  
    8)   The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
    9)   Avoid creation of  index as far as possible
    10) Avoid operators like  <>, > , < & like % in where clause conditions
    11) Avoid select/select single statements in loops.
    12) Try to use 'binary search' in READ internal table. Ensure table is sorted before using   BINARY SEARCH.
    13) Avoid using aggregate functions  (SUM, MAX etc) in selects ( GROUP BY , HAVING,)  
    14) Avoid using  ORDER  BY in selects
    15) Avoid Nested Selects
    16) Avoid Nested Loops of Internal Tables
    17) Try  to  use FIELD SYMBOLS.
    18) Try to avoid into Corresponding Fields of
    19) Avoid using Select  Distinct, Use DELETE ADJACENT
    <b>
    Reward Points for sure if you find it useful. </b>
    Regards
    Babu

  • Development of alv tree report using classes from basics

    Hi,
    Need a simple ALV tree report by showing the reason for why we are using the classse so that i can build a ALV report in the same manner.
    i have the data from MARA for given materials and their descriptions.Now in the basiv out put MARA information should come and tree out put for the material description when the user selects the maerial.
    A hot spot should come on the material and if he opts click the material then MM03 out put should come.
    Help me out in this regard
    Regards
    Naren

    Ok, but the importance of ABAP OO, should not be taken from an example ALV tree, but more in general. There are several good  articles on this on SCN. But for example in this particular case (ALV Tree), you should already see the importance as far as object instances and inheritance is concerned. Without much work, you can create an instance of an ALV tree, and all the attributes, methods etc. are there for use. Some of the methods / attributes are inherited from other superclasses.
    There are propably even more things to be mentioned here which emphasizes the importance of ABAP OO in ALV tree, but as far as I'm concerned, this is about it for me.

Maybe you are looking for

  • How can I delete unsupported content songs from my iPad?

    How can I delete unsupported content songs from my iPad?

  • Automatic payment: OBBA Define Value date rules

    hi experts, Have you ever tried OBBA to define Value date rules? I met a problem with it. In OBBA, my configuration is as follows: House banK Account ID Transaction R C1 S Dev C2  A CIT1               CNY                              3 CN -    1   CN

  • Vendor Credit Memo blocked

    Hi Expert, I have confusion over the Credit Memo Block. Can anyone explain me in which circumtances Credit Memo can be blocked? b'coz it is causing problem for vendor payment. Early help will be really appriciated. Thanks

  • Lion and Mountain Lion and Snow Leopard, oh my!

    My iMac does not support OS X Mountain Lion, but it does support Lion; is there anyway to upgrade to Lion?  In the app store I can't find a way to download Lion now that Mountain Lion is available.  Currently running Snow Leopard.  Want Lion so that

  • Converting doubles to integers?

    HI i have a slight problem with converting varibles of type to double to an integer. (i just want to output the value as a whole number.) Any ideas of how this can be done? thanks.