Alv report headings in two lines

Hi all,
I have created an ALV report. Now the requirement is that the 60 odd columns should be divided into 3 parts.
The first 20 colums come under a common heading above the column heading.
21 to 40 come under another heading and so on.
How can I give two lines of column headings.
It should look like this.
Project                 No of Enquiries                           Sales orders
                   col1     col2     col3.....                  col21   col22        col23...
Please help.
Regards,
BP

in the field catalog u will have an option to mention the row position.. check that..
fc-fieldname = 'KUNRES'.
fc-row_pos = '2'.            "<< this is what u needed..
fc-seltext_s = 'Total'.
fc-do_sum = 'X'.
APPEND fc. CLEAR fc.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
i_callback_program = alv_repid
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = alv_layout
it_fieldcat = fc[]             "<<<<<<<<<<<<fiedl catalog here..
i_default = 'X'
i_save = 'A'
is_variant = alv_variant
i_tabname_header = 'HEADER'
i_tabname_item = 'LIST'
is_keyinfo = alv_keyinfo
is_print = alv_print
TABLES
t_outtab_header = header
t_outtab_item = list.

Similar Messages

  • Alv report to have 2 lines for column header

    How do I set the column header to have 2 lines?
    eg
              Week Ending  --- 1st  line
               09.10.2007    ---  2nd line
    My report always ends up with 2 detail lines when I tried to insert it into the catalog.

    Try this it may help you for multiple values for one instance....
    *Type-pools
    TYPE-POOLS: slis.
    Data declarations.
    DATA: BEGIN OF t_vbak OCCURS 0,
    vbeln TYPE vbeln,
    bstnk TYPE vbak-bstnk,
    erdat TYPE vbak-erdat,
    kunnr TYPE vbak-kunnr,
    END OF t_vbak.
    DATA: BEGIN OF t_vbap OCCURS 0,
    vbeln TYPE vbeln,
    matnr TYPE vbap-matnr,
    netpr TYPE vbap-netpr,
    waerk TYPE vbap-waerk,
    kwmeng TYPE vbap-kwmeng,
    meins TYPE vbap-meins,
    END OF t_vbap.
    DATA: t_fieldcatalog1 TYPE slis_t_fieldcat_alv.
    DATA: t_fieldcatalog2 TYPE slis_t_fieldcat_alv.
    DATA: v_repid TYPE syrepid.
    DATA: s_layout TYPE slis_layout_alv.
    DATA: v_tabname TYPE slis_tabname.
    DATA: t_events TYPE slis_t_event.
    start-of-selection event.
    START-OF-SELECTION.
    v_repid = sy-repid.
    Get the fieldcatalog for the first block
    PERFORM get_fieldcat1 CHANGING t_fieldcatalog1.
    Get the fieldcatalog for the second block
    PERFORM get_fieldcat2 CHANGING t_fieldcatalog2.
    Get the data for the first block
    SELECT vbeln bstnk erdat kunnr UP TO 10 ROWS
    INTO TABLE t_vbak
    FROM vbak WHERE vbeln > '0060000100'.
    Get the data for the second block
    SELECT vbeln matnr netpr waerk kwmeng meins UP TO 10
    ROWS
    INTO TABLE t_vbap
    FROM vbap WHERE vbeln > '0060000100'.
    init
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
    i_callback_program = v_repid.
    First block
    v_tabname = 'ITAB1'.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    is_layout = s_layout
    it_fieldcat = t_fieldcatalog1
    i_tabname = v_tabname
    it_events = t_events
    TABLES
    t_outtab = t_vbak.
    Second block
    v_tabname = 'ITAB2'.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    is_layout = s_layout
    it_fieldcat = t_fieldcatalog2
    i_tabname = v_tabname
    it_events = t_events
    TABLES
    t_outtab = t_vbap.
    *Display
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    FORM GET_FIELDCAT1
    Get the field catalog for the first block
    FORM get_fieldcat1 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname = 'T_VBAK'.
    s_fieldcatalog-ref_tabname = 'VBAK'.
    s_fieldcatalog-ref_fieldname = 'VBELN'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    Customer purchase order.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'BSTNK'.
    s_fieldcatalog-tabname = 'T_VBAK'.
    s_fieldcatalog-ref_tabname = 'VBAK'.
    s_fieldcatalog-ref_fieldname = 'BSTNK'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    Creation date.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'ERDAT'.
    s_fieldcatalog-tabname = 'T_VBAK'.
    s_fieldcatalog-ref_tabname = 'VBAK'.
    s_fieldcatalog-ref_fieldname = 'ERDAT'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    Customer
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'KUNNR'.
    s_fieldcatalog-tabname = 'T_VBAK'.
    s_fieldcatalog-ref_tabname = 'VBAK'.
    s_fieldcatalog-ref_fieldname = 'KUNNR'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    ENDFORM.
    FORM GET_FIELDCAT2
    Get the field catalog for the second block
    FORM get_fieldcat2 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname = 'T_VBAP'.
    s_fieldcatalog-ref_tabname = 'VBAP'.
    s_fieldcatalog-ref_fieldname = 'VBELN'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    Material number
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'MATNR'.
    s_fieldcatalog-tabname = 'T_VBAP'.
    s_fieldcatalog-ref_tabname = 'VBAP'.
    s_fieldcatalog-ref_fieldname = 'MATNR'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    Net price
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'NETPR'.
    s_fieldcatalog-tabname = 'T_VBAP'.
    s_fieldcatalog-ref_tabname = 'VBAP'.
    s_fieldcatalog-ref_fieldname = 'NETPR'.
    s_fieldcatalog-cfieldname = 'WAERK'.
    s_fieldcatalog-ctabname = 'T_VBAP'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    Currency.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'WAERK'.
    s_fieldcatalog-tabname = 'T_VBAP'.
    s_fieldcatalog-ref_tabname = 'VBAP'.
    s_fieldcatalog-ref_fieldname = 'WAERK'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    Quantity
    s_fieldcatalog-col_pos = '5'.
    s_fieldcatalog-fieldname = 'KWMENG'.
    s_fieldcatalog-tabname = 'T_VBAP'.
    s_fieldcatalog-ref_tabname = 'VBAP'.
    s_fieldcatalog-ref_fieldname = 'KWMENG'.
    s_fieldcatalog-qfieldname = 'MEINS'.
    s_fieldcatalog-qtabname = 'T_VBAP'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    UOM
    s_fieldcatalog-col_pos = '6'.
    s_fieldcatalog-fieldname = 'MEINS'.
    s_fieldcatalog-tabname = 'T_VBAP'.
    s_fieldcatalog-ref_tabname = 'VBAP'.
    s_fieldcatalog-ref_fieldname = 'MEINS'.
    APPEND s_fieldcatalog TO lt_fieldcatalog.
    CLEAR s_fieldcatalog.
    ENDFORM.
    ALV Report to have two different Reports
    Plz Reward points if contents are useful,,,

  • Alv column heading in two lines

    Hi,
    In ALV grid column headings is possible in two lines.
    ex.
    material            old material
    Number            Number
    Regards,
    Suresh

    Hi Suresh,
              It is possible in ALV Grid. Please try using the code below:
    Data : it_fieldcat type slis_t_fieldcat_alv,
              wa_fieldcat like line of it_fieldcat,
              IT_LISTHEADER  TYPE SLIS_T_LISTHEADER,
              WA_LISTHEADER  LIKE LINE OF IT_LISTHEADER,
              W_PSTRING1(65) TYPE C,
              W_PSTRING2(60) TYPE C.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = SY-REPID
       I_CALLBACK_TOP_OF_PAGE         = 'TOP'
       IT_FIELDCAT                                  = it_fieldcat
      TABLES
        t_outtab                                         = it_final
    *&      Form  TOP
        TOP OF PAGE FOR ALV REPORT
    FORM TOP.
    *APPENDING HEADER DETAILS
      W_PSTRING1 = text-001.
      WA_LISTHEADER-TYP = 'H'.
      WA_LISTHEADER-INFO = W_PSTRING1.
      APPEND WA_LISTHEADER TO IT_LISTHEADER.
      clear wa_listheader.
      W_PSTRING2 = text-002.
      WA_LISTHEADER-TYP = 'H'.
      WA_LISTHEADER-INFO = W_PSTRING2.
      APPEND WA_LISTHEADER TO IT_LISTHEADER.
       clear wa_listheader.
    FM FOR DISPLAYING THE HEADER
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = IT_LISTHEADER.
      CLEAR IT_LISTHEADER.
    ENDFORM.
    text-001 = ALV Demo
    text-002 = Sample Program
    Output : ALV Demo
                Sample Program
           I hope it will solve your problem.

  • ALV Report: Input on some line items

    Dear All,
    Can you please help me out in this requirement..
    I have a ALV report with checkbox. If I select some checkbox line items and click on Edit button(Custom button) those line items should get enabled and user should be able to input value for those line items. INPUT in fieldcatalog enables the entire set of output, not individually those line items.
    Please can you suggest on that?
    Thanks and regards,
    Atanu

    Hi,
    Herewith i am sending the sample code for the CHECKBOX ALV REPORT.
    TYPE-POOLS: slis.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    DATA: s_layout TYPE slis_layout_alv.
    DATA: BEGIN OF itab OCCURS 0,
    icon TYPE icon-id,
    vbeln TYPE vbeln,
    kunnr TYPE kunnr,
    erdat TYPE erdat,
    box TYPE c,
    END OF itab.
    DATA: v_repid TYPE syrepid.
    START-OF-SELECTION.
    Get the data.
    SELECT vbeln kunnr erdat UP TO 100 ROWS
    FROM vbak
    INTO CORRESPONDING FIELDS OF TABLE itab.
    IF sy-subrc <> 0.
    MESSAGE s208(00) WITH 'No data found'.
    LEAVE LIST-PROCESSING.
    ENDIF.
    Modify the record with red light.
    itab-icon = '@0A@'.
    MODIFY itab TRANSPORTING icon WHERE NOT vbeln IS initial.
    v_repid = sy-repid.
    Get the field catalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'ICON'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-seltext_l = 'Status'.
    s_fieldcatalog-icon = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'VBELN'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'KUNNR'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'KUNNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'ERDAT'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'ERDAT'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    Set the layout.
    s_layout-box_fieldname = 'BOX'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = v_repid
    is_layout = s_layout
    i_callback_pf_status_set = 'SET_PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    it_fieldcat = t_fieldcatalog[]
    TABLES
    t_outtab = itab.
    FORM SET_PF_STATUS *
    --> EXTAB *
    FORM set_pf_status USING extab TYPE slis_t_extab.
    SET PF-STATUS 'TEST2'.
    ENDFORM.
    FORM user_command *
    --> UCOMM *
    --> SELFIELD *
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
    Check the ucomm.
    IF ucomm = 'DETAIL'.
    LOOP AT itab WHERE box = 'X'.
    itab-icon = '@08@'.
    MODIFY itab TRANSPORTING icon.
    ENDLOOP.
    ENDIF.
    selfield-refresh = 'X'.
    ENDFORM.
    Thanks,
    Shankar

  • Displaying an interactive report row using two lines

    Is there a way to take a report row from an interactive report that has too many columns for one display row and display using 2 rows? This would minimize the amount of scrolling the user would then need to do.
    Thanks in advance!

    Hi,
    I dont think we can show a single row as two lines in an interactive report but if you use a classic report instead of interactive then you can do that by creating your own custom report template from scratch and selecting templete type as Named Column (row template) and show the row in what ever way you need...any way if you find any solution for interactive report just post your solution here which will help me too
    Thanks,
    Mahesh

  • ALV Report to have two different Reports

    Hi All,
    I have a need to display two different reports for the same set of data selections, (Successful data and Error Data) in a Single ALV Layout using a Application tool bar Button. Does anyone have a sample code for this kind of requirement. Preferably using Objects.
    Also, how can we check if an object is already created? In other words, how to check for a null reference?
    Thanks in advance.
    Jr.

    Sample code for split alv using OOABAP.
    this would help you in ur requirement.
    go through this program where the screen is divided in two for two alv in different containers.
    DATA: save_ok LIKE sy-ucomm,
          g_container TYPE scrfname VALUE 'CC1',
          g_grid  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          g_max TYPE i VALUE 100.
    declarations for top of page event
    Data:  gv_c_split type ref to cl_gui_splitter_container,
           gv_c_ptv type ref to cl_gui_container,
           gv_alv_ptv type ref to cl_gui_alv_grid,
           o_dd_doc TYPE REF TO cl_dd_document,
           text TYPE sdydo_text_element,
           o_split type ref to cl_gui_easy_splitter_container,
           o_top type ref to cl_gui_container,
           o_bot type ref to cl_gui_container,
           gv_c_vp type ref to cl_gui_container.
    end of declaration for top of page.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    *class lcl_application_dc definition deferred.
    DATA: o_event_receiver TYPE REF TO lcl_event_receiver.
         g_dc type ref to lcl_application_dc.
    DATA: gt_outtab TYPE TABLE OF sbook.
          CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS: handle_f4 FOR EVENT onf4 OF cl_gui_alv_grid
                   IMPORTING e_fieldname
                             es_row_no
                             er_event_data
                             et_bad_cells
                             e_display,
                handle_top_of_page FOR EVENT top_of_page OF cl_gui_alv_grid
                   IMPORTING e_dyndoc_id.
        METHODS: reset.
        METHODS: show_f4.
      PRIVATE SECTION.
    attributes for creating an own F4-Help
    (using a second ALV Grid Control
        DATA: f4_grid TYPE REF TO cl_gui_alv_grid,
              f4_custom_container TYPE REF TO cl_gui_custom_container.
        TYPES: BEGIN OF ty_f4.
        TYPES: value TYPE s_class.
        TYPES: descr(20) TYPE c.
        TYPES: END OF ty_f4.
        DATA: f4_itab TYPE TABLE OF ty_f4.
        DATA: f4_fieldcatalog TYPE lvc_t_fcat.
    attributes to store event parameters
    (after the CALL SCREEN command, the event parameters
    are not accessible)
        TYPES: BEGIN OF onf4_event_parameters_type.
        TYPES: c_fieldname     TYPE lvc_fname.
        TYPES: cs_row_no       TYPE lvc_s_roid.
        TYPES: cr_event_data   TYPE REF TO cl_alv_event_data.
        TYPES: ct_bad_cells    TYPE lvc_t_modi.
        TYPES: c_display       TYPE char01.
        TYPES: END OF onf4_event_parameters_type.
        DATA: f4_params TYPE onf4_event_parameters_type.
    Methods to create own F4-Help
    (This is done using a second ALV Grid Control)
        METHODS: init_f4.
        METHODS: build_fieldcatalog.
        METHODS: fill_f4_itab .
        METHODS: on_double_click FOR EVENT double_click OF cl_gui_alv_grid
                        IMPORTING es_row_no.
    ENDCLASS.                    "lcl_application_f4 DEFINITION
          CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    *§2. Implement an event handler method for event ONF4.
      METHOD handle_f4.
    Save event parameter as global attributes of this class
    (maybe solved differently if you use a function module!)
        f4_params-c_fieldname = e_fieldname.
        f4_params-cs_row_no = es_row_no.
        f4_params-cr_event_data = er_event_data.
        f4_params-ct_bad_cells = et_bad_cells.
        f4_params-c_display = e_display.
    *§3. Call your own f4 help. To customize your popup check
       first if the cell is ready for input (event parameter E_DISPLAY).
    (parameter E_DISPLAY is checked later in method on_double_click)
    (Probably, you would call a function module at this point,
    pass the needed event parameter and call the popup screen
    within that function module. This is not done in this example
    to avoid scattering its code).
        CALL SCREEN 101 STARTING AT 10 10.
    *§7. Inform the ALV Grid Control that an own f4 help has been processed
       to suppress the standard f4 help.
        er_event_data->m_event_handled = 'X'.
      ENDMETHOD.                                                "on_f4
      METHOD show_f4.
       DATA: ls_outtab TYPE sbook.
    initialize own f4 help if needed
        IF f4_custom_container IS INITIAL.
          CALL METHOD init_f4.
        ENDIF.
        CALL METHOD fill_f4_itab.
    refresh list of values in f4 help and show it
        CALL METHOD f4_grid->refresh_table_display.
    CAUTION: Do not use method REFRESH_TABLE_DISPLAY for
    your editable ALV Grid instances while handling events
    DATA_CHANGED or ONf4. You would overwrite intermediate
    values of your output table on frontend.
    'f4_grid' is a non-editable ALV Grid Control for the
    application specific F4-Help. Therefore, calling
    REFRESH_TABLE_DISPLAY for this instance has no
    negative effect.
        CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.                                                "show_f4
      METHOD init_f4.
        DATA: ls_f4_layout TYPE lvc_s_layo.
    build fieldcatalog entries for f4
        CALL METHOD build_fieldcatalog.
    create controls
        CREATE OBJECT f4_custom_container
                  EXPORTING container_name = 'CC_ONF4'.
        CREATE OBJECT f4_grid
                  EXPORTING i_parent = f4_custom_container.
    hide toolbar
        ls_f4_layout-no_toolbar = 'X'.
        CALL METHOD f4_grid->set_table_for_first_display
          EXPORTING
            is_layout       = ls_f4_layout
          CHANGING
            it_fieldcatalog = f4_fieldcatalog
            it_outtab       = f4_itab.
    register event double click on backend
        SET HANDLER me->on_double_click FOR f4_grid.
    flush since 'ls_layout' is local!
        CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.                                                "init_f4
      METHOD fill_f4_itab.
        DATA ls_f4_itab TYPE ty_f4.
    Delete all entries in f4_itab to determine
    offered values dynamically
        CLEAR f4_itab[].
        ls_f4_itab-value = 'C'.
        ls_f4_itab-descr = text-t03. "Business Class
        APPEND ls_f4_itab TO f4_itab.
        ls_f4_itab-value = 'Y'.
        ls_f4_itab-descr = text-t04. "Economie Class
        APPEND ls_f4_itab TO f4_itab.
        ls_f4_itab-value = 'F'.
        ls_f4_itab-descr = text-t05. "First Class
        APPEND ls_f4_itab TO f4_itab.
      ENDMETHOD.                    "fill_f4_itab
      METHOD build_fieldcatalog.
        DATA: ls_fcat TYPE lvc_s_fcat.
        CLEAR ls_fcat.
        ls_fcat-fieldname = 'VALUE'.
        ls_fcat-coltext = text-t02.
       ls_fcat-inttype = 'S_CLASS'.
        ls_fcat-outputlen = 5.
        APPEND ls_fcat TO f4_fieldcatalog.
        CLEAR ls_fcat.
        ls_fcat-fieldname = 'DESCR'.
        ls_fcat-coltext = text-t01.
        ls_fcat-inttype = 'C'.
        ls_fcat-outputlen = 20.
        APPEND ls_fcat TO f4_fieldcatalog.
      ENDMETHOD.                    "build_fieldcatalog
      METHOD on_double_click.
    *§5. If not already caught by your own f4 help, check whether
       the triggered cell was ready for input by using E_DISPLAY
       and if not, exit.
        IF f4_params-c_display EQ 'X'.
          LEAVE SCREEN.
        ENDIF.
    *§6. After the user selected a value, pass it to the ALV Grid Control:
    *§  6a. Define a field symbol of type: LVC_T_MODI and a structure of
          type LVC_S_MODI to pass the value later on.
        FIELD-SYMBOLS  TYPE lvc_t_modi.
        DATA: ls_modi TYPE lvc_s_modi,
              ls_f4_itab TYPE ty_f4.
    *§  6b. Dereference attribute M_DATA into your field symbol and add
          the selected value to the table to which this symbol points to.
        ASSIGN f4_params-cr_event_data->m_data->* TO .
        LEAVE TO SCREEN 0.
      ENDMETHOD.                    "on_double_click
      METHOD reset.
        FIELD-SYMBOLS display_document
                 EXPORTING parent = o_top.
      ENDMETHOD.                    "handle_top_of_page
    ENDCLASS.                    "lcl_application_f4 IMPLEMENTATION
    END-OF-SELECTION.
      CALL SCREEN 100.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF g_custom_container IS INITIAL.
        PERFORM create_and_init_alv CHANGING gt_outtab[]
                                             gt_fieldcat.
      ENDIF.
    ENDMODULE.                    "pbo OUTPUT
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      save_ok = sy-ucomm.
      CLEAR sy-ucomm.
      CASE save_ok.
        WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
          PERFORM exit_program.
        WHEN 'SWITCH'.
          PERFORM switch_edit_mode.
        WHEN OTHERS.
        do nothing
      ENDCASE.
    ENDMODULE.                    "pai INPUT
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
      LEAVE PROGRAM.
    ENDFORM.                    "exit_program
    *&      Form  build_fieldcat
          text
         -->PT_FIELDCAT  text
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'SBOOK'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
    Exchange smoker field with invoice field - just to
    make the dependance between SMOKER and CLASS more transparent
    (Smoking is only allowed in the first class).
        IF ls_fcat-fieldname EQ 'SMOKER'.
          ls_fcat-col_pos = 11.
          ls_fcat-outputlen = 10.
          ls_fcat-edit = 'X'.
    Field 'checktable' is set to avoid shortdumps that are caused
    by inconsistend data in check tables. You may comment this out
    when the test data of the flight model is consistent in your system.
          ls_fcat-checktable = '!'.        "do not check foreign keys
          MODIFY pt_fieldcat FROM ls_fcat.
        ELSEIF ls_fcat-fieldname EQ 'INVOICE'.
          ls_fcat-col_pos = 7.
          MODIFY pt_fieldcat FROM ls_fcat.
        ELSEIF    ls_fcat-fieldname EQ 'CLASS'.
          ls_fcat-edit = 'X'.
          ls_fcat-outputlen = 5.
          ls_fcat-checktable = '!'.        "do not check foreign keys
          MODIFY pt_fieldcat FROM ls_fcat.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "build_fieldcat
    *&      Form  create_and_init_alv
          text
         -->PT_OUTTAB    text
         -->PT_FIELDCAT  text
    FORM create_and_init_alv CHANGING pt_outtab TYPE STANDARD TABLE
                                      pt_fieldcat TYPE lvc_t_fcat.
      DATA: lt_exclude TYPE ui_functions,
            ls_layout TYPE lvc_s_layo.
      CREATE OBJECT g_custom_container
              EXPORTING container_name = g_container.
    CREATE OBJECT g_grid
            EXPORTING i_parent = g_custom_container.
      CREATE OBJECT gv_c_split
         EXPORTING
          link_dynnr        = lv_dynnr
          link_repid        = lv_repid
          parent            = g_custom_container
          rows              = 2
          columns           = 1
         EXCEPTIONS
           cntl_error        = 1
           cntl_system_error = 2
           others            = 3    .
      CALL METHOD gv_c_split->set_border
       EXPORTING
         border            = space.
      CALL METHOD gv_c_split->get_container
         EXPORTING
           row       = 1
           column    = 1
         RECEIVING
           container = gv_c_ptv.
      CALL METHOD gv_c_split->set_row_height
        EXPORTING
          id                = 1
          height            = 20
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 6 .
      CALL METHOD gv_c_split->get_container
         EXPORTING
           row       = 2
           column    = 1
         RECEIVING
           container = gv_c_vp .
      CALL METHOD gv_c_split->set_row_height
        EXPORTING
          id                = 2
          height            = 10
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3 .
       CREATE OBJECT o_split
         EXPORTING
          parent            = gv_c_ptv
          with_border       = 1
         EXCEPTIONS
           cntl_error        = 1
           cntl_system_error = 2
           others            = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    o_top = o_split->top_left_container.
    o_bot = o_split->bottom_right_container.
    CREATE OBJECT gv_alv_ptv
         EXPORTING
           i_parent          = o_bot
         EXCEPTIONS
           error_cntl_create = 1
           error_cntl_init   = 2
           error_cntl_link   = 3
           error_dp_create   = 4
           others            = 5    .
    CREATE OBJECT g_grid
            EXPORTING
              i_parent          = gv_c_vp
            EXCEPTIONS
              error_cntl_create = 1
              error_cntl_init   = 2
              error_cntl_link   = 3
              error_dp_create   = 4
              others            = 5    .
      PERFORM build_fieldcat CHANGING pt_fieldcat.
    Optionally restrict generic functions to 'change only'.
      (The user shall not be able to add new lines).
      PERFORM exclude_tb_functions CHANGING lt_exclude.
      PERFORM build_data CHANGING pt_outtab.
      ls_layout-grid_title = 'F4 help implemented for field CLASS'.
      CREATE OBJECT o_event_receiver.
      SET HANDLER o_event_receiver->handle_top_of_page FOR gv_alv_ptv.
      SET HANDLER o_event_receiver->handle_top_of_page FOR g_grid.
      CREATE OBJECT o_dd_doc EXPORTING style = 'ALV_GRID'
                                       no_margins = 'X'.
      CALL METHOD gv_alv_ptv->set_table_for_first_display
       EXPORTING
         is_layout                    = ls_layout
      CHANGING
        it_outtab                     = pt_outtab[]
        it_fieldcatalog               = pt_fieldcat
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          it_toolbar_excluding = lt_exclude
          is_layout            = ls_layout
        CHANGING
          it_fieldcatalog      = pt_fieldcat
          it_outtab            = pt_outtab[].
      CALL METHOD gv_alv_ptv->list_processing_events
        EXPORTING
          i_event_name      = 'TOP_OF_PAGE'
           i_dyndoc_id       = o_dd_doc.
    register f4 for field CLASS
      PERFORM register_events.
    Set editable cells to ready for input initially
      CALL METHOD g_grid->set_ready_for_input
        EXPORTING
          i_ready_for_input = 1.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  exclude_tb_functions
          text
         -->PT_EXCLUDE text
    FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
    Only allow to change data not to create new entries (exclude
    generic functions).
      DATA ls_exclude TYPE ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      APPEND ls_exclude TO pt_exclude.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_data
          text
    -->  p1        text
    <--  p2        text
    FORM build_data CHANGING pt_outtab TYPE STANDARD TABLE.
      DATA: ls_sbook TYPE sbook,
            l_index TYPE i.
      SELECT * FROM sbook INTO TABLE gt_outtab UP TO g_max ROWS.
      IF sy-subrc NE 0.
        PERFORM generate_entries CHANGING pt_outtab.
      ENDIF.
      LOOP AT pt_outtab INTO ls_sbook.
        l_index = sy-tabix.
        CLEAR ls_sbook-class.
    Alternate between smoker and non smoker to make
    it more obvious what this example is about
        l_index = l_index MOD 2.
        IF l_index EQ 1.
          ls_sbook-smoker = 'X'.
        ELSE.
          ls_sbook-smoker = ' '.
        ENDIF.
        MODIFY pt_outtab FROM ls_sbook.
      ENDLOOP.
    ENDFORM.                               " build_data
    *&      Form  generate_entries
          text
         -->PT_SBOOK   text
    FORM generate_entries CHANGING pt_sbook TYPE STANDARD TABLE.
      DATA: ls_sbook TYPE sbook,
            l_month(2) TYPE c,
            l_day(2) TYPE c,
            l_date(8) TYPE c,
         l_prebookid TYPE i.
      ls_sbook-carrid = 'LH'.
      ls_sbook-connid = '0400'.
      ls_sbook-forcurkey = 'DEM'.
      ls_sbook-loccurkey = 'USD'.
      ls_sbook-custtype = 'B'.
      DO 110 TIMES.
        l_prebookid = sy-index.
        ls_sbook-forcuram = sy-index * 10.
        ls_sbook-loccuram = ls_sbook-loccuram * 2.
        ls_sbook-customid = sy-index.
        ls_sbook-counter = 18.
        ls_sbook-agencynum = 11.
        l_month = sy-index / 10 + 1.
        DO 2 TIMES.
          l_day = 3 + l_month + sy-index * 2.
          l_date+0(4) = '2000'.
          l_date+4(2) = l_month.
          l_date+6(2) = l_day.
          ls_sbook-fldate = l_date.
          SUBTRACT 3 FROM l_day.
          ls_sbook-order_date+0(6) = l_date+0(6).
          ls_sbook-order_date+6(2) = l_day.
          ls_sbook-bookid = l_prebookid * 2 + sy-index.
          IF sy-index EQ 1.
            ls_sbook-smoker = 'X'.
          ELSE.
            ls_sbook-smoker = space.
          ENDIF.
          ls_sbook-luggweight = l_prebookid * 10.
          IF ls_sbook-luggweight GE 1000.
            ls_sbook-wunit = 'G'.
            ls_sbook-class = 'C'.
          ELSE.
            ls_sbook-wunit = 'KG'.
            ls_sbook-class = 'Y'.
          ENDIF.
          IF ls_sbook-bookid > 40 AND ls_sbook-wunit EQ 'KG'.
            ls_sbook-invoice = 'X'.
          ENDIF.
          IF ls_sbook-bookid EQ 2.
            ls_sbook-cancelled = 'X'.
            ls_sbook-class = 'F'.
          ENDIF.
          APPEND ls_sbook TO pt_sbook.
        ENDDO.
      ENDDO.
    ENDFORM.                               " generate_entries
    *&      Form  register_events
          text
    FORM register_events.
    *§1. Register event ONF4 at frontend using method
       register_f4_for_fields. For this purpose, you pass a table
       with all fields, for which you want to implement your own
       f4 help.
    remark: If you want to use an own f4 help for fields where
            no standard f4 help exists set field F4AVAILABL for
            this field in the fieldcatalog.
      DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
      CLEAR lt_f4.
      lt_f4-fieldname = 'CLASS'.
    If you would like to deregister the field again,
    pass value SPACE with field 'register'.
      lt_f4-register = 'X'.
    *§  1b. If the value range in your f4 help depends on other
          values of cells that are input enabled, set the
          GETBEFORE parameter.
    The consequence is that the ALV Grid Control raises
    event DATA_CHANGED before the f4 help is called to
    check values that the f4 help depends on.
      lt_f4-getbefore = 'X'.
    The next parameter is used to change values after onf4 has
    been processed. The ALV Grid Control will raise
    event DATA_CHANGED afterwards, if you set it.
      lt_f4-chngeafter = space.
      INSERT TABLE lt_f4.
      CALL METHOD g_grid->register_f4_for_fields
        EXPORTING
          it_f4 = lt_f4[].
    register events for abap objects (backend)
      SET HANDLER o_event_receiver->handle_f4 FOR g_grid.
    ENDFORM.                    " register_events
    MODULE status_0101 OUTPUT
    MODULE status_0101 OUTPUT.
      SET PF-STATUS 'POPUP'.
      SET TITLEBAR 'POPUP'.
      CALL METHOD o_event_receiver->show_f4.
    ENDMODULE.                 " STATUS_0101  OUTPUT
    *&      Module  USER_COMMAND_0101  INPUT
          text
    MODULE user_command_0101 INPUT.
      PERFORM user_command.
    ENDMODULE.                 " USER_COMMAND_0101  INPUT
    *&      Form  user_command
          text
    FORM user_command.
      DATA: save_ok TYPE sy-ucomm.
      save_ok = sy-ucomm.
      CLEAR sy-ucomm.
      CASE save_ok.
        WHEN 'CANCEL'.
          CALL METHOD o_event_receiver->reset.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  switch_edit_mode
          text
    FORM switch_edit_mode.
      IF g_grid->is_ready_for_input( ) EQ 0.
    set edit enabled cells ready for input
        CALL METHOD g_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = 1.
      ELSE.
    lock edit enabled cells against input
        CALL METHOD g_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = 0.
      ENDIF.
    ENDFORM.                    "switch_edit_mode

  • Export option in ALV report downloades first two columns blank

    Hi ,
    Before posting this query I searched the solution in SDN but I did't find the solution.
    My problem is  After displaying report in ALV format ,if I press Export --> Local file --->spreadsheet ;  file will downloaded to excel sheet but first two columns(only heading no data ) will be blank  and next two columns with proper data.
    I checked field catalog defination it seems to be ok,  any other mistake ?
    Please suggest.
    Narayan

    Hi
    It's the option you have in the path System->List->Save->Local file
    I means it's the standard option to export an abap list into a local file, so you should try this path too and check if the resul it's the same
    I think you should choose  Export --->spreadsheet: here before saving the file an excel document will be open
    Max

  • Classic Report with a two-line row, the second one as a drop down?

    Hi,
    Using APEX 4.0 is it possible to make a classic report layout that has row items sorted in 2 rows? The first row for each SQL record set row looks like the classic report 'normal' row, while the second one contains just one single column value. This second row is supposed to be hidden and should be displayable by clicking a small '+' sign at the beginning of the row.
    I remember having seen this done, but I simply seem not to be able to formulate my query correctly to let Google display me the expected result. Although I am not sure if was APEX+jQuery or ExtJs. I hope though it is not ExtJS, since I do not plan to use that one.
    Thank you in advance.
    Tamas

    Is this for Verizon landline internet? If so, you should ask your question in the Verizon Residential forums. http://forums.verizon.com

  • In ALV to make coloum heading in two lines

    I have requrement that my alv report should display the output in two lines.
    ie the first one should be in English and the second line should be in fresh for the same field description .
    Is this posible? can one help me in doing this.

    Hi,
      I guess this is not possible to display the report header in two lines.
    If you find any solution then please post it in SDN, so that i can use the functionality in my future.
    Rgds,
    Bujji

  • ALV .  How to remove the sort buttons on toolbar in ALV report?

    Hi,experts
      As you know, in default case , the alv report will display two sort buttons(ascending ,descending) on its toolbar , So How to remove the sort buttons on toolbar in ALV report?
      Thanks for your help .

    Hi guixin,
    1. Before calling REUSE_ALV_LIST_DISPLAY
    2. Write this code :
    data : excl type SLIS_T_EXTAB.
    data : exclwa type SLIS_EXTAB.
    exclwa = '&OUP'.
    append exclwa to excl.
    exclwa = '&ODN'.
    append exclwa to excl.
    3. Then while calling the FM,
       pass this parameter also .
    IT_EXCLUDING     = excl
    It will work fantastic.
    regards,
    amit m.

  • ALV Reporting with drill down capabillities

    I'm creating a abap custom report using the ALV.  I want to drill down to CJ03 which is projects.  I know how to do it in regular custom reporting, but I don't seem to be able to get it to work using the ALV.  Can anyone help?
    Thanks.
    Linda

    Hi Linda,
    Take a look at this sample program. The logic to handle any interaction with the user is in my "PORCESS_USER_COMMANDS" routine.
    This is defined in the "I_CALLBACK_USER_COMMAND" parameter in the ALV FM.
    Hope this helps.
    Cheers,
    Pat.
    [code]
    Modification History
    Date      | Author    | Chg Req #     | Description
    15.08.2001| Pat Yee   | $TMP          | Program Creation
    This program is an example of how the ALV Display works.
    It will display Customer Data.
    This report will also show how to display an ALV report with different
    colored lines and icons
    REPORT zpat.
    Include Programs
    INCLUDE <icon>.
    Database Tables
    TABLES: kna1.                  "Customer Master
    Types
    TYPE-POOLS: kkblo.
    Structures
    Structure to hold the Color Information
    DATA: BEGIN OF st_color,
            color(3) TYPE c,
          END OF st_color.
    Structure to hold the Icon Information
    DATA: BEGIN OF st_icon,
            icon(4) TYPE c,
          END OF st_icon.
    ALV Field Catalog Structure
    DATA: st_fieldcat   TYPE slis_fieldcat_alv.
    ALV Layout Structure
    DATA: st_layout     TYPE slis_layout_alv.
    Internal Tables
    Output Table
    DATA: BEGIN OF tbl_kna1 OCCURS 0.
            INCLUDE STRUCTURE st_icon.   "Icon Structure
            INCLUDE STRUCTURE kna1.      "Customer Master Structure
            INCLUDE STRUCTURE st_color.  "Color Structure
    DATA: END OF tbl_kna1.
    ALV Field Catalog Table
    DATA: tbl_fieldcat  TYPE slis_t_fieldcat_alv.
    Variables
    DATA: fieldname(30) TYPE c,
          g_repid       LIKE sy-repid.
    Start of Selection
    START-OF-SELECTION.
      g_repid = sy-repid.
      PERFORM get_data.
    End of Selection
    END-OF-SELECTION.
      PERFORM do_fancy_stuff.
      PERFORM get_layout.
      PERFORM get_fieldcat.
      PERFORM create_report.
    *&      Form  CREATE_REPORT
          Learn to read the subroutine name!
    FORM create_report.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_interface_check       = ' '
                i_callback_program      = g_repid
                i_callback_user_command = 'PROCESS_USER_COMMANDS'
                it_fieldcat             = tbl_fieldcat
                i_default               = 'X'
                i_save                  = ' '
                is_layout               = st_layout
           TABLES
                t_outtab                = tbl_kna1
           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.                               " CREATE_REPORT
    *&      Form  GET_FIELDCAT
          Build the Field Catalog
    FORM get_fieldcat.
    Here the field catalog is created. To display more fields simply
    'uncomment' the additional lines and add the field name. Also note
    that the field catalog is much more powerful than this. You can
    intensify fields, change the colour, assign reference fields, etc.
    Look at type slis_fieldcat_alv for more options.
      PERFORM write_fieldcat USING 'ICON'  'TBL_KNA1' '    ' 'X' 1 '2' 'X'
      PERFORM write_fieldcat USING 'KUNNR' 'TBL_KNA1' 'KNA1' 'X' 2 ' ' ' '
      PERFORM write_fieldcat USING 'NAME1' 'TBL_KNA1' 'KNA1' ' ' 3 '10' ' '
                                   'X'.
      PERFORM write_fieldcat USING 'STRAS' 'TBL_KNA1' 'KNA1' ' ' 4 ' ' ' '
      PERFORM write_fieldcat USING 'TELF1' 'TBL_KNA1' 'KNA1' ' ' 5 ' ' ' '
      PERFORM write_fieldcat USING 'ORT01' 'TBL_KNA1' 'KNA1' ' ' 6 ' ' ' '
      PERFORM write_fieldcat USING 'PSTLZ' 'TBL_KNA1' 'KNA1' ' ' 7 ' ' ' '
      PERFORM write_fieldcat USING 'SORTL' 'TBL_KNA1' 'KNA1' ' ' 8 ' ' ' '
      PERFORM write_fieldcat USING 'ERNAM' 'TBL_KNA1' 'KNA1' ' ' 9 ' ' ' '
      PERFORM write_fieldcat USING 'SPRAS' 'TBL_KNA1' 'KNA1' ' ' 10 ' ' ' '
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 10 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 11 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 12 ' '.
    ENDFORM.                               " GET_FIELDCAT
    *&      Form  WRITE_FIELDCAT
          Write the Field Catalog data to the Field Catalog Table
         -->name   Field name
         -->tab    Table name
         -->st     Structure Name
         -->key    Is this field a Key?
         -->pos    Position Number
         -->length Field Length
         -->icon   Display as Icon
         -->hot    Hotspot
    FORM write_fieldcat USING name tab st key pos length icon hot.
      st_fieldcat-fieldname   = name.
      st_fieldcat-tabname     = tab.
      st_fieldcat-ref_tabname = st.
      st_fieldcat-key         = key.
      st_fieldcat-col_pos     = pos.
      st_fieldcat-outputlen   = length.
      st_fieldcat-icon        = icon.
      st_fieldcat-hotspot     = hot.
      APPEND st_fieldcat TO tbl_fieldcat.
      CLEAR st_fieldcat.
    ENDFORM.                               " WRITE_FIELDCAT
    *&      Form  PROCESS_USER_COMMANDS
          Interactive Reporting Commands
    FORM process_user_commands USING syst-ucomm LIKE syst-ucomm
                                     selfield TYPE slis_selfield.
    This subroutine is called when there is user interaction in the output
    In this case if the user double clicks the Customer Number then the
    program will call transaction XD03 and display the Customer Master
    Data
      CASE syst-ucomm.
        WHEN '&IC1'.
    get cursor field fieldname.
          READ TABLE tbl_kna1 INDEX selfield-tabindex.
          SET PARAMETER ID 'KUN' FIELD tbl_kna1-kunnr.
          CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                               " PROCESS_USER_COMMANDS
    *&      Form  GET_LAYOUT
      set the layout of the ALV.
      add color to the row?
    FORM get_layout.
      st_layout-info_fieldname    = 'COLOR'.
      st_layout-colwidth_optimize = 'X'.
      st_layout-get_selinfos      = 'X'.
    ENDFORM.                    " GET_LAYOUT
    *&      Form  get_data
          Get some data to play with
    FORM get_data.
      SELECT * FROM kna1 INTO CORRESPONDING FIELDS OF TABLE tbl_kna1
             UP TO 30 ROWS.
    ENDFORM.                    " get_data
    *&      Form  do_fancy_stuff
          Do some fancy pants stuff for example changing the color of
          lines and adding icons
    FORM do_fancy_stuff.
    Here we will demonstrate changing the color of ALV Record lines as
    well as displaying Icons
      LOOP AT tbl_kna1.
    All records where NAME1 begins with 'M', will be displayed in Bluish
    Green
        IF tbl_kna1-name1(1) EQ 'M'.
          tbl_kna1-color = 'C41'.  "Bluish Green
          MODIFY tbl_kna1 TRANSPORTING color.
        ENDIF.
    All records with no TELF1 will be displayed in White and have a
    Warning Icon
        IF tbl_kna1-telf1 IS INITIAL.
          tbl_kna1-color = 'C00'.  "White
          tbl_kna1-icon  = '@AH@'. "Warning Icon
          MODIFY tbl_kna1 TRANSPORTING icon color.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " do_fancy_stuff[/code]

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

  • Two line column heading in ALV Report

    Hi Experts,
    My requirement is that I have to create an ALV report with columns having two lines of headings. Like a main heading called Consultants under which 5 to 10 columns of departments(Dept Num, Num of Ppl , Manager etc. ) and then Contractors(Name, Address Etc ) underwhich there would be 5 to 10 departments. Right now my report has the depts of...     
    How can i do that . If u would suggest by CL_SALV_TABLE then it would be great.
    Thanks a lot !
    Sau

    i don't think you can do it using cl_gui_alv_grid or cl_salv_table.

  • Field description in two line in ALV report

    Hi ,
    In ALV report I  want the description for each field to be displayed in two lines . For example
    the description for field matnr is " Material No for grade A " which is displayed in one line . But i want to display it as :  Material No
                                                           for grade A
    in two lines . Is it possible . Please help me out .
    Neetesh

    Hi Neetesh,
      Its not possible to display as you like in 2 lines header for single column. But i can provide the alternative way , it won't good logically. Please try the following logic.
    Let suppose you have 10 fields F1-f10. Each field has the 2 lines header. So take 20fields in your fields catalog ie take 10 dummy fields which are equal lenght of the fields F1-f10. and for the last 10 fields(F11-F20) set the row pos as 2, set the second line header to these field(F11-F20). So you will succed to display the 2 level header for single column. But the problem here is you will get one empty row additional row for each row. Because you have taken (F11-F20) fields are dummy and don't have the data also. This solution will works only in the case of ALV List display not in Grid Display.
      But Before that tell to your customer about this problem , Because I have done the same things when my customer giving important to 2 lines header and he accepeted that also.
    If suppose you have the data in 2 lines for each column then this solution will work fine. Thats what i implemented in my ALV Report.
    Warm Regards,
    Vijay.

  • How to display multi line headings in procedural alv report

    Hi experts,
    How to display multi line heading in alv( procedural alv report) report.
    some columns single line and some columns multi line in the same report.
    ex: 
                  solvent consumed          solvent recovered
                   fresh |   recovery             recovery | spent                            batch no                         storage
    I am using procedural alv .pls give me idea.

    Hi Ram,
    Check the sample report [how to display multi line headings in procedural alv report|http://sample-code-abap.blogspot.com/2008/01/printing-multiple-line-header-and.html]
    Thanks,
    Duy

Maybe you are looking for

  • Security question and answer

    I like to find out my security question and answer

  • Full ABAP Edition-Trial: no installation of maxdb???

    Hello to all, I installed "Full ABAP Edition-Trial" some days ago and everything worked fine without any problems. Windows on partition H: and programs (like sap and sapdb) on partition L:. Because of an other problem I had to reinstall Windows on H:

  • Volume Problem in Iphone 3gs

    I have an iphone 3gs and suddenly after sometime, the volume switches off.. i can only play songs.. but no volume.. but after some time, if i plug my device for charging, the volume comes up or if i play a game the volume returns. Whats the problem??

  • Cannot connect to database with servlet thru apache http server / vhosts

    Hello, I have an application that works perfectly when Tomcat 5.5 is running stand-alone, but when I run Tomcat and Apache HTTP Server together, I get an error when trying to connect to the database. Servlets are working fine otherwise. Connection po

  • How do I organize individual songs by artists name in my iphone5?

    Hey, the pre-installed music player in my iphone5 doesn't have an option for me to organize individual songs by artists. It is organized by song names. I'm sure I can do this in itune. How do i do this? Also I have another question. When I play my mu