ALV Problem

Moderator message: please use a more meaningful subject in future
Hi Experts,
I have one query in ALV report. In ALV output I am not able to see the option for SUM & subtotal icons are not displayed.
I wanted to display both icons in my ALV output. Any suggestion how I can achieve this requirment.
Also, icons for Microsoft excel & word processing is not working.
Please suggest me.
Regards,
Poonam
Edited by: Matt on Dec 19, 2008 6:55 AM

hi,
You need to create 'Layout' for displaying the Tool bar.
If you are Creating ALV using OOPS method , then declare a work area like this,
Data : ty_lay1 TYPE lvc_s_layo.
ty_lay1-no_toolbar = ''.
Then pass this work area to method 'set_table_for_first_display'
CALL METHOD cl_alv->set_table_for_first_display
    EXPORTING
      is_layout       = ty_lay1
    CHANGING
      it_outtab       = t_output[]
      it_fieldcatalog = t_fieldcat.
However If you are using FM REUSE_ALV_LIST_DISPLAY or FM REUSE_ALV_GRID_DISPLAY
then you have to declare above work area like this,
Data : ty_lay1 TYPE SLIS_LAYOUT_ALV.
ty_lay1-no_toolbar = ''.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      is_layout       = ty_lay1
    CHANGING
      it_outtab       = t_output[] " Internal table which holds data
      it_fieldcatalog = t_fieldcat. " Field catlog

