ALV Report dynamically fields i want to display

Hi experts,
how to declare dynamical fields in ALV reports not in oops.can i use fieldcat merge function mod for this requirement.pls write the code if possible.

Hi,
how to declare dynamical fields in ALV reports not in oops. ? I didnt understand what exactly you mean ? Do you want to build an internal table which is of dynamic in nature ?
can i use fieldcat merge function mod for this requirement.  No
pls write the code if possible. No one writes the code here. Paste your code here !! If there any mistakes, any one of the SDNer will let you know !!
If you want the internal table to be dynamically created, check the following link:
Re: Dynamic Table with Validation
Regards
Kannaiah

Similar Messages

  • On ALV report in1 column I want to put Icon on every row of that column.

    On ALV report there is 1 column I want to put Icon on every row of that column.That ALV program uses object oriented concept all class and methods.
      I want to use that icon on that row. That icon name is ‘ICON_OKAY’
    In my program when I assign values to internal table at that time I am assigning that ‘ICON_OKAY’ value to that row as follow.
    Itab-
    Itab-icon = ICON_OKAY.
    Append itab.

    please follow below procedure to display icon in ALV
    1) In corresponding fieldcatelog entry do
    fieldcatalog-icon = 'X'
    2) While filling the internal table fill the corresponding key value of icon , for example ICON_OKAY value is '@0V@' so statement would be
    Itab-icon = '@0V@'
    to get list of corresponding key for icon open include <ICON> in se38

  • Create a ALV report with fields editable and  entry to be saved in ztable

    Hello Experts,
    I have created the ALV report which has two of the fields editable. Now whenever user puts an entry in the ALV it has to be saved in the ZTABLE.
    The report is displayed with editable fields but i'm not sure what has to be written in the 'USER COMMAND' subroutine to save the entries in ztable.
    Please see my code belwo:-
      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 = 'ALV_USER_COMM'
               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_bg2
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    Thanks,
    Naveen
    Edited by: jaikrishna on Sep 4, 2010 8:13 AM

    Hi,
    I have worked on similar requirement. You can do that on sy-ucomm value only and you have to call a FM and a method. For that end user has to click on a button which you need to create in the application toolbar. Say that button function code is 'SAVE'. Write the following code in your user command :
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
            RS_SELFIELD TYPE SLIS_SELFIELD.
    *Code to reflect the changes done in the internal table
      DATA : REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
      DATA: L_VALID TYPE C.
      IF REF_GRID IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            E_GRID = REF_GRID.
      ENDIF.
      IF NOT REF_GRID IS INITIAL.
        CALL METHOD REF_GRID->CHECK_CHANGED_DATA
          IMPORTING
            E_VALID = L_VALID.
      ENDIF.
      CASE SY-UCOMM.
        WHEN 'SAVE'.
    *Data will come with the edited values from ALV
    *Here you write your code to save entries into Z table
    ENDCASE.
    ENDFORM. "USER_COMMAND
    Thanks & Regards,
    Rock.

  • Re: Problem in ALV reports using Field symbols

    Hi Friends,
    Can you tell me how to convert a normal report using field symbols into ALV report
    can ypu please suggest me any solutions.I am sending the code along with this mail.
    Regards,
    Dinesh
    <b>Coding:</b>
    *& Report  YSDBTEMP                                                    *
    REPORT  YSDBTEMP                                .
    tables: ekko , ekpo .
    TYPE-POOLS: SLIS.
    *Internal Table Declaration
    data: begin of line ,
          ebeln like ekko-ebeln , "Purchasing Document No.
          bedat like ekko-bedat , "Purchasing Document Date
          matnr like ekpo-matnr , "Material No.
          netwr like ekpo-netwr , "Net Order Value in PO Currancy
          meins like ekpo-meins , "UOM
          change like ekpo-menge ,
    end of line .
    *Internal table Declaration
    DATA: IT_final like table of line  with header line.
    DATA :  FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV with header line.
    DATA :  V_REPID TYPE SYREPID.
    DATA :  IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    data :  i_layout type slis_layout_alv .
    Header for Main Grid Display
    data:i_header1 type slis_t_listheader with header line.
    Header for Interactive Report Display
    data:i_header2 type slis_t_listheader with header line.
    *Field Symbol declaration.
    FIELD-SYMBOLS: <FS> type any table.
    **select option Declaration
    selection-screen begin of block block.
    select-options: s_ebeln for ekko-ebeln .
    selection-screen end of block block .
    start-of-selection.
      perform get_data.
      perform field_cat.
      perform layout using i_layout .
      perform grid_display .
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    FORM get_data .
    SELECT EKKO~EBELN
      EKKO~BEDAT
      EKPO~EBELP
      EKPO~MATNR
      EKPO~NETWR
      EKPO~MEINS
      EKPO~MENGE
      EKPO~BPRME
      INTO CORRESPONDING FIELDS OF table IT_FINAL
      FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
      WHERE EKKO~EBELN IN S_EBELN.
    ENDFORM.                    " get_data
    *&      Form  field_cat
          text
    -->  p1        text
    <--  p2        text
    FORM field_cat .
      fieldcatalog-fieldname = 'EBELN'.
      fieldcatalog-seltext_m = 'Purchase Order No'.
      fieldcatalog-col_pos = 1.
       append fieldcatalog .
      clear fieldcatalog.
      fieldcatalog-fieldname = 'BEDAT'.
      fieldcatalog-seltext_m = 'Purchasing Document Date'.
      fieldcatalog-col_pos = 2.
       append fieldcatalog .
      clear fieldcatalog.
      fieldcatalog-fieldname = 'MATNR'.
      fieldcatalog-seltext_m = 'Material No'.
      fieldcatalog-col_pos = 3.
       append fieldcatalog .
      clear fieldcatalog.
      fieldcatalog-fieldname = 'MATNR'.
      fieldcatalog-seltext_m = 'Net order'.
      fieldcatalog-col_pos = 4.
       append fieldcatalog .
      clear fieldcatalog.
    ENDFORM.                    " field_cat
    *&      Form  layout
          text
         -->P_I_LAYOUT  text
    FORM layout  USING    P_I_LAYOUT.
      i_layout-lights_tabname = 'IT_FINAL'.
      i_layout-box_tabname = 'IT_FINAL'.
    ENDFORM.                    " layout
    *&      Form  grid_display
          text
    -->  p1        text
    <--  p2        text
    FORM grid_display .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
      IS_LAYOUT = I_LAYOUT
      IT_FIELDCAT = FIELDCATALOG[]
    *IT_EVENTS = I_EVENT[]
      TABLES
      t_outtab = <fs>.
    endform.

    Hi,
    This is one sample program,
    Check this.
    I hope it is helpful to you.
    TABLES : zeastable_02,zeastable_04.
    TYPE-POOLS : slis.
    TYPES : BEGIN OF fieldst,
            name LIKE zeastable_02-name,
            znum LIKE zeastable_02-znum,
            empno LIKE zeastable_04-empno,
            zempsalary LIKE zeastable_04-zempsalary,
            END OF fieldst.
    DATA itab TYPE TABLE OF fieldst WITH HEADER LINE.
    DATA: w_report_id  LIKE sy-repid.            "Program name
    DATA: w_title   TYPE lvc_title VALUE    'Assignment 1 in ALV'.
    DATA: w_layout   TYPE slis_layout_alv.      "Layout setup
    DATA: w_fieldcat TYPE slis_t_fieldcat_alv.  "Field Catlog
    START-OF-SELECTION.
      SELECT-OPTIONS employee FOR zeastable_04-empno.
    SELECT zeastable_02name  zeastable_02znum
           zeastable_04empno zeastable_04zempsalary
           INTO CORRESPONDING FIELDS OF TABLE itab FROM
           zeastable_02 INNER JOIN zeastable_04 ON
           zeastable_02name = zeastable_04name
           WHERE  zeastable_04~empno IN employee.
    w_report_id = sy-repid.
    PERFORM i_layout CHANGING w_layout.
    PERFORM i_fieldcat CHANGING w_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
        i_callback_program                = 'ZEASALV_04'
         i_grid_title                      = w_title
         is_layout                         = w_layout
         it_fieldcat                       = w_fieldcat
         i_save                            = 'A'
        TABLES
          t_outtab                          = itab
       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.
      PERFORM i_layout CHANGING w_layout.
      PERFORM i_fieldcat CHANGING w_fieldcat.
    *&      Form  i_layout
          text
         <--P_W_LAYOUT  text
    form i_layout  changing p_w_layout.
    clear w_layout.
      w_layout-colwidth_optimize = 'X'.
      w_layout-edit = ' '.
    endform.                    " i_layout
    *&      Form  i_fieldcat
          text
         <--P_W_FEILDCAT  text
    form i_fieldcat  changing p_w_feildcat.
    data: l_line_fieldcat type slis_fieldcat_alv.
    clear l_line_fieldcat.
      l_line_fieldcat-fieldname = 'NAME'.
      l_line_fieldcat-ref_tabname = 'itab'.
      l_line_fieldcat-seltext_m = 'NAME'.
      l_line_fieldcat-key  = 'X'.
       append l_line_fieldcat to w_fieldcat.
      clear l_line_fieldcat.
      l_line_fieldcat-fieldname = 'ZNUM'.
      l_line_fieldcat-ref_tabname = 'itab'.
      l_line_fieldcat-seltext_m = 'NUMBER'.
      l_line_fieldcat-key  = 'X'.
      append l_line_fieldcat to w_fieldcat.
      clear l_line_fieldcat.
      l_line_fieldcat-fieldname = 'EMPNO'.
      l_line_fieldcat-ref_tabname = 'itab'.
      l_line_fieldcat-seltext_m = 'EMPLNUM'.
    *l_line_fieldcat-key  = 'X'.
      append l_line_fieldcat to w_fieldcat.
      clear l_line_fieldcat.
      l_line_fieldcat-fieldname = 'ZEMPSALARY'.
      l_line_fieldcat-ref_tabname = 'itab'.
      l_line_fieldcat-seltext_m = 'SALARY'.
    *l_line_fieldcat-key  = 'X'.
      append l_line_fieldcat to w_fieldcat.
    endform.                    " i_fieldcat
    Reward for useful answers.

  • ALV report(Dynamic Messages)

    Hi all,
    i want to display my output in ALV's,
    but there are some messages needs to be displayed on the screen dynamically depends upon the output result.
    eg : in Out put if there are 2 diff  Amount  values.if  the difference is not EQ  .
    i want to display 'not matched'.
    please let me know .
    Thanx in adavance,
    Regards,
    Raj.

    hi,
    d_fieldcat_wa-fieldname = 'AMOUNT1'.
    d_fieldcat_wa-seltext_l = 'amount1'.
    d_fieldcat_wa-col_pos = 1.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'AMOUNT2'.
    d_fieldcat_wa-seltext_l = 'amount2'.
    d_fieldcat_wa-col_pos = 2.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    data : gd_repid like sy-repid.
           gd_repid = sy-repid.
    if AMOUNT1 NE AMOUNT2.
    write :/ 'NOT MATCHED'.
    else
    call function module reuse_alv_grid_display.
    exporting.
    program name = gd_repid.
    t_fieldcatalog = d_fieldcat.
    importing.
    t_outtab = itab.
    exceptions.
    endif.
    Reward with points if helpful.

  • Call alv report dynamically

    how to call 2 diff alv reports in 1 custom control dynamically

    Hi Naveen,
    REPORT ytest .
    * Based on: BCALV_GRID_DEMO.
    TYPE-POOLS: icon.
    TYPES: BEGIN OF ty_s_sflight.
    INCLUDE TYPE sflight.
    TYPES: button1 TYPE lvc_emphsz.
    TYPES: button2 TYPE lvc_emphsz.
    TYPES: button3 TYPE lvc_emphsz.
    TYPES: button4 TYPE lvc_emphsz.
    TYPES: END OF ty_s_sflight.
    DATA:
    gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
    gt_fcat TYPE lvc_t_fcat.
    DATA: ok_code LIKE sy-ucomm,
    * gt_sflight TYPE TABLE OF sflight,
    g_container TYPE scrfname VALUE ‘BCALV_GRID_DEMO_0100_CONT1′,
    grid1 TYPE REF TO cl_gui_alv_grid,
    g_custom_container TYPE REF TO cl_gui_custom_container.
    * CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
    PUBLIC SECTION.
    CLASS-DATA:
    md_cnt TYPE i.
    CLASS-METHODS:
    handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING
    e_row_id
    e_column_id
    es_row_no
    sender.
    ENDCLASS. “lcl_eventhandler DEFINITION
    * CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
    METHOD handle_hotspot_click.
    * define local data
    FIELD-SYMBOLS:
    TYPE ty_s_sflight,
    TYPE ANY.
    READ TABLE gt_sflight ASSIGNING INDEX es_row_no-row_id.
    CHECK ( IS ASSIGNED ).
    * Set all radio buttons “unselected”
    -button1 = ICON_CANCEL.
    -button2 = ICON_CANCEL.
    -button3 = ICON_CANCEL.
    -button4 = ICON_CANCEL.
    ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE
    TO .
    IF ( IS ASSIGNED ).
    * Set selected radio button “selected”.
    = ICON_OKAY.
    ENDIF.
    * Force PAI followed by refresh of table display in PBO
    CALL METHOD cl_gui_cfw=>set_new_ok_code
    EXPORTING
    new_code = ‘DUMMY’
    * IMPORTING
    * RC =
    ENDMETHOD. “handle_hotspot_click
    ENDCLASS. “lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
    * MAIN *
    PERFORM select_data.
    CALL SCREEN 100.
    * MODULE PBO OUTPUT *
    MODULE pbo OUTPUT.
    SET PF-STATUS ‘MAIN100′.
    IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
    EXPORTING container_name = g_container.
    CREATE OBJECT grid1
    EXPORTING i_parent = g_custom_container.
    PERFORM build_fieldcatalog.
    CALL METHOD grid1->set_table_for_first_display
    * EXPORTING
    * i_structure_name = ‘SFLIGHT’
    CHANGING
    it_fieldcatalog = gt_fcat
    it_outtab = gt_sflight.
    * Set event handler for event TOOLBAR
    SET HANDLER:
    lcl_eventhandler=>handle_hotspot_click FOR grid1.
    else.
    CALL METHOD grid1->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
    EXCEPTIONS
    FINISHED = 1
    others = 2.
    IF sy-subrc 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    ENDMODULE. “PBO OUTPUT
    * MODULE PAI INPUT *
    MODULE pai INPUT.
    * to react on oi_custom_events:
    CALL METHOD cl_gui_cfw=>dispatch.
    * CASE ok_code.
    CASE sy-ucomm.
    WHEN ‘EXIT’.
    PERFORM exit_program.
    WHEN OTHERS.
    * do nothing
    ENDCASE.
    CLEAR ok_code.
    ENDMODULE. “PAI INPUT
    * FORM EXIT_PROGRAM *
    FORM exit_program.
    * CALL METHOD G_CUSTOM_CONTAINER->FREE.
    * CALL METHOD CL_GUI_CFW=>FLUSH.
    LEAVE PROGRAM.
    ENDFORM. “EXIT_PROGRAM
    *& Form BUILD_FIELDCATALOG
    * text
    * –> p1 text
    * 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DELETE gt_fcat WHERE ( fieldname ‘EMPHASIZE’ ).
    CALL FUNCTION ‘LVC_FIELDCATALOG_MERGE’
    EXPORTING
    * I_BUFFER_ACTIVE =
    i_structure_name = ‘SFLIGHT’
    * I_CLIENT_NEVER_DISPLAY = ‘X’
    * I_BYPASSING_BUFFER =
    * I_INTERNAL_TABNAME =
    CHANGING
    ct_fieldcat = gt_fcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    IF sy-subrc 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE gt_fcat INTO ls_fcat
    WITH KEY fieldname = ‘EMPHASIZE’.
    IF ( syst-subrc = 0 ).
    DELETE gt_fcat INDEX syst-tabix.
    ENDIF.
    ls_fcat-fieldname = ‘BUTTON4′.
    ls_fcat-icon = ‘X’.
    ls_fcat-hotspot = ‘X’.
    INSERT ls_fcat INTO gt_fcat INDEX 4.
    ls_fcat-fieldname = ‘BUTTON3′.
    INSERT ls_fcat INTO gt_fcat INDEX 4.
    ls_fcat-fieldname = ‘BUTTON2′.
    INSERT ls_fcat INTO gt_fcat INDEX 4.
    ls_fcat-fieldname = ‘BUTTON1′.
    INSERT ls_fcat INTO gt_fcat INDEX 4.
    LOOP AT gt_fcat INTO ls_fcat.
    ls_fcat-col_pos = syst-tabix.
    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
    ENDLOOP.
    ENDFORM. ” BUILD_FIELDCATALOG
    *& Form SELECT_DATA
    * text
    * –> p1 text
    Reward pts if found usefull
    Regards
    Sathish

  • In ALV Report ,a field to allow the user EDIT/CHANGE

    Hi Guys,
    My requirement is
    in the ALV Grid display iam having 10 fields.5th field should be allow the user EDIT/CHANGE mode.
    what ever he enters the value the same should be updated to an custom table.
    EX.
    o/p:
    0001   0002   0003   0004   0005   0006   0007  0008   0009   0010
    Now the user changed the value 0005 to 0011.
    0001   0002   0003   0004   0011   0006   0007  0008   0009   0010
    now 0011 should be updated in custom table.
    to do this process please suggest a best way for coding.
    thanks in advance.
    Sunil.

    hi
    *& Report  ZTESTDEMO_INTERACTIVE_LIST_2
    REPORT  ZTESTDEMO_INTERACTIVE_LIST_2.
    TABLES: MARA,MARC,MARD.
    * internal table itab_mara 3 fields matnr, ernam,mtart
    DATA: BEGIN OF ITAB_MARA OCCURS 0,
    MATNR LIKE MARA-MATNR,  " material number
    ERNAM LIKE MARA-ERNAM,  " name of person who create
    MTART LIKE MARA-MTART,  " Material Type
    END OF ITAB_MARA.
    * internal table itab_marc 3 fields matnr, werks,lvorm
    DATA: BEGIN OF ITAB_MARC OCCURS 0,
    MATNR LIKE MARC-MATNR,
    WERKS LIKE MARC-WERKS,  " Plant
    LVORM LIKE MARC-LVORM,  " Flag Material for Deletion at Plant Level
    END OF ITAB_MARC.
    * internal table itab_mard 2 fields
    DATA: BEGIN OF ITAB_MARD OCCURS 0,
    MATNR LIKE MARD-MATNR,
    LGORT LIKE MARD-LGORT,  " Storage Location
    END OF ITAB_MARD.
    SELECT-OPTIONS: S_MTART FOR MARA-MTART.
    INITIALIZATION.
    S_MTART-LOW = 'HALB'.
    S_MTART-HIGH = 'HAWA'.
    S_MTART-OPTION = 'BT'.
    APPEND S_MTART.
    START-OF-SELECTION.
    SELECT MATNR ERNAM MTART FROM MARA INTO TABLE ITAB_MARA WHERE MTART IN
    S_MTART.
    PERFORM DISPLAY.
    TOP-OF-PAGE.
    WRITE:/2(15) 'MATERIAL NO',20(20) 'CREATED BY',45(15) 'MATERIAL TYPE'.
    FORM DISPLAY.
    LOOP AT ITAB_MARA.
    WRITE:/ ITAB_MARA-MATNR UNDER 'MATERIAL NO' HOTSPOT ON,ITAB_MARA-ERNAM
    UNDER 'CREATED BY',ITAB_MARA-MTART UNDER 'MATERIAL TYPE'.
    HIDE: ITAB_MARA-MATNR.
    ENDLOOP.
    ENDFORM.
    AT LINE-SELECTION.
    CASE SY-LSIND.
    WHEN 1.
    SELECT MATNR WERKS LVORM FROM MARC INTO TABLE ITAB_MARC WHERE MATNR =
    ITAB_MARA-MATNR.
    PERFORM DISPLAY1.
    WHEN 2.
    SELECT MATNR LGORT FROM MARD INTO TABLE ITAB_MARD WHERE MATNR =
    ITAB_MARC-MATNR.
    PERFORM DISPLAY2.
    when 3.
    sy-lsind = 0.
    ENDCASE.
    FORM DISPLAY1.
    LOOP AT ITAB_MARC.
    WRITE:/ ITAB_MARC-MATNR HOTSPOT ON, ITAB_MARC-WERKS,ITAB_MARC-LVORM.
    HIDE: ITAB_MARC-MATNR.
    ENDLOOP.
    WRITE:/ SY-LSIND.
    ENDFORM.
    FORM DISPLAY2.
    LOOP AT ITAB_MARD.
    WRITE:/ ITAB_MARD-MATNR, ITAB_MARD-LGORT.
    ENDLOOP.
    WRITE:/ SY-LSIND.
    ENDFORM.
    regards
    ravish
    <b>plz dont forget to reward points if helpful</b>

  • ALV Reporting with Field Headings

    Hi ,
    Can anyone  tell..
    Can we Display Field heading with Some Common Heading for a group in ALV grid Reporting.
    Below is the format...
                GROSS Block                               DEP RESEREVE                    
         GL CODES   SAP register       Unit`s Trial     Check           GL CODES     SAP register     Unit`s Trial     Check     
         311100     38810062.33     38810062.33     0                0.00         0.00     0     0     
         311200     0     0     0                0.00         0.00     0     0     

    Hi ,
    Can anyone  tell..
    Can we Display Field heading with Some Common Heading for a group in ALV grid Reporting.
    Below is the format...
                GROSS Block                               DEP RESEREVE                    
         GL CODES   SAP register       Unit`s Trial     Check           GL CODES     SAP register     Unit`s Trial     Check     
         311100     38810062.33     38810062.33     0                0.00         0.00     0     0     
         311200     0     0     0                0.00         0.00     0     0     

  • ALV and dynamic fields

    Hallo colleagues,
    I have to create a dynamic structure and show it within an ALV.
    Therefore I have created my stuctrure like this:
      MOVE 'COMP1' TO gw_component-name.
      gw_component-type ?= cl_abap_elemdescr=>get_string( ).
      INSERT gw_component INTO TABLE gt_components.
      MOVE 'COMP2' TO gw_component-name.
      gw_component-type ?= cl_abap_elemdescr=>get_i( ).
      INSERT gw_component INTO TABLE gt_components.
    get structure descriptor -> GR_STRUCTDESCR
      gr_structdescr ?= cl_abap_structdescr=>create( gt_components ).
    create work area of structure GR_STRUCTDESCR -> GR_WA
      CREATE DATA gr_wa TYPE HANDLE gr_structdescr.
      ASSIGN gr_wa->* TO <gw_wa>.
    So now I have my dynamic structure, but how i can create a field catalog, which fit into the function module 'REUSE_ALV_FIELDCATALOG_MERGE' and 'REUSE_ALV_LIST_DISPLAY'?
    Any help?
    Thanks in advance
    Irian

    Hi,
    REPORT zmtable LINE-SIZE 255
                   LINE-COUNT 65.
    Program written by Vijay Chaitanya Raju
    Maintain Table dynamicly (Table name is entered on Selection Screen)
    Very powerfull program. Please maintain authorisation access and
    restrict maintenance to Z-tables
    Version 6.20 and up
    (can be used in 4.6C with some modifications to block try - endtry
    and classes)
    Enhanced functionality with dynamic selection screen
    TABLES: sscrfields.                "Fields on selection screens
    TYPE-POOLS rsds.
    DATA ds_clauses TYPE rsds_where.
    DATA: BEGIN OF ifield OCCURS 0,
          fieldname LIKE dd03l-fieldname,
          position  LIKE dd03l-position,
          keyflag   LIKE dd03l-keyflag,
          datatype  LIKE dd03l-datatype.
    DATA: END OF ifield.
    DATA: sl_step    LIKE sy-tabix,
          ss_step    LIKE sy-subrc,
          ss_act(1)  TYPE c,
          sl_lines   LIKE sy-tfill,
          sl_status  LIKE sy-subrc,
          sl_subrc   LIKE sy-subrc,
          sl_update(1) TYPE c,
          sl_mandt(1)  TYPE c,
          len(6)       TYPE n,
          f_value(255) TYPE c,
          sl_datum     LIKE sy-datum,
          sl_uzeit     LIKE sy-uzeit,
          price1(15)   TYPE c,
          price2(15)   TYPE c,
          mess(60)     TYPE c,
          d_stat   LIKE sy-subrc,
          m_stat   LIKE sy-subrc,
          slchar(6) TYPE c.
    DATA: ref_ptr TYPE REF TO cx_root.      "Root class more common
    DATA: text TYPE string.
    DATA: sl_index LIKE sy-tabix.
    DATA: zauth LIKE dd02l-tabname.
    DATA: num TYPE i,
          max_len TYPE i,
          check_len TYPE i,
          sl_sel(1) TYPE c.
    TYPE-POOLS: icon.
    SELECTION-SCREEN.
    SELECTION-SCREEN BEGIN OF LINE.
    text-012 - 'Table Name'
    SELECTION-SCREEN COMMENT 1(25) text-012.
    PARAMETERS: tabname LIKE dd02l-tabname DEFAULT 'ZSCARE'.
    text-003 - 'Selection'
    SELECTION-SCREEN PUSHBUTTON 75(9) text-003 USER-COMMAND sta1.
    SELECTION-SCREEN END OF LINE.
    numrows(text) - 'Max Number of ROWS'
    PARAMETERS: numrows LIKE sy-subrc DEFAULT '100'.
    At Selection-Screen                                                 *
    AT SELECTION-SCREEN.
      CASE sscrfields-ucomm.
        WHEN 'STA1'.
          CLEAR sl_sel.
          CALL FUNCTION 'ZSTAN_SELECTIONS'
            EXPORTING
              tabname         = tabname
            IMPORTING
              ds_clauses      = ds_clauses
            EXCEPTIONS
              table_not_valid = 1
              other_error     = 2
              OTHERS          = 3.
          IF sy-subrc = 0.
            sl_sel = 'X'.
          ENDIF.
      ENDCASE.
    *At Selection-Screen Output                                            *
    AT SELECTION-SCREEN OUTPUT.
      SELECT SINGLE tabname
        INTO tabname
        FROM dd02l
        WHERE tabname  = tabname
          AND as4local = 'A'
          AND ( tabclass = 'TRANSP' OR tabclass = 'POOL'
                OR tabclass = 'CLUSTER' ).
      IF sy-subrc <> 0.
        MESSAGE 'Table is not valid' TYPE 'S'.
        RETURN.
      ENDIF.
    START-OF-SELECTION.
    START-OF-SELECTION.
      DEFINE: acheck.
        zauth = 'ZTABAUTH'.
        select single statu
          into sl_update
          from (zauth)
          where tabname = tabname
            and bname   = sy-uname.
        if sy-subrc <> 0.
          message 'You are not authorized to view this table' type 'S'.
          return.
        endif.
      END-OF-DEFINITION.
      SELECT SINGLE tabname
        INTO tabname
        FROM dd02l
        WHERE tabname  = tabname
          AND as4local = 'A'
          AND ( tabclass = 'TRANSP' OR tabclass = 'POOL'
                OR tabclass = 'CLUSTER' ).
      IF sy-subrc <> 0.
        MESSAGE 'Table is not valid' TYPE 'S'.
        RETURN.
      ENDIF.
      DATA: ptr_itab TYPE REF TO data.
      FIELD-SYMBOLS: <fs_itab> TYPE STANDARD TABLE. "ANY TABLE.
      CREATE DATA ptr_itab TYPE STANDARD TABLE OF (tabname).
      ASSIGN ptr_itab->* TO <fs_itab>.
    For DELETION
      DATA: ptr_itd TYPE REF TO data.
      FIELD-SYMBOLS: <fs_itd> TYPE STANDARD TABLE.
      CREATE DATA ptr_itd TYPE STANDARD TABLE OF (tabname).
      ASSIGN ptr_itd->* TO <fs_itd>.
    For MODIFICATION
      DATA: ptr_itm TYPE REF TO data.
      FIELD-SYMBOLS: <fs_itm> TYPE STANDARD TABLE.
      CREATE DATA ptr_itm TYPE STANDARD TABLE OF (tabname).
      ASSIGN ptr_itm->* TO <fs_itm>.
      DATA: ptr_wtab TYPE REF TO data.
      FIELD-SYMBOLS: <fs_wtab> TYPE ANY.
      CREATE DATA ptr_wtab TYPE (tabname).
      ASSIGN ptr_wtab->* TO <fs_wtab>.
      DATA: itabname(15) TYPE c.
      itabname = '<fs_wtab>'.
    Standard list status with 'SAVE' button
      SET PF-STATUS 'STLI'.
      CLEAR sl_update.
    Maintain authorisation access in table ZTABAUTH
    Key fields:  tabname - Table name
                 bname   = sy-uname - User name
                 statu   = 'X' - maintain
                           ' ' - view
    Check authorisation access
      acheck.
      SELECT fieldname position keyflag datatype
        INTO TABLE ifield
        FROM dd03l
        WHERE tabname = tabname
          AND fieldname NOT LIKE '.INCLU%'
        ORDER BY position.
      FIELD-SYMBOLS: <f1> TYPE ANY.
      DATA: tab_field(60) TYPE c,
            sline LIKE sy-lisel.
      DATA: field_attr LIKE dfies.
      DATA: BEGIN OF tfield_attr OCCURS 0.
              INCLUDE STRUCTURE field_attr.
      DATA: END OF tfield_attr.
      LOOP AT ifield.
        CALL FUNCTION 'G_FIELD_READ'
          EXPORTING
            table      = tabname
            fieldname  = ifield-fieldname
            text_flag  = 'X'
          IMPORTING
            field_attr = field_attr.
        tfield_attr = field_attr.
        APPEND tfield_attr.
      ENDLOOP.
      IF sl_sel = 'X'.
        SELECT *
          FROM (tabname)
          INTO TABLE <fs_itab> UP TO numrows ROWS
          WHERE (ds_clauses-where_tab).
      ELSE.
        SELECT *
          FROM (tabname)
          INTO TABLE <fs_itab> UP TO numrows ROWS.
      ENDIF.
      DESCRIBE TABLE <fs_itab> LINES sl_lines.
    Show two extra lines to allow addition up to 2 new lines
      IF sl_update = 'X'.
        DO 2 TIMES.
          APPEND INITIAL LINE TO <fs_itab>.
        ENDDO.
      ENDIF.
      DATA: info(22) VALUE 'D - Delete, M - Modify'.
      WRITE: / icon_information AS ICON QUICKINFO info.
      WRITE ' '.
      CLEAR check_len.
      LOOP AT tfield_attr.
        IF tfield_attr-datatype = 'CLNT'.
          CONTINUE.
        ENDIF.
        len = tfield_attr-outputlen.
        IF tfield_attr-keyflag = 'X'.
          check_len = check_len + len + 1.
        ENDIF.
        IF tfield_attr-scrtext_m IS NOT INITIAL.
          WRITE: AT (len) tfield_attr-scrtext_m COLOR 1.
        ELSE.
          WRITE: AT (len) tfield_attr-fieldtext COLOR 1.
        ENDIF.
      ENDLOOP.
      CLEAR ss_step.
      CLEAR ss_act.
      LOOP AT <fs_itab> INTO <fs_wtab>.
        IF sy-tabix LE sl_lines.
          ss_step = 1.
        ELSE.
          CLEAR ss_step.
        ENDIF.
    In field SS_STEP put D -  to delete record
                         M -  to modify/add new record
        IF sl_update = 'X'.
          WRITE:/ icon_change AS ICON.
          IF ss_step = 1.
            WRITE:  ss_act INPUT ON.
          ELSE.
            ss_act = 'M'.
            WRITE:  ss_act.
            CLEAR ss_act.
          ENDIF.
        ELSE.
          WRITE:/ icon_display AS ICON.
          WRITE:  ss_act COLOR 2.
        ENDIF.
        LOOP AT ifield.
    Maintain client dependant tables in the same client
          IF ifield-datatype = 'CLNT'.
            sl_mandt = 'X'.
            CONTINUE.
          ENDIF.
          CONCATENATE itabname '-' ifield-fieldname INTO tab_field.
          ASSIGN (tab_field) TO <f1>.
          IF sl_update = 'X'.
            IF ifield-keyflag = 'X' AND ss_step IS NOT INITIAL.
              WRITE: <f1> COLOR 4.
            ELSE.
              WRITE: <f1> INPUT ON.
            ENDIF.
          ELSE.
            IF ifield-keyflag = 'X' AND ss_step IS NOT INITIAL.
              WRITE: <f1> COLOR 4.
            ELSE.
              WRITE: <f1> COLOR 2.
            ENDIF.
          ENDIF.
          UNASSIGN <f1>.
        ENDLOOP.
      ENDLOOP.
    END-OF-SELECTION.
    END-OF-SELECTION.
    AT USER-COMMAND.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'SAVE'.
          IF sl_update = 'X'.
            CLEAR: sl_step,
                   sl_status,
                   sl_subrc,
                   <fs_wtab>,
                   d_stat,
                   m_stat,
                   max_len.
            REFRESH <fs_itd>.
            REFRESH <fs_itm>.
            DO.
              IF sl_status <> 0.
                EXIT.
              ENDIF.
              ADD 1 TO sl_step.
              IF sl_subrc <> 0.
                EXIT.
              ENDIF.
              CLEAR ss_step.
              CLEAR ss_act.
              READ LINE sl_step
                   FIELD VALUE ss_act INTO f_value.
              sl_subrc = sy-subrc.
              IF f_value(1) EQ 'D' OR f_value(1) = 'd'.
                ss_step = 1.  "Delete
              ELSEIF f_value(1) EQ 'M' OR f_value(1) = 'm'.
                ss_step = 2.  "Modify
              ELSE.
                CLEAR ss_step.
              ENDIF.
              CHECK sy-lisel(3) = '0Z '.
              IF ss_step GT 0.
                CLEAR sline.
                sline = sy-lisel+5(250).
                max_len = 250.
                CHECK sline(check_len) <> ' '.
                LOOP AT tfield_attr.
                  CONCATENATE itabname '-' tfield_attr-fieldname
                                                  INTO tab_field.
                  ASSIGN (tab_field) TO <f1>.
                  IF tfield_attr-fieldname = 'MANDT'.
                    <f1> = sy-mandt.
                  ELSE.
                    CLEAR f_value.
                    IF max_len LT tfield_attr-outputlen.
                      max_len = 255.
                      ADD 1 TO sl_step.
                      READ LINE sl_step.
                      sline = sy-lisel.
                    ENDIF.
                    f_value = sline(tfield_attr-outputlen).
                    max_len = max_len - tfield_attr-outputlen - 1.
                    IF tfield_attr-inttype = 'D'.
                      IF f_value CO ' 0./-'.
                        CLEAR sl_datum.
                        <f1> = sl_datum.
                      ELSE.
                        CALL FUNCTION 'CONVERT_DATE_INPUT'
                          EXPORTING
                            input                     = f_value
                            plausibility_check        = 'X'
                          IMPORTING
                            output                    = sl_datum
                          EXCEPTIONS
                            plausibility_check_failed = 1
                            wrong_format_in_input     = 2
                            OTHERS                    = 3.
                        IF sy-subrc = 0.
                          <f1> = sl_datum.
                        ELSE.
                          text = 'Invalid Date'.
                          sl_status = 1.
                          EXIT.
                        ENDIF.
                      ENDIF.
                    ELSEIF tfield_attr-inttype = 'T'.
                      IF f_value CO ' 0:'.
                        CLEAR sl_uzeit.
                        <f1> = sl_uzeit.
                      ELSE.
                        CALL FUNCTION 'CONVERT_TIME_INPUT'
                          EXPORTING
                            input                     = f_value
                            plausibility_check        = 'X'
                          IMPORTING
                            output                    = sl_uzeit
                          EXCEPTIONS
                            plausibility_check_failed = 1
                            wrong_format_in_input     = 2
                            OTHERS                    = 3.
                        IF sy-subrc = 0.
                          <f1> = sl_uzeit.
                        ELSE.
                          text = 'Invalid Time'.
                          sl_status = 1.
                          EXIT.
                        ENDIF.
                      ENDIF.
                    ELSEIF tfield_attr-inttype = 'C'.
                      TRANSLATE f_value TO UPPER CASE.
                      <f1> = f_value.
                    ELSE.
                      TRANSLATE f_value USING ', '.
                      CONDENSE f_value NO-GAPS.
                      TRY.
                          <f1> = f_value.
                        CATCH cx_root INTO ref_ptr.
                          text = ref_ptr->get_text( ).
                          sl_status = 1.
                          EXIT.
                      ENDTRY.
                    ENDIF.
                    SHIFT sline BY tfield_attr-outputlen PLACES.
                    SHIFT sline LEFT.
                  ENDIF.
                  UNASSIGN <f1>.
                ENDLOOP.
                IF sl_status = 0.
                  CASE ss_step.
                    WHEN 1.  "Delete
                      ADD 1 TO d_stat.
                      APPEND <fs_wtab> TO <fs_itd>.
                    WHEN 2.  "Modify
                      ADD 1 TO m_stat.
                      APPEND <fs_wtab> TO <fs_itm>.
                  ENDCASE.
                ENDIF.
              ENDIF.
            ENDDO.
            IF sl_status = 0.
              IF d_stat IS NOT INITIAL.
                slchar = d_stat.
                CONCATENATE 'Deleted -' slchar 'record.' INTO text
                  SEPARATED BY space.
                DELETE (tabname) FROM TABLE <fs_itd>.
              ENDIF.
              IF m_stat IS NOT INITIAL.
                slchar = m_stat.
                CONCATENATE text 'Modified -' slchar 'record.' INTO text
                  SEPARATED BY space.
                MODIFY (tabname) FROM TABLE <fs_itm>.
              ENDIF.
              IF d_stat IS INITIAL AND m_stat IS INITIAL.
                MESSAGE 'No changes were done' TYPE 'S'.
              ELSE.
                MESSAGE text TYPE 'S'.
              ENDIF.
              LEAVE.
            ELSE.
              MESSAGE text TYPE 'I'.
              EXIT.
            ENDIF.
          ELSE.
            LEAVE.
          ENDIF.
      ENDCASE.
    *--END--
    Below is Function for a Dynamic Selection Screen
    FUNCTION zstan_selections.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(TABNAME) LIKE  DD02L-TABNAME DEFAULT 'ZSCARE'
    *"  EXPORTING
    *"     VALUE(DS_CLAUSES) TYPE  RSDS_WHERE
    *"  EXCEPTIONS
    *"      TABLE_NOT_VALID
    *"      OTHER_ERROR
      DATA texpr TYPE rsds_texpr.
      DATA twhere TYPE rsds_twhere.
      DATA trange TYPE rsds_trange.
      DATA BEGIN OF qcat.                    "Selections View for
              INCLUDE STRUCTURE rsdsqcat.    "Free Selectoptions
      DATA END OF qcat.
      DATA BEGIN OF tabs OCCURS 10.
              INCLUDE STRUCTURE rsdstabs.
      DATA END   OF tabs.
      DATA BEGIN OF fields OCCURS 10.
              INCLUDE STRUCTURE rsdsfields.
      DATA END   OF fields.
      DATA BEGIN OF efields OCCURS 10.
              INCLUDE STRUCTURE rsdsfields.
      DATA END   OF efields.
      DATA selid LIKE rsdynsel-selid.
      DATA actnum LIKE sy-tfill.
      DATA title LIKE sy-title VALUE 'Selection Screen'.
      DATA: maxnum LIKE sy-subrc VALUE '69'.
      CLEAR    tabs.
      tabs-prim_tab = tabname.
      COLLECT  tabs.
      DATA: position LIKE dd03l-position.
      DATA: keyflag  LIKE dd03l-keyflag.
      CLEAR fields.
      fields-tablename = tabname.
      fields-sign      = 'I'.
      DATA: step LIKE sy-subrc.
      SELECT fieldname keyflag position
        INTO (fields-fieldname, keyflag, position)
        FROM dd03l
        WHERE tabname = tabname
          AND fieldname NOT LIKE '.INCLU%'
          AND datatype NE 'CLNT'
        ORDER BY position.
        ADD 1 TO step.
        CHECK step LE maxnum.
        IF keyflag <> 'X'.
          efields = fields.
          APPEND efields.
        ENDIF.
        APPEND fields.
      ENDSELECT.
      IF sy-subrc <> 0.
        RAISE table_not_valid.
      ENDIF.
      CALL FUNCTION 'FREE_SELECTIONS_INIT'
        EXPORTING
          expressions              = texpr
          kind                     = 'F'
        IMPORTING
          selection_id             = selid
          expressions              = texpr
          where_clauses            = twhere
          field_ranges             = trange
          number_of_active_fields  = actnum
        TABLES
          tables_tab               = tabs
          fields_tab               = fields
          fields_not_selected      = efields
        EXCEPTIONS
          fields_incomplete        = 01
          fields_no_join           = 02
          field_not_found          = 03
          no_tables                = 04
          table_not_found          = 05
          expression_not_supported = 06
          incorrect_expression     = 07
          illegal_kind             = 08
          area_not_found           = 09
          inconsistent_area        = 10
          kind_f_no_fields_left    = 11
          kind_f_no_fields         = 12
          too_many_fields          = 13.
      IF sy-subrc = 0.
        CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
          EXPORTING
            selection_id            = selid
            title                   = title
          IMPORTING
            where_clauses           = twhere
            expressions             = texpr
            field_ranges            = trange
            number_of_active_fields = actnum
          TABLES
            fields_tab              = fields
          EXCEPTIONS
            internal_error          = 01
            no_action               = 02
            no_fields_selected      = 03
            no_tables_selected      = 04
            selid_not_found         = 05.
        IF sy-subrc = 0.
          CLEAR ds_clauses.
          MOVE tabname TO ds_clauses-tablename.
          READ TABLE twhere WITH KEY ds_clauses-tablename INTO ds_clauses.
          IF sy-subrc <> 0.
            RAISE other_error.
          ENDIF.
        ELSE.
          RAISE other_error.
        ENDIF.
      ELSE.
        RAISE other_error.
      ENDIF.
    ENDFUNCTION.
    Regards,
    Shiva

  • ALV Report Editable field

    Hi Expart ,
    Ex:  In  ALV O/P having check box field have  10 row . I want editable perticular row  in o/p list . how can i create .
    Please tell me or give me one Example .
    Regards
    Bhabani

    Hi Sankardey,
    You can make use of method MC_STYLE_ENABLED of class CL_GUI_ALV_GRID to achieve this.
    Please refer below code snippet for your reference :-
    FIELD-SYMBOLS : <fs_fieldcat> TYPE lvc_s_fcat.
      LOOP AT i_fieldcat ASSIGNING <fs_fieldcat>.
        CASE <fs_fieldcat>-fieldname.
          WHEN 'ERNAM'.
    * Making a column as Editable
            <fs_fieldcat>-edit = 'X'.
        ENDCASE.
      ENDLOOP.
    * Making a particular cell as non-editable and other editable
      CLEAR w_style.
      w_style-fieldname = 'ERNAM'.
      w_style-style = cl_gui_alv_grid=>mc_style_enabled.
      REFRESH wa-cellstyles.
      APPEND w_style TO wa-cellstyles.
      MODIFY itab FROM wa INDEX 3 TRANSPORTING cellstyles.
    Kindly set to resolved if it helps you.
    Regards
    Abhii

  • Dynamic display of fields of table in ALV report.

    To display the records of a table in ALV report dynamically such that first 10 fields of the table should only be displayed excluding 'mandt' field .
    That is field no 2nd to 11th should be displayed.

    parameters: p_vari type slis_vari.
    at selection-screen on value-request for p_vari.
      perform alv_variant_f4 changing p_vari.
    form alv_variant_f4 changing l_vari type slis_vari.
    On F4 for layout selection - Get laouts created to this report.
      data: l_variant type disvariant.
      l_variant-report   = sy-repid.
      l_variant-username = sy-uname.
      call function 'REUSE_ALV_VARIANT_F4'
        exporting
          is_variant = l_variant
          i_save     = 'A'
        importing
          es_variant = l_variant
        exceptions
          others     = 1.
      if sy-subrc = 0.
        l_vari = l_variant-variant.
      endif.
    Create a structure
    data: wa_layout type disvariant.
    fill up the layout with selected fields.
    wa_layout-report = sy-repid.
    wa_layout-username = sy-uname " Choose this if you want user specific
    wa_layout-variant = p_vari.
    Assign the same to the REUSE_ALV_GRID_DISPLAY
    it is a import paramter  IS_VARIANT = wa_layout.
    All you have to do is first execute the report and save layouts what exactly you want
    and then next time you run the report you will get a chance to select the layout of your own.
    or
    You can get rid of MANDT field from fieldcatalog and internal table by creating a new
    structure. I mean, if you know you always want to display the field from 2 to 11 then simply
    delete the field from fieldcatalog.
    You can assign to different field catalog using Field symbols and change your internal
    table as well since you have created a dynamic internal table.
    Let me know if you need more.

  • How to make optional fields in alv report

    Hello Experts,
                             Can anyone tell me how to do fields as optional in ALV report Output. My requirement is I want to display only few fields as default in my output and remaining fields will be added if needed by clicking the layout button.For clear example i have totally 10 fields in that fields i want to display only 5 fields and remaining 5 fields will be optional and when i click on layout button then i can add those 5 fields also. Can anyone tell me how to do this.
    Thanks,
    Vinod.

    Hi Vinod,
    As suggested by Eitan, kindly use the attribute NO_OUT = 'X' in field catalog for the appropriate column.  Based on that we can hide the fields.
         L_FIELDCAT-NO_OUT = 'X'.
    Also we can group the hidden fields in layout using SP_GROUP attribute in Field catalog as shown below. Based on that, we can separate the fields based on category/group.
         L_FIELDCAT-SP_GROUP = 'A'.
    Regards
    Rajkumar Narasimman

  • Urgent: regarding ALV  report display problem

    hi,
    There are 3 problems:-
    1.) I had made a ALV report in which i have to display 'POSTING DATE' (iseg-budat) when we execute the report i.e. it should be displayed as  PERIOD :- _______  to _______ on alv report ..
    2.)the 2nd problem is dat when i use the '  wa_fieldcat-no_zero = 'X'.  It eliminates all the leading zeros which are present which is okay when i it displays material no.. but the problem is dat it also deletes the other fields where the values are to be zeros.
    i had used this FM:-
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
       INPUT = ITS1-MATNR
       IMPORTING
       OUTPUT = ITS1-MATNR.
    so that only matnr field are to be 0's.
    3.) I want to delete the rows which use to contain the values 0's as there are no calculations are performing as these are displayed .
    ANYbody having solution of this problem ,plzzzz provide the soluion of it as it is most urgent to me and dat person will definately rewarded.
    regards,
    ric.s

    hi kiran,
    thanks for ur response. here is d code which i am using it and plzz help me to figure out where i have to make changes:-
    REPORT  ZTEST03.
    TABLES: ISEG,MARA.
    TYPE-POOLS : SLIS.
    INTERNAL TABLE FOR INVENTORY STOCK *****************
    DATA: BEGIN OF ITS1 OCCURS 0,
          MATNR LIKE ISEG-MATNR,
          MEINS LIKE ISEG-MEINS,
          MENGE LIKE ISEG-MENGE,
          WRTZL LIKE ISEG-WRTZL,
          BUCHM LIKE ISEG-BUCHM,
          WRTBM LIKE ISEG-WRTBM,
          WERKS LIKE ISEG-WERKS,
          BUDAT LIKE ISEG-BUDAT,
          MTART LIKE MARA-MTART,
          ITEMDESC LIKE MAKT-MAKTX,
          DIFFQTY LIKE ISEG-BUCHM,
          DIFFVALUE LIKE ISEG-WRTBM,
          END OF ITS1.
    data: t_heading type slis_t_listheader.
    SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
    *********PARAMETERS*********
    PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
    *********SELECTION SCREEN OPTIONS*********
    SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT,
                     M_TYPE  FOR MARA-MTART,
                     IT_M FOR MARA-MATNR.
    *********DEFINING VARIABLES*********
      SELECTION-SCREEN END OF BLOCK par1.
    TOP-OF-PAGE.
         PERFORM PG_HEADER.
    START-OF-SELECTION.
    SELECT DISTINCT A~MATNR A~MEINS A~MENGE A~WRTZL A~BUCHM A~WRTBM A~WERKS A~BUDAT B~MTART
       FROM ISEG AS A INNER JOIN MARA AS B ON B~MATNR = A~MATNR
         INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE B~MATNR = A~MATNR  AND B~MEINS = A~MEINS AND A~WERKS = PLANT AND A~BUDAT IN R_DATE AND B~MTART IN M_TYPE AND B~MATNR IN IT_M.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
       INPUT = ITS1-MATNR
       IMPORTING
       OUTPUT = ITS1-MATNR.
      SORT ITS1 BY MATNR.
      DELETE ADJACENT DUPLICATES  FROM  ITS1 WHERE MENGE = 0 AND BUCHM = 0.
    LOOP AT ITS1.
         ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
         ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
         SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
         MODIFY ITS1.
    ENDLOOP.
    PERFORM PRN_SMSTOCK_ALV.
    WRITING DATA FROM D TABLES**********
    FORM PG_HEADER.
    WRITE : 'PHYSICAL INVENTORY AUDIT REPORT             PLANT : ', PLANT.
    ENDFORM.
    *&      Form  PRN_SMSTOCK_ALV
          text
    -->  p1        text
    <--  p2        text
    form PRN_SMSTOCK_ALV .
    data: w_title   type lvc_title,
          w_repid   type syrepid,
          w_comm    type slis_formname,
          w_status  type slis_formname,
          x_layout  type slis_layout_alv,
          t_event    type slis_t_event,
          t_fieldcat type slis_t_fieldcat_alv,
          t_sort     type slis_t_sortinfo_alv.
    refresh t_fieldcat.
    refresh t_event.
    refresh t_sort.
    clear x_layout.
    clear w_title.
      perform set_fieldcat2 using:
    1  'MTART'     'MTART'     'MARA'  '15'  space 'MATERIAL TYPE'        space  space  space space space space space space SPACE t_fieldcat 'L' 'C',
    2  'MATNR'     'MATNR'     'MARA'  '13'  space 'MATERIAL NO. '        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    3  'ITEMDESC'  'MAKTX'     'MAKT'  '25'  space 'MATERIAL DESCRIPTION' space  space  space space space space space space SPACE t_fieldcat 'L' 'C',
    4  'MEINS'     'MEINS'     'MARA'  '5'   space 'UOM'                  space  space  space space space space space space SPACE t_fieldcat 'C' 'C',
    5  'MENGE'     'MENGE'     'ISEG'  '13'  space 'ORG.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    6  'WRTZL'     'WRTZL'     'ISEG'  '13'  space 'ORG.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    7  'BUCHM'     'BUCHM'     'ISEG'  '13'  space 'PHY.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    8  'WRTBM'     'WRTBM'     'ISEG'  '13'  space 'PHY.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    9  'DIFFQTY'   'MENGE'     'ISEG'  '13'  space 'DIFF.INV.QTY'         space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    10 'DIFFVALUE' 'WRTZL'     'ISEG'  '13'  space 'DIFF.INV.VALUE'       space  space  space space space space space space SPACE t_fieldcat SPACE 'P'.
    x_layout-zebra = 'X'.
    perform set_top_page_heading using t_heading t_event.
    perform set_events using t_event.
      w_status = ''.
      w_repid = sy-repid.
      w_comm   = 'USER_COMMAND'.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program       = w_repid
          it_fieldcat              = t_fieldcat
          i_Callback_top_of_page   = 'Top-of-page'
          is_layout                = x_layout
          it_sort                  = t_sort
          i_callback_pf_status_set = w_status
          i_callback_user_command  = w_comm
          i_save                   = 'X'
          it_events                = t_event
          i_grid_title             = w_title
          tables
          t_outtab                 = ITS1
        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.
    FORM set_fieldcat2 USING
          p_colpos p_fieldname p_ref_fieldname p_ref_tabname
          p_outputlen p_noout
          p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
          p_hotspot p_showasicon p_checkbox p_edit
          p_dosum
          t_fieldcat TYPE slis_t_fieldcat_alv
          P_JUST
          P_FTYPE.
      DATA: wa_fieldcat TYPE slis_fieldcat_alv.
      CLEAR wa_fieldcat.
    General settings
      wa_fieldcat-fieldname = p_fieldname.
    wa_fieldcat-no_zero = 'X'.
      wa_fieldcat-col_pos = p_colpos.
      wa_fieldcat-no_out = p_noout.
      wa_fieldcat-hotspot = p_hotspot.
      wa_fieldcat-checkbox = p_checkbox.
      wa_fieldcat-icon = p_showasicon.
      wa_fieldcat-do_sum = p_dosum.
    Set output length.
      IF NOT p_outputlen IS INITIAL.
        wa_fieldcat-outputlen = p_outputlen.
      ENDIF.
    Set text headers.
    IF NOT p_seltext_m IS INITIAL.
        wa_fieldcat-seltext_m = p_seltext_m.
    ENDIF.
    IF NOT p_seltext_l IS INITIAL.
        wa_fieldcat-seltext_l = p_seltext_l.
    ENDIF.
    IF NOT p_seltext_s IS INITIAL.
        wa_fieldcat-seltext_s = p_seltext_s.
    ENDIF.
      IF NOT p_reptext_ddic IS INITIAL.
        wa_fieldcat-reptext_ddic = p_reptext_ddic.
      ENDIF.
    IF NOT p_ddictxt IS INITIAL.
        wa_fieldcat-ddictxt = p_ddictxt.
    ENDIF.
      IF NOT P_JUST IS INITIAL.
        WA_FIELDCAT-JUST = P_JUST.
      ENDIF.
    Set as editable or not.
      IF NOT p_edit IS INITIAL.
        wa_fieldcat-input     = 'X'.
        wa_fieldcat-edit     = 'X'.
      ENDIF.
      APPEND wa_fieldcat TO t_fieldcat.
    ENDFORM.                   "set_fieldcat2
    ======================== Subroutines called by ALV ================
    *&      Form  top_of_page
          Called on top_of_page ALV event.
          Prints the heading.
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
         exporting
              it_list_commentary = t_heading.
    ENDFORM.
    form set_top_page_heading using t_heading type slis_t_listheader
                                    t_events  type slis_t_event.
    data: x_heading type slis_listheader,
          x_event   type line of slis_t_event.
    Report title
      clear t_heading[].
      clear x_heading.
      x_heading-typ = 'H'.
      x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
      append x_heading to t_heading.
    Plant Name
    clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'PLANT: '.
      x_heading-info = its1-werks.
      append x_heading to t_heading.
    Posting Date
    *clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'POSTING DATE: '.
    x_heading-info = ITS1-BUDAT.
    append x_heading to t_heading.
    Control Date
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'CONTROL No: '.
    x_heading-info = its1-werks.
    append x_heading to t_heading.
    Control date
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'CONTROL DATE: '.
    x_heading-info = its1-werks.
    append x_heading to t_heading.
    User who is running the report
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'User: '.
    x_heading-info = sy-uname.
    append x_heading to t_heading.
    Date of execution
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Date: '.
      write sy-datum to x_heading-info.
      append x_heading to t_heading.
    Time of execution
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Time: '.
      write sy-uzeit to x_heading-info.
      append x_heading to t_heading.
    Top of page event
      x_event-name = slis_ev_top_of_page.
      x_event-form = 'TOP_OF_PAGE'.
      append x_event to t_events.
    endform.
    form set_events using t_events type slis_t_event.
    data: x_event   type line of slis_t_event.
    endform.
    plzzz help me out as it is most urgent to me.
    regards,
    ric.s

  • Field width in ALV report

    Hi,
    How to increase the field width of a field in ALV report.
    I mean, in a ALV report, the field description of a field is not showing correctly. IF i try to extend the field width by the mouse/coursor, it displays the correct description.
    IS there any way where for displaying the  field description correctly?
    Thanks,
    Kumar

    Hi,
    Go through the sample code,
    *& Report ZDEMO_ALVLIST *
    *& Example of a simple ALV List Report *
    *& The basic requirement for this demo is to display a number of *
    *& fields from the EKKO table. *
    REPORT zdemo_alvlist .
    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.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    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_LIST_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_XEVENTS
    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.
    Regards,
    Raj.

  • Merge field label of two fields in ALV report

    Hi,
    Greetings of the day !!
    I have a requirement to create a ALV report and the alv report has three fields(say F1, F2, F3). Where F1 and F2 fall under same category and i need to have single field label for both these fields.
    How can I merge the field label of the fields F1 and F2?
    Pl. share your knowledge regarding this.
    Thanking you.
    Regards,
    Raghu

    Hi Jodeswara Rao,
    I need to display a ALV report with fields F1, F2 and F3. But F1 and F2 should have same field Label.
    Header 1
    Header 3
    F1
    F2
    F3

Maybe you are looking for

  • How to save the favorites ? How to subscribe to a page ?

    Hello, I instaled version 29 a few days ago. Since that time I cannot anymore: - subscribe to a Web page as a favorite - save all my favorites Is there a solution or should I try to reinstall the previous version 28 whch was just fine ? Thanks for an

  • How to import ORacle 7 database to Oracle 10g by using OWB?

    Hi, I have an old Oracle 7 database that I want to import into an Oracle 10g database by using OWB. I have made an odbc connection to the Oracle 7 database, and the dblink is working when I test it through SQL Plus, and I also manage to see the sourc

  • Hp vectra system recovery f10 key prompt to backup files

    Does the HP Vectra system recovery f10 key prompt you to backup files prior to format?

  • BI Tools with SAP BI

    Hi Can any one please provide more information on IBM Datastage (BI Tool) Data Quality Technology and how they can be with SAP BI Thanks

  • Can't exec external program (Permission denied)-

    Hi All We have mentioned external command in SM69 and executed the command in SM49, I am getting the below error message. Command executed:       /home/ SMIME/run/signand.sh : Target host:            dt02 Can't exec external program (Permission denie