Is possible to change ALV report  which include ALE change ?

I friends , i have developed an ALV report and now a new require ment has come , it is , the client wants to make it  ALE enable . I have no idea how to include ALE changes to it ? If any body of you have any idea please help me  from beginning?

HI,
for ALE enabling, you have create idoc's for the alv data and distribute them to the target server.
for step by step implementation of ALE check this link.
http://www.sappoint.com/abap.html
Regards,
Wasim Ahmed
Message was edited by: Wasim Ahmed

Similar Messages

  • Possibility of calling ALV report

    hi experts,
    i have a requirement that i have to design an entry screen whcih contain pushbuttons (SAVE, CLEAR ,DISPLAY).
    whenever user pressed DISPLAY, he wants to call the selection screen of an alv report which is already exists.
    is that possible to call an alv report selection screen and execute it.
    any suggestions pls.
    thanks&regards
    maheshlap.
    Edited by: Thomas Zloch on Dec 17, 2011 11:07 PM

    Hi,
    Follow this code,
    *DISPLAY DYNAMIC PUSHBUTTON ON APP TOOLBAR ON USER CLICKS
    SELECTION-SCREEN: FUNCTION KEY 1,
                      FUNCTION KEY 2,
                      FUNCTION KEY 3.
    **EVENT ON SELECTION SCREEN FOR OUTPUT DISPLAY
    AT SELECTION-SCREEN OUTPUT.
    *CLICK OF FIRST RADIO BUTTON
      IF pa = 'X'.
        sscrfields-functxt_01 = 'Materials Management'.
        WRITE icon_plant AS ICON TO text_001.
    *CODE TO GET DYNAMICS BASED ON THE SELECTED RADIO
        LOOP AT SCREEN.
          IF screen-group1 = 'MOD'.
            screen-intensified = '1'.
            screen-active = 1.
            screen-display_3d = '1'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'RAD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'CAD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    *CLICK OF SECOND RADIO
      IF pb = 'X'.
        sscrfields-functxt_02 = 'Sales And Distribution'.
        WRITE icon_ws_ship AS ICON TO text_001.
        LOOP AT SCREEN.
          IF screen-group1 = 'RAD'.
            screen-intensified = '1'.
            screen-active = 1.
            screen-display_3d = '1'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'MOD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'CAD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    *CLICK OF THIRD RADIO
      IF pc = 'X'.
        sscrfields-functxt_03 = 'Human Resources'.
        WRITE icon_new_employee AS ICON TO text_001.
        LOOP AT SCREEN.
          IF screen-group1 = 'RAD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'MOD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'CAD'.
            screen-intensified = '1'.
            screen-active = 1.
            screen-display_3d = '1'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    *CUSTOMISING THE TOOLBARS OF THE SELECTION SCREEN
    *WITH F8 BUTTON DISABLED
      APPEND :  'PRIN' TO it_ucomm,
                'SPOS' TO it_ucomm,
                'ONLI' TO it_ucomm.
      CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
        EXPORTING
          p_status  = sy-pfkey
        TABLES
          p_exclude = it_ucomm.
    Warm Regards,
    PavanKumar.G

  • How to create report which includes records of current month and last 7 days of previous month.

    Hi Experts,
    I need to create a report which includes records of current month and last 7 days of previous month.
    I will get records of current month by this formula :- month({PROBSUMMARYM1.OPEN_TIME})=month(currentdate)
    Please tell me how to add the records of last 7 days of previous Month for the same report.
    Thanks in Advance.

    Hi Ajay,
    If you have more than a year data in your database then your formula will return wrong results. ie. If your data consist of 2012,2013,2014 data then below formula will return all 8th month data irrespective of year. So, you need to check year also here
    month({PROBSUMMARYM1.OPEN_TIME})=month(currentdate)  and
    Year({PROBSUMMARYM1.OPEN_TIME})=Year(currentdate)
    Now add Abhilash second statement in OR so, your formula should look like :
    (month({PROBSUMMARYM1.OPEN_TIME})=month(currentdate)  and
    Year({PROBSUMMARYM1.OPEN_TIME})=Year(currentdate))
    OR
    Date({PROBSUMMARYM1.OPEN_TIME}) IN [DateAdd('d',-7,Maximum(LastFullMonth)), Maximum(LastFullMonth)
    -Sastry

  • ALV report which displays Delivery and Invoice details..by linking vbfa.

    Hi...
    I wants to develop an ALV Report, which displays Delivery details as well as Invoice details for a range of given sale orders.
    For this report I am using Tables : VBAK,VBAP,LIKP,LIPS,VBFA tables .
    Here VBFA is a table for Document flow how to link this with report ??
    Please reply.
    Regards ,
    ASHOK
    Moderator message : Not enough re-search before posting, spec dumping not allowed. Thread locked.
    Edited by: Vinod Kumar on Aug 1, 2011 9:58 AM

    VBFA has VBELV and POSNV can be used to map VBAP (sales order item) i.e.
    VBFA-VBELV = VBAP-VBELN AND
    VBFA-POSNV = VBAP-POSNV
    with VBTYP_N = J Values available in VBFA-VBELN and VBFA-POSNN will be LIPS -VBELN and LIPS-POSNR
    VBTYP_N/ VBTYP_V = J stands for delivery and C stands for order
    Nitesh

  • Is it possible to run ALV report in background if Yes how?

    is it possible to run ALV report in background if Yes how?

    Hi,
    Why not?Through se38 only you create ALV report. there you can give your report name and go to program on menu bar - click - execute buton- click-Background . You will get new screen there you can choose Execute immediate or schedule.
    <REMOVED BY MODERATOR>
    Cheers,
    Chandra Sekhar.
    Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:12 PM

  • Accounts Receivable - Report which includes Volumetrics i.e. Material/Volume/Price

    Hello,
    What report can be used to obtain the following for Accounts Receivable (all in one report would be preferred):
         AR Aging
         Material Code
         Volume
         Price of material
    For example, AR has $1M due from a customer (its current/within 30 days)
         What material(s) does that cover? It covers x,y,z materials
         At what price per material? x price is $90.81 per bbl, y price is $100.79 per bbl and z price is $65.84 per bbl
         What is the volume of each? x volume is 5,000 bbls, y volume is 3,000 bbls and z volume is 3,700
    We need to be able to run a report that includes all the above data.
    Any help is greatly appreciated.
    Thanks!

    Please check report under Financial-> Financial report->Accounting->Aging- > Choose customer aging receivables.
    Also here is a list of other usual reports available:
    Accounting - Financial Accounting - Customers - Information System - Reports for Accounts Receivable Accounting
    Customer Balances
    S_ALR_87012167 - Accounts Receivable Information System
    S_ALR_87012172 - Customer Balances in Local Currency
    S_ALR_87012186 - Customer Sales
    S_ALR_87012169 - Transaction Figures: Account Balance
    S_ALR_87012170 - Transaction Figures: Special Sales
    S_ALR_87012171 - Transaction Figures: Sales
    Customers: Items
    S_ALR_87012168 - Due Date Analysis for Open Items
    S_ALR_87012197 - List of Customer Line Items
    S_ALR_87012173 - List of Customer Open Items for Printing
    S_ALR_87012174 - List of Customer Open Items
    S_ALR_87012175 - Open Items - Customer Due Date Forecast
    S_ALR_87012176 - Customer Evaluation with OI Sorted List
    S_ALR_87012177 - Customer Payment History
    S_ALR_87012178 - Customer Open Item Analysis by Balance of Overdue Items
    S_ALR_87012198 - List of Cleared Customer Items for Printing
    S_ALR_87012199 - List Of Down Payments Open On Key Date - Customers
    Master Data
    S_ALR_87012179 - Customer List
    S_ALR_87012180 - Address List
    S_ALR_87012182 - Display Changes to Customers
    S_ALR_87012183 - Display/Confirm Critical Customer Changes
    S_ALR_87012195 - Customer Master Data Comparison

  • Edit the field in an alv report, also save the changes.

    Hi Everyone,
        I have made one interactive ALV report using function
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    also i had provided the code to edit a particular col.
    fs_fieldcat-fieldname = 'AENAM'.
      fs_fieldcat-tabname = 't_mara'.
      fs_fieldcat-seltext_m = 'Changed by'.
      fs_fieldcat-emphasize = 'X'.
      fs_fieldcat-edit = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat.
    now i want to make changes in the AENAM field and save the changes done back on the database table MARA.
    pls, if anyone can provide me some assitance  on how to save the changes on the alv.
    Regards
    Ravi Aswani.

    When SAVE Using the User_command handle the Changed records, and modify the Material using BAPI.
    Just check this following code sample. For this you need to handle to events one PF-STATUS and other USER_COMMAND. see the below comments.
    REPORT  zalv_edit.
    TYPE-POOLS: slis.
    DATA: x_fieldcat  TYPE slis_fieldcat_alv,
          it_fieldcat TYPE slis_t_fieldcat_alv.
    data: BEGIN OF itab OCCURS 0,
            vbeln LIKE vbak-vbeln,
            posnr LIKE vbap-posnr,
            kwmeng LIKE vbap-kwmeng,
          END OF itab.
    SELECT vbeln
           posnr
           kwmeng
      FROM vbap
      UP TO 20 ROWS
      INTO TABLE itab.
    x_fieldcat-fieldname = 'VBELN'.
    x_fieldcat-seltext_l = 'VBELN'.
    x_fieldcat-hotspot = 'X'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 1.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'POSNR'.
    x_fieldcat-seltext_l = 'POSNR'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 2.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'KWMENG'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 3.
    x_fieldcat-input = 'X'.
    x_fieldcat-edit = 'X'.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program       = sy-repid
        i_callback_pf_status_set = 'STATUS'
        i_callback_user_command  = 'USER_COMMAND'
        it_fieldcat              = it_fieldcat
      TABLES
        t_outtab                 = itab
      EXCEPTIONS
        program_error            = 1
        OTHERS                   = 2.
    IF sy-subrc NE 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *&      Form  STATUS
    *       PF-STATUS
    FORM status USING p_extab TYPE slis_t_extab.
      "Set the Button using the staus
      "Copy the Standard status from the program SAPLKKBL status
      " STANDARD using SE41, and use that here.
      "Pf status
      SET PF-STATUS 'STATUS' EXCLUDING p_extab.
    ENDFORM. " STATUS
    *&      Form  USER_COMMAND
    *       USER_COMMAND
    FORM user_command USING r_ucomm LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      DATA: gd_repid LIKE sy-repid,
            ref_grid TYPE REF TO cl_gui_alv_grid.
      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 .
      ENDIF.
      CASE r_ucomm.
        WHEN 'SAVE'.
          "Here you will get the data(along with modified rows/data)
          "Filter the modified rows and update to DB using BAPI/BDC
          "Accordingly
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM. "USER_COMMAND

  • Report which include sales order, material, qty, raw mat cost, sold gds cst

    Dear All,
    I want report which has to provide Sales order No, Material, Material Description, Raw material cost and Cost of sold goods.
    Please suggest
    Regards

    Hi,
    VA05 return all the orders that are present under one customer.
    It will give you customer number,material and material description etc...
    But failed in other fields.
    So you have to develop a Z report with the help of your ABAPer.
    Regards,
    Krishna.

  • Price change summary report & approach of price change on Sales Orders

    Hi,
    I have made the setups for updating the price on Sales Order via profile options (i update the list price field on SO line the SO line price gets updated). The Customer have manual price overide in their existing system in place so they want same in oracle system as well. Their price change doesn't have any serious logic,,it is quite erratic based on market condition on that day.
    (1) How can I get the report fro the changed price wrt price on price list for all the items on Sales Orders (during a period). It seems, Audit trial functionality for changing list price is not available.
    (2) For the system whether required price change as above is better approach or maintaining new price list all the time is preferable option. In case of new price list, do we have any standard report which fetches itemwise price change details on Sales Orders for a period.
    Thanks.
    With Best Regards,
    Nirabh Nayan

    Nirabh,
    Did you say you update the List Price itself in the Order Lines? In my opinion you should never update List Price. Set the profile OM: Discounting Privilege to 'Unlimited' to allow update of Selling Price, but switch off 'OM: List Price Override Privilege' for the responsibilities so that List Price field is not Editable. So that List Price always reflect the price with which Order Line was created (From the price List). Now create a custom report wherever Unit Selling Price does not match Unit List Price.
    If you really want to go a little further then create a modifier with Application method 'New Price' that should kick in everytime the Unit Selling Price is updated. Let me know if that helped.
    Dipanjan
    Edited by: Dipanjan Maitra on May 25, 2012 2:25 PM

  • Wan to add a sr.no in alv list which shld not change after sortin any field

    Hi Expert
    i want to hav a o/p
    like
    field1 field2 field3 field4
    1 A1 B C
    2 c a b
    3 b c a
    here ma first field shld remain as it is
    even dou i sort the fiel2 and field3 and field4 but ma field 1 shld npt change
    in runtime for example if i sort field3 ma o/p shld be
    field1 field2 field3 field4
    1 c a b
    2 A1 B C
    3 b c a
    plz help me out
    points wll b rewarded

    For that you need to refresh the your internal table with the new serial number after the SORT.
    For gaining the control back from ALV to program you need to implement the FM's parameter EVENTS_EXIT.
    You need to give the FORM in this Perform which will be called after the SORT event.
    IN that perform you can do like this:
    SORT ITAB.
    LOOP AT ITAB.
      ITAB-SRL = SY-TABIX.
      MODIFY ITAB.
    ENDLOOP.
    Regards,
    Naimesh Patel

  • PO report which includes Vendor Material number

    I am looking for a report similar to ME2K but including the Vendor Material Number.  Customer wants to run by Cost Centre and Material group.  However, I cannot find a way to include the Vendor Material number on this report, is there a way to do that thorugh config?
    Thanks for any info.

    Hi,
    You can find the vendor material number in the material data tab of purchase order.
    Goto EKPO table enter the PO numebr and look for the field name with vendor material number. Select that with all other fields . for cost center and account assignment chekc table EKAN.
    Write the program to fetch data from all these tables with feild names.
    Hope thsi helps.
    Regards,
    Smitha

  • Summing up a Column in ALV report

    Hi All,
    I have developed an ALV Report which will display Invoices and other details.
    Now i need to display the sum of NETWR column, if user wish to select that column and click the "SUM" icon.
    As of now, if i select the NETWR column and click 'SUM" column, i am getting Runtime error.
    How to resolve this issue?
    Regards
    Pavan

    Hi Pavan,
    ALV GRID CONTROL:
    This task is performed by the SAP Control Framework.
    The R/3 System allows you to create custom controls using ABAP Objects. The application server is the Automation Client, which drives the custom controls (automation server) at the front end.
    If custom controls are to be included on the frontend, then the SAPGUI acts as a container for them.
    Custom controls can be ActiveX Controls or JavaBeans.
    The system has to use a Remote Function Call (RFC) to transfer methods for creating and using a control to the front end.
    ABAP objects are used to implement the controls in programs.
    An SAP Container can contain other controls (for example, SAP ALV Grid Control, Tree Control, SAP Picture Control, SAP Splitter Control, and so on). It administers these controls logically in one collection and provides a physical area for the display.
    Every control exists in a container. Since containers are themselves controls, they can be nested within one another. The container becomes the parent of its control. SAP containers are divided into five groups:
    SAP custom container: Displays within an area defined in Screen Painter on screens or sub screens.
    Class: CL_GUI_CUSTOM_CONTAINER
    SAP dialog box container: Displays in a modeless dialog box or as a full screen. Class:
    CL_GUI_DIALOGBOX_CONTAINER
    SAP docking container: Displays as docked, resizable sub-window with the option of displaying it as a modeless dialog box. Class: CL_GUI_DOCKING_CONTAINER
    SAP splitter container: Displays and groups several controls in one area - that is, splits the area into cells Class: CL_GUI_SPLITTER_CONTAINER
    SAP easy splitter container: Displays controls in two cells, which the user can resize using a split bar. Class: CL_GUI_EASY_SPLITTER_CONTAINER.
    In the control, you can adjust the column width by dragging, or use the 'Optimum width' function to adjust the column width to the data currently displayed. You can also change the column sequence by selecting a column and dragging it to a new position.
    Standard functions are available in the control toolbar. The details display displays the fields in the line on which the cursor is positioned in a modal dialog box.
    The sort function in the ALV Control is available for as many columns as required. You can set complex sort criteria and sort columns in either ascending or descending order.
    You can use the 'Search' function to search for a string (generic search without *) within a selected area by line or column.
    You can use the 'Sum' function to create totals for one or more numeric columns. You can then use the "Subtotals" function to set up control level lists: You can use the 'Subtotal' function to structure control level lists: select the columns (non-numeric columns only) that you want to use and the corresponding control level totals are displayed.
    For 'Print' and 'Download' the whole list is always processed, not just the sections displayed on the screen.
    You can define display variants to meet your own specific requirements. For information on saving variants, see 'Advanced Techniques'.
    The ALV grid control is a generic tool for displaying lists in screens. The control offers standard functions such as sorting by any column, adding numeric columns, and fixed lead columns .
    Data collection is performed in the program (with SELECT statements, for example) or by using a logical database. The data records are saved in an internal table and passed on to the ALV control along with a field description.
    The field description contains information about the characteristics of each column, such as the column header and output length. This information can defined either globally in the Dictionary (structure in the Dictionary) or in the field catalog in the program itself. You can also merge both techniques.
    The ALV link is a standard function of Query and QuickViewer. If multiline queries or Quick View lists have been defined, they will automatically be compressed to a single line and output in the ALV control as a long, single line list.
    Use Screen Painter to create a sub screen container for the ALV grid control. The control requires an area where it can be displayed in the screen. You have to create a container control that determines this area.
    Use the corresponding icon in the Screen Painter layout to create the container control. The size of area "MY_CONTROL_AREA" determines the subsequent size of the ALV control.
    The valid GUI status must be set at the PBO event in the flow logic of the ALV subscreen container.
    The OK_CODE processing for the cancel functions must be programmed at the PAI event.
    The reference variables for the custom container and the ALV grid control must be declared.
    To create reference variables, use ABAP statement TYPE REF TO .
    The global classes you need to do this are called cl_gui_custom_container (for the custom container control) and cl_gui_alv_grid (for the ALV grid control).
    The global classes are defined in the Class Builder. You can use the Class Builder to display information for the methods, their parameters, exceptions, and so on.
    Use ABAP statement CREATE OBJECT to create the objects for the container and the ALV control. Objects Are instances of a class.
    When an object is created (CREATE), method CONSTRUCTOR of the corresponding class is executed. The parameters of method CONSTRUCTOR determine which parameters have to be supplied with data when the object is created. In the above example, object alv_grid is given the name of the container control (g_custom_container) in exporting parameter i_parent, which links the two controls. For information on which parameters method CONSTRUCTOR possesses and which of these parameters are required, see the Class Builder.
    Objects should only be created once during the program. To ensure that this is the case, enclose the CREATE OBJECT statement(s) in an IF IS INITIAL. ... ENDIF clause. The objects must be generated before the control is displayed for the first time - that is, during the PBO event of the ALV subscreen container.
    To display the requested dataset in the ALV control, the data must be passed on to the control as an internal table, and a field description must exist indicating the order in which the columns will be output.
    In the simplest case, the field description can use a structure from the Dictionary. The Dictionary also determines the technical field attributes like type and length, as well as the semantic attributes like short and long texts. The ALV control uses this information to determine the column widths and headers. The column sequence is determined by the field sequence in the structure.
    If no suitable structure is active in the Dictionary, or you want to output internal program fields in the control, then you will have to define information like the output length and column header in the field catalog.
    In a typical program run, the dataset is read first (SELECT ....), the internal table is filled with the data to display (... INTO TABLE ...), and ABAP statement CALL SCREEN is then used to call the ALV sub screen container.
    The data transfer to the ALV control takes place during the call of method
    set_table_for_first_display from class cl_gui_alv_grid. The method call must be programmed at the PBO event of the ALV subscreen container.
    The name of the Dictionary structure that supplies the field description is specified in exporting parameter i_structure_name. The name of the internal table that contains the data records to display is specified in changing parameter it_outtab.
    The field description for the ALV control can be ta ken from an active Dictionary structure (fully automatic), by passing a field catalog (manual), or through a mixture of the two options (merge).
    The field catalog is in internal table with type lvc_t_fcat. This type is defined globally in the Dictionary.
    Each line in the field catalog table corresponds to a column in the ALV control.
    The field characteristics (= column characteristics) are defined in the field catalog. The field catalog is in internal table with type lvc_t_fcat. Each line that is explicitly described in the ALV control corresponds to a column in the field catalog table.
    The link to the data records to output that are saved in internal table is established through field name . This name must be specified in column "fieldname" in the field catalog.
    This field can be classified through a Dictionary reference (ref_table and ref_field) or by specifying an ABAP data type (inttype).
    Column headers and field names in the detail view of an ALV control line can be determined in the field catalog in coltext and seltext, respectively.
    The position of a field during output can be determined with col_pos in the field catalog.
    If you want to hide a column, fill field no_out with an "X" in the field catalog. Hidden fields can be displayed again in a user display variant.
    Icons can be displayed in the ALV control. If you want a column to be interpreted as an icon, then the icon name must be known to the program (include .) and icon = "X" must be specified for this column in the field catalog.
    The above example shows a semi-automatic field description: Part of the field description comes from the Dictionary structure (sflight), while another part is explicitly defined in the field catalog (gt_fieldcat).
    The field catalog (internal table) is filled in the program and is passed on together with the name of the Dictionary structure during the method call. The information is merged accordingly in method set_table_for_first_display.
    For a user to save display variants, parameters is_variant and i_save must be passed on during method call set_table_for_first_screen. To assign display variants uniquely to a program, at least the program name must be supplied in the transferred structure (gs_variant).
    Program names can be up to 30 characters long.
    If you only pass on the current parameters for is_variant, then existing variants can be loaded, but no new ones can be saved. If you use parameter i_save, you must pass on a variant structure with is_variant.
    I_SAVE = SPACE No variants can be saved.
    I_SAVE = 'U' The user can only save user-specific variants.
    I_SAVE = 'X' The user can only save general (shared) variants.
    I_SAVE = 'A' The user can save both user-specific and general (shared) variants.
    You can use parameter is_layout of method set_table_for_first_display, for example, to define the header in the ALV control and the detail display.
    To do this, define a query area in the program in accordance with Dictionary structure lvc_s_layo, and pass on the text to display in field -grid_title or -detailtitl.
    If you want to create print lists with zebra stripes, set field -zebra to "X". You can display a print preview for print lists by requesting standard function "Print".
    All parameters of method SET_TABLE_FOR_FIRST_DISPLAY from global class
    CL_GUI_ALV_GRID are defined in the Class Builder.
    Events are defined in global class cl_gui_alv_grid; you can use these events to implement user interaction within the program. To respond to a double -click on a table line, you must respond to event DOUBLE_CLICK.
    You receive control in the program, allowing you to implement interactive reporting - such as a full screen details list. The events for cl_gui_alv_grid are located in the Class Builder.
    To define an implement a local class in the program, you use a handler method. In this handler method, you program the functionality to trigger by a double -click in the output table.
    To activate a handler method at runtime, a class or an object from that class registers itself with an event using command SET HANDLER. The names of the IMPORTING parameters in the handler method correspond to the names of the EXPORTING parameters of the related event.
    In the above example, the local class is LCL_ILS and the handler method is ON_DBLCLICK. An object - ALV_DBLCLICK - is created and registers itself for event DOUBLE_CLICK.
    You can query parameter e_row-index to determine which output line was requested by the double -click. This parameter corresponds to the line number of the output table (internal table with the data records to output). If you need information for the selected line, you have to read it with READ TABLE itab INDEX e_row-index.
    This subsequent read in the output table generally corresponds to the HIDE area in conventional reporting. You first have to make sure that the user has double -clicked a line in the output table (similar to the valid line selection with the HIDE technique).
    A field group can contain global data objects, but not data objects that have been defined locally in a subroutine or function module.
    You can use INSERT to specify both fields and field symbols. This makes it possible to dynamically insert a data object referred to by a field symbol into a field group at runtime. Any field symbols that have not been assigned are ignored, which means no new field is inserted into the field group.
    The EXTRACT statement writes all the fields of a field group as one record to a sequential dataset (transport takes place with similarly named fields). If a HEADER field group is defined, then its fields are placed ahead of each record as sort keys. You can then sort the dataset with SORT and process it with LOOP ...ENDLOOP. In this case, no further EXTRACT is possible.
    The INSERT statement is not a declarative statement: This means field groups can also be expanded in the program flow section.
    As soon as the first dataset of a field group has been extracted with EXTRACT, that field group can no longer be expanded with INSERT. In particular, the HEADER field group cannot be expanded after the first EXTRACT (regardless of the field group).
    When the GET events are processed, the logical database automatically writes hexadecimal zeros in all the fields of a node when it returns to an upper-level node in the hierarchy. Since the HEADER normally contains sort fields for all field groups, these hexadecimal zeros in the HEADER serve as a type of hierarchy key: The more zeros there are, the further up in the control level hierarchy you go.
    &#61550;&#61472;The SORT statement sorts the extract dataset in accordance with the defined field sequence in field group HEADER. The addition BY ... sets a new sort key.
    Each must be either a field of field group HEADER or a field group that consists only of fields of the field group HEADER. You can use the additions ASCENDING and DESCENDING to determine whether the fields are sorted in ascending (default) or descending order.
    Fields containing X'00' in the logical databases are always displayed before all other values during a SORT.
    Processing of an extract dataset always takes places within a LOOP. The contents of the extract dataset field are placed in program fields with the same names.
    The group change always involves the fields of the HEADER. Single record processing for extract datasets is performed using language element AT ( = field group).
    CNT() is not a statement, but instead a field that is automatically create d and filled when is a non-numeric field from field group HEADER and is part of the sort key. At the end of the group, CNT() contains the number of different values that the field recorded in this group level.
    SUM() is not a statement, but instead a field that is automatically created and filled when is a numeric field of an extract dataset. At the end of the group, SUM() contains the control total of field .
    *** and CNT are only available at the end of the group level or at AT LAST.
    Single record processing for extract datasets AT WITH is only performed when field group is immediately followed by field group in the temporary dataset.
    Loops over an extract dataset cannot be nested. However, several contiguous loops are permitted.
    The sequence of the control level changes within the LOOP must correspond to the sort sequence.
    Totals can only be calculated within control footer processing.
    Extracts allow only appends (EXTRACT), sorting (SORT) and sequential processing (LOOP).
    Once a SORT or LOOP has occurred, the intermediate dataset is frozen and cannot be expanded with EXTRACT. Operations that insert into or delete from EXTRACT datasets are not supported.
    Extracts allow for several record types (FIELD-GROUPS) with fields that can be set dynamically (INSERT is not a declarative statement!). Internal tables have a single, statically-defined line type.
    Internal tables use the sequence of table fields according to the declaration for the hierarchy of the control leve l. The control level structure for internal tables is therefore static, and is independent of which criteria were used to sort the internal table.
    Extracts do not depend on the field sequence for control level processing: a re-sort or a completely different control level process can take place. The control level structure for extract datasets is therefore dynamic. It corresponds exactly to the sort key of the extract dataset. The sort key is the sequence of fields from the field group HEADER, and is used to sort the extract dataset.
    Extracts rely on the compiler to determine which combinations of group levels and a cumulating field the control level totals desire. The desired control level totals are determined by the processing of LOOP ... ENDLOOP blocks. Internal tables build the control level total with the SUM statement.
    This procedure leads to high resource depletion for totaling control levels in internal tables.
    Regards,
    Chandru

  • Problem in ALV report o/p to Excel

    Hi to all
    I have developed an ALV report, which is showing correct display and out put.
    But when I am downloading it to excel, o/p is not coming in proper way. Fields are misplaced from there actual place and not in readable condition.
    Please guide me..
    Regards
    Anubhav

    Hello Lakshmiraj
    I am sending you the coding of my ALV report program.
    Please check.
    REgards
    Anubhav
    *& Report  YRMR033_AMENDMENT_ORDER_LIST
    *& DEVELOPER : ANUBHAV GUPTA
    *& DATE : 21.03.2008
    *&  REPORT DESCRIPTION : REPORT TO DISPLAY  AMENDMENTS IN PURCDHASE ORDERS
                            WITH OLD VALUES AND NEW VALUES.
    REPORT YRMR033_AMENDMENT_ORDER_LIST LINE-SIZE 132 NO STANDARD PAGE HEADING
    LINE-COUNT 065(001)
    MESSAGE-ID VR.
    TABLES: DD04T,
    CDHDR,
    CDPOS,
    DD03L,
    DD41V,
    T685T,
    VBPA,
    TPART,
    KONVC,
    EKKO.
    TABLES : NAST,  LFA1,ekpo.
    SELECT-OPTIONS: "XUDATE FOR nast-erdat OBLIGATORY, "Created on date
                    XUDATE FOR CDHDR-UDATE OBLIGATORY, "Amendment date
                    S_EKGRP FOR EKKO-EKGRP,
                    s_lifnr for ekko-lifnr.
    SELECTION-SCREEN SKIP.
    DATA: WFLAG,
    WCHANGENR LIKE CDHDR-CHANGENR.
    DATA: INDTEXT(60) TYPE C.
    DATA: BEGIN OF ICDHDR OCCURS 50.
            INCLUDE STRUCTURE CDHDR.
    DATA: END OF ICDHDR.
    DATA: BEGIN OF ICDSHW OCCURS 50.
            INCLUDE STRUCTURE CDSHW.
    DATA: END OF ICDSHW.
    DATA: BEGIN OF EKKEY,
    EBELN LIKE EKET-EBELN,
    EBELP LIKE EKET-EBELP,
    ETENR LIKE EKET-ETENR,
    END OF EKKEY.
    DATA: BEGIN OF ITAB OCCURS 50,
    BEGIN OF EKKEY,
    EBELN LIKE EKET-EBELN,
    EBELP LIKE EKET-EBELP,
    ETENR LIKE EKET-ETENR,
    END OF EKKEY,
    ebeln like ekko-ebeln,
    ebelp like ekpo-ebelp,
    CHANGENR LIKE CDHDR-CHANGENR,
    UDATE LIKE CDHDR-UDATE,
    UTIME LIKE CDHDR-UTIME,
    USERNAME LIKE CDHDR-USERNAME,
    CHNGIND LIKE CDSHW-CHNGIND,
    FNAME LIKE CDSHW-FNAME,     "ADDED BY ANUBHAV
    FTEXT LIKE CDSHW-FTEXT,
    OUTLEN LIKE CDSHW-OUTLEN,
    F_OLD LIKE CDSHW-F_OLD,
    F_NEW LIKE CDSHW-F_NEW,
    END OF ITAB.
    DATA : BEGIN OF ITAB1 OCCURS 0,
            EBELN LIKE EKET-EBELN,
            bedat like ekko-bedat,
            EBELP LIKE EKET-EBELP,
            txz01 like ekpo-txz01,
            lifnr like ekko-lifnr,
            name1 like lfa1-name1,
            UDATE LIKE CDHDR-UDATE,
            FTEXT LIKE CDSHW-FTEXT,
            F_OLD LIKE CDSHW-F_OLD,
           ekgrp like ekko-ekgrp,
           F_NEW LIKE CDSHW-F_NEW,
           CHANGENR LIKE CDHDR-CHANGENR,
    UTIME LIKE CDHDR-UTIME,
    USERNAME LIKE CDHDR-USERNAME,
    CHNGIND LIKE CDSHW-CHNGIND,
    FNAME LIKE CDSHW-FNAME,     "ADDED BY ANUBHAV
    OUTLEN LIKE CDSHW-OUTLEN,
    AMDNO TYPE CHAR4,
    END OF ITAB1.
    DATA: OLD_OBJECTID LIKE CDHDR-OBJECTID.
          INTERNAL TABLES
    ----"modification
    DATA: BEGIN OF I_NAST OCCURS 0,
           OBJKY TYPE NAST-OBJKY,
           ERDAT TYPE NAST-ERDAT,
           KAPPL TYPE NAST-KAPPL,
           KSCHL TYPE NAST-KSCHL,
           PARVW TYPE NAST-PARVW,
           PARNR TYPE NAST-PARNR,
           ERUHR TYPE NAST-ERUHR,
           AMDNO TYPE CHAR4,
           EBELN TYPE EKKO-EBELN,
          END OF I_NAST.
    DATA : I_NAST1 LIKE TABLE OF I_NAST WITH HEADER LINE.
    DATA: BEGIN OF I_TAB OCCURS 0,
           OBJKY TYPE NAST-OBJKY,
           ERDAT TYPE NAST-ERDAT,
           KAPPL TYPE NAST-KAPPL,
           KSCHL TYPE NAST-KSCHL,
           PARVW TYPE NAST-PARVW,
           PARNR TYPE NAST-PARNR,
           ERUHR TYPE NAST-ERUHR,
          END OF I_TAB.
    DATA: INDEX TYPE I.
    TYPE-POOLS : SLIS.
              ALV Declarations                                          *
    DATA: W_REPID            LIKE      SY-REPID,
          P_I_FIELDCAT       TYPE      SLIS_T_FIELDCAT_ALV,
          P_I_HEADING        TYPE      SLIS_T_LISTHEADER,
          I_LAYOUT           TYPE      SLIS_LAYOUT_ALV,
          I_EVENTS           TYPE      SLIS_T_EVENT,
          I_HEADING          TYPE      SLIS_T_LISTHEADER.
    DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
          SR TYPE I.
    INITIALIZATION----
    INITIALIZATION.
      CLEAR I_NAST.
      CLEAR I_TAB.
      REFRESH I_NAST.
      REFRESH I_TAB.
    AT SELECTIN SCREEN----
    AT SELECTION-SCREEN.
    PERFORM DATA_VALIDATION.
    TOP OF PAGE----
    TOP-OF-PAGE.
    PERFORM TOP_OF_PAGE.
    END OF PAGE----
    END-OF-PAGE.
    START OF SELECTION----
    START-OF-SELECTION.
      PERFORM BUILD_COMMENT  USING I_HEADING.
      PERFORM EVENT_BUILD CHANGING I_EVENTS.
      SELECT * FROM EKKO . " WHERE EBELN IN XEBELN AND
    *LIFNR IN XLIFNR.
        CLEAR CDHDR.
        CLEAR CDPOS.
        CDHDR-OBJECTCLAS = 'EINKBELEG'.
        CDHDR-OBJECTID = EKKO-EBELN.
        PERFORM GETCHGDOCS.
      ENDSELECT.
      DELETE ITAB WHERE ( FNAME NE 'NETPR'
                       AND FNAME NE 'NETWR'
                       AND FNAME NE 'MENGE' ).
      loop at itab.
        read table itab.
        itab-ebeln = itab-ekkey+0(10).
        itab-ebelp = itab-ekkey+11(4).
        modify itab.
      endloop.
      LOOP AT ITAB.
        MOVE-CORRESPONDING ITAB TO ITAB1.
        APPEND ITAB1.
      ENDLOOP.
      LOOP AT ITAB1.
        SELECT OBJKY ERDAT KAPPL KSCHL PARVW PARNR ERUHR
         FROM NAST
         INTO CORRESPONDING FIELDS OF TABLE I_NAST
         WHERE OBJKY = ITAB1-EBELN
           AND KAPPL = 'EF'
           AND KSCHL = 'ZNEU'
           AND PARVW = 'LF'
           AND SPRAS = SY-LANGU.
        IF SY-SUBRC NE 0.
          DELETE ITAB1.
        ENDIF.
        LOOP AT I_NAST.
          MOVE-CORRESPONDING I_NAST TO I_NAST1.
          APPEND I_NAST1.
        ENDLOOP.
      ENDLOOP.
      SORT I_NAST1 BY OBJKY ASCENDING ERDAT DESCENDING ERUHR DESCENDING.
      DELETE ADJACENT DUPLICATES FROM I_NAST1 COMPARING OBJKY.
    * Select data from TABLE NAST to get ebeln before selected date
      IF I_NAST1[] IS NOT INITIAL.
        SELECT OBJKY ERDAT KAPPL KSCHL PARVW PARNR ERUHR
        FROM NAST
        INTO CORRESPONDING FIELDS OF TABLE I_TAB
        FOR ALL ENTRIES IN I_NAST1
        WHERE OBJKY =  I_NAST1-OBJKY
          AND ERDAT <= I_NAST1-ERDAT
          AND PARNR =  I_NAST1-PARNR
          AND KAPPL =  'EF'
          AND KSCHL =  'ZNEU'
          AND PARVW =  'LF'
          AND SPRAS = SY-LANGU.
      ENDIF.
    Logic to get no of amendments for one po
      LOOP AT I_NAST1.
        CLEAR INDEX.
        LOOP AT I_TAB WHERE OBJKY = I_NAST1-OBJKY.
          INDEX = INDEX + 1.
        ENDLOOP.
        I_NAST1-AMDNO = INDEX - 1.
        I_NAST1-EBELN = I_NAST1-OBJKY.
        MODIFY I_NAST1 TRANSPORTING AMDNO EBELN.
      ENDLOOP.
    *LOOP AT I_NAST1.
    *READ TABLE ITAB1 WITH KEY EBELN = I_NAST1-EBELN.
    *IF SY-SUBRC = 0.
    *ITAB1-AMDNO = I_NAST1-AMDNO.
    *MODIFY ITAB1 TRANSPORTING AMDNO .
    *ENDIF.
    *ENDLOOP.
    DELETE I_NAST1 WHERE AMDNO = 0. "ADDED BY ANUBHAV
    LOOP AT ITAB1.
    READ TABLE I_NAST1 WITH KEY EBELN = ITAB1-EBELN.
    IF SY-SUBRC NE 0.
    DELETE ITAB1.
    ENDIF.
    ENDLOOP.
      loop at itab1.
        select single *
                                  from ekko
                                  into  ekko
                                  where ebeln = itab1-ebeln.
        if sy-subrc = 0.
          itab1-bedat = ekko-bedat.
          itab1-lifnr = ekko-lifnr.
          itab1-ekgrp = ekko-ekgrp.
          modify itab1.
        endif.
      endloop.
      DELETE ITAB1 WHERE EKGRP NOT IN S_EKGRP.
      DELETE ITAB1 WHERE LIFNR NOT IN S_LIFNR.
      loop at itab1.
        select single *
                      from lfa1
                      into lfa1
                      where lifnr = itab1-lifnr.
        if sy-subrc = 0.
          itab1-name1 = lfa1-name1.
          modify itab1.
        endif.
      endloop.
      loop at itab1.
        select single *
                      from ekpo
                      into ekpo
                      where ebeln = itab1-ebeln
                      and  ebelp = itab1-ebelp.
        if sy-subrc = 0.
          itab1-txz01 = ekpo-txz01.
          modify itab1.
        endif.
      endloop.
      sort itab1 by udate descending ebeln ebelp.
    building field catelogue
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'Itab1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'EBELN'.
      WA_FIELDCAT-SELTEXT_L  = 'PO NO '.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'Itab1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'BEDAT'.
      WA_FIELDCAT-SELTEXT_L  = 'PO DATE '.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'Itab1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'EBELP'.
      WA_FIELDCAT-SELTEXT_L  = 'Item No '.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'Itab1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'TXZ01'.
      WA_FIELDCAT-SELTEXT_L  = 'Item Description'.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'Itab1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'LIFNR'.
      WA_FIELDCAT-SELTEXT_L  = 'Vendor NO '.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'Itab1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'NAME1'.
      WA_FIELDCAT-SELTEXT_L  = 'Vendor Name'.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'ITAB1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'UDATE'.
      WA_FIELDCAT-SELTEXT_L  = 'Amendment Date'.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'ITAB1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'FTEXT'.
      WA_FIELDCAT-SELTEXT_l  = 'Change Field Description'.
      WA_FIELDCAT-just = 'L'.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'ITAB1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'F_OLD'.
      WA_FIELDCAT-SELTEXT_L  = 'Old Value '.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      ADD 1 TO SR.
      WA_FIELDCAT-COL_POS    = SR.
      WA_FIELDCAT-ROW_POS    = 1.
      WA_FIELDCAT-TABNAME    = 'ITAB1'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-FIELDNAME  = 'F_NEW'.
      WA_FIELDCAT-JUST       = 'L' .
      WA_FIELDCAT-SELTEXT_L  = 'New Value '.
      APPEND WA_FIELDCAT TO P_I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      DATA : L_REPID TYPE  SYREPID,
             L_REPID1 LIKE DISVARIANT.
      L_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
         I_BUFFER_ACTIVE                   = 'X'
         I_CALLBACK_PROGRAM                = L_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
         IS_LAYOUT                         = I_LAYOUT
         IT_FIELDCAT                       = P_I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
         I_SAVE                            = 'X'
         IS_VARIANT                        = L_REPID1
         IT_EVENTS                         = I_EVENTS
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = ITAB1[]
       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.
    *&      Form  GETCHGDOCS
          text
    FORM GETCHGDOCS.
      CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
        EXPORTING
          DATE_OF_CHANGE    = CDHDR-UDATE
          OBJECTCLASS       = CDHDR-OBJECTCLAS
          OBJECTID          = CDHDR-OBJECTID
          TIME_OF_CHANGE    = CDHDR-UTIME
          USERNAME          = CDHDR-USERNAME
        TABLES
          I_CDHDR           = ICDHDR
        EXCEPTIONS
          NO_POSITION_FOUND = 1
          OTHERS            = 2.
      CHECK SY-SUBRC EQ 0.
      DELETE ICDHDR WHERE CHANGE_IND EQ 'I'.
      CHECK NOT ICDHDR[] IS INITIAL.
      LOOP AT ICDHDR.
        CHECK ICDHDR-UDATE IN XUDATE.
       CHECK ICDHDR-USERNAME IN XNAME.
        CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
          EXPORTING
            CHANGENUMBER      = ICDHDR-CHANGENR
          IMPORTING
            HEADER            = CDHDR
          TABLES
            EDITPOS           = ICDSHW
          EXCEPTIONS
            NO_POSITION_FOUND = 1
            OTHERS            = 2.
        CHECK SY-SUBRC EQ 0.
        DELETE ICDSHW WHERE ( CHNGIND NE 'U' OR TABNAME NE 'EKPO' ).
        LOOP AT ICDSHW.
          CHECK ICDSHW-TEXT_CASE EQ SPACE.
          MOVE-CORRESPONDING ICDSHW TO ITAB.
          MOVE-CORRESPONDING ICDHDR TO ITAB.
          MOVE ICDSHW-TABKEY+3 TO ITAB-EKKEY.
          APPEND ITAB.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    "GETCHGDOCS
    *&      Form  BUILD_COMMENT
          text
         -->P_I_HEADING  text
    FORM BUILD_COMMENT  USING  P_I_HEADING TYPE SLIS_T_LISTHEADER.
      DATA: WA_LINE TYPE SLIS_LISTHEADER,
              TEXT1(50) TYPE C,
              TEXT2(40) TYPE C,
              W_DATE1(10) TYPE C,
              W_DATE2(10) TYPE C.
      CONCATENATE ' CHAMBAL FERTILISERS AND CHEMICALS LIMITED' ' ' INTO TEXT1.
      WA_LINE-TYP  = 'H'.
      WA_LINE-INFO = TEXT1.
      APPEND WA_LINE TO P_I_HEADING.
      CLEAR TEXT1.
      CONCATENATE ' AMENDED ORDERS' ' ' INTO TEXT1.
      WA_LINE-TYP  = 'S'.
      WA_LINE-INFO = TEXT1.
      APPEND WA_LINE TO P_I_HEADING.
      write xudate-low to w_date1 DD/MM/YYYY .
      write xudate-high to w_date2 DD/MM/YYYY .
      concatenate 'PERIOD FROM : ' W_DATE1 ' TO ' W_DATE2 INTO TEXT2 SEPARATED BY SPACE.
      WA_LINE-TYP = 'S'.
      WA_LINE-INFO = TEXT2.
      APPEND WA_LINE TO P_I_HEADING.
    ENDFORM.                    " build_comment
    *&      Form  EVENT_BUILD
          text
         -->P_I_EVENTS text
    FORM EVENT_BUILD  CHANGING P_I_EVENTS  TYPE SLIS_T_EVENT.
      DATA: W_EVENT TYPE SLIS_ALV_EVENT.
      CONSTANTS:
    GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = P_I_EVENTS.
      READ TABLE P_I_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO W_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO W_EVENT-FORM.
        APPEND W_EVENT TO P_I_EVENTS.
      ENDIF.
    ENDFORM.                    " event_build
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE .
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = I_HEADING
          I_LOGO             = 'CFCLLOGO'.
    ENDFORM.                    " top_of_page

  • How to print Column Labels on each print page of an ALV report

    Hi,
    I have an ALV report which is of 10 print pages.
    I need to print Column Labels on each print page.
    How it is possible.
    Plz write the solution
    Narendra

    Hi Narendra
    try this code.
    reward pts if help.
    Deepanker.
    *& Report  ZDEMO_ALVGRID_EDIT                                          *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display specific fields as          *
    *& editable depending on field value                                   *
    REPORT  ZDEMO_ALVGRID_EDIT                 .
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      field_style  TYPE lvc_t_styl, "FOR DISABLE
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER LINE,
          wa_fieldcat TYPE lvc_s_fcat,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM set_specific_field_attributes.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      wa_fieldcat-fieldname   = 'EBELN'.
      wa_fieldcat-scrtext_m   = 'Purchase Order'.
      wa_fieldcat-col_pos     = 0.
      wa_fieldcat-outputlen   = 10.
      wa_fieldcat-emphasize   = 'X'.
      wa_fieldcat-key         = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'EBELP'.
      wa_fieldcat-scrtext_m   = 'PO Item'.
      wa_fieldcat-col_pos     = 1.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'STATU'.
      wa_fieldcat-scrtext_m   = 'Status'.
      wa_fieldcat-col_pos     = 2.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'AEDAT'.
      wa_fieldcat-scrtext_m   = 'Item change date'.
      wa_fieldcat-col_pos     = 3.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MATNR'.
      wa_fieldcat-scrtext_m   = 'Material Number'.
      wa_fieldcat-col_pos     = 4.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MENGE'.
      wa_fieldcat-scrtext_m   = 'PO quantity'.
      wa_fieldcat-col_pos     = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MEINS'.
      wa_fieldcat-scrtext_m   = 'Order Unit'.
      wa_fieldcat-col_pos     = 6.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'NETPR'.
      wa_fieldcat-scrtext_m   = 'Net Price'.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      wa_fieldcat-col_pos     = 7.
      wa_fieldcat-outputlen   = 15.
      wa_fieldcat-datatype     = 'CURR'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'PEINH'.
      wa_fieldcat-scrtext_m   = 'Price Unit'.
      wa_fieldcat-col_pos     = 8.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
    Set layout field for field attributes(i.e. input/output)
      gd_layout-stylefname = 'FIELD_STYLE'.
      gd_layout-zebra             = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
           EXPORTING
                i_callback_program      = gd_repid
               i_callback_user_command = 'USER_COMMAND'
                is_layout_lvc               = gd_layout
                it_fieldcat_lvc             = it_fieldcat
                i_save                  = 'X'
           TABLES
                t_outtab                = it_ekko
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  set_specific_field_attributes
          populate FIELD_STYLE table with specific field attributes
    form set_specific_field_attributes .
      DATA ls_stylerow TYPE lvc_s_styl .
      DATA lt_styletab TYPE lvc_t_styl .
    Populate style variable (FIELD_STYLE) with style properties
    The NETPR field/column has been set to editable in the fieldcatalog...
    The following code sets it to be disabled(display only) if 'NETPR'
    is gt than 10.
      LOOP AT it_ekko INTO wa_ekko.
        IF wa_ekko-netpr GT 10.
          ls_stylerow-fieldname = 'NETPR' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                                 "set field to disabled
          APPEND ls_stylerow  TO wa_ekko-field_style.
          MODIFY it_ekko FROM wa_ekko.
        ENDIF.
      ENDLOOP.
    endform.                    " set_specific_field_attributes
    pls reward pts is help,

  • Regarding download of the ALV report to excel

    Hi experts,
    I have an ALV report which took long time to extract records from various table. So while there is some restriction the report can be executed well in foreground. And the report can be extracted well to excel sheet. But while there is hudge records, i have to execute the report in backgroung. And then from spool i generally prefers to download the report to excel.
    There is a field UOM where it contains value ' " ' for some records. And also there may be possiblity that other fields can also contain the same.
    Now my problem is: while download to excel... When ever there is a value ' " ' from this point to the next value ' " '. It is treating as one record. and keep that in a same position in the excel sheet.
    But i want to keep all the values in there respective fields. Can you please how can i do that? Please give me some solution...
    regards,
    charles.

    Actually now I think there is another way to do this, storing file on application server can create problems as sometimes the users don't have directory write access or things like that.
    Instead you should export your data to a memory or database cluster and import it back using abother program.
    The proposed changes would be
    1: At the point you are calling your alv grid function, check if the sy-batch is 'X' for background job, if yes than export to database table INDX or you can create your own. suppose your data is in internal table ITAB than in case of background job, you will do
    data: keyf like indx-srtfd.
    *We just assign username, date time to this
    concatenate sy-uname sy-datum sy-uzeit into keyf.
    EXPORT itab TO DATABASE indx(ZZ) ID keyf.
    check for subrc if export is successfull.
    Now you have stored your itab in database for later processing. remember to have keyf. In case of background job you can have it write in the output so from spool output you can check what was the keyf to use.
    You have to write another program to import itab from database and download it or display it.....
    This program will have keyf as input parameter and you must define ITAB same as the orignal program.
    parameters: p_keyf like like indx-srtfd.
    import itab from database indx(ZZ) id keyf.
    *Now you have itab. do whatever you want with it. download it using GUI_DOWNLOAD function or display it in an ALV grid.......
    Hope you got the overall idea.

Maybe you are looking for