Similar Messages

  • ALV: Problem in exporting to excel with too many columns

    Hi,
    While exporting from ALV report to excel following issue was faced:
    ALV report contains 81 columns out of which 67 columns are displayed properly but from 68th column onwards data is dispalyed on next row
    I want all columns displayed on single row..
    Any help will greatly appreciated..
    Thanks,
    Deepak

    Hi Deepak,
    I was browsing through these threads to find anwer for the same issue.
    So thought of putting my analysis which helped me resolve my problem.
    Analysis/Solution:
    When we export ALV data to excel worksheet, as sap notes say the maximum lenght allowed is 1023 charaters and the max no of columns supported is 90.
    (I never faced any issue related to no of columns as it worked fine for columns >90 too)
    Issue occured when row size of exported data gets more than 1023 character.
    Therefore the row data must not exceed 1023 character, otherwise column splits and moves to next row.
    One additional aspect generally missed is that:
    When data in any particular column changes it's length, alv header also changes its lengh (short text, medium text, long text; depending on the length of of the longest cell in the column)
    therefore even if you have total length of row less than 1023 character, there might be cases when your ALV header size exceeds this length.
    Hopefully it will be helpful for you too.
    Regards,
    Parveen

  • ALV problems, trying to click Back button, Filtering, download (Excel)

    Hi
    When I try to click Back button, Filtering or download (Excel) on ALV grid this dumps appear:
    Runtime Error          MOVE_TO_LIT_NOTALLOWED_NODATA
    Error analysis
        The program tried to assign a new value to the field "<L_BOX>" even though
        it is protected against changes.
        The following objects are protected:
        - Character or numeric literals
        - Constants (CONSTANTS)
        - Parameters of the category IMPORTING REFERENCE for functions
          and methods
        - Untyped field symbols to which a field has not yet been assigned
          using ASSIGN
        - TABLES parameters if the corresponding actual parameter is protected
          against changes
        - USING reference parameters and CHANGING parameters for FORMs if
          the actual parameter for this is protected against changes
        - Field symbols if the field assigned using ASSIGN or ASSIGNING
          is protected against changes
        - External write accesses to READ-ONLY attributes
        - Key components of lines in internal tables of the type HASHED or
          SORTED TABLE
          SORTED TABLE.
    Line  SourceCde
    681 * set/unset <box> of all items
    682     if l_ucomm eq '&SAL' or l_ucomm eq '&ALL'.
    683       if l_ucomm eq '&SAL'.
    684         loop at t_outtab.
    685           l_tabix = l_tabix + 1.
    ->>>           <l_box> = ' '.
    687           modify t_outtab index l_tabix.
    688         endloop.
    689       endif.
    690       if l_ucomm eq '&ALL'.
    691         loop at t_outtab.
    692           l_tabix = l_tabix + 1.
    693           <l_box> = 'X'.
    694           modify t_outtab index l_tabix.
    695         endloop.
    696       endif.
    What I must check on my ALV settings:
    ch_alv_layout-zebra          = 'X'.
      ch_alv_layout-box_fieldname  = 'SELE'.
      ch_alv_layout-box_tabname    = v_nametab.
      ch_alv_layout-reprep         = 'X'.
      ch_alv_layout-info_fieldname = 'COLOR'. "infofield for listoutput
      ch_alv_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = sy-repid
          is_layout          = ch_alv_layout
          it_fieldcat        = ch_alv_fieldcat
          it_sort            = ch_alv_sortinfo
          i_save             = 'X'
          it_events          = ch_slis_event
        TABLES
          t_outtab           = p_control
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    Thanks in advance.

    ch_alv_layout-info_fieldname = 'COLOR'. "infofield for listoutput
      ch_alv_layout-colwidth_optimize = 'X'.
    try commenting the above values.and also check the Fieldcatlog.
    Check the issue similar issue was resolve by checking catalog and layout:
    [ALV Issue solution|Re: Problem when export ALV.]
    Regards,
    Gurpreet

  • ALV - problem in downloading to excel - HIGH

    In our ALV report , we are facing problem with downloading to excel. It is intact downloading but in an irregular manner.
    LIST-> EXPORT-> Local File(excel)
    How to overcome this..

    try to load like this
    spreadsheet>press enter>pivot table-->microsoft excel

  • ALV - problem to disable row selection (SET_ROW_SELECTABLE)

    Hi,
    I'm using an (non editable) ALV with a supply function to display details to each line.
    I have to buttons "New" and "Modify" to insert a new line or to modify an existing row (in the details).
    This works fine.
    Now what I want to do is, if the user press one of the buttons "New" or "Modify", I want to disable the row selection of the ALV, so the user can't select another row during inserting or editing.
    For this, I've implemented in the WDDOMODIFYVIEW of the view the coding to enable or disable the row selection
    lo_value->if_salv_wd_table_settings~SET_ROW_SELECTABLE( ABAP_TRUE ).
    * or
    lo_value->if_salv_wd_table_settings~SET_ROW_SELECTABLE( ABAP_FALSE ).
    In case of "New" this works fine. The row selection is disabled.
    But not in case of "Modify".
    There is a strange behaviour:
    The row selection is not completely disabled. It looks like you can select rows, but if you select another row, it is automatically jumping to the first row and also the details is updated to the first row.
    The different between "New" and "Modify" is, that in "New", I create a new element in the ALV.
    Than it works correct. If I do the same in "Modify", I have the same correct behavior.
    But of course, I don't want to insert a new row in my "modify" mode.
    So maybe it has something todo with set lead selection?
    Maybe I do something wrong or that is a problem in the abap release. But I can't find anything in OSS.
    Thanks in advance!
    Andreas

    Hi,
    I would like to propose another approach here,
    I assume that ALV is in read only mode.
    1. User select the row and press the "Modify" button. As soon as user press the modify button "disable" the Modify and New button.
    2. Once the user is finish with the changes and press save. Enable the new and modify button.
    3. Without saving if user select anyother row then raise the "Save" confirmation popup with Yes, NO and Cancel button.
    4. If User press the New button then add new row and disable the "New" and "Modify button". Follow the Step 2 and 3 for this case also.
    I hope this will give you some idea.
    Thanks,
    Rahul

  • Alv. problem in I_call

    Hi Gurus,
                Problem in this program.plz check it its very urgent.
    im working in version 4.6. the problem is in I_call_back.plz help me in this.
    Correct answers will be appreciated with good points.
    Thanks & regards
    sunita
    TABLES : likp.
    TYPE-POOLS: slis.
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    SELECT-OPTIONS: s_vkorg FOR likp-vkorg,
    s_vstel FOR likp-vstel,
    s_vbeln FOR likp-vbeln,
    s_lfdat FOR likp-lfdat,
    s_lfart FOR likp-lfart ,
    s_wadat FOR likp-wadat,
    s_wa_ist FOR likp-wadat_ist,
    s_kunnr FOR likp-kunnr,
    s_kunag FOR likp-kunag.
    SELECTION-SCREEN END OF BLOCK b1.
    DATA: BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE likp.
    DATA: zchk(20),
    END OF itab.
    DATA: gt_fcat type slis_t_fieldcat_alv.
    SELECT * FROM likp
    INTO CORRESPONDING FIELDS OF TABLE itab
    WHERE vkorg IN s_vkorg
    AND vstel IN s_vstel
    AND vbeln IN s_vbeln
    AND lfdat IN s_lfdat
    AND lfart IN s_lfart
    AND wadat IN s_wadat
    AND wadat_ist IN s_wa_ist
    AND kunnr IN s_kunnr
    AND kunag IN s_kunag.
    LOOP AT itab.
    IF itab-wadat = itab-wadat_ist.
    itab-zchk = 'OK'.
    ELSE.
    itab-zchk = 'Posting Error'.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = itab
    CHANGING
    ct_fieldcat = gt_fcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    it_fieldcat = gt_fcat

    Hi Sunita,
    Create your ALV output structure via the ABAP Dictionary (SE11) as a dictionary Structure (ZSTRUCTURE) and then follow the code changes as below:
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        i_program_name     = sy-repid
    *    i_internal_tabname = 'ITAB'  --------------> Delete
        I_STRUCTURE_NAME   = 'ZSTRUCTURE'  <----------------
      CHANGING
        ct_fieldcat        = gt_fcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        it_fieldcat        = gt_fcat
      TABLES
        t_outtab           = itab.   <----------------------------
    Cheers,
    Sougata.
    Message was edited by:
            Sougata Chatterjee

  • ALV problem.pls

    hi ,
    1.i have a toolbar in the alv output,,,but according to my client requirement ,i have to add 4 more standard functions to the toolbar...how can we achieve this?
    2.I need to download the alv output in Excel format..there is a standard function in the toolbar where we can download....but now the problem is while downloading the alv output to the excel sheet , the first column/field in the alv output is coming in the last in the excel sheet.....that means second column in the alv output is coming as first colum in th excel sheet..which is not meeting the requirement
    pls help me in this regard
    regards
    jack

    hi,
    1)  <a href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_pfstatus.htm">Adding PF Status to ALV</a>
    2) Add the Button for the download in the PF Status.. and Use GUI_Download Function Module for this button.
    Thanks
    Mahesh

  • ALV problem with zeros

    Hi guys,
       I have a problem in ALV. There is character field which is company code , whenever the value is '000'or 010' it is displaying as '0' or '10'. can you please help me on this. here is the field catelog for this... it is really urgent.
    CLEAR e_fieldcat.
      ADD 1 TO w_col_pos.
      e_fieldcat-fieldname   = 'AUFNR'.
      e_fieldcat-seltext_m   = 'Company Code'.
      e_fieldcat-col_pos     = w_col_pos.
      e_fieldcat-no_zero = space.
      e_fieldcat-lzero = 'X'.
      e_fieldcat-edit_mask = '==ALPHA'.
      APPEND e_fieldcat TO t_fieldcat.
    thanks.

    Hi Lakshmi ,
    wa_fieldcat-edit_mask = '==ALPHA'.
    wa_fieldcat-edit_lzero = 'X'.
    If this doesnt work.
    <b>
    Declare the field as type MARA-MATNR.
    </b>
    BCOZ conv routine for MATNR IS MATN1.
    Usually, if all is well, this will be handled automatically, for example, if on a dynpro, all you need to do is set the conversion routine value to ALPHA, then the conversion will be automatic, nothing to code. If in a list display, the field should be TYPE MARA-MATNR, then the conversion will be automatic on the list display, as well as the ALV grid.
    Reward points if helpful
    Regards
    Naresh

  • ALV: Problem with toolbar event

    Hi ALV-experts,
    I have a dynpro with a header area where I display an ALV table. Below this I have a subscreen with a tabstrip control and two tabs.
    In the ALV toolbar I defined an own button. This button gets deactivated after pressing this button. I achieved this by the option "disabled" in the structure stb_button within the event handler for the toolbar event.
    This works all fine so far. If I start the dynpro and click on the button in the ALV-toolbar the buttons gets deactivated afterwards. But I have I jump between the tabs before I press the ALV-toolbar button, the button does not get deactivated.
    The debugger does not go into the event handler of the toolbar event. I also did system debugging of the method SET_TOOLBAR of the CL_GUI_ALV_GRID-class. Here I pass in both cases the command
    raise event toolbar e_object = m_cl_toolbar e_interactive = i_interactive.
    but in the second case (when I change the tabs before I press the button) the event handler is not executed and I don't know why. I also tried to register the event handler for all instances of the ALV still with the same result.
    The ALV method set_toolbar_interactive( ) did also not solve the problem.
    I couldn't find any SAP note about an issue for this event.
    Does anybody have an idea or a solution for this problem?
    EDIT:
    Problem solved, it was typo!
    Thanks in advance and regards,
    Martin
    Edited by: Martin Fischer on Jul 7, 2010 4:53 PM

    The problem was a typo!

  • Dynamic ALV Problem

    I am getting the following short dump error : Program " " not found".The fieldcat is successfully built but when Iam trying to call the method "create_dynamic_table" it is showing the error.
    I executed the following Dynamic ALV program without any error yesterday,I did slight modifications and it is started showing the error.See the below code :
    Data : t_fieldcat TYPE lvc_t_fcat,
           wa_fieldcat TYPE lvc_s_fcat.
    FIELD-SYMBOLS : <it_dyn> TYPE STANDARD TABLE,
                    <wa_dyn>.
    DATA : g_tdref TYPE REF TO data,
           g_wdref TYPE REF TO data,
           dats like vbbe-mbdat.
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_mbdat FOR dats.
    SELECTION-SCREEN : END OF BLOCK blk1.
    wa_fieldcat-tabname = 'MSKA'.
    wa_fieldcat-fieldname = 'WERKS'.
    wa_fieldcat-datatype = 'CHAR'.
    wa_fieldcat-intlen = '10'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR : wa_fieldcat.
    wa_fieldcat-tabname = 'MSKA'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-datatype = 'CHAR'.
    wa_fieldcat-seltext = 'Material Number'.
    wa_fieldcat-intlen = '18'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR : wa_fieldcat.
      wa_fieldcat-tabname = 'MAKT'.
      wa_fieldcat-fieldname = 'MAKTX'.
      wa_fieldcat-datatype = 'CHAR'.
      wa_fieldcat-intlen = '10'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR : wa_fieldcat.
    wa_fieldcat-tabname = 'VBBE'.
    wa_fieldcat-fieldname = 'MBDAT'.
    wa_fieldcat-datatype = 'CHAR'.
    wa_fieldcat-intlen = '10'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR : wa_fieldcat.
    DATA : d TYPE i,
           v(02) TYPE n VALUE '0',
           day(8) TYPE c.
    d = s_mbdat-high - s_mbdat-low.
    DO d TIMES.
      v = v + 1.
      CONCATENATE 'x Day' v INTO day.
      wa_fieldcat-tabname = 'VBBE'.
      wa_fieldcat-fieldname = day.
      wa_fieldcat-datatype = 'DATS'.
      wa_fieldcat-seltext = day.
      wa_fieldcat-intlen = '8'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR : wa_fieldcat.
    ENDDO.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = t_fieldcat
        IMPORTING
          ep_table        = g_tdref.
      ASSIGN g_tdref->* TO <it_dyn>.
      CREATE DATA g_wdref LIKE LINE OF <it_dyn>.
      ASSIGN g_wdref->* TO <wa_dyn>.
    What might be the problem?

    well...i executed exactly the same code as yours....and i got a table G_TDREF with four fields WERKS MATNR MAKTX and MBDAT successfully....
    I even debugged the create_dynamic_table method and found that LVC_TABLE_CREATE function module has the i_callback_program as an optional parameter...so it should not be a problem....
    could you please debug the create_dynamic_table method a bit to know exactly at what point the dump is occuring...
    looks to be a system issue to me.....check if everything is correct in the system....it works perfectly fine for me

  • Editable OO ALV Problem

    Hi Everyone,
    My Problem is when i set the edit option in field catalog  respective field get converted into edit mode but the data of field is get disappear.
    wa_fcat1-fieldname  = 'TRADESCHM'.
      wa_fcat1-coltext    = 'TRADE SCHEME'.
      wa_fcat1-col_pos    =  7.
      wa_fcat1-ref_table  = 'T_ZVCBD_TRADE_SCHM'.
      wa_fcat1-outputlen  = '7'.
      wa_fcat1-emphasize  = c_x.
      wa_fcat1-edit       = c_x.
      APPEND wa_fcat1 TO t_fcat1.
      CLEAR wa_fcat1.
    i searched the all threads but didn't got the reason of my problem.
    Regards,
    Sandeep

    Hi,
    when we run the report for first time before edit  that time only its not showing.
    if we check in debugger  at  this code field have data.
    *   Calling the method for alv display
        CALL METHOD w_obj_alv_grid->set_table_for_first_display
           EXPORTING
    *        i_buffer_active                =
    *        i_bypassing_buffer            =
    *        i_consistency_check           =
    *        i_structure_name              =
             is_variant                    = w_var
             i_save                        = w_save
    *        i_default                     = 'X'
             is_layout                     = wa_layout
    *        is_print                      =
    *        it_special_groups             =
    *        it_toolbar_excluding          =
    *        it_hyperlink                  =
    *        it_alv_graphics               =
    *        it_except_qinfo               =
    *        ir_salv_adapter               =
          CHANGING
            t_outtab                      = t_zvcbd_trade_schm*+ "  till here is data present perfectly but in outputeditable   field is blank for which we " put the editable on
            it_fieldcatalog                = t_fcat1
    *        it_sort                       =
    *        it_filter                     =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
    Edited by: pas_abap on Feb 15, 2010 10:27 AM

  • SAP Gui 7.20 PLevel 3, ALV Problems with German Umlauts u00FCu00F6u00E4...

    Hi,
    we have updated our SAP Gui to version 7.20 lately and have some serious problems now with entering German Umlauts 'üöäÜÖÄß' into any editable ALV grid.
    This means when typing in e.g. 'ü', the grid immediately removes this character and replaces it by, well, by nothing. It just ignores this character at all.
    SAP Gui is currently at patch level 3 . The correct version is 7200.1.3.3190, build 1196830. Running German Windows XP clients with service pack 3. ERP is running SAP ECC 6.0.
    Is this a known problem? Has sbdy. a workaround this?
    Edit: Just found the release notes for SAP Gui 7.20 Lvl 3:
    2010/09/02     Texts get garbled while typing umlaut character in ALVGrid, Note 1503081
    This note, however, is not open for public view. OTH this means SAP was aware of this problem and tried to correct it to no avail so far.
    Thanks,
    Michael
    Edited by: Michael Fritz on Nov 19, 2010 11:19 AM

    Hi Martin,
    where did you get this info? Any official SAP note available? Do you encounter similar problems?
    We, too, noticed that uploading and downloading files from directories with German Umlauts, this fails now,too. There may be problems with files, too, however, we did not check this so far. The previous SAP Gui, I guess it was 7.10, didn't have any problems with this.
    I start wondering if SAP Germany have ever tested this? Or do they not use Umlauts anyway

  • ALV problems

    hey guys
    I am facing a small problem:
    i written a code in to display the output in alv format.
    In that i have two tables in nested format. That is during declaration i have two tables see the sample of field-catalog declaration.
      fieldcat-tabname = 'IITEM'.
      fieldcat-fieldname = 'KUNNR'.
      fieldcat-ref_fieldname ='KUNNR'.
      fieldcat-ref_tabname ='ZVBRKVBRP'.
      fieldcat-col_pos       = '1'.
      fieldcat-seltext_m = 'Billing Doc'.
      fieldcat-seltext_l = 'Billing Doc'.
      fieldcat-seltext_s = 'Billing Doc'.
      APPEND fieldcat TO fieldtab.
      CLEAR fieldcat.
      fieldcat-tabname = 'IVBELN'.
      fieldcat-fieldname = 'POSNR'.
      fieldcat-col_pos       = '2'.
      fieldcat-seltext_m = 'Billing Item'.
      fieldcat-seltext_l = 'Billing Item'.
      fieldcat-seltext_s = 'Billing Item'.
      APPEND fieldcat TO fieldtab.
      CLEAR fieldcat.
    here IITEM is outer internal table and
    IVBELN is inner internal table.
    Although my final output of the program is working fine, but the problem is:
    i cant able to do subtotal (ctlshiftf6) according to inner internal table. is there any problem in settings or it should be hard-coded.
    I am using TYPE-POOLS : SLIS.
    Pls help me.
    Deepak

    Hi Depaak,
    I am going to assume you are using the basic function module REUSE_ALV_LIST_DISPLAY, have you tried to use the function module REUSE_ALV_HIERSEQ_LIST_DISPLAY instead? This FM allows you to define 2 internal tables with a "header" and "item" relationship.
    Here is some code demonstrating how to use this FM. You can sort and do totaling and subtotaling the usual way. Let me know if you get any problems.
    Cheers,
    Pat
    *& Report  ZPAT2                                                       *
    Modification History
    Date      | Author    | Chg Req #     | Description
    15.08.2001| Pat Yee   | $TMP          | Program Creation
    This program is an example of how the ALV Hierarchy Display works.
    It will display a sales order and it's associated line items
    REPORT  zpat2.
    Types
    TYPE-POOLS: kkblo.
    Database Tables
    TABLES: vbak, vbap.
    Structures
    DATA: st_fieldcat TYPE slis_fieldcat_alv.
    DATA: st_keyinfo TYPE slis_keyinfo_alv.
    DATA: st_sort TYPE slis_sortinfo_alv.
    DATA: st_layout TYPE slis_layout_alv.
    Internal tables
    DATA: tbl_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: tbl_sort TYPE slis_t_sortinfo_alv.
    DATA: BEGIN OF tbl_header OCCURS 0.
            INCLUDE STRUCTURE vbak.
    DATA: END OF tbl_header.
    DATA: BEGIN OF tbl_item OCCURS 0.
            INCLUDE STRUCTURE vbap.
    DATA: END OF tbl_item.
    Constants
    CONSTANTS: c_y VALUE 'X'. "Yes
    CONSTANTS: c_n VALUE ' '. "No
    Simple Variables
    DATA: field_name(30) TYPE c,
          g_repid        like sy-repid.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK sel_options WITH FRAME TITLE text-tt1.
    SELECT-OPTIONS s_vbeln FOR vbak-vbeln.
    SELECTION-SCREEN END OF BLOCK sel_options.
    Start of Selection
    START-OF-SELECTION.
    Get the Report ID
      g_repid = sy-repid.
    Select data from the Sales Document Header Table
      SELECT * FROM vbak INTO TABLE tbl_header
        WHERE vbeln IN s_vbeln.
    Select the relevant Sales Document Item data
      SELECT * FROM vbap INTO TABLE tbl_item
        FOR ALL ENTRIES IN tbl_header
        WHERE vbeln = tbl_header-vbeln.
    End of Selection
    END-OF-SELECTION.
      PERFORM get_keyinfo.
      PERFORM get_layout.
      PERFORM get_sort.
      PERFORM get_fieldcat.
      PERFORM create_report.
    *&      Form  get_fieldcat
          text
    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.
    Header
      PERFORM write_fieldcat USING 'VBELN' 'TBL_HEADER' 'VBAK' c_y 1
                                   c_n c_y c_n c_n.
      PERFORM write_fieldcat USING 'ERDAT' 'TBL_HEADER' 'VBAK' c_n 2
                                   c_n c_n c_n c_y.
      PERFORM write_fieldcat USING 'AUDAT' 'TBL_HEADER' 'VBAK' c_n 3
                                   c_n c_n c_n c_n.
      PERFORM write_fieldcat USING 'VBTYP' 'TBL_HEADER' 'VBAK' c_n 4
                                   c_n c_n c_n c_n.
      PERFORM write_fieldcat USING 'WAERK' 'TBL_HEADER' 'VBAK' c_n 5
                                     c_n c_n c_n c_n.
      PERFORM write_fieldcat USING 'VKBUR' 'TBL_HEADER' 'VBAK' c_n 6
                                     c_n c_n c_n c_y.
    perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 7.
    perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 8.
    perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 9.
    perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 10.
    Item
      PERFORM write_fieldcat USING 'POSNR' 'TBL_ITEM' 'VBAP' c_y 1
                                     c_n c_n c_n c_n.
      PERFORM write_fieldcat USING 'MATNR' 'TBL_ITEM' 'VBAP' c_n 2
                                     'C411' c_n c_n c_n.
      PERFORM write_fieldcat USING 'NETPR' 'TBL_ITEM' 'VBAP' c_n 3
                                     'C300' c_n c_y c_n.
      PERFORM write_fieldcat USING 'PRCTR' 'TBL_ITEM' 'VBAP' c_n 4
                                     c_n c_n c_n 'X'.
      PERFORM write_fieldcat USING 'GSBER' 'TBL_ITEM' 'VBAP' c_n 5
                                     c_n c_n c_n 'X'.
      PERFORM write_fieldcat USING 'WERKS' 'TBL_ITEM' 'VBAP' c_n 6
                                     c_n c_n c_n 'X'.
      PERFORM write_fieldcat USING 'AUFNR' 'TBL_ITEM' 'VBAP' c_n 7
                                     'C611' c_n c_n c_n.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 8.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 9.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 10.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 11.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 12.
    ENDFORM.                    " get_fieldcat
    *&      Form  write_fieldcat
          text
         -->name   Field name
         -->tab    Table name
         -->st     Structure Name
         -->key    Is this field a Key?
         -->pos    Position Number
         -->emp    Emphasize
         -->hot    Hotspot
         -->sum    Do_sum
         -->hide   No_out
    FORM write_fieldcat USING    name tab st key pos emp hot sum hide.
      st_fieldcat-fieldname = name.
      st_fieldcat-tabname = tab.
      st_fieldcat-ref_tabname = st.
      st_fieldcat-key = key.
      st_fieldcat-col_pos = pos.
      st_fieldcat-emphasize = emp.
      st_fieldcat-hotspot = hot.
      st_fieldcat-do_sum = sum.
      st_fieldcat-no_out = hide.
      APPEND st_fieldcat TO tbl_fieldcat.
      CLEAR st_fieldcat.
    ENDFORM.                    " write_fieldcat
    *&      Form  create_report
          Hummmm I wonder what this subroutine does?
    FORM create_report.
    Here we call the Function Module to create the Hierarchical
    Sequential List
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
         i_interface_check              = ' '
         i_callback_program             = g_repid
         i_callback_user_command        = 'PROCESS_USER_COMMANDS'
         is_layout                      = st_layout
         it_fieldcat                    = tbl_fieldcat
         it_sort                        = tbl_sort
         i_default                      = 'X'
         i_save                         = 'A'
         is_variant                     = ' '
          i_tabname_header               = 'TBL_HEADER'
          i_tabname_item                 = 'TBL_ITEM'
          is_keyinfo                     = st_keyinfo
        TABLES
          t_outtab_header                = tbl_header
          t_outtab_item                  = tbl_item
       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_keyinfo
          text
    FORM get_keyinfo.
    This defines the "link" between the "header" and "item" tables
      st_keyinfo-header01 = 'VBELN'.
    ENDFORM.                    " get_keyinfo
    *&      Form  get_sort
          text
    FORM get_sort.
    Here we sort the report by the Document Number...why not?
      REFRESH tbl_sort.
      CLEAR st_sort.
      st_sort-spos = 1.
      st_sort-fieldname = 'VBELN'.
      st_sort-up = 'X'.
      APPEND st_sort TO tbl_sort.
    ENDFORM.                    " get_sort
          FORM process_user_commands                                    *
          Interactive Reporting commands
    -->  SYST-UCOMM                                                    *
    -->  SELFIELD                                                      *
    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 Document Number then the
    program will call transaction VA03 and display the Sales Document
      CASE syst-ucomm.
        WHEN '&IC1'.
          GET CURSOR FIELD field_name.
          IF field_name = 'TBL_HEADER-VBELN'.
            READ TABLE tbl_header INDEX selfield-tabindex.
            CHECK tbl_header-vbeln NE 0.
            SET PARAMETER ID 'AUN' FIELD tbl_header-vbeln.
            CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                  "process_user_commands
    *&      Form  get_layout
          text
    FORM get_layout.
    Here we manipulate the layout of the list. In this instance we are
    giving the list a 'zebra' format. Once again like the field catalog
    there are many more options available. Look at type slis_layout_alv
    for more options.
      CLEAR st_layout.
      st_layout-zebra = 'X'.
    ENDFORM.                    " get_layout

  • Control ALV: Problem with Fieldcat buffer

    I have developed an ALV report using grid controls.
    However when i change the fieldcatalog(moving coloumns order and so....) and run again i dont see the effect on the list. I tried logging off and in but still same problem. Also is passed below buffer parameters also.
    What could be the issue with controls?
    Any hint/ideas greatly appreciated.
    Thanks.
        CALL METHOD GRID_100->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
            I_BYPASSING_BUFFER            = 'X'
            I_BUFFER_ACTIVE               = ' '
            IS_VARIANT                    = gv_variant
            I_SAVE                        = gv_save
            IS_LAYOUT                     = x_layout
          CHANGING
            IT_OUTTAB                     = <gt_table>
            IT_FIELDCATALOG               = it_fieldcat[]
            IT_SORT                       = it_sortcat[]
          EXCEPTIONS
            INVALID_PARAMETER_COMBINATION = 1
            PROGRAM_ERROR                 = 2
            TOO_MANY_LINES                = 3
            others                        = 4

    I just wanna let everyone know that <b>today</b> i suffered the same and exactly issue like in this entry. It was really causing me to bang my head -> wall like Rich....
    I couldn't see my result after i insert a new column and move a column...
    yeah, guys out there, when you move your ALV fieldcat... make sure you check your layout management tooo...
    otherwise you go around the world to look what's going on!....
    phew... thanks to this post... oh god!
    william wilstroth

  • ALV - PROBLEM IN CAL   AVG

    Hi gurus,
    I have a problem, please help me out.
    Iam doing an report program with alv display. In that iam calculating the AVG for the workcenter wise for the field TAT.
    please observe my below o/p in general ALv format.
    work center-- TAT- Tat(Yes/no)
    qm0010------ 1 -- yes
    qm0010-------2 -- yes
    qm0010------ 4 -- yes
    qm0010------ 7 -- No (because >5)
    Subtotal(qm0010)--3 (avg caluculated)
    qm0020-- 4 --- yes
    qm0020-7-- No (because >5)
    qm0020--10 - No (because >5)
    qm002010- No (because >5)
    Subtotal(qm0020)-- 7 (avg caluculated).
    this is the rough o/p iam getting . this is acheived by programming the Field catalog for TAT field i.e... do_sum = 'C'.
    then giving the sort table to REUSE_ALV_GRID_DISPLAY.
    Now my problem is:
    I want the avg to be calcuted by the business formula which is:
    avg = sum of(TAT within 5 days) / total no of the entries .
    Ex:
    work center-- TAT- Tat(Yes/no)
    qm0010------ 1 -- yes
    qm0010-------2 -- yes
    qm0010------ 4 -- yes
    qm0010------ 7 -- No (because >5)
    Subtotal(qm0010)---*7/4=2 (avg caluculated for tat<5)*
    qm0020-- 4 --- yes
    qm0020-7-- No (because >5)
    qm0020--10 - No (because >5)
    qm002010- No (because >5)
    Subtotal(qm0020)--4/4=1 (avg caluculated for tat<5).
    How can i acheive the above, since in field catalog and alv, i think we cannot pass any conditions(like for TAT which is less than 5). So is there any other way to acheive the above.
    Please understand the problem and give me(please directly dont suggest any programs , since iam not a expert to understand)..
    Please explain me in detail. Points will be duly rewarded.
    Thanks in advance........Chaitu

    s

  • Layout in ALV  problem

    hi experts, in my ALV report, layout selected from select-options(F4) is not displaying, after the initial list dispaly if i select from the layouts then it is comming, pls help me,
    i did all the required things like i_save = 'X' ,is_variant = alv_variant, in FM reuse_alv_grid_display,
    i also use the FM in this order
    1)INITIALIZATION  -> REUSE_ALV_VARIANT_DEFAULT_GET
    2)AT SELECTION-SCREEN ON VALUE-REQUEST FOR -
    >REUSE_ALV_VARIANT_F4
    3)AT SELECTION-SCREEN---->REUSE_ALV_VARIANT_DEFAULT_GET
    4)start-of-selection.
      perform f001-data_retrieval.
      perform f002-build_fieldcatalog.
      perform f003-build_layout.
      perform f004-display_alv_report.
    thanks & regards

    REPORT z_demo_alv_event_exit_1.
    >********************************************************************
    This report reads and displays data from table TRDIR,               *
    using the FM : REUSE_ALV_LIST_DISPLAY                               *
    The columns are displayed in the same order than the Sort Order     *
    There is an underline if the sort is by UNAM or UDAT                *
    Author : Michel PIOUD                                               *
    Email : [email protected]  HomePage : http://www.geocities.com/mpioud *
    SELECTION-SCREEN :
    BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.            "#EC NEEDED
    PARAMETERS p_max(3) TYPE n DEFAULT '99' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    TYPE-POOLS slis.                       " ALV Global Types
    TYPES:
      BEGIN OF ty_trdir,
        name TYPE trdir-name,             " ABAP program name
        cnam TYPE trdir-cnam,             " Created by
        cdat TYPE trdir-cdat,             " Created on
        unam TYPE trdir-unam,             " Last changed by
        udat TYPE trdir-udat,             " Last changed on
      END OF ty_trdir.
    DATA:
      gt_trdir TYPE TABLE OF ty_trdir.       " Data displayed
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
          Form  f_read_data
    FORM f_read_data.
      SELECT name cnam cdat unam udat
        INTO TABLE gt_trdir
          UP TO p_max ROWS
        FROM trdir
       WHERE name LIKE 'Z%'.
    ENDFORM.                               " F_READ_DATA
         Form  f_display_data
    FORM f_display_data.
    Macro definition
      DEFINE m_fieldcat.
        add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname = &1.
        ls_fieldcat-ref_tabname = 'TRDIR'.
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_event_exit.
        clear ls_event_exit.
        ls_event_exit-ucomm = &1.
        ls_event_exit-after = 'X'.
        append ls_event_exit to lt_event_exit.
      END-OF-DEFINITION.
      DATA :
        ls_layout     TYPE slis_layout_alv,
        ls_fieldcat   TYPE slis_fieldcat_alv,
        lt_fieldcat   TYPE slis_t_fieldcat_alv,
        lt_event_exit TYPE slis_t_event_exit,
        ls_event_exit TYPE slis_event_exit.
    Build Field Catalog
      m_fieldcat 'NAME'.
      m_fieldcat 'CNAM'.
      m_fieldcat 'CDAT'.
      m_fieldcat 'UNAM'.
      m_fieldcat 'UDAT'.
    Build Event Exit Table
      m_event_exit '&OUP'.                 " Sort up
      m_event_exit '&ODN'.                 " Sort Down
      ls_layout-zebra = 'X'.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program      = sy-cprog
                i_callback_user_command = 'USER_COMMAND'
                is_layout               = ls_layout
                it_fieldcat             = lt_fieldcat
                it_event_exit           = lt_event_exit
           TABLES
                t_outtab                = gt_trdir.
    ENDFORM.                               " F_DISPLAY_DATA
          FORM USER_COMMAND                                             *
    FORM user_command USING u_ucomm     TYPE syucomm
                            us_selfield TYPE slis_selfield.     "#EC CALLED
      CASE u_ucomm.
        WHEN '&OUP' OR '&ODN'.             " Sort
          PERFORM f_modif_fieldcat.
          us_selfield-refresh = 'X'.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND
          Form  F_MODIF_FIELDCAT
    FORM f_modif_fieldcat.
      DATA:
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv.
      FIELD-SYMBOLS :
        <sort>     TYPE slis_sortinfo_alv,
        <fieldcat> TYPE slis_fieldcat_alv.
    Read current ALV list information
      CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_GET'
           IMPORTING
                et_fieldcat   = lt_fieldcat
                et_sort       = lt_sort
           EXCEPTIONS
                no_infos      = 1
                program_error = 2
                OTHERS        = 3.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      CHECK NOT lt_sort[] IS INITIAL.
    Fieldcat modification
      DESCRIBE TABLE lt_fieldcat.
      LOOP AT lt_fieldcat ASSIGNING <fieldcat>.
        <fieldcat>-col_pos = <fieldcat>-col_pos + sy-tfill.
      ENDLOOP.
      LOOP AT lt_fieldcat ASSIGNING <fieldcat>.
        READ TABLE lt_sort ASSIGNING <sort>
                            WITH KEY fieldname = <fieldcat>-fieldname.
        CHECK sy-subrc EQ 0.
        <fieldcat>-col_pos = <sort>-spos.
      ENDLOOP.
      SORT lt_fieldcat BY col_pos.
      LOOP AT lt_fieldcat ASSIGNING <fieldcat>.
        <fieldcat>-col_pos = sy-tabix.
      ENDLOOP.
    Underline if the sort is by UNAM or UDAT
      READ TABLE lt_sort ASSIGNING <sort> INDEX 1.
      IF <sort>-fieldname = 'UNAM'  OR
         <sort>-fieldname = 'UDAT'.
        <sort>-group = 'UL'.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_SET'
           EXPORTING
                it_sort     = lt_sort
                it_fieldcat = lt_fieldcat.
    ENDFORM.                               " F_MODIF_FIELDCAT
    END OF PROGRAM Z_DEMO_ALV_EVENT_EXIT_1 ***********************

