Problem in displaying Alv grid output  using oops........

hi,
i have two problems in displaying ALV grid output Using Oops.
1) How to modify the fieldcatalog after we getting a field catalog using general FM.
2) initialy it is displaying 13 fields but there are 63 fields .
   eventhough we chage the layout to 63 fields it is displaying only 13 fields , these 13 fields may be different based on our selection but count  of displayed fileds are same . how can display 63 fields at a time .

Hi,
You can chnage using below code:
loop at gt_fieldcat.
if <gt_fieldcat-field_name> = 'FIELDNAME'.
endif.
modify gt_fieldcat.
clear gt_fieldcat.
endloop.
Make sure that all the field should not have no_out = 'X' and tech = 'X'.
Thanks,
Sriram Ponna.

Similar Messages

  • Facing problem while downloading ALV grid Output into Excel

    Hi Guys,
    I am facing problem while downloading ALV grid Output into Excel.
    It is downloading into excel, but all character columns first and next all quantity columns it is displaying. But I need columns order as it is in the grid.
    If I take all columns as characters it works fine. But it will be problem for calculating total, subtotals of quantity columns
    Can someone help me regarding this
    thanks for your help

    Hi,
    Open up Excel on your desktop. Goto Tools > Macro > Security.
    Make sure that your security is set to Medium (or less). SAP uses OLE automation to run the Excel instance and in Office 2003 (for example), Microsoft has increased their default security setting to High. With the High setting, the output to Excel fails.
    Was this your problem? Don't forget those points, either.
    check with this wetther it is solved or not.
    Regards,
    sana.

  • ALV Grid Report using OOPS

    Hi Friends,
    I have to develop the ALV Grid report using the Classes ie OOPS, as i am new to OOPS and know little bit of ALV,  so it will be little bit tough to develop the object so plz try to solve my query. I'm sending the Functional specs:
    The program should display the list of Purchase orders and Purchase requisitions created for specified materials. The output should be displayed in form of ALV grid. There should be separate ALV Grid for Purchase order and Purchase requisition list. The user should also have an option to save various ALV layouts and should be able to choose the ALV layout on the selection screen.The user should be able to navigate to the relevant document form the ALV grid. (Use hyperlink).
    The output must appear in the same screen.     
    Selection screen fields–
         Material Number
         Creation date (For both, PR and PO)
         Output fields –
              List one –
                  Po Number
                                        Po Item number
                                        Vendor
                                        Date
                                        Material Number
                                        Material Quantity
              List two –
                             PR Number
                                        Material Number
                                        Material Quantity
                                        Release status
                                        Date
                                        Reference
         Tables:  EKPO, EKKO, EBAN
         Transactions: ME23N
    HINT –      Use class - CL_GUI_ALV_GRID
    thnks in advance.....

    Hi,
    Check out these standard reports, they are enough to help you out .
    BCALV_GRID_01
    BCALV_GRID_02
    BCALV_GRID_03
    BCALV_GRID_04
    BCALV_GRID_05
    BCALV_GRID_06
    BCALV_GRID_07
    BCALV_GRID_08
    BCALV_GRID_09
    BCALV_GRID_10
    BCALV_GRID_11
    BCALV_GRID_AND_POPUP
    BCALV_GRID_DEMO
    Regards,
    Amit

  • Problem while displaying data in spool using oops alv

    Hi,
    I have created a oops alv, in which iam displaying 2 ALV's  on 2 containers..
    Iam able to display the data which i need when i execute the program in foreground , But when i execute the program in background iam not able to see the 2nd ALV in the spool....
    The ALV displays one below the other.
    How i can i correct it..?
    Vishwa

    Hi,
    The container created in ALV will work only in foreground as this is the framework the background cannnot initiate the container object and assign the ALV to the container.
    Hence you cannot create the container object and assign the same to the ALV screen in background. Instead you need to use the factory method/ALV FM to display in background mode.
    For background ALV processing, don't use OOPS! U can use this fm : REUSE_ALV_GRID_DISPLAY.
    You can also refer below threads:
    Re: ALV: Foreground Vs Background
    Re: OO ALV in background job
    Regards
    Shiva

  • Problem while downloading ALV GRID Output to Local Spreadsheet(Excel) File.

    Hi,
    I am displaying output in ALV GRID. While downloading the output to Excel file using "Local File" option provided by ALV.
    But while downloading the columns and their respective values are coming in single column vertially of excel file instead of horizontal.
    e.g. Grid output is as follows.
    F1 F2
    V1 V2
    (F represents Field Title, and V represent Value)
    Downloaded Excel File content:-
    F1
    F2
    V1
    V2
    Please help.

    Hi ,
    Please use below FM :
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename = 'C:\Documents and Settings\akshayr2403\Desktop\docs\rep.xls'
    FILETYPE = 'WK1'
    WRITE_FIELD_SEPARATOR = 'X'
    tables
    data_tab = it_vbak
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Also, if your problem still persist, please refer SAP's demo code on ALV "BCALV_FULLSCREEN_DEMO".
    There are many sample codes available, what you need to do is just go to SE38 and put BCALV* and do F4.
    I hope this will help you.
    Regards,
    Rahul Mahajan

  • Hiding few columns before displaying alv grid output

    Hi All,
    I struck up at hiding few columns before displaying alv output. I have used used FM: REUSE_ALV_GRID_DISPLAY. By using this i am displaying 29 fields to the output. But before displaying the output i want to hide few columns among them, and also those fields have to be avialable for further selection by the user by using layout.
    Kindly help me in this,
    Regards
    Srinivas K

    Hi,
    In field catalog set NO_OUT='X' for all the columns you want to hide. They will be available when changing layout for ALV, so you can show them at any time.
    Regards
    Marcin

  • Problem in downloading ALv Grid output

    Hi Friends,
       I've made an ALV report using the FM: REUSE_ALV_GRID_DISPLAY. Now when I try to download the output in excel using the path:LIST->EXPORT->EXCELSHEET, the 'excelsheet' option is showing as disabled. This is happening only for this report, while I'm successfully ablw to do this for other ALV grid reports. I'm on ECC6.0 & trying to download the output in XXL format.Kindly help me as what exactly needs to looked into.
    Thanks:
    Gaurav

    hi,
    Think that you does n't have authorization for that (auth group "J_1IDNLD").
    You can try to do with another user which is ahving authorisation.
    Get authorization for above grp.    Hope it will helps you.       Thanks!
    Kishore

  • Filter is not working in ALV GRID output using FM 'REUSE_ALV_GRID_DISPLAY'

    Hello Experts,
    I have searched SCN before posting this thread.
    In my report output (by using 'REUSE_ALV_GRID_DISPLAY'), i am trying to filter values which is of type CHAR.
    Unable to filter by char30 field in the report output.
    Tried to filter using the following steps:
    Selected the column which i want to filter-> then selected filter symbol of ALV toolbar.
    Selection screen appeared where select-option of that field displayed.
    Selection screen only allows user to enter 1 character.
    Even though the field contains 30 characters the filed in selection screen appeared with 1char length.
    This is the same for all the fields in that ALV. Please suggest how can i change the field length to original field length.

    In field catalog pass:
    wa_alv_fieldcat-outputlen   = p_len
    Set p_len as 30.
    'FIELD'            text-001   '01' 'X'  '30'  'L'

  • How to send the ALV GRID output to spool by using the print button in std t

    How to send the ALV GRID output to spool by using the print button in standard tool bar.
    We have created a button in the va02 transaction.  If user click on the button the new screen will be display on that screen we are populating the alv grid output using the oops concept.  But i am unable to send the output to spool using the print button in the standard tool bar.
    I am able to display the Print parameter dialog box but i am not able to send it to spool.
    Kindly help.
    Thanks In Advance.
    G.V.Ramana

    Hi Shaik,
    There is not properties button in my print screen.
    MODULE user_command_0900 INPUT.
        WHEN 'EXCEL'.
          PERFORM excel_download.                              
        WHEN 'PRI'.
          PERFORM print_output.
    form Print_output.
    CALL FUNCTION 'RSPO_LIST_LAYOUT_FITS'
               EXPORTING
                    columns        = 80
                    device         = 'ANY '
                    lines          = 65
                    maxpenality    = 1999
               TABLES
                    layouts        = lt_layouts1
               EXCEPTIONS
                    unknown_device = 1
                    OTHERS         = 2.
          IF sy-subrc = 0.
            LOOP AT lt_layouts1.
              IF lt_layouts1-penality < 1000        AND
                 lt_layouts1-penality < l_min_penality.
                l_layout       = lt_layouts1-layout.
                l_min_penality = lt_layouts1-penality.
              ENDIF.
            ENDLOOP.
            IF NOT l_layout IS INITIAL.
              CALL FUNCTION 'GET_PRINT_PARAMETERS'
                   EXPORTING
                        mode                   = 'CURRENT'
                        line_size              = 80             "#EC *
                new_list_id            = l_new_list_id
                        no_dialog              = l_no_dialog
                        layout                 = l_layout
                   IMPORTING
                        out_archive_parameters = rs_arc_params
                        out_parameters         = rs_pri_params
                        valid                  = l_valid
                   EXCEPTIONS
                        archive_info_not_found = 1
                        invalid_print_params   = 2
                        invalid_archive_params = 3
                        OTHERS                 = 4.
              IF sy-subrc NE 0.                                 " INS SLIN
              ENDIF.                                            " INS SLIN
              IF rs_pri_params-linsz LT 80 OR
                 rs_pri_params-linsz LT gt_stack-s_lprint-width.
                gt_stack-print_line_break = 'X'.
              ELSE.
                CLEAR gt_stack-print_line_break.
              ENDIF.
              IF l_valid NE 'X'.
                rs_pri_params = ls_pri_params_sav.
                rs_arc_params = ls_arc_params_sav.
              ENDIF.
            ENDIF.
          ENDIF.
    endform.                    " Print_output
        CALL METHOD gv_cost_tot_alv_grand->set_table_for_first_display
                EXPORTING
                   is_layout         = gs_layout_cost_tot_grand
                CHANGING
                   it_fieldcatalog   = gt_fcat_cost_tot_grand[]
                   it_outtab         = gt_cost_tot_grand[].
    Please check my code

  • ALV GRID OUTPUT PROBLEM.

    here i m sending code for u r reviews.
    i have two tables: pa0002, zfm_handy
    i have to display alv grid by using these tables, i m getting output but the fields in the table pa0002(nachn,vorna) r not populated i m getting output for the fields those which r in the table zfm_handy only.
    plz modify this code and suggest according to my requirement...
    *& Report  ZFM_MOBLIST                                                 *
    REPORT  ZFM_MOBLIST.
    TABLES: ZFM_HANDY , PA0002.
    TYPE-POOLS : SLIS.
    DATA: G_REPID LIKE SY-REPID,
          GS_PRINT            TYPE SLIS_PRINT_ALV,
          GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
          GT_LIST_END_OF_PAGE TYPE SLIS_T_LISTHEADER,
          GT_EVENTS           TYPE SLIS_T_EVENT,
          GT_SORT             TYPE SLIS_T_SORTINFO_ALV,
          GS_LAYOUT           TYPE SLIS_LAYOUT_ALV,
          GT_FIELDCAT         TYPE SLIS_T_FIELDCAT_ALV,
          FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
          COL_POS TYPE I.
    *DATA:
    t_HANDY LIKE TABLE OF ZFM_HANDY,
    t_pa0002 like table of PA0002,
    f_handy like line of t_handy.
    *DATA : BEGIN OF I_ZFM OCCURS 0.
    *INCLUDE STRUCTURE ZFM_HANDY.
    *DATA : NACHN LIKE PA0002-NACHN,
          VORNA LIKE PA0002-VORNA,
          END OF I_ZFM.
      DATA : BEGIN OF ty_MOBLIST.
            include structure zfm_handy.
       data: NACHN  like  pa0002-nachn,     
           VORNA     like  pa0002-vorna,
          END OF ty_MOBLIST.
    DATA : BEGIN OF ty_zfm_handy.
            include structure zfm_handy.
    data : END OF ty_zfm_handy.
    DATA : BEGIN OF ty_pa0002,
            NACHN   type pa0002-nachn,     
            VORNA     type pa0002-vorna,
            pernr type pa0002-pernr,
           END OF ty_pa0002.
    data : it_MOBLIST LIKE table of ty_MOBLIST,
           wa_MOBLIST LIKE  ty_MOBLIST ,
           it_zfm_handy LIKE table of ty_zfm_handy,
           wa_zfm_handy LIKE  ty_zfm_handy ,
           it_pa0002 LIKE table of ty_pa0002,
           wa_pa0002 LIKE ty_pa0002 .
    *DATA : BEGIN OF IT_ZFM_MOBLIST OCCURS 0.
           include structure zfm_handy.
      data: NACHN  like  pa0002-nachn,     
          VORNA     like  pa0002-vorna,
        END OF IT_ZFM_MOBLIST.
    DATA : BEGIN OF IT_ZFM_HANDY OCCURS 0.
           include structure zfm_handy.
           END OF IT_ZFM_HANDY.
    *DATA : BEGIN OF IT_ZFM_PA0002 OCCURS 0,
           NACHN   type pa0002-nachn,     
           VORNA     type pa0002-vorna,
           pernr type pa0002-pernr,
          END OF IT_ZFM_PA0002.
    INITIALIZATION.
      G_REPID = SY-REPID.
      PERFORM PRINT_BUILD USING GS_PRINT.      "Print PARAMETERS
    START-OF-SELECTION.
      SELECT * from
               zfm_handy
          into corresponding fields of table it_zfm_handy.
      if not it_zfm_handy[] is initial.
        select  NACHN        
               VORNA     
         from  pa0002
         into table it_pa0002
         for all entries in it_zfm_handy
         where pernr =  it_zfm_handy-pernr.
      endif.                              " not it_zfm_handy
      loop at it_zfm_handy into wa_zfm_handy.
        read table it_pa0002 into wa_pa0002 with key pernr = ty_zfm_handy-pernr.
        if sy-subrc = 0.
          clear wa_MOBLIST.
          move wa_zfm_handy to wa_MOBLIST.
          move wa_pa0002 to wa_MOBLIST.
          append  wa_MOBLIST to it_MOBLIST .
        endif.                    " sy-subrc
      endloop.
    *SELECT * from
              zfm_handy
         into corresponding fields of table it_zfm_handy.
    if not it_zfm_handy[] is initial.
       select  NACHN        
              VORNA     
        from  pa0002
        into table it_pa0002
        for all entries in it_zfm_handy
        where pernr =  it_zfm_handy-pernr.
    endif.                              " not it_zfm_handy
    loop at it_zfm_handy.
       read table it_pa0002 FROM PA0002 with key pernr = ty_zfm_handy-pernr.
       if sy-subrc = 0.
         clear wa_MOBLIST.
         move wa_zfm_handy to wa_MOBLIST.
         move wa_pa0002 to wa_MOBLIST.
         append  wa_MOBLIST to it_MOBLIST .
         APPEND IT_ZFM_MOBLIST.
       endif.                    " sy-subrc
    endloop.
    SELECT *
       FROM zfm_handy
       INTO TABLE t_handy.
    *SELECT ZFM_HANDY~TELNUM ZFM_HANDY~KARTNR ZFM_HANDY~ZUTART ZFM_HANDY~PERNR
            ZFM_HANDYZDATE ZFM_HANDYPINNR ZFM_HANDYPUKNR ZFM_HANDYTARIF1
               ZFM_HANDYTARIF2 ZFM_HANDYTARIF3 ZFM_HANDYGTYPE ZFM_HANDYIMEI ZFM_HANDY~TWINCARD
                  ZFM_HANDYTWINBILL ZFM_HANDYEINBAU ZFM_HANDYBESCHR ZFM_HANDYTEXT1 ZFM_HANDY~TEXT2
                    ZFM_HANDYTEXT3 PA0002NACHN PA0002~VORNA INTO TABLE I_ZFM FROM ZFM_HANDY INNER JOIN PA0002
                         ON ZFM_HANDYPERNR = PA0002PERNR.
            select atelnum akartnr azutart apernr azdate apinnr apuknr atarif1 atarif2 atarif3 agtype aimei a~twincard
            atwinbill aeinbau abeschr atext1 atext2 atext3 bnachn bvorna into table i_zfm from zfm_handy as a inner join pa0002
              as b on apernr = bpernr where apernr = bpernr.
    *telnum , kartnr , zutart , pernr , zdate , pinnr , puknr ,
                tarif1 , tarif2 , tarif3 , gtye , imei , twincard , twinbill , einbau , beschr , text1 , text2 , text3 , nachn , vorna) from
                zfm_handy as a inner join pa0002 as b on apernr = bpernr where apernr = bpernr.
      PERFORM BUILD.
      PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
      PERFORM COMMENT_BUILD  CHANGING GT_LIST_TOP_OF_PAGE.
      PERFORM CALL_ALV.
    *&      Form  BUILD
    FORM BUILD.
    DATA FIELD CATALOG
    Explain Field Description to ALV
      DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME = 'TELNUM'.
      FIELDCAT_LN-TABNAME   = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT    = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TELNUM'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME = 'KARTNR'.
      FIELDCAT_LN-TABNAME   = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT    = ' '.
      FIELDCAT_LN-SELTEXT_L = 'KARTNR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME = 'ZUTART'.
      FIELDCAT_LN-TABNAME   = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT    = ' '.
      FIELDCAT_LN-SELTEXT_L = 'ZUTART'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'PERNR'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'PERNR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'ZDATE'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'ZDATE'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'PINNR'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'PINNR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'PUKNR'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'PUKNR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TARIF1'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TARIF1'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TARIF2'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TARIF2'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TARIF3'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TARIF3'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'GTYPE'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'GTYPE'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'IMEI'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'IMEI'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TWINCARD'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TWINCARD'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TWINBILL'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TWINBILL'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'EINBAU'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'EINBAU'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'BESCHAR'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'BESCHR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TEXT1'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TEXT1'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TEXT2'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TEXT2'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TEXT3'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TEXT3'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'NACHN'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L =  'NACHN'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'VORNA'.
      FIELDCAT_LN-TABNAME       = 'IT_MOBLIST'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'VORNA'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
    DATA SORTING
      DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
      CLEAR GS_SORT.
      GS_SORT-FIELDNAME = 'TELNUM'.
      GS_SORT-SPOS      = 1.
      GS_SORT-UP        = 'X'.
    GS_SORT-SUBTOT    = 'X'.
      APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'KARTNR'.
    GS_SORT-SPOS      = 2.
    GS_SORT-UP        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
      APPEND GS_SORT TO GT_SORT.
    ENDFORM.                    "BUILD
    *&      Form  CALL_ALV
    FORM CALL_ALV.
    ABAP List Viewer
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
      I_CALLBACK_PROGRAM = G_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME = 'ITAB1'
      IS_LAYOUT =  GS_LAYOUT
      IT_FIELDCAT = GT_FIELDCAT
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
        IT_SORT = GT_SORT
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
        IT_EVENTS = GT_EVENTS
    IT_EVENT_EXIT =
        IS_PRINT = GS_PRINT
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IT_HYPERLINK =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
      TABLES
      T_OUTTAB = IT_ZFM_HANDY[]
      EXCEPTIONS
      PROGRAM_ERROR = 1
      OTHERS = 2.
    ENDFORM.                    "CALL_ALV
    HEADER FORM
    FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
      CONSTANTS:
      GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
      GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = LT_EVENTS.
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    define END_OF_PAGE event
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_END_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    ENDFORM.                    "EVENTTAB_BUILD
    *&      Form  COMMENT_BUILD
    FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: GS_LINE TYPE SLIS_LISTHEADER.
      data: today_date(10) type c.
      concatenate
      sy-datum+6(2) '.'
      sy-datum+4(2) '.'
      sy-datum(4) into today_date.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'H'.
      GS_LINE-INFO = 'MOBLIST DETAILS'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'S'.
      GS_LINE-KEY  = 'Date:'.
      GS_LINE-INFO = today_date.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
    GS_LINE-KEY  = 'User:'.
    GS_LINE-INFO = sy-uname.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'A'.
      GS_LINE-INFO = 'ACTION'.
      APPEND GS_LINE TO  GT_TOP_OF_PAGE.
    ENDFORM.                    "COMMENT_BUILD
    *&      Form  TOP_OF_PAGE
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
      WRITE: SY-DATUM, 'Page No', SY-PAGNO RIGHT-JUSTIFIED.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  END_OF_PAGE
    FORM END_OF_PAGE.
      WRITE: /.
      WRITE at (sy-linsz) sy-pagno CENTERED.
    ENDFORM.                    "END_OF_PAGE
    ### PRINT SETTINGS
    FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
      LS_PRINT-PRINT              = ' '. "PRINT IMMEDIATE
      LS_PRINT-NO_PRINT_SELINFOS  = 'X'. "NO SELECTION INFO
      LS_PRINT-NO_COVERPAGE       = ' '. "NO COVER PAGE
      LS_PRINT-NO_NEW_PAGE        = ' '. "NO NEW PAGE
      LS_PRINT-NO_PRINT_LISTINFOS = 'X'. "NO PRINT LIST INFO
      LS_PRINT-RESERVE_LINES      = 2.   " FOOTERLINE
    ENDFORM.                    "PRINT_BUILD

    Hi narendra,
    loop at it_zfm_handy into wa_zfm_handy.
    <b>read table it_pa0002 into wa_pa0002 with key pernr = ty_zfm_handy-pernr.</b>
    if sy-subrc = 0.
    clear wa_MOBLIST.
    move wa_zfm_handy to wa_MOBLIST.
    move wa_pa0002 to wa_MOBLIST.
    append wa_MOBLIST to it_MOBLIST .
    endif. " sy-subrc
    endloop.
    <b>read table it_pa0002 into wa_pa0002 with key pernr = ty_zfm_handy-pernr.</b>
    replace the above statement with
    <b>read table it_pa0002 into wa_pa0002 with key pernr = it_zfm_handy-pernr.</b>

  • Displaying the selected rows in ALV Grid output

    Hi Experts,
    I am developing one interactive ALV Grid report where user can process the selected records/rows from the ALV Grid output.
    for displaying the ALV Grid, I have used the class CL_GUI_ALV_GRID class. I am working on ECC 6.0 system.
    when I select any records/rows from output and then press any Application Toolbar button, PAI and then PBO modules of the screen gets executed as per the normal flow.
    however After PBO, when same ALV output comes, all the selected/highlighted rows appear as unselected, that means I want to retain the ALV
    rows selection during the round trip.
    please advise.
    Regards,
    Jagesh

    Hi,
    Feiyun Wu is correct.
    Get_selected_rows and set_selected_rows are the methods to be used .
    Some code:
    Note the sequence of code:
    FORM set_gui_alv_grid_1 .
      DATA: wa_layout TYPE lvc_s_layo ,
            wa_print TYPE lvc_s_prnt .
      DATA: it_sort TYPE lvc_t_sort ,
            wa_sort TYPE LINE OF lvc_t_sort .
      DATA: it_fieldcatalog TYPE lvc_t_fcat.
      IF gui_custom_container_1 IS INITIAL .
        CREATE OBJECT gui_custom_container_1
          EXPORTING
            container_name = 'GUI_CUSTOM_CONTAINER_1'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6 .
        IF sy-subrc <> 0.
        ENDIF.
        PERFORM get_field_catalog
          USING gc_log_group_1
          CHANGING it_fieldcatalog  .
        CREATE OBJECT gui_alv_grid_1
          EXPORTING i_parent = gui_custom_container_1.
        CREATE OBJECT ob_event_receiver_1
          EXPORTING log_group = gc_log_group_1 .
    * registers the event handlers
        SET HANDLER ob_event_receiver_1->handle_toolbar      FOR gui_alv_grid_1 .
        SET HANDLER ob_event_receiver_1->handle_user_command FOR gui_alv_grid_1 .
        SET HANDLER ob_event_receiver_1->print_top_of_page   FOR gui_alv_grid_1 .
        SET HANDLER ob_event_receiver_1->hotspot_click       FOR gui_alv_grid_1 .
        wa_layout-cwidth_opt = abap_true .
    *   wa_layout-excp_fname = gc_excp_fname .
    *   wa_layout-ctab_fname = gc_ctab_fname.
    *   wa_layout-excp_led   = abap_true .
        CALL METHOD gui_alv_grid_1->set_table_for_first_display
          EXPORTING
            is_layout       = wa_layout
            is_print        = wa_print
            i_save          = 'A'
            is_variant      = gs_disvariant_1
          CHANGING
            it_sort         = it_sort
            it_fieldcatalog = it_fieldcatalog
            it_outtab       = it_alv_grid_1.
      ELSE .
        CALL METHOD gui_alv_grid_1->refresh_table_display.
    * Restore selections
        CALL METHOD gui_alv_grid_1->set_selected_rows
          EXPORTING
            it_index_rows = ob_event_receiver_1->it_rows.
    * Restore position
        CALL METHOD gui_alv_grid_1->set_scroll_info_via_id
          EXPORTING
            is_col_info = ob_event_receiver_1->wa_col
            is_row_no   = ob_event_receiver_1->wa_roid.
      ENDIF.
    ENDFORM .                    "set_gui_alv_grid_1
    Regards.

  • Alv output using oops for numc field

    Hi,
    iam displaying alv output using oops.
    one of output field data type numc and length 4.
    in field catalog  i set lzero = 'X'.
    now data is coming with leading zero. if data contains 0000  i want blank value in report output.
    i tried with no_zero = 'X'  blank values are display but leading zero are not display for other values.
    how can i change the code.
    Regards,
    Suresh.

    You will have to use data type char in your case.
    regards,
    Advait

  • Reg. can we display alv grid using field groups (extracts)

    Hi,
    can we display alv grid using field groups (extracts). is this possible. i have to develop a blocked alv.
    tnks
    Yerukala Setty

    No, you will need the data in an internal table to use ALV.
    Cheers
    Allan

  • Display ALV GRID Using Dynamic Internal Table

    Hi all,
    I try to display ALV Grid using Dynamic Internal Table, but when i activate my program, i get an error message "DYN_TABLE" is not type-compatible with formal parameter "IT_OUTTAB". ( DYN_TABLE is my Dynamic Itab).
    Anybody can help me how to passing Dynamic Itab into ALV Grid ?? Of ALV Grid only accept static Itab ??
    Thanks,

    Hi Vijay,
    It's doesn't work, and make new error "Formal parameter "IT_OUTTAB[]" does not exist. However, the parameter "IT_OUTTAB" has a similar name."
    Because the method is:
    CALL METHOD <ref. var. to CL_GUI_ALV_GRID>->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE = <any type (ANY)>
    I_STRUCTURE_NAME = <string of type DD02L-TABNAME>
    IS_VARIANT = <structure of type DISVARIANT>
    I_SAVE = <var. of type CHAR01>
    I_DEFAULT = <var. of type CHAR01>
    IS_LAYOUT = <structure of type LVC_S_LAYO>
    IS_PRINT = <structure of type LVC_S_PRNT>
    IT_SPECIAL_GROUPS = <internal table of type LVC_T_SGRP>
    IT_TOOLBAR_EXCLUDING = <internal table of type UI_FUNCTIONS>
    IT_HYPERLINK = <internal table of type LVC_T_HYPE>
    IT_ALV_GRAPHICS = <internal table of type DTC_T_TC>
    CHANGING
    IT_OUTTAB = <internal table>
    IT_FIELDCATALOG = <internal table of type LVC_T_FCAT>
    IT_SORT = <internal table of type LVC_T_SORT>
    IT_FILTER = <internal table of type LVC_T_FILT>
    Thanks,

  • ALV Report Development using OOPs concept

    complete details of " ALV Report Development using OOPs concept".
    Thanks in advance ...

    hi Sudharshan,
    please use these sample codes to understand about OOALV
    BC_ALV_GRID_CONTROL
    BC_ALVHIERGRID1_D100
    BC_ALVHIERGRID1_D210
    BC_ALVHIERGRID1_HIER
    BC_ALV_DEMO_HTML_D0100
    BC_ALV_GRID_CONTROL
    BC_ALVEXCEL
    BC_ALVEXCEL_D100
    BC_ALVEXCEL_D210
    BC_ALVEXCEL_HIER
    BC_ALVEXCEL_SAP_TEMPL
    BC_ALVEXCEL_SAP_TEMPL_F01
    BC_ALVEXCEL_SAP_TEMPL_TOP
    BC_ALVEXCELTOP
    BC_ALVHIERGRID1_D100
    BC_ALVHIERGRID1_D210
    BC_ALVHIERGRID1_HIER
    BC_ALVHIERTOP
    For learning OOPS-ALV in every SAP their is transaction named ZALV
    or try the following links:
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    The ALV object Grid methods allow the same functionality as ALV grid report function modules but are displayed within
    a screen (dialog program). SAP has provided a suit of programs which demonstrate how to For examples see standard SAP
    programs as detailed below:
    BCALV_EDIT_01 This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.
    BCALV_EDIT_02 This report illustrates how to set chosen cells of an ALV Grid Control editable.
    BCALV_EDIT_03 In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.
    The report checks the input value(s) semantically and provides protocol messages in case of error
    BCALV_EDIT_04 This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to
    implement the saving of the new data.
    BCALV_EDIT_05 This example shows how to use checkboxes within an ALV Grid Control. You learn:
    (1) how to define a column for editable checkboxes for an attribute of your list
    (2) how to evaluate the checked checkboxes
    (3) how to switch between editable and non-editable checkboxes
    BCALV_EDIT_06 This example shows how to define a dropdown listbox for all cells of one column in an editable ALV
    Grid Control.
    BCALV_EDIT_07 This example shows how to define dropdown listboxes for particular cells of your output table.
    BCALV_EDIT_08 This report implements an ALV Grid Control with an application specific F4 help. The following aspects
    are dealt with:
    (1) how to replace the standard f4 help
    (2) how to pass the selected value to the ALV Grid Control
    (3) how to build an f4 help, whose value range depend on a value of another cell.

Maybe you are looking for