Hi gurus what is ALV grid contol explain me plz

hi gurus what is ALV grid contol explain me plz

Hi
Check the below link:
http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
http://www.geocities.com/ZSAPcHAT
http://www.allsaplinks.com/files/using_table_in_screen.pdf
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.sap-img.com/
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
You can also check the transaction ABAPDOCU which gives you lot of sample programs.
Also you can see the below examples...
Go to se38 and give demodynpro and press F4.
YOu will get a list of demo module pool programs.
One more T-Code is ABAPDOCU.
YOu can find more examples there.
See the prgrams:
DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB
http://www.geocities.com/ZSAPcHAT
http://www.allsaplinks.com/files/using_table_in_screen.pdf
ALV
ABAP List Viewer
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
This helps us to implement all the features mentioned very effectively.
Using ALV, We can have three types of reports:
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
There are some function modules which will enable to produce the above reports without much effort.
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
iii. I_callback_user_command : routine where the function codes are handled
iv. I_structure name : name of the dictionary table
v. Is_layout : structure to set the layout of the report
vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table
iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events
for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action
Key : only when typ is ‘S’.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block
II. it_fieldcat : field catalog
III. i_tabname : internal table name with output data
IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the
output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field
names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output
ii. t_outtab_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary)
E. ref_tabname : table (dictionary)
F. key(1) : column with key-color
G. icon(1) : icon
H. symbol(1) : symbol
I. checkbox(1) : checkbox
J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
1->go to Screen Painter, choose the column which you need to make as drop down.
2->Click F2 to go tothe properties screen.
3->Select Listbox or Listbox with Key for the DROPDOWN field (3rd field in properties tab)
4->give value for the FCODE field also, to track the actions in SY_UCOMM when the user selects the value.
5->in the ABAP code, you need to include the logic to populate values for this drop down. You can use the function module VRM_SET_VALUES to populate the listbox in each line of the table control. The fucntion module has to be called in the PBO module, which is defined inside the loop...endloop statement in the flow logic.
6->for changing the values based on user selection, you can include the code in the PAI module, checking SY_UCOMM or OK_CODE.
check this link:
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBTUT/BCDWBTUT.pdf
http://help.sap.com/saphelp_40b/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/applet.htm
Have a look at these good links-
http://www.allsaplinks.com/dialog_programming.html
http://sap.mis.cmich.edu/sap-abap/abap09/
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://sap.mis.cmich.edu/abap-00/
http://www.allsaplinks.com/files/using_table_in_screen.pdf
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com
http://www.sapgenie.com/abap/example_code.htm
http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
http://www.allsaplinks.com/dialog_programming.html
http://www.sapbrain.com/TUTORIALS/default.html
http://www.sappoint.com/abap/spmp.pdf
http://sappoint.com/abap.html
http://www.sap-img.com/abap.htm
http://sap.ittoolbox.com/code/archives.asp?i=10&t=450&a=t
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.sap-img.com/abap/
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.sap-img.com/
http://www.sappoint.com/faq/faqdiapr.pdf
http://www.allsaplinks.com/dialog_programming.html
http://www1.sapdesignguild.org/resources/MiniSG/3_Managing/3_Overview_Tree_Variants.htm
http://www1.sapdesignguild.org/resources/MiniSG/3_Managing/3_Design_Layout.htm
Check this demo program:
SAPCOLUMN_TREE_CONTROL_DEMO
Sample code:
http://www.geocities.com/victorav15/sapr3/utilities/zvvooa3.txt
How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
chk these 2 useful links
http://www.sap-img.com/abap-function.htm
http://www.geocities.com/mpioud/Abap_programs.html
check this...
http://sapbrain.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
ALV WITH TWO CONTAINER ON ONE PAGE
Look at the below threads ...
Logo in OO ALV Grid
Display Two Report IN ONE
TOP_OF_PAGE in ALV Grid Using OO Approach!!
ALV in webdynpro
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4
Reward if useful.
Regards,
Chandru

Similar Messages

  • What is ALV grid and describe its implementation procedure

    Hi all,
               Can you tell me the step by step implementation procedure of ALV grid

    hi..
    Steps To Use ALV Grid in a Program
    1. Declare reference variables for,
           Container (class CL_GUI_CUSTOM_CONTAINER) and
           Grid (class CL_GUI_ALV_GRID)
    Example
    DATA: grid  TYPE REF TO cl_gui_alv_grid,
                custom_container  TYPE REF TO cl_gui_custom_container
    2. Create Standard Screen and a container on that screen  and give a name to that container ( Use custom control button from tool bar) . This name will be used to link the container we have created on the screen with the object reference of class CL_GUI_CUSTOM_CONTAINER, which we have declared in the first step
    3. Call the screen which has been created
    4. Instantiate the container control and the ALV Grid Control in PBO of the screen.
    Example
    IF custom_container IS INITIAL.
      CREATE OBJECT custom_container
             EXPORTING
            CONTAINER_NAME = u2018MY_CONTAINER'.
    CREATE OBJECT grid
           EXPORTING
           I_PARENT = custom_container.
    ENDIF
    5. For displaying the data, call the method set_table_for_first_display of object reference of CL_GUI_ALV_GRID.
    Example
    CALL METHOD grid->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE               =
    I_BYPASSING_BUFFER            =
    I_CONSISTENCY_CHECK           =
    I_STRUCTURE_NAME              =
    IS_VARIANT                    =
    I_SAVE                        =
    I_DEFAULT                     =
    IS_LAYOUT                     =
    IS_PRINT                      =
    IT_SPECIAL_GROUPS             =
    IT_TOOLBAR_EXCLUDING          =
    IT_HYPERLINK                  =
    IT_ALV_GRAPHICS               =
    IT_EXCEPT_QINFO               =
    CHANGING
    IT_OUTTAB                     =
    IT_FIELDCATALOG               =
    IT_SORT                       =
    IT_FILTER                     =
    EXCEPTION
    INVALID_PARAMETER_COMBINATION =
    PROGRAM_ERROR                 =
    TOO_MANY_LINES                =
    others                        =
    EXPLANATION OF SOME IMPORTANT PARAMETERS.
    I_BYPASSING_BUFFER & I_BUFFER_ACTIVE :
    When the program is run for the first time, the fields present in the output table and their positions are stored in a buffer.  So the buffer is taken as reference for the successive executions.  In order to bypass this buffer the above parameter values should be u2018Xu2019 and  u2018 u2018(space)  respectively. If these values are not passed  to the function module, the changes made in the structure of the internal table will not be reflected in the output.
    I_STRUCTURE_NAME:
    If the structure of your output table corresponds to a structure stored in the Data Dictionary (DDIC), the ALV Grid Control can use this information to generate the field catalog automatically. Pass the table structure as parameter. In this case, all fields of this DDIC structure are displayed in the list.
    IS_VARIANT :
    It allows the user to save and reuse the layout. It is a structure of type DISVARIANT and contain the display variant name. It  facilitates pre-assignment for a layout, rather than displaying report and then choosing displaying variant.
    I_SAVE:
    This single character variable specifies whether the user specific display variants can be saved or not.
    The I_SAVE "Options for saving layouts" parameter can have the following values:
    U Only user specific layouts can be saved
    X Only global layouts can be saved
    A Both user specific and global layouts can be saved
    Space Layouts can not be saved
    IS_LAYOUT:
    This structure of type LVC_S_LAYO
    is used to control the layout of the ALV.  Two important fields are:
    GRID TITLE. : Title of grid
    ZEBRA : Alternate lines in list are displayed in different colors.
    IT_FIELDCATALOG:
    This internal table of type LVC_T_FCAT
    is used to specify the position of various fields in the report itab.
    There are three ways we can fill the field catalog table
    1. Automatically through data dictionary structure (DDIC). In this case we pass the table structure to I_STRUCTURE_NAME.
    2. Manually in ABAP program. Filling the internal table of type LVC_T_FCAT
    1.                  . With each row corresponding to each column of output table. Each row of this table will hold value like
    i). TABNAME & FIELDNAME specifies the reference fields for F1 help
    ii). CTABNAME & CFIELDNAME specifies the reference fields for currency formatting
    iii). QTABNAME & QFIELDNAME specifies the reference fields for quantity formatting
    iv). SELTEXT_L holds the long description of the field
    v).  SELTEXT_M holds the medium description of the field
    vi). SELTEXT_S holds the small description of the field
    vii). KEY specifies the Key field ( cannot be hidden )
    viii). OUTPUTLEN species the output length of the field
    ix). DO_SUM specifies that subtotal is required on this field
    x). NO_OUT specifies a hidden field
    3.  Semi-Automatically by combining the above 2 procedures.
    Call function Module REUSE_ALV_FIELDCATALOG_MERGE and pass DDIC
    structure or the output table to generate the field catalog.
    Add additional Rows or modify existing properties of the fields to be displayed.
    hope this will help you.
    regards
    lokesh

  • What is the constant name for Change layout Button in ALV Grid ABAP Objects

    Dear All,
    I have one query please help me.
    what is the constant name for Change layout Button in ALV Grid ABAP Objects.
    With Rgds,
    Babu

    Halo Vinod,
    The consant name is cl_gui_alv_grid=>mc_fc_current_variant.
    Regards
    Arshad

  • Hi gurus what is RFC , how to work on RFC explain to me plz,

    hi gurus what is RFC , how to work on RFC explain to me plz,FROM WHERE TO WHERE TO WHERE SEND THE DATA USING RFC , AND HOW TO SEND .

    RFC
    rfc
    Re: what is Remote Function Call (RFC)?
    RFC
    /message/4752331#4752331 [original link is broken]
    What are idocs, BAPI, RFC?
    Reward points..

  • Hi gurus what is lock objects in datadictionary ,can explain with example

    hi gurus what is lock objects in datadictionary ,can explain with exple

    Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
    SAP Provide three type of Lock objects.
    Read Lock(Shared Locked)
    protects read access to an object. The read lock allows other transactions read access but not write access to
    the locked area of the table
    Write Lock(exclusive lock)
    protects write access to an object. The write lock allows other transactions neither read nor write access to
    the locked area of the table.
    Enhanced write lock (exclusive lock without cumulating)
    works like a write lock except that the enhanced write lock also protects from further accesses from the
    same transaction.
    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
    Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
    Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
    Technicaly:
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    You have to use these function module in your program.
    Hope this will give a basic idea.
    Here is a Link with good example
    Lock Objects
    Look the following Links for additionl info.
    http://help.sap.com/saphelp_nw04/helpdata/en/c2/2d7037ecc92a7ee10000009b38f8cf/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    http://articles.techrepublic.com.com/5100-6329_11-5066352.html
    Hope this Helps

  • For all users having probs with OO ALV Grid

    I wanted to put this in the WIKI but it keeps bombing out when I try and save so I've put this here -- Maybe a MOD can move it for me.
    This generic class should give you far more insite into using an EDITABLE ALV table than the standard documentation.
    If you follow the steps you should be able to code very quickly a decent useable ALV OO program which can retrieve and manipulate data very easily.  The events are (hopefully) well documented as are all the steps.
    Once you understand the basics you can add more functionality like colouring Cells, adding hyperlinks etc etc.
    I've always found that stupid SEAT / AIRLINE application SAP uses for its examples far too overblown and in reality who would ever use a SAP system for Airline reservations anyway.
    The class here describes a much simpler application which CLEARLY (I hope) explains how the whole thing works.
    Jimbo's generic class for using the OO ALV GRID Class CL_GUI_ALV_GRID
    from an application program to display and manipulate ANY table
    with minimal coding needed in the Calling application program.
    Handles the following EVENTS
    1) TOOLBAR BUTTONS
    (you can add more to the toolbar method
      if you need even more functionality).
    2) DOUBLE CLICK
    3) ENTER KEY PRESSED
    4) DATA CHANGED
    5) DATA CHANGED FINISHED
    Methods available
    PUBLIC METHODS  ( Can be called directly from the application program).
    1) display_grid  displays grid with toolbar
       Table and FCAT are built dynamically - user only needs to
       define the table structure (can be DDIC or User fields)
    2) change_title  - changes title at the top of the Grid
    3) refresh_grid   - refreshes grid after table updated etc.
    4) build_dynamic_structures - this method creates a dynamic table and a dynamic FCAT
       using the structure defined in the calling application program
    PRIVATE METHODS (Internal Methods used within the class)
    1) verwerk - returns to FORM VERWERK in calling application program
       (Via Toolbar). The application program can then do any special processing
       at this point e.g update SAP tables etc.
    2) download_to_excel (via Toolbar). This creates an EXCEL spreadsheet
       directly which can be downloaded / saved to a file if required,
    3) return_structure - internal method returns the structure
       of the table defined in the calling application program. This is needed in order
       to build the dynamic table and Field Catalog.
    4) create_dynamic_table  - creates a dynamic table from the structure defined in
       the calling application program
    5) create_dynamic_fcat  - creates the dynamic field catalog from the structure
       defined in the application program.
    6) dubbleklik entered when user double clicks a cell
    activated by EVENT DOUBLE_CLICK.
    returns to FORM DUBBELKLIK  in the
    calling application program
       COOKBOOK STEP BY STEP instructions on how to use this class
       in your application program.
       In the application program :
    1) define a blank screen 100  - SE51 with a custom container
       on it called CCONTAINER1.
       you need the following logic in the screen
       The PAI is only used if you have defined a STATUS with SE41 and you exit the
       application program via the standard SAP buttons on the
       top of the Screen (NOT the GRID toolbar).
         PROCESS BEFORE OUTPUT.
          MODULE STATUS_0100.
         PROCESS AFTER INPUT.
         MODULE USER_COMMAND_0100.
    2) (optional) define a STATUS with a titlebar - SE41
       you only need this if you want the standard EXIT and menu buttons on the
       top line of the screen
    3) If you want to have your OWN colum names on the grid
       add the following macro to the start of your program
         DEFINE col_name.
         read  table it_fldcat into  wa_it_fldcat index &1.
         wa_it_fldcat-coltext = &2.
         modify it_fldcat from wa_it_fldcat index &1.
         END-OF-DEFINITION.
    4) Define the following Field symbols
       <fs1>           TYPE  ANY,
       <fs2>           TYPE  STANDARD TABLE,
       <fs3>           TYPE ANY,
       <field_catalog> TYPE STANDARD TABLE,
       <dyn_table>    TYPE  STANDARD TABLE,
       <orig_table>   TYPE  STANDARD TABLE,
       <dyn_field>,
       <dyn_wa>.
    5) After the field-symbols add the code in this class
        as an INCLUDE
        e.g INCLUDE ZZJIMBOXX_INCL.
    6) define your Internal table as follows
        TYPES:  BEGIN OF s_elements,
                  Your structure
                your structure etc.
                END OF  s_elements.
    For example
    INCLUDE  <icon>.
    TABLES: VAPMA.
    *TYPES:  BEGIN OF s_elements,
    vbeln   TYPE vapma-vbeln,
    posnr   TYPE vapma-posnr,
    matnr   TYPE vapma-matnr,
    kunnr   TYPE vapma-kunnr,
    werks   TYPE vapma-werks,
    vkorg   TYPE vapma-vkorg,
    vkbur   TYPE vapma-vkbur,
    status  TYPE c,
    *END OF  s_elements.
    7) Define the following data  IN YOUR APPLICATION PROGRAM
       (note here only data is described
       that relates to using THIS CLASS. Data purely used internally
       in the application program is NOT shown here).
    DATA: z_object          TYPE REF TO zcl_dog,  "Instantiate our class
          grid_container1    TYPE REF TO cl_gui_custom_container,
          t_elements         TYPE TABLE OF s_elements, "refers to our ITAB
          wa_elements        TYPE s_elements,
          wa_dyn_table_line  TYPE REF TO DATA,
          it_fldcat          TYPE lvc_t_fcat,
          i_gridtitle        TYPE lvc_title,
          wa_it_fldcat       TYPE lvc_s_fcat,
          new_table          TYPE REF TO DATA,
          dy_table           TYPE REF TO data,
          dy_line            TYPE REF TO data,
          row_id             TYPE sy-index.
    8) insert the following code at the start of the application program.
    *START-OF-SELECTION.
    *CALL SCREEN 100.
    *END-OF-SELECTION.
    *MODULE status_0100 OUTPUT.
    *ASSIGN  wa_elements TO <fs1>.
    *CREATE OBJECT z_object EXPORTING z_object = z_object. "Instantiate the class
    *CALL METHOD z_object->build_dynamic_structures
           CHANGING it_fldcat = it_fldcat.
    9) if you inserted the macro in step 3) then
       define your own column names as follws
      col_name 1 'Name1'.
      col_name 2 'Name2'.
      etc. The number is the colum number you want and the name is
      the name you want to assign to the column.
    for example using the table shown above
      col_name 1 'Order Nr'.
      col_name 2 'Item'.
      col_name 3 'Material'.
      col_name 4 'Customer'.
      col_name 5 'Plant'.
      col_name 6 'Sales Org'.
      col_name 7 'Sales Office'.
      col_name 8 'Status'.
    10)  perform a routine that fills your dynamic table and
         display the GRID. If you created a status with SE41 you can set
         a title etc. Further processing is dependent on the users action
         after the GRID is displayed for example if a Cell is double clicked,
         dat is entered, a toolbar button is pressed or a SAP ICON on top of the screen is pressed.
    PERFORM populate_dynamic_itab.
    CALL METHOD z_object->display_grid
          CHANGING it_fldcat = it_fldcat.
    SET PF-STATUS '0001'.
    SET TITLEBAR '000'.
    ENDMODULE.
    11) If you added a STATUS via SE41 you can exit the program via the
    standard SAP buttons at the top of the screen
    otherwise exit via the exit button on the toolbar.
    You only need this piece of code if you defined a STATUS in the application program
    MODULE user_command_0100 INPUT.
    CASE sy-ucomm.
       WHEN 'BACK'.
         LEAVE PROGRAM.
       WHEN 'EXIT'.
         LEAVE PROGRAM.
       WHEN 'RETURN'.
         LEAVE PROGRAM.
       WHEN OTHERS.
    ENDCASE.
    12)  to populate the dynamic table you only need to code something like this
    remember the class has already created and structured the field-symbol <dyn_table>
    so you don't have to do anything other than just select the fields you want
    filled and from what data source(es).
    *FORM populate_dynamic_itab.
    *SELECT vbeln posnr matnr kunnr werks vkorg vkbur
          UP TO 200 rows
          FROM vapma
          INTO  CORRESPONDING FIELDS OF TABLE <dyn_table>.
    if you want to keep the original table before making any changes etc code
    the following
    create 2nd Dyn table to hold original data. We can use
    the same field catalog as for the original table
    as we are just creating an identical copy here.
    *CALL METHOD cl_alv_table_create=>create_dynamic_table
       EXPORTING
            it_fieldcatalog = it_fldcat
         IMPORTING
            ep_table = dy_table.
      ASSIGN dy_table->* TO <orig_table>.
    CREATE DATA dy_line LIKE LINE OF <orig_table>.
    ASSIGN dy_line->* TO <dyn_wa>.
    <orig_table> = <dyn_table>.
    ENDFORM.
    13) you need these 2 processing routines in your application program.
    FORM VERWERK.  "Entered from VERW on toolbar
    *break-point 1.
    Orig table is in dynamic table <orig_table>
    ALV GRID changed table is in <dyn_table>.
    *Loop at <orig_table>  into <dyn_wa>.
      Do what you want here
    end
    endloop.
    ENDFORM.
    *form dubbleklik using     "Entered when a cell is double clicked
           e_row   type LVC_S_ROW
           e_column type LVC_S_col
           es_row_no type lvc_s_roid.
           break-point 1.
    Get Row id into a variable for this program.
           row_id =  e_row.
            SET TITLEBAR '001'.      "If you defined a status in SE41
           i_gridtitle = 'Grid Title Changed'.
           CALL METHOD  z_object->change_title
             EXPORTING i_gridtitle = i_gridtitle.
           PERFORM refresh.
    endform.
    The REFRESH routine is optional but after a double click I assume
    you want to do some processing
    and re-display the data
    so as a sample code something like
    *FORM refresh.
    data: ord_nr  TYPE vapma-vbeln.  "Your data
    *READ TABLE  <dyn_table> index row_id into wa_elements.
       ord_nr = wa_elements-vbeln.
    You've now got the Row double clicked so pick out the data element(s)
    you wnat to process and do your processing
    *set parameter id 'AUN'  field ord_nr.
    *CALL TRANSACTION  'VA02' AND SKIP FIRST SCREEN.
    You can update the dynamic table for example
    *wa_elements-status = 'C'.
    *modify <dyn_table> from wa_elements index row_id.
    now redisplay the updated grid.
    *CALL METHOD z_object->refresh_grid.
    *ENDFORM.
    *************Class ZCL_DOG*************
    CLASS zcl_dog DEFINITION.
    PUBLIC SECTION.
    METHODS:
      constructor
         IMPORTING
                      z_object TYPE REF TO zcl_dog,
       display_grid
         CHANGING
                      it_fldcat TYPE lvc_t_fcat,
           build_dynamic_structures
         CHANGING        it_fldcat TYPE lvc_t_fcat,
        change_title
         IMPORTING
                i_gridtitle  TYPE lvc_title,
         refresh_grid.
      PRIVATE SECTION.
       METHODS:
        on_user_command FOR EVENT before_user_command OF cl_gui_alv_grid
          IMPORTING       e_ucomm
                          sender,
        on_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
          IMPORTING      e_object
                         e_interactive,
         on_dubbelklik FOR EVENT double_click OF cl_gui_alv_grid
          IMPORTING e_row
                    e_column
                    es_row_no,
        handle_data_changed
                 FOR EVENT data_changed OF cl_gui_alv_grid
                 IMPORTING er_data_changed,
        handle_data_changed_finished
                 FOR EVENT data_changed_finished OF cl_gui_alv_grid
                 IMPORTING e_modified
                           et_good_cells,
        verwerk
                IMPORTING program TYPE sy-repid,
        download_to_excel,
        dubbleklik
                IMPORTING
                     e_row  type  LVC_S_ROW
                     e_column   TYPE LVC_S_COL
                     es_row_no  type lvc_s_ROID
                     program type sy-repid,
         return_structure,
         create_dynamic_fcat
          EXPORTING       it_fldcat TYPE lvc_t_fcat,
          create_dynamic_table
          IMPORTING       it_fldcat TYPE lvc_t_fcat
          EXPORTING       dy_table  TYPE REF TO DATA.
    DATA:
        lr_rtti_struc    TYPE REF TO cl_abap_structdescr,        "RTTI
        zog              LIKE LINE OF lr_rtti_struc->components, "RTTI
        wa_it_fldcat     TYPE lvc_s_fcat,
        it_fldcat        TYPE lvc_t_fcat,
        dy_table         TYPE REF TO data,
        dy_line          TYPE REF TO data,
        struct_grid_lset TYPE lvc_s_layo,
        e_row            TYPE LVC_S_ROW,
        e_column         TYPE lvc_s_col,
        es_rowid         TYPE lvc_s_roid,
        grid_container1  TYPE REF TO cl_gui_custom_container,
        grid1            TYPE REF TO cl_gui_alv_grid,
        ls_layout        TYPE kkblo_layout,
        lt_fieldcat_wa   TYPE kkblo_fieldcat,
        l_mode           TYPE raw4,
        celltab          TYPE LVC_T_STYL,
        wa_celltab       TYPE lvc_s_styl,
        lt_fieldcat      TYPE kkblo_t_fieldcat,
       l_tabname         TYPE slis_tabname.
    TYPES:
       struc            LIKE  zog.
    DATA:
        zogt           TYPE TABLE OF struc.
       ENDCLASS.
    CLASS zcl_dog IMPLEMENTATION.
    METHOD constructor.
       CREATE OBJECT grid_container1
           EXPORTING
                   container_name = 'CCONTAINER1'.
        CREATE OBJECT  grid1
            EXPORTING
                  i_parent = grid_container1.
        SET HANDLER z_object->on_user_command for grid1.
        SET HANDLER z_object->on_toolbar for grid1.
        SET HANDLER Z_OBJECT->handle_data_changed_finished FOR grid1.
        SET HANDLER Z_OBJECT->on_dubbelklik FOR grid1.
        CALL METHOD grid1->register_edit_event
            EXPORTING
                    i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    ENDMETHOD.
    METHOD refresh_grid.
      CALL METHOD cl_gui_cfw=>flush.
      CALL METHOD grid1->refresh_table_display.
    ENDMETHOD.
    METHOD on_dubbelklik.
    CALL METHOD me->dubbleklik
             EXPORTING
                     e_row  = e_row
                     e_column =  e_column
                     es_row_no = es_row_no
                     program  = sy-repid.
    break-point 1.
    ENDMETHOD.
    METHOD  handle_data_changed.
    Insert user code here if required
    this method is entered if user ENTERS DATA.
    ENDMETHOD.
    METHOD handle_data_changed_finished.
    Insert user code here if required
    Method entered here after data entry has finished.
    ENDMETHOD.
    METHOD return_structure.
      lr_rtti_struc ?= cl_abap_structdescr=>DESCRIBE_BY_DATA( <fs1> ).
      zogt[]  = lr_rtti_struc->components.
      ASSIGN zogt[] TO <fs2>.
      ENDMETHOD.
    METHOD create_dynamic_fcat.
        LOOP AT <fs2>  INTO zog.
          CLEAR wa_it_fldcat.
          wa_it_fldcat-fieldname = zog-name .
          wa_it_fldcat-datatype = zog-type_kind.
          wa_it_fldcat-inttype = zog-type_kind.
          wa_it_fldcat-intlen = zog-length.
          wa_it_fldcat-decimals = zog-decimals.
          wa_it_fldcat-coltext = zog-name.
          wa_it_fldcat-lowercase = 'X'.
          APPEND wa_it_fldcat TO it_fldcat .
          ASSIGN it_fldcat[] TO <field_catalog>.
          ENDLOOP.
           ASSIGN  it_fldcat[] TO <field_catalog>.
        ENDMETHOD.
    METHOD  download_to_excel.
    break-point 5.
    CALL FUNCTION  'LVC_TRANSFER_TO_KKBLO'
        EXPORTING
          it_fieldcat_lvc   = <field_catalog>
         is_layout_lvc     = m_cl_variant->ms_layout
           is_tech_complete  = ' '
        IMPORTING
          es_layout_kkblo   = ls_layout
          et_fieldcat_kkblo = lt_fieldcat.
    LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
       CLEAR lt_fieldcat_wa-tech_complete.
        IF lt_fieldcat_wa-tabname IS initial.
           lt_fieldcat_wa-tabname = '1'.
           MODIFY lt_fieldcat FROM lt_fieldcat_wa.
        ENDIF.
        l_tabname = lt_fieldcat_wa-tabname.
    ENDLOOP.
    CALL FUNCTION 'ALV_XXL_CALL'
        EXPORTING
          i_tabname           = l_tabname
          is_layout           = ls_layout
          it_fieldcat         = lt_fieldcat
          i_title             = sy-title
        TABLES
          it_outtab           = <dyn_table>
        EXCEPTIONS
          fatal_error         = 1
          no_display_possible = 2
          others              = 3.
      IF  sy-subrc <> 0.
         message id sy-msgid type 'S' number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    ENDMETHOD.
    METHOD create_dynamic_table.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
             it_fieldcatalog = it_fldcat
          IMPORTING
             ep_table = dy_table.
    ENDMETHOD.
    METHOD build_dynamic_structures.
    CALL METHOD me->return_structure.
    CALL METHOD me->create_dynamic_fcat
       IMPORTING
         it_fldcat = it_fldcat.
    CALL METHOD me->create_dynamic_table
        EXPORTING
          it_fldcat = it_fldcat
        IMPORTING
          dy_table        = dy_table.
         ASSIGN dy_table->* TO <dyn_table>.
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    ASSIGN dy_line->* TO <dyn_wa>.
    ENDMETHOD.
    METHOD display_grid.
      struct_grid_lset-edit = 'X'. "To enable editing in ALV
      struct_grid_lset-grid_title = 'Bulkwijzigingen inkoopprijzen'.
      struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.
      struct_grid_lset-stylefname = 'CELLTAB'.
      CALL METHOD grid1->set_ready_for_input
          EXPORTING
               i_ready_for_input = '1'.
      CALL METHOD grid1->set_table_for_first_display
          EXPORTING
               is_layout       = struct_grid_lset
        CHANGING
               it_outtab       = <dyn_table>
               it_fieldcatalog = it_fldcat.
    ENDMETHOD.
    METHOD change_title.
      CALL METHOD grid1->set_gridtitle
       EXPORTING
       i_gridtitle =  i_gridtitle.
      ENDMETHOD.
    METHOD on_user_command.
      CASE e_ucomm.
          WHEN 'EXIT'.
            LEAVE PROGRAM.
         WHEN 'EXCEL'.
         CALL METHOD me->download_to_excel.
          WHEN 'SAVE'.
          WHEN 'VERW'.
          CALL METHOD me->verwerk
               EXPORTING
                  PROGRAM = SY-REPID.
      ENDCASE.
    ENDMETHOD.                    "on_user_command
    METHOD on_toolbar.
    User can add extra functionality by adding extra
    buttons if required. Functionality can also be simplified by removing buttons.
    DATA: ls_toolbar TYPE stb_button.
         CLEAR ls_toolbar.
         MOVE 0 TO ls_toolbar-butn_type.
         MOVE 'EXIT' TO ls_toolbar-function.
         MOVE SPACE TO ls_toolbar-disabled.
         MOVE icon_system_end TO ls_toolbar-icon.
         MOVE 'Click2Exit' TO ls_toolbar-quickinfo.
         APPEND ls_toolbar TO e_object->mt_toolbar.
         CLEAR ls_toolbar.
         MOVE  0 TO ls_toolbar-butn_type.
         MOVE 'SAVE' TO ls_toolbar-function.
         MOVE SPACE TO ls_toolbar-disabled.
         MOVE  icon_system_save TO ls_toolbar-icon.
         MOVE 'Save data' TO ls_toolbar-quickinfo.
         APPEND ls_toolbar TO e_object->mt_toolbar.
         CLEAR ls_toolbar.
         MOVE  0 TO ls_toolbar-butn_type.
         MOVE 'EDIT' TO ls_toolbar-function.
         MOVE  SPACE TO ls_toolbar-disabled.
         MOVE  icon_toggle_display_change TO ls_toolbar-icon.
         MOVE 'Edit data' TO ls_toolbar-quickinfo.
         MOVE  'EDIT' TO ls_toolbar-text.
         APPEND ls_toolbar TO e_object->mt_toolbar.
         CLEAR ls_toolbar.
         MOVE  0 TO ls_toolbar-butn_type.
         MOVE 'VERW' TO ls_toolbar-function.
         MOVE  SPACE TO ls_toolbar-disabled.
         MOVE   icon_businav_process to ls_toolbar-icon.
         MOVE 'Verw.' TO ls_toolbar-quickinfo.
         MOVE  'VERW' TO ls_toolbar-text.
         APPEND ls_toolbar TO e_object->mt_toolbar.
          CLEAR ls_toolbar.
         MOVE  0 TO ls_toolbar-butn_type.
         MOVE 'EXCEL' TO ls_toolbar-function.
         MOVE  SPACE TO ls_toolbar-disabled.
         MOVE  icon_xxl TO ls_toolbar-icon.
         MOVE 'Excel' TO ls_toolbar-quickinfo.
         MOVE  'EXCEL' TO ls_toolbar-text.
         APPEND ls_toolbar TO e_object->mt_toolbar.
       ENDMETHOD.
       METHOD verwerk.
          PERFORM verwerk IN PROGRAM (program).
          LEAVE PROGRAM.
      ENDMETHOD.
      METHOD dubbleklik.
      PERFORM dubbleklik IN PROGRAM (program)
        USING
            e_row
            e_column
            es_row_no.
      ENDMETHOD.
    ENDCLASS.
    Cheers
    Jimbo

    Hi Dinu,
    Before analysing ALV, please cross check the behaviour of the calling program.
    Is the control really going to the application server when you do all the above process?
    If so, when user makes some changes are they saved in the data base / affected the internal table which you are using for ALV?
    Regards
    Surya.

  • How to identify the modified rows in ALV grid in OO

    Hello All,
    I have strange problem and i don't know how to solve it?
    I have ALV grid and in that ALV grid i have two buttons 'CONT' and 'ALLOC', when the user press 'ALLOC' button i will give a popup to make the user to enter some value.
    After entering the value i will do some calicualtions and i will distribute the amount in the fields of ALV grid and i should update the ALVGRID.
    Normally we can use CALL METHOD ME->REFRESH_TABLE_DISPLAY.( I have already checked by using this method and it worked fine)
    Here is the way my program look like
    ALVTREE1
    ALVTREE2
                 |----
    ALVGRID
    The problem is when i press the other button CONT i am unable to know what values exist in ALVGRID.
    How can i find these distributed amount in ALV?
    I hope i am clear while explaining problem.
    Here is  the required code:
      method handle_user_command.
        data: lt_fields       type table of sval,
              ls_field        type sval,
              ls_fieldcatalog type lvc_s_fcat,
              ls_merkpl       type zvhf_merkpl,
              lv_month(2)     type n ,
              lv_year(4)      type n ,
              lv_spmon        type zvhf_allocation-spmon,
              lv_value        type p.
        field-symbols: <fs> type any,
                       <ls_merkpl> type zvhf_merkpl.
        case  e_ucomm.
          when 'CNT'.
            call method gcl_gui_alv_grid->check_changed_data.
            call method dailogbox_container->set_visible
              exporting
                visible = space.
            call method gcl_gui_alv_tree2->frontend_update.
            call method gcl_gui_alv_tree2->update_calculations.
            clear: gt_merkpl.
          when 'ALCT'.
    Popup to get the values enterd by the user
            ls_field-tabname   = 'DD02V'.
            ls_field-fieldname = 'DDTEXT'.
            append ls_field to lt_fields.
            call function 'POPUP_GET_VALUES'
              exporting
                popup_title     = 'Enter value'
                start_column    = '1'
                start_row       = '1'
              tables
                fields          = lt_fields
              exceptions
                error_in_fields = 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.
            elseif sy-subrc = 0.
              read table lt_fields into ls_field index 1.
              if sy-subrc = 0.
                gv_value = ls_field-value.
    Read the table zvhf_allocation with nodekey  in order to get percentages
                select * from zvhf_allocation into table gt_allocation
                                   where dvkbur = gs_node_info-nodename.
    Read gt_merkpl in order to get existing line in ALV grid
                loop at  gt_merkpl into ls_merkpl.
    *Read FCAT inorder to find the field and move proprtinate value
                  loop at gt_fieldcatlog3 into ls_fieldcatalog.
    *Split is required to match ZVHF_ALLOCATION-SPMON  with screen text and to proprtinate the value
                    split ls_fieldcatalog-scrtext_l at '.' into
                          lv_month lv_year.
                    concatenate lv_year lv_month into lv_spmon.
    Check whether an entry exist or not in ZVHF_allocation
                    read table gt_allocation into gs_allocation
                                              with key spmon = lv_spmon binary search.
    *If an entry exist proprtinate the value as enterd in table
                    if sy-subrc = 0.
                      lv_value  = gv_value * gs_allocation-prozent.
                      lv_value = lv_value / 100.
                      perform assign_value using     ls_fieldcatalog-fieldname lv_value
                                           changing  ls_merkpl.
                      modify gt_merkpl from ls_merkpl.
                    endif.
                  endloop.
                 CALL METHOD gcl_gui_alv_grid->frontend_update.
                  call method gcl_gui_alv_grid->refresh_table_display
                    exceptions
                      finished = 1
                      others   = 2.
                  if sy-subrc <> 0.
                    message id sy-msgid type sy-msgty number sy-msgno
                               with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
                  endif.
                endloop.
              endif.
            endif.
        endcase.
      endmethod.                    "handle_user_command
    If you have any further questions please let me know.
    Regards,
    Lisa

    Hello Vijay,
    Thanks for you reply,
    The event data_changed is not working because i called method refresh_table_display. So the event changed will not be raised after i press button CONT
    If i didn't call this method then i can see the value enterd by the user in ALV grid.
    So, do you have an more ideas.
    Regards,
    Lisa

  • Problem with ALV grid in edit mode

    Hello, gurus!
    I have a problem with ALV-grid. Sometimes when I call F4 help for a cell, data is inserted in a different cell.  And when I call check_changed_data method, my internal table (passed to ALV-control in set_table_for_first_display) does not updates properly. In what can be a problem?
    Thanks,
    Mikhail

    Hi Prabhu,
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      title_of_report = text-010.
      SET TITLEBAR '0100' WITH title_of_report.
      DATA: g_event_receiver TYPE REF TO lcl_event_handler.
      IF z_custom_container IS INITIAL .
        CREATE OBJECT z_custom_container
          EXPORTING
            container_name = 'ALV_ZAC'.
        CREATE OBJECT alv_grid
          EXPORTING
            i_parent = z_custom_container.
        g_repid = sy-repid.
        gs_variant-report = g_repid.
        x_save = 'A'.
        PERFORM check_alv_grid_fields.
        ps_layout-cwidth_opt = 'X'.
        ps_layout-edit = 'X'.
        CALL METHOD alv_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = '1'.
    *    CALL METHOD alv_grid->register_edit_event
    *      EXPORTING
    *        i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        APPEND   s_list_rec   to it_list_rec.
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            is_layout       = ps_layout
            is_variant      = gs_variant
            i_save          = x_save
          CHANGING
            it_fieldcatalog = pt_fieldcat
            it_outtab       = it_list_rec[].
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDIF.
    FORM check_alv_grid_fields .
      DATA: ls_fcat LIKE LINE OF pt_fieldcat.
    REFRESH pt_fieldcat .
    CLEAR: ps_layout, ls_fcat.
      ls_fcat-fieldname = 'VBELN'.
      ls_fcat-ref_field = 'VBELN'. ls_fcat-ref_table =  'LIPS'. " .
      ls_fcat-outputlen = 9.
    *  ls_fcat-datatype   = 'CHAR'.
    *  ls_fcat-inttype    = 'C'.
      APPEND  ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
      ls_fcat-fieldname = 'ERDAT'.
      ls_fcat-ref_field = 'ERDAT'. ls_fcat-ref_table = 'LIPS'.
      ls_fcat-outputlen = 9.
    *  ls_fcat-f4availabl = 'X' .
    *  ls_fcat-datatype   = 'DATS'.
    *  ls_fcat-inttype    = 'D'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
    ENDFORM.                    " check_alv_grid_fields
    FORM save_p .
      CLEAR l_valid.
      CALL METHOD alv_grid->check_changed_data
        IMPORTING
          e_valid = l_valid.
      IF l_valid IS INITIAL.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel = text-i01
            txt1  = text-i02
            txt2  = text-i03
            txt3  = text-i04.
      ELSE.
        i_dat_reg = zrumm_prr-cdprr.
        CLEAR is_temp_otc.
        freshit i_prrpus_fax.
        freshit i_list2_ot.
        LOOP AT it_list_rec INTO s_list_rec.
          MOVE-CORRESPONDING s_list_rec TO i_list2_ot.
          i_list2_ot-fgrup = 'RECE'.
          i_list2_ot-prrnu = i_num_prr.
          APPEND i_list2_ot.
          MOVE-CORRESPONDING s_list_rec TO i_prrpus_fax.
          APPEND i_prrpus_fax.
        ENDLOOP.
      ENDIF.
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:41 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM

  • How to Restrict the values of Field TASKTYPE on a ALV Grid.?

    Hi;
    Let me explain my problem. I have report written by another abap developer who has gone now.
    On the ALV Grid there is a field called "Activity Process". By F1 F9 I can read that field depends on table TCATX_TASKTYPES and field TASKTYPE   . From se11 I can see that there is no search help related with the field.
    When the user press F4 all the data in the table is listed . The user want to filter some of the listed data according to same logic .
    When I debug the code after F4 on the field I found that the system finds Search Help: TCATX_TASKTYPES of type 'CT'. But unfortunately SE11 says that there in  no search help such as TCATX_TASKTYPES.
    The previous abap developer used BADI NETW_USER_FIELDS_F4 AT_F4 with class ZCL_IM_NETW_USER_FIELDS_F4 and interface IF_EX_NETW_USER_FIELDS_F4  for the transaction cj20n to filter the same field but this is not triggered by the F4 on the ALV Grid.
    What can I do ?
    Would you please help me ?

    I know i can do this using ADF Business Components as the business service but the problem is that the initial value for that attribute will be changed depending on the screen ... ill give u a simple example : lets say that I have employee table ( which include dept column) and under that table I have a table called "Emp_dept_movements" now in the main ADF page "employee entry" I have two blocks Employee data ( master view) employee dept data ( detail view ) now when the user press the create-insert button on the employee dept view the system should copy the dept no from the employee view to the dept no on the emp_dept_movements view... and the "Emp_dept_movements" will be used in another screen called " employee departement movements" without any initial value for the DeptNo
    I dont want to create more than one view and cant set the initial value for that attribute in the view , Can this be done through the UI by adding set action listener on that button and specifying from ( binding master_view.dept ) - to (binding of detail_view.dept) ..
    hope that am clear this time,
    Edited by: Delta on Jul 5, 2010 11:21 PM

  • Using GETGUI command --in ALV grid, how to extract multiple DATA

    Using GETGUI command , I am able to get a single value form the ALV grid. Please explain me how I can read multiple data like rows and columns data from the ALV grid.
    Please be detailed as I already tried selecting the whole block of ALV grid, but I could not help myself.
    Regards
    Srinivas.

    Hi Srinivas,
    You will have to use the concept of Regular expressions for this. We will have to loop through each row/coloumn to do what u desire.
    The ID of an element on grid will be something like GRIDNAME-<ELEMENT NAME>[ROW NO] [COLUMN NO]
    we need to parameterize the row and also the el;ementname changes for each column along with the column number. Please let me know if this much detail is enough. If not i can show u a real time ecatt code snippet on how to play around with grids.
    Regards,
    Justin

  • Excel in place from AlV GRID

    Hello,
    i am displaying an ALV Grid by using "REUSE_ALV_GRID_DISPLAY". When I switch to Excel inplace display for the result list only 202 rows are displayed in excel. (in alv list there are 1376). When i switch back to alv list all are shown again. Has anyone an idea about ? I guess there is a parameter who limits it for excel.
    Kind Regards
    Joachim Bertram

    Hi,
    There is a Macro Security setting "Trust Access to Visual Basic Project" which needs to be turned on within Excel in order to get any rows in the Excel inplace from your ALV, but since you are getting a subset of rows I doubt this is your issue. 
    Judging from the number of SAP Notes updated in the year 2008, it would seem to me that the Excel integration is still very much an ongoing work-in-progress.  Unfortunately, I couldn't find any other Notes that specifically talk about missing only some rows (other than the ones that cover the ALL rows missing problem). 
    You may want to check with your Basis team to determine if there is some sort of setting that is limiting the number of rows being transferred.  From what you describe, though, I'd be very surprised if a setting like this (if it even exists) would be set to such a small number of Excel rows.  You might also want to check with them to find out if there is a max number of bytes allowed for Excel inplace transfers.  If so, and if you have a lot of columns, then this might be a factor.
    Which versions of Office/Excel and SAPGUI are you using?  This is important because, as [Note 722513|https://service.sap.com/sap/support/notes/722513] explains in detail, only certain combinations of MS Office, SAPGUI and SAP Basis are supported.  If you can exclude the support issue as a factor then there is a chance that the issue you described in you original message may actually be a new problem that has not been addressed by SAP yet.  After all, how and why do you suppose all of the dozens of existing Notes regarding ALV and Office integration got created in the first place?  Some customer had to discover the problem and report it to SAP. 
    One final suggestion I can make is that you should have someone confirm that Note 756623 has been applied correctly in your system.  Even though the support pack SAPKB62061 should have this Note, it never hurts to check the Note implementation line-by-line just in case (especially in a case like this in which the note seems to match your symptoms so closely).
    Best Regards,
    Jamie

  • Alv grid coding....problems

    tables: zfm_handy, pa0002
    zfm_handy table contains 19 fields and the other table contains two fields(nachn, vorna) the output list has to be a alv grid list.
    condition:  plz read the fields nachn and vorna from the table pa0002 and list it in the output along with zfm_handy fields.
    here i m enclosing coding what i have written but i m not getting output and the statement read is not executed.plz sent the modifications.
    REPORT  ZFM_MOBLIST.
    TABLES: ZFM_HANDY , PA0002.
    TYPE-POOLS : SLIS.
    DATA: G_REPID LIKE SY-REPID,
          GS_PRINT            TYPE SLIS_PRINT_ALV,
          GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
          GT_LIST_END_OF_PAGE TYPE SLIS_T_LISTHEADER,
          GT_EVENTS           TYPE SLIS_T_EVENT,
          GT_SORT             TYPE SLIS_T_SORTINFO_ALV,
          GS_LAYOUT           TYPE SLIS_LAYOUT_ALV,
          GT_FIELDCAT         TYPE SLIS_T_FIELDCAT_ALV,
          FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
          COL_POS TYPE I.
    data :  BEGIN OF ty_MOBLIST occurs 0.
                include structure zfm_handy.
    data : NACHN   type pa0002-nachn,     
            VORNA     type pa0002-vorna,
           END OF ty_MOBLIST.
    data : BEGIN OF ty_zfm_handy occurs 0.
             include structure zfm_handy.
    data : END OF ty_zfm_handy.
    data : BEGIN OF ty_pa0002 occurs 0,
            NACHN   type pa0002-nachn,     
            VORNA     type pa0002-vorna,
           END OF ty_pa0002.
    data : it_MOBLIST like table of ty_MOBLIST,
           wa_MOBLIST like  ty_MOBLIST ,
           it_zfm_handy like table of ty_zfm_handy,
           wa_zfm_handy like  ty_zfm_handy ,
           it_pa0002 like table of ty_pa0002,
           wa_pa0002 like  ty_pa0002 .
    INITIALIZATION.
      G_REPID = SY-REPID.
      PERFORM PRINT_BUILD USING GS_PRINT.      "Print PARAMETERS
    START-OF-SELECTION.
    SELECT * from
             zfm_handy
        into table it_zfm_handy.
    if not it_zfm_handy[] is initial.
    select NACHN        
            VORNA     
      from  pa0002
      into table it_pa0002
      for all entries in it_zfm_handy
      where pernr =  it_zfm_handy-pernr.
    endif.                              " not it_zfm_handy
    loop at it_zfm_handy into wa_zfm_handy.
      read table it_pa0002 into wa_pa0002 with key pernr = wa_zfm_handy-pernr.
      if sy-subrc = 0.
        clear wa_MOBLIST.
        move wa_zfm_handy to wa_MOBLIST.
        move wa_pa0002 to wa_MOBLIST.
        append  wa_MOBLIST to it_MOBLIST .
      endif.                    " sy-subrc
    endloop.
      PERFORM BUILD.
      PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
      PERFORM COMMENT_BUILD  CHANGING GT_LIST_TOP_OF_PAGE.
      PERFORM CALL_ALV.
    *&      Form  BUILD
    FORM BUILD.
    DATA FIELD CATALOG
    Explain Field Description to ALV
      DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME = 'TELNUM'.
      FIELDCAT_LN-TABNAME   = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT    = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TELNUM'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME = 'KARTNR'.
      FIELDCAT_LN-TABNAME   = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT    = ' '.
      FIELDCAT_LN-SELTEXT_L = 'KARTNR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME = 'ZUTART'.
      FIELDCAT_LN-TABNAME   = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT    = ' '.
      FIELDCAT_LN-SELTEXT_L = 'ZUTART'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'PERNR'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'PERNR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'ZDATE'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'ZDATE'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'PINNR'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'PINNR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'PUKNR'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'PUKNR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TARIF1'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TARIF1'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TARIF2'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TARIF2'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TARIF3'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TARIF3'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'GTYPE'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'GTYPE'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'IMEI'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'IMEI'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TWINCARD'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TWINCARD'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TWINBILL'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TWINBILL'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'EINBAU'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'EINBAU'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'BESCHAR'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'BESCHR'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TEXT1'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TEXT1'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TEXT2'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TEXT2'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'TEXT3'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'TEXT3'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'NACHN'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L =  'NACHN'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
      CLEAR FIELDCAT_IN.
      FIELDCAT_LN-FIELDNAME     = 'VORNA'.
      FIELDCAT_LN-TABNAME       = 'ty_moblist'.
      FIELDCAT_LN-NO_OUT        = ' '.
      FIELDCAT_LN-SELTEXT_L = 'VORNA'.
      APPEND FIELDCAT_LN TO GT_FIELDCAT.
    DATA SORTING
      DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
      CLEAR GS_SORT.
      GS_SORT-FIELDNAME = 'TELNUM'.
      GS_SORT-SPOS      = 1.
      GS_SORT-UP        = 'X'.
    GS_SORT-SUBTOT    = 'X'.
      APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'KARTNR'.
    GS_SORT-SPOS      = 2.
    GS_SORT-UP        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
      APPEND GS_SORT TO GT_SORT.
    ENDFORM.                    "BUILD
    *&      Form  CALL_ALV
    FORM CALL_ALV.
    ABAP List Viewer
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
      I_CALLBACK_PROGRAM = G_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME = 'ITAB1'
      IS_LAYOUT =  GS_LAYOUT
      IT_FIELDCAT = GT_FIELDCAT
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
        IT_SORT = GT_SORT
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
        IT_EVENTS = GT_EVENTS
    IT_EVENT_EXIT =
        IS_PRINT = GS_PRINT
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IT_HYPERLINK =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
      TABLES
      T_OUTTAB = ty_moblist
      EXCEPTIONS
      PROGRAM_ERROR = 1
      OTHERS = 2.
    ENDFORM.                    "CALL_ALV
    HEADER FORM
    FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
      CONSTANTS:
      GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
      GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = LT_EVENTS.
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    define END_OF_PAGE event
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_END_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    ENDFORM.                    "EVENTTAB_BUILD
    *&      Form  COMMENT_BUILD
    FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: GS_LINE TYPE SLIS_LISTHEADER.
      data: today_date(10) type c.
      concatenate
      sy-datum+6(2) '.'
      sy-datum+4(2) '.'
      sy-datum(4) into today_date.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'H'.
      GS_LINE-INFO = 'MOBLIST DETAILS'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'S'.
      GS_LINE-KEY  = 'Date:'.
      GS_LINE-INFO = today_date.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
    GS_LINE-KEY  = 'User:'.
    GS_LINE-INFO = sy-uname.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'A'.
      GS_LINE-INFO = 'ACTION'.
      APPEND GS_LINE TO  GT_TOP_OF_PAGE.
    ENDFORM.                    "COMMENT_BUILD
    *&      Form  TOP_OF_PAGE
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
      WRITE: SY-DATUM, 'Page No', SY-PAGNO RIGHT-JUSTIFIED.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  END_OF_PAGE
    FORM END_OF_PAGE.
      WRITE: /.
      WRITE at (sy-linsz) sy-pagno CENTERED.
    ENDFORM.                    "END_OF_PAGE
    ### PRINT SETTINGS
    FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
      LS_PRINT-PRINT              = ' '. "PRINT IMMEDIATE
      LS_PRINT-NO_PRINT_SELINFOS  = 'X'. "NO SELECTION INFO
      LS_PRINT-NO_COVERPAGE       = ' '. "NO COVER PAGE
      LS_PRINT-NO_NEW_PAGE        = ' '. "NO NEW PAGE
      LS_PRINT-NO_PRINT_LISTINFOS = 'X'. "NO PRINT LIST INFO
      LS_PRINT-RESERVE_LINES      = 2.   " FOOTERLINE
    ENDFORM.                    "PRINT_BUILD

    Hi,
    You are populating the internal table  it_MOBLIST..But in the ALV you are using some other internal table..
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = <b>it_moblist</b>
    THanks,
    Naren

  • ALV Grid OO Error

    Hi Guys,
    When i am executing the program for ALV grid using OO concepts i got thisn type of error
    "Short text
    Access via 'NULL' object reference not possible.
    What happened?
    Error in the ABAP Application Program
    The current ABAP program "Z_TEST_PGM" had to be terminated because it has
    come across a statement that unfortunately cannot be executed.
    Error analysis
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not
    caught in
    procedure "ALVGRID_OO_DISPLAY" "(FORM)", nor was it propagated by a RAISING
    clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    You attempted to use a 'NULL' object reference (points to 'nothing')
    access a component (variable: "GRID").
    An object reference must point to an object (an instance of a class)
    before it can be used to access components.
    Either the reference was never set or it was set to 'NULL' using the
    CLEAR statement."
    The code for this one is .
    Data : grid type ref to cl_gui_alv_grid,
    g_custom_container type ref to cl_gui_custom_container,
    FCAT TYPE LVC_T_FCAT,
    gt_final1 type table of t_Final_out.
    Initialization.
    v_repid = sy-repid.
    set screen '101'.
    MODULE STATUS_0101 output.
    if g_custom_container is initial .
    create object g_custom_container
    Exporting
    Container_name = 'CCCONTAINER'.
    Create Object grid
    Exporting
    I_Parent = g_custom_container.
    Endif.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    I_STRUCTURE_NAME = 't_final_out'
    CHANGING
    CT_FIELDCAT = FCAT[].
    ENDMODULE.
    Perform ALVGRID_OO_Display.
    Form ALVGRID_OO_Display.
    *set screen '101'.
    Call Method grid->set_table_for_first_display
    Exporting I_Structure_name = 't_final_out'
    Changing it_outtab = gt_final1.
    Endform.
    't_final_out' is the final output Structure of the Internal table.
    Please respond to this thread.
    Thanks,
    Gopi

    t_final_out is a local structure do n't give this structure create a global structure in se11 with the fields used and pass that structure to FM  'LVC_FIELDCATALOG_MERGE'. this will sove your problem.
    <b>if helpful reward some points.</b>

  • Excel-Export in ALV-Grid not available

    Hello,
    I have a strange problem with the Export-functionality within ALV Grid. The Export-options "Spreadsheet", "Word processing", "Local file" and "Send" are not available at all PC's. I don't know if this issue is related to  SAP Gui, Patches ...

    Thanks for info - I was original thinking of the "Expert mode" option in some Report Writer outputs... but that was a different issue...
    Is it user specific or PC specific?  If the former, you might like to look in table SALV_BS_ADMIN (which can be maintained via report SALV_BS_ADMIN_MAINTAIN) as this can impact what the user sees in some ALV options - we were having problems a few weeks ago on an ECC5 system in this area - Note 1080608 and others explain more.
    Jonathan

  • Pdf availability in alv grid

    Hi gurus,
    I have a doubt . Does ALV GRID supports for PDF FILE dowmload of an alv report.I mean to say that is there any icon provided on alv grid to down load the report as pdf file to local disk.I know spread sheet down works.
    kindly reply << Removed >>.
    regards,
    padmaja.
    Edited by: Rob Burbank on Feb 15, 2009 9:52 PM

    hi ,
    can u please explain me clearly.first i tried with normal report , I thought that if it works then i go for alv report.If u can give direct solution for alv report it will be very much helpful for me.
    please go through the bellow program once.
    I have written the bellow code to convert the report program to pdf file downloaded to c drive , but when i am opening that pdf file it is giving the bellow message
    "adobe reader could not open 'REPORT.PDF'because it is either not a supported file type or because the file has been damaged( for example it was sent as a email attachementand wasn't correctly decoded)".
    code is  : for this code i created one set-pf-status  with pushbutton 'PDF'.
    REPORT  ZPDF.
    data: begin of i_list occurs 0,
    line(255),
    end of i_list.
    data: v_variable(40).
    v_variable = 'PDF CONVERSION OF REPORT'.
    start-of-selection.
    set pf-status 'PDFFILE'.
    WRITE:/ V_VARIABLE.
    at user-command.
    if sy-ucomm = 'PDF'.
    DO.
    READ LINE SY-INDEX.
    IF SY-SUBRC NE 0.
    EXIT.
    ELSE.
    I_LIST = SY-LISEL.
    APPEND I_LIST.
    ENDIF.
    ENDDO.
    NEW-PAGE PRINT ON DESTINATION 'LP03' IMMEDIATELY ' ' COVER TEXT ' ' KEEP IN SPOOL 'X' NEW LIST IDENTIFICATION 'X' LINE-SIZE 132 LINE-COUNT 65 NO DIALOG.
    LOOP AT I_LIST.
    IF I_LIST-LINE IS INITIAL.
    SKIP.
    ELSE.
    WRITE: I_LIST-LINE+0(132).
    ENDIF.
    ENDLOOP.
    NEW-PAGE PRINT OFF.
    DATA: SPOOL TYPE TSP01-RQIDENT.
    SPOOL = SY-SPONO.
    DATA: I_LIST1 LIKE TLINE OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        SRC_SPOOLID                    = SPOOL
      NO_DIALOG                      =
      DST_DEVICE                     =
      PDF_DESTINATION                =
    IMPORTING
      PDF_BYTECOUNT                  =
      PDF_SPOOLID                    =
      LIST_PAGECOUNT                 =
      BTC_JOBNAME                    =
      BTC_JOBCOUNT                   =
    TABLES
       PDF                             = I_LIST1
    EXCEPTIONS
       ERR_NO_ABAP_SPOOLJOB           = 1
       ERR_NO_SPOOLJOB                = 2
       ERR_NO_PERMISSION              = 3
       ERR_CONV_NOT_POSSIBLE          = 4
       ERR_BAD_DESTDEVICE             = 5
       USER_CANCELLED                 = 6
       ERR_SPOOLERROR                 = 7
       ERR_TEMSEERROR                 = 8
       ERR_BTCJOB_OPEN_FAILED         = 9
       ERR_BTCJOB_SUBMIT_FAILED       = 10
       ERR_BTCJOB_CLOSE_FAILED        = 11
       OTHERS                         = 12
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'C:/REPORT.PDF'
        FILETYPE                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      SHOW_TRANSFER_STATUS            = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = I_LIST1
      FIELDNAMES                      =
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endif.
    kindly explain me why my code is not giving pdf file.
    thanks in advance,
    padmaja.

Maybe you are looking for

  • I have upgraded from 3.5 to 4.1 , it downloads to the folder but still uses the 3.5

    I'm getting an urgent to update on my screen so I have updated from 3.5 to 4.1 , it has down loaded to the firefox folder but still brings up the old firerfox. I have downloaded it 3 times and rebooted around 6 times but still the same screen telling

  • How can i transfer HD video from tape to Beta Sp tape, Is it posible?

    I was shooting on HDV and after i finished editing my client is asking me to put final video to Beta Sp tape. What do i need to do? Please help.

  • SWF-file not getting info from UI

    Hi All, I have a dialog that loads a flash-file. This swf-file gets info from my dialog and puts it in a datagrid. It works well, untill i try it the script on an other computer. The swf-file loads but is not receiving any information given through t

  • Some images doesnot load

    I am trying to launch an application with javaws and my application needs lot of .gif images. I embedded all the images in a jar file and specified it in the jar href attribute of the jnlp file. Most of the images gets loading but then 2 or 3 doesnot

  • How is it possible to show contents of JComboBox that aren't in list

    I have an application that I have developed over time that requires that I be able to select any item in a JComboBox list and send an actionEvent. In order to do this I set the value of the JComboBox selectedIndex to -1 indicating no selection. This