Maybe you are looking for

  • Relative path to image in contentfolder

    Hi, In Configurator 1.0 I was able to put an image/logo in the content folder and use the SWF/Image Loader to show that image just by typing the images name in the URL field. I can't get that to work with Configurator 2.0 !? Do I have to type a speci

  • ITunes imports movies; they do not show in catalog

    I have around 500 movies in my iTunes catalog. All of these have been ripped from DVD and run through MetaX to add titles,artwork, etc. Along the way there have been bumps with iTunes here and there, but I have learned what they want and have done my

  • Re: Using the setSearchSelection() method of Selector

    Hello All! I am not clear what value needs to be supplied to the setSearchSelection method of Selector object(Although the API help specifies that a string needs to be passed) Can someone throw some light? Actullay, I need to find a way to fetch all

  • Is it possible to send a fcp x project (media and events) to be finished on a imac running fcp7?

    I started a project using FCP X on a Macbook as part of a training workshop in a school.  The school have requested that, if possible, I send the rough cut and all media to them, as they have access to FCP 7 running on an iMac.  What is the best way

  • Connecting to computers

    Can someone give me an example of the java code I have to write to do the following: I have 10 computers. From one of them, I want to connect to the other 9, map each C:\ drive so I can scan the directories for files and file versions. the java code