Need to display two ALV GRIDs in a single screen

Hi,
I have a question, i'm using version 4.6. I want to display 2 ALVs in a single screen or by calling.
Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2) 
Step 2 : Display In a single report
ALV1 report (Editable ,Has to be a GRID)
ALV2 report (Non Editable, Has to be a GRID)
                         (or)
Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2)
Step 2 :
ALV1 report (Editable ,Has to be a GRID, with a custom button to call ALV2 hiding the ALV1 ie not visible to user)
ALV2 report (Non Editable ,Has to be a GRID, with a custom button to call ALV1 hiding the ALV2 ie not visible to user)
Please help me <b><REMOVED BY MODERATOR></b>
Message was edited by:
        Alvaro Tejada Galindo

Hi
ABAP List Viewer
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
Check the program in the following link:
http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm
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
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
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
13. Top-of-page in ALV
selection-screen and top-of-page in ALV
14.  ALV Group Heading
http://www.sap-img.com/fu037.htm
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
15. ALV output to PDF conversion
It has an example code for PDF Conversion.
http://www.erpgenie.com/abap/code/abap51.htm
converting the output of alv in pdf
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
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
Regards
Anji

Similar Messages

  • Two ALV Grids in a single screen are overlapping eachother

    Hi,
    I have created two ALV grids in a single screen. I have used seperate containers for them.
    But on executing them , both the ALV grids are overlapping eachother.
    Please give me a solution.

    Hi,
      IF w_custom_container IS INITIAL.
    Creating Object for the Custom Container.
        CREATE OBJECT w_custom_container
          EXPORTING
            container_name              = w_container
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        CASE sy-subrc.
          WHEN 1.
            MESSAGE e054.  "CNTL ERROR
          WHEN 2.
            MESSAGE e055.  "CNTL SYSTEM ERROR
          WHEN 3.
            MESSAGE e056.  "CREATE ERROR
          WHEN 4.
            MESSAGE e057.  "LIFETIME ERROR
          WHEN 5.
            MESSAGE e058.  "LIFETIME DYNPRO DYNPRO LINK
        ENDCASE.
    Creating object for the Splitter Container.
        CREATE OBJECT w_split_container
          EXPORTING
            parent            = w_custom_container
            orientation       = 0
            sash_position     = 30
            with_border       = 2
          EXCEPTIONS
            cntl_error        = 1
            cntl_system_error = 2
            OTHERS            = 3.
        CASE sy-subrc.
          WHEN 1.
            MESSAGE e054. "CNTL_ERROR
          WHEN 2.
            MESSAGE e055. "CNTL_SYSTEM_ERROR
        ENDCASE.
    Creating Grid Control.
        CREATE OBJECT w_grid1
          EXPORTING
            i_parent = w_split_container->top_left_container.
        CREATE OBJECT w_grid2
          EXPORTING
            i_parent = w_split_container->bottom_right_container.
    Building field catalog for ALV.
    Fieldcat for the Detail Record.
        PERFORM build_fieldcat        USING:  c_1 c_code c_output c_check
                                              c_comcode c_olength,
                                              c_2 c_fileno c_output c_check
                                              c_filenum c_olength,
                                              c_3 c_dedcod c_output c_check
                                              c_dedcode c_olength,
                                              c_4 c_dedfac c_output c_check
                                              c_dedf c_olength.
    FieldCatlog for the Error Records.
        PERFORM build_fieldcat_error  USING:  c_1 c_pernr c_error c_check
                                              c_person c_olength,
                                              c_2 c_desc c_error c_check
                                              c_descp c_olength.
    ALV Display.
        CALL METHOD w_grid1->set_table_for_first_display
    EXPORTING
       i_buffer_active               =
       i_bypassing_buffer            =
       i_consistency_check           =
       i_structure_name              =
       is_variant                    =
       i_save                        =
       i_default                     = 'X'
       is_layout                     =
       is_print                      =
       it_special_groups             =
       it_toolbar_excluding          =
       it_hyperlink                  =
       it_alv_graphics               =
       it_except_qinfo               =
       ir_salv_adapter               =
          CHANGING
            it_outtab                     = t_error
            it_fieldcatalog               = t_fieldcat_error
       it_sort                       =
       it_filter                     =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4
        CASE sy-subrc.
          WHEN 1.
            MESSAGE e076. "invalid parameter combination
          WHEN 2.
            MESSAGE e001. "program error
          WHEN 3.
            MESSAGE e078. "too many lines
        ENDCASE.
        CALL METHOD w_grid2->set_table_for_first_display
    EXPORTING
       i_buffer_active               =
       i_bypassing_buffer            =
       i_consistency_check           =
       i_structure_name              =
       is_variant                    =
       i_save                        =
       i_default                     = 'X'
       is_layout                     =
       is_print                      =
       it_special_groups             =
       it_toolbar_excluding          =
       it_hyperlink                  =
       it_alv_graphics               =
       it_except_qinfo               =
       ir_salv_adapter               =
          CHANGING
            it_outtab                     = t_output
            it_fieldcatalog               = t_fieldcat
       it_sort                       =
       it_filter                     =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4
        CASE sy-subrc.
          WHEN 1.
            MESSAGE e076. "invalid parameter combination
          WHEN 2.
            MESSAGE e001. "program error
          WHEN 3.
            MESSAGE e078. "too many lines
        ENDCASE.
      ELSE.
        CALL METHOD w_grid1->refresh_table_display
          EXPORTING
            i_soft_refresh = 'X'.
        CALL METHOD w_grid2->refresh_table_display
          EXPORTING
            i_soft_refresh = 'X'.
      ENDIF.
    Hope it Helps,
    Jayant Sahu.

  • Two AlV Grids in a single screen

    I want to bring two ALV GRIDS in a single report output screen.How can i achieve this through Classical coding( not OBJECT ORIENTED ). If possible please provide with codes.
    thanks,
    Venkat

    Hello Venkat
    I agree that using fm's this is an almost impossible task whereas using OO-based ALV lists it is just a piece of cake.
    For a sample have a look at report ZUS_SDN_TWO_ALV_GRIDS in thread alv
    or report ZUS_SDN_THREE_ALV_GRIDS in thread Alv
    Regards
      Uwe

  • Multiple ALV Grid Panes in single screen

    Hi all,
    How can we get multiple ALV Grid panes in single output.
    Is it possible to get the same without using OOPS.
    Thanks in advance. 
    Eswar

    Hi,
    You can do this by creating 2 custom controls on the layout of the screen, and then you will also need to create 2 custom containers in your ABAP program, 1 for each ALV.
    Ex :
    grid  TYPE REF TO cl_gui_alv_grid,
    custom_container TYPE REF TO cl_gui_custom_container,
    grid  TYPE REF TO cl_gui_alv_grid,
    custom_container TYPE REF TO cl_gui_custom_container,
    regards,
    Advait

  • How to use two ALV grids in a single program (pl read below for details)?

    Please read thoroughly::
    I have an ALV report using REUSE_ALV_GRID_DISPLAY.
    On the output of this report, when I click on a "change" button, a couple of columns should be made editable.
    I achieved this by modifying the fieldcatalog and triggering the output with another REUSE_ALV_GRID_DISPLAY.
    When I click on the back button of this second report, it is still taking me to the first one.
    How to over come this?
    Note:
    I used custom containers etc but the default buttons on the container are not controllable. I added custom buttons but could not suppress the default ones. So I did not pursue this much even though this is more comfortable to use.
    I am not able to get into the code in debug to see how the default buttons like COPY, INSERT ROW etc are working.
    Can any body throw some inputs into this?
    Thanks,
    Ven.

    >I achieved this by modifying the fieldcatalog and triggering the >output with another REUSE_ALV_GRID_DISPLAY.
    >When I click on the back button of this second report, it is still >taking me to the first one.
    >How to over come this?
    For this there is a solution
    i am thinking you are using user_command and calling the second time ALV Grid if so check this.
    form user_command using r_ucomm type sy-ucomm selfield type slis_selfield.
    case r_ucomm.
    when 'CHANGE'.
    selfield-exit = 'X'.   "use this , this will solve the problem
    "i hope you are calling the Function here
    endform.

  • Report with two ALV grids and a header

    Hi experts,
    I have a report with two ALV grids in the same screen, each one in a separated container. The information displays it correctly. The report has been implemented by using OO Programming.
    My real trouble is in the header. It must have a logo, a title with a specific font and other information.
    I'll attach a capture of my need:
    [Report with two ALV grids and a header|http://picasaweb.google.com/lh/photo/AcQD49QPmm-0L_jL2iMedA?feat=directlink]
    Then, I want to set up the header you can see, with logo, a font with specific features. Obviously, the header you see has taken from another report. But is the same idea.
    I've tried with a third container, using the CL_GUI_CONTAINER and CL_GUI_CONTAINER classes, but it doesn't work.
    Any idea? Would welcome any help you can provide.
    Thanks in advance,
    Jorge Rojas

    Hi, Jorge.
    Should the header be a"attached" to any of the ALV? Or it should be carried alone?
    If first applies, you've given the solution yourself: put the info & logo in first ALV's header and invoke it from the proper method.
    You could use CL_GUI_DOCKING_CONTAINER CLASS to divide screen in several containers and then, in the upper one, I would create another one docking container to divide the screen into two: the written info could be performed with an HTML viewer class and the logo with a CL_GUI_PICTURE element.
    Cheers.

  • Data not getting displayed in ALV grid when run in background

    Hello experts!
    Could anyone help me out please?
    I need to display an ALV grid in the background. My requirements are as follows:
    I first display an ALV grid in the foreground based on some input parameters. The user selects a few records for updating it and clicks on the "update" button. On the click of this button another report must be called and here the ALV report is displayed in the background.I am using "reuse_alv_grid_display" to display the grid.
    I am using Import/Export to get the selected rows in my called report. When i execute this report in the foreground i get the ALV grid along with the data. But when i execute it in the background, i get only the grid with the fieldnames and not the data when i check in SP01.
    Thanks in advance!
    Smitha

    Hi Smitha,
    If you are able to see in SP01 and only see the output layout or "List contains no data" shows clealry that the data is not getting passed in the called program or the data is not being used correctly in the called program.
    Cheers
    VJ

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • Can we have two alv grid in the output

    Hi
    Can we have two alv grid in the output?. If yes how can we do that using oops alv. I think first need to create the container on that two subscreen. is this correct? Thanks.
    Regards
    Raj

    >
    Rajitha1234 wrote:
    > Hi
    >
    >  Can we have two alv grid in the output?. If yes how can we do that using oops alv. I think first need to create the container on that two subscreen. is this correct? Thanks.
    >
    > Regards
    > Raj
    Hi Rajitha,
    You can have as many as ALV output in the screen By using OOPS.
    By using Container you can pass ALV output.
    see the sample Program SALV_TEST_TABLE.
    Regards,
    Prabhudas

  • How can i change sequence of structrure when i display in alv grid.

    Hi,
    I am doing object oriented alv. Now i need to change my sequence of alv grid. How can i change sequence of structrure when i display in alv grid. Send me code if possible....
    IF G_CONTAINER IS INITIAL.
         CREATE OBJECT G_CONTAINER
             EXPORTING
                CONTAINER_NAME = 'CONTAINER'.
         CREATE OBJECT ALV_DISP
             EXPORTING
                I_PARENT = G_CONTAINER.
         CALL METHOD ALV_DISP->SET_TABLE_FOR_FIRST_DISPLAY
             EXPORTING
               I_STRUCTURE_NAME  = 'ZPMS_OUTPUT_V3'
              CHANGING
                IT_OUTTAB        = IT_PMT
                IT_FIELDCATALOG  = G_FLDCAT
              EXCEPTIONS
                INVALID_PARAMETER_COMBINATION = 1
                PROGRAM_ERROR                 = 2
                TOO_MANY_LINES                = 3
                OTHERS                        = 4.
         IF SY-SUBRC <> 0.
         ENDIF.
    Regards,
    Gurprit Bhatia
    Message was edited by:
            GURPRIT BHATIA

    Hi Gurprit,
    when you are maintaining the field catalog you can maintain the order by populating the value as 1,2,... into col_pos filed.
    <b><REMOVED BY MODERATOR></b>
    Satish
    Message was edited by:
            Alvaro Tejada Galindo

  • Create blank screen space between two ALV grids

    I want to create some blank screen space between the two ALV grids I have on the screen.  Can someone tell me how to do this?
    Thanks and best regards,
    Sandy

    You don't have link the two containers.
    I guess you have a grid and tree control that you want to display. So, use a different container for each of these controls, so that they appear differently.
    If you don't want space in between them, you can have one container and split that into and display the tree and grid in each of the split portions.
    The advantage with this will be you can resize the tree/grids using the vertical line that separates them.
    Take a look at WE02 transaction to see what I am trying to explain.
    Regards,
    Ravi

  • ALV Grid  Usin Function Modulesshould be Displayed in ALV Grid Function mod

    Hi,
    I had a requirmentlike SM30 we hav to create initial Screen and wat ever ZXXXX tables we enter it will create Fieldcatalog Dynamically and press dislay it show in display mode.
    If we Press Maintain it will Display in Editable Mode.The changed data should be updated into DB.Evrything should be displayed in
    ALV Grid Function MOdule..
    How to Get value from Screen Field ?
    How To Generate Fieldcatalog For that Table dynamically?

    Hello,
    How To Generate Fieldcatalog For that Table dynamically?
    Use the FM 'REUSE_ALV_FIELDCATALOG_MERGE' pass the table name in the import param I_STRUCTURE_NAME & you'll get the fiel cat dynamically!
    BR,
    Suhas

  • ALV Grid: refresh in sub screens

    Hello All,
    I have some issues with internal table display in ALV grid.
    The following is the scenario.
    I am in a wizard which has 2 sub screens (SScreen 1 and sscreen 2).
    1)On sscreen 1, i have a input field,where i provide a value and on clicking the next button i get a list of values which i display on sub screen 2 using ALV grid.
    2)Now i go back to sscreen1 and change the value in the input field,since i use on-request module, i know the value in the field has changed and now i need to display new set of values on sscreen 2.
    In this case i clear the internal table, get new values for internal table and then call set_values_for_first_display().However i still get the old values displayed on SScreen 2!!!!.
    Any suggestions on what i might be doing wrong?
    Cheers
    Dev

    Hi Vijay,
    Thanks for the info.
    I will try refresh_table_display option after getting to work in a couple of hours.
    I am initializing the grid and control everytime i change a value on Subscreen 1 in the PBO of Subscreen 2(the screen where the ALV list is displayed).
    That is the reason why i call set_table_first_display, whenever there are new values in the internal table and avoid refresh_table_display.
    Cheers
    Dev

  • Need to be displayed in ALV grid

    Dear All,
    Below is my Program's code which is working accordingly. But in this code I am generating output as Basic list display.  But  I want my output to be displayed in ALV only. So from where I will start. Where to add code for Alv in my existing code. Can anybody help me out on the same.
    Regards,
    Abhay.
    REPORT  zfi_temp_rfkopr00
            MESSAGE-ID FR
           LINE-SIZE  132
           NO STANDARD PAGE HEADING.
    Report Name : Vendor Open Items Ageing Report
    Purpose : This report displays the Vendor Open Items based on
    different Ageing days (Calculated by taking the Base
    Line date and the days mentioned in Payment Terms)
    D A T A B A S E T A B L E S D E C L A R A T I O N
    TABLES: lfa1, " Vendor Master (General)
    t001, " Company Codes
    rfpdo.
    I N T E R N A L T A B L E S D E C L A R A T I O N S *
    Internal Table for Vendor Open Items Data
    DATA: BEGIN OF int_bsik OCCURS 0,
    lifnr LIKE bsik-lifnr, " Vendor Number
    name1 LIKE lfa1-name1, " Vendor Name
    shkzg LIKE bsik-shkzg, " Dr/Cr Indicator
    belnr LIKE bsik-belnr, " Document Number
    xblnr LIKE bsik-xblnr, " Ref Doc No
    blart LIKE bsik-blart, " Document Type
    zfbdt LIKE bsik-zfbdt, " Base Line Date
    zbd1t LIKE bsik-zbd1t,                                      " Due date1
    zbd2t LIKE bsik-zbd2t,                                      " Due Date2
    zbd3t LIKE bsik-zbd3t,                                      " Due Date3
    waers LIKE bsik-waers, " Currency
    dmbtr LIKE bsik-dmbtr, " Amount in Local Curr
    END OF int_bsik.
    Internal Table for Amounts Sum Up Data
    DATA: BEGIN OF int_final OCCURS 0,
    lifnr LIKE bsik-lifnr, " Vendor Number
    name1 LIKE lfa1-name1, " Vendor Name
    total1 LIKE bsik-dmbtr, " Amount in Local Curr
    total2 LIKE bsik-dmbtr, " Amount in Local Curr
    total3 LIKE bsik-dmbtr, " Amount in Local Curr
    total4 LIKE bsik-dmbtr, " Amount in Local Curr
    total5 LIKE bsik-dmbtr, " Amount in Local Curr
    total6 LIKE bsik-dmbtr, " Amount in Local Curr
    total LIKE bsik-dmbtr, " Amount in Local Curr
    END OF int_final.
    D A T A D E C L A R A T I O N S
    DATA : v_flag, " Flag
    v_gtotal1 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal2 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal3 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal4 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal5 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal6 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal LIKE bsik-dmbtr, " Amount Totals
    v_subtotal1 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal2 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal3 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal4 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal5 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal6 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal LIKE bsik-dmbtr, " Amount Totals
    v_date LIKE bsik-zfbdt, " Due Date
    v_tage1(4), " Age 30 days
    v_tage2(4), " Age 60 days
    v_tage3(4), " Age 90 days
    v_fir(15), " Column Text1
    v_sec(15), " Column Text2
    v_thir(15), " Column Text3
    v_four(17), " Column Text4
    v_fidd(4), " Days field1
    v_sedd(4), " Days field2
    v_thdd(4), " Days field3
    v_fodd(4), " Days field4
    v_str TYPE sy-lisel, " String
    v_str1(11), " String
    v_tage(3), " String
    v_date1(10). " Date field
    R A N G E D E C L A R A T I O N S
    RANGES: r_date1 FOR bsik-zfbdt, " Date Range 1
    r_date2 FOR bsik-zfbdt, " Date Range 2
    r_date3 FOR bsik-zfbdt, " Date Range 3
    r_date4 FOR bsik-zfbdt. " Date Range 4
    S E L E C T I O N S C R E E N *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr. "Vendor account
    PARAMETERS: p_bukrs LIKE t001-bukrs. "Co. Code
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: p_allgst LIKE rfpdo-allgstid OBLIGATORY DEFAULT sy-datum.
    "Open items at key date
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS: p_tage1 LIKE rfpdo1-allgfael DEFAULT '30',
    p_tage2 LIKE rfpdo1-allgfael DEFAULT '60',
    p_tage3 LIKE rfpdo1-allgfael DEFAULT '90',
    p_tage4 LIKE rfpdo1-allgfael DEFAULT '120'.
    SELECTION-SCREEN END OF BLOCK b3.
    A T S E L E C T I O N S C R E E N *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_flds.
    S T A R T O F S E L E C T I O N *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
    T O P O F P A G E
    Header
    TOP-OF-PAGE.
      PERFORM header.
    E N D O F P A G E
    Footer
    END-OF-PAGE.
      ULINE.
    T O P O F P A G E D U R I N G L I N E S E L E C T I O N *
    Top of Page in Secondary List
    TOP-OF-PAGE DURING LINE-SELECTION.
      PERFORM header1.
    A T L I N E S E L E C T I O N *
    AT LINE-SELECTION.
    Perform Line Selections
      PERFORM line_selection.
    E N D O F S E L E C T I O N
    END-OF-SELECTION.
    List generation
      PERFORM basic_list.
    *& Form validate_flds
    Validation of Selection Screen fields
    FORM validate_flds .
    Validate Vendor Code
      CLEAR lfa1-lifnr.
      SELECT lifnr UP TO 1 ROWS
      INTO lfa1-lifnr
      FROM lfa1
      WHERE lifnr IN s_lifnr AND
      spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e000 WITH 'Invalid Vendor Code range'(023).
      ENDIF.
    Validate Company Code
      CLEAR t001-bukrs.
      SELECT bukrs UP TO 1 ROWS
      INTO t001-bukrs
      FROM t001
      WHERE bukrs = p_bukrs AND
      spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e021. " Invalid Company Code range
      ENDIF.
      IF ( p_tage1 > p_tage2 ) OR ( p_tage1 > p_tage3 ) OR
      ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 1 greater'(004)
        'than Column# 2 or 3 or 4'(005).
      ENDIF.
    *column 2
      IF ( p_tage2 > p_tage3 ) OR ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 2 greater'(006)
        'than Column# 3 or 4'(007).
      ENDIF.
    *column3
      IF ( p_tage3 > p_tage4 ).
        MESSAGE e999 WITH 'Column 3 greater'(008)
        'than Column#4'(009).
      ENDIF.
    ENDFORM. " validate_flds
    *& Form fetch_data
    Fetching Data from Database Tables
    FORM fetch_data .
    Date Range Population
      r_date1-sign = 'I'.
      r_date1-option = 'BT'.
      r_date1-low = p_allgst.
      r_date1-high = r_date1-low + p_tage1.
      APPEND r_date1.
      r_date2-sign = 'I'.
      r_date2-option = 'BT'.
      r_date2-low = r_date1-high + 1.
      r_date2-high = r_date1-low + p_tage2.
      APPEND r_date2.
      r_date3-sign = 'I'.
      r_date3-option = 'BT'.
      r_date3-low = r_date2-high + 1.
      r_date3-high = r_date1-low + p_tage3.
      APPEND r_date3.
      r_date4-sign = 'I'.
      r_date4-option = 'BT'.
      r_date4-low = r_date3-high + 1.
      r_date4-high = r_date1-low + p_tage4.
      APPEND r_date4.
    Select the Vendor Open Items data from BSIK
      SELECT l~lifnr
      l1~name1
      b~waers
      b~dmbtr
      b~zfbdt
      b~zbd1t
      b~zbd2t
      b~zbd3t
      b~belnr
      b~xblnr
      b~shkzg
      b~blart
      INTO CORRESPONDING FIELDS OF TABLE int_bsik
      FROM lfb1 AS l INNER JOIN lfa1 AS l1
      ON llifnr = l1lifnr
      INNER JOIN bsik AS b
      ON llifnr = blifnr AND
      lbukrs = bbukrs
      WHERE l~lifnr IN s_lifnr AND
      l~bukrs = p_bukrs AND
      b~zfbdt LE p_allgst.
      IF sy-subrc <> 0.
        MESSAGE i000 WITH 'No Data found'(027).
      ENDIF.
    Removing the date limit to get the due items in the past
      DELETE int_bsik WHERE
      ( blart NE 'RE' AND blart NE 'KR' ) OR
      shkzg NE 'H'.
      SORT int_bsik BY lifnr.
    ENDFORM. " fetch_data
    *& Form header
    Display the Report Columns
    FORM header .
      v_tage1 = p_tage1 + 1.
      v_tage2 = p_tage2 + 1.
      v_tage3 = p_tage3 + 1.
      v_fidd = p_tage1.
      v_sedd = p_tage2.
      v_thdd = p_tage3.
      v_fodd = p_tage4.
      MOVE v_fodd0(4) TO v_fodd1(3).
      v_fodd+0(1) = space.
      CONCATENATE '1 to'(010) v_fidd INTO v_fir.
      CONCATENATE v_tage1 ' to '(011) v_sedd INTO v_sec.
      CONCATENATE v_tage2 ' to '(011) v_thdd INTO v_thir.
      CONCATENATE v_tage3 ' to '(011) space v_fodd INTO v_four.
    Standard header
      CLEAR: v_date1, v_str, v_str1, v_tage.
      WRITE p_allgst TO v_date1.
      MOVE p_tage4 TO v_tage.
      CONCATENATE '>' v_tage text-025 INTO v_str1.
      CONCATENATE
      'Summary of Ageing Analysis for Vendor Open Invoices as on'(013)
      v_date1 INTO v_str SEPARATED BY space.
    CALL FUNCTION 'Z_STANDARD_HEADER'
       EXPORTING
         title1 = 'Saudi International Petrochemical Company'(012)
         title2 = v_str.
      FORMAT COLOR OFF.
      WRITE : /1(168) sy-uline.
      FORMAT COLOR 1 INTENSIFIED.
      WRITE :/1 sy-vline, 13 sy-vline, 49 sy-vline,
      50(101) 'Invoices Due For(In Days)'(014) CENTERED,
      151 sy-vline, 168 sy-vline .
      WRITE :/1 sy-vline, 2(11) 'Vendor#'(015) CENTERED,
      13 sy-vline ,14(35) 'Vendor Name'(016) CENTERED,
      49 sy-vline,
      50(101) sy-uline,151 sy-vline,
      152(16) 'Total'(017) CENTERED,
      168 sy-vline.
      WRITE : /1 sy-vline,13 sy-vline, 49 sy-vline,
      50(16) v_fir CENTERED, 66 sy-vline,
      67(16) v_sec CENTERED, 83 sy-vline,
      84(16) v_thir CENTERED, 100 sy-vline,
      101(16) v_four CENTERED, 117 sy-vline,
      118(16) v_str1 CENTERED, 134 sy-vline,
      135(16) 'Already Overdue'(018) CENTERED,151 sy-vline,
      168 sy-vline.
      FORMAT COLOR OFF.
      WRITE : /1(168) sy-uline.
    ENDFORM. " header
    *& Form basic_list
    Display the Basic List
    FORM basic_list .
      NEW-PAGE LINE-SIZE 168.
      LOOP AT int_bsik.
        CLEAR v_date.
        IF int_bsik-zbd3t <> ' '.
          v_date = int_bsik-zfbdt + int_bsik-zbd3t.
        ELSE.
          IF int_bsik-zbd2t <> ' '.
            v_date = int_bsik-zfbdt + int_bsik-zbd2t.
          ELSE.
            v_date = int_bsik-zfbdt + int_bsik-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsik-zbd1t = ' '.
          v_date = int_bsik-zfbdt.
        ENDIF.
        IF v_date IN r_date1.
          int_final-total1 = int_final-total1 + int_bsik-dmbtr.
        ELSEIF v_date IN r_date2.
          int_final-total2 = int_final-total2 + int_bsik-dmbtr.
        ELSEIF v_date IN r_date3.
          int_final-total3 = int_final-total3 + int_bsik-dmbtr.
        ELSEIF v_date IN r_date4.
          int_final-total4 = int_final-total4 + int_bsik-dmbtr.
        ELSEIF v_date > r_date4-high.
          int_final-total5 = int_final-total5 + int_bsik-dmbtr.
        ELSEIF v_date < p_allgst.
          int_final-total6 = int_final-total6 + int_bsik-dmbtr.
        ENDIF.
        AT END OF lifnr.
          v_flag = 1.
        ENDAT.
        IF v_flag = 1.
          int_final-lifnr = int_bsik-lifnr.
          int_final-name1 = int_bsik-name1.
          int_final-total = int_final-total1 + int_final-total2 +
          int_final-total3 + int_final-total4 + int_final-total5 +
          int_final-total6.
          APPEND int_final.
          v_gtotal1 = v_gtotal1 + int_final-total1.
          v_gtotal2 = v_gtotal2 + int_final-total2.
          v_gtotal3 = v_gtotal3 + int_final-total3.
          v_gtotal4 = v_gtotal4 + int_final-total4.
          v_gtotal5 = v_gtotal5 + int_final-total5.
          v_gtotal6 = v_gtotal6 + int_final-total6.
          v_gtotal = v_gtotal + int_final-total.
          WRITE: /1 sy-vline,
          2 int_final-lifnr COLOR 4 INTENSIFIED ON,
          13 sy-vline,
          14 int_final-name1 COLOR 4 INTENSIFIED ON,
          49 sy-vline.
          DATA : v_rem.
          v_rem = sy-tabix MOD 2.
          IF v_rem NE 0.
            FORMAT COLOR 2 INTENSIFIED.
            WRITE : 50 int_final-total1 CURRENCY int_bsik-waers,
            66 sy-vline,
            67 int_final-total2 CURRENCY int_bsik-waers,
            83 sy-vline,
            84 int_final-total3 CURRENCY int_bsik-waers,
            100 sy-vline,
            101 int_final-total4 CURRENCY int_bsik-waers,
            117 sy-vline,
            118 int_final-total5 CURRENCY int_bsik-waers,
            134 sy-vline,
            135 int_final-total6 CURRENCY int_bsik-waers,
            151 sy-vline,
            152 int_final-total CURRENCY int_bsik-waers,
            168 sy-vline.
          ELSE.
            WRITE : 50 int_final-total1 CURRENCY int_bsik-waers,
            66 sy-vline,
            67 int_final-total2 CURRENCY int_bsik-waers,
            83 sy-vline,
            84 int_final-total3 CURRENCY int_bsik-waers,
            100 sy-vline,
            101 int_final-total4 CURRENCY int_bsik-waers,
            117 sy-vline,
            118 int_final-total5 CURRENCY int_bsik-waers,
            134 sy-vline,
            135 int_final-total6 CURRENCY int_bsik-waers,
            151 sy-vline,
            152 int_final-total CURRENCY int_bsik-waers,
            168 sy-vline.
          ENDIF.
          FORMAT COLOR OFF.
          HIDE int_final.
          CLEAR int_final.
          v_flag = 0.
        ENDIF.
        AT LAST.
          WRITE : /1(168) sy-uline.
          FORMAT COLOR 3 INTENSIFIED.
          WRITE : /1 sy-vline, 2(47) 'GRAND TOTAL'(022) CENTERED,
          49 sy-vline, 50 v_gtotal1 CURRENCY int_bsik-waers,
          66 sy-vline, 67 v_gtotal2 CURRENCY int_bsik-waers,
          83 sy-vline, 84 v_gtotal3 CURRENCY int_bsik-waers,
          100 sy-vline,101 v_gtotal4 CURRENCY int_bsik-waers,
          117 sy-vline,118 v_gtotal5 CURRENCY int_bsik-waers,
          134 sy-vline,135 v_gtotal6 CURRENCY int_bsik-waers,
          151 sy-vline,152 v_gtotal CURRENCY int_bsik-waers,
          168 sy-vline.
          HIDE : v_gtotal1,
          v_gtotal2,
          v_gtotal3,
          v_gtotal4,
          v_gtotal5,
          v_gtotal6,
          v_gtotal.
        ENDAT.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE : /1(168) sy-uline.
    ENDFORM. " basic_list
    *& Form line_selection
    When double clicked on the line display the seconday list
    FORM line_selection .
      NEW-PAGE LINE-SIZE 206.
    Sy-lsind = 1.
      DATA : v_rem,v_cnt LIKE sy-tabix.
      v_cnt = 0.
      SORT int_bsik BY belnr zfbdt.
      LOOP AT int_bsik WHERE lifnr EQ int_final-lifnr.
        v_rem = v_cnt MOD 2.
        CLEAR v_date.
        IF int_bsik-zbd3t <> ' '.
          v_date = int_bsik-zfbdt + int_bsik-zbd3t.
        ELSE.
          IF int_bsik-zbd2t <> ' '.
            v_date = int_bsik-zfbdt + int_bsik-zbd2t.
          ELSE.
            v_date = int_bsik-zfbdt + int_bsik-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsik-zbd1t = ' '.
          v_date = int_bsik-zfbdt.
        ENDIF.
        IF v_rem NE 0.
          FORMAT COLOR 2 INTENSIFIED.
          WRITE :/1 sy-vline, 2 int_bsik-belnr,
          12 sy-vline,13 int_bsik-lifnr,
          23 sy-vline,24 int_bsik-name1,
          59 sy-vline,60 int_bsik-xblnr,
          76 sy-vline,77 int_bsik-zfbdt,
          87 sy-vline.
          WRITE : 104 sy-vline,121 sy-vline,
          138 sy-vline,155 sy-vline,
          172 sy-vline, 189 sy-vline,
          190 int_bsik-dmbtr CURRENCY int_bsik-waers,
          206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 = v_subtotal1 + int_bsik-dmbtr.
            WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 = v_subtotal2 + int_bsik-dmbtr.
            WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 = v_subtotal3 + int_bsik-dmbtr.
            WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 = v_subtotal4 + int_bsik-dmbtr.
            WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date > r_date4-high.
            v_subtotal5 = v_subtotal5 + int_bsik-dmbtr.
            WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date < p_allgst.
            v_subtotal6 = v_subtotal6 + int_bsik-dmbtr.
            WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ENDIF.
          FORMAT COLOR OFF.
        ELSE.
          WRITE :/1 sy-vline, 2 int_bsik-belnr,
          12 sy-vline,13 int_bsik-lifnr,
          23 sy-vline,24 int_bsik-name1,
          59 sy-vline,60 int_bsik-xblnr,
          76 sy-vline,77 int_bsik-zfbdt,
          87 sy-vline.
          WRITE : 104 sy-vline,121 sy-vline,
          138 sy-vline,155 sy-vline,
          172 sy-vline,189 sy-vline,
          190 int_bsik-dmbtr CURRENCY int_bsik-waers,
          206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 = v_subtotal1 + int_bsik-dmbtr.
            WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 = v_subtotal2 + int_bsik-dmbtr.
            WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 = v_subtotal3 + int_bsik-dmbtr.
            WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 = v_subtotal4 + int_bsik-dmbtr.
            WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date > r_date4-high.
            v_subtotal5 = v_subtotal5 + int_bsik-dmbtr.
            WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date < p_allgst.
            v_subtotal6 = v_subtotal6 + int_bsik-dmbtr.
            WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ENDIF.
        ENDIF.
        FORMAT COLOR OFF.
        v_cnt = v_cnt + 1.
      ENDLOOP.
      WRITE : /1(206) sy-uline.
      v_subtotal = v_subtotal1 + v_subtotal2 + v_subtotal3
      + v_subtotal4 + v_subtotal5 + v_subtotal6.
      FORMAT COLOR 3 INTENSIFIED.
      WRITE : /1 sy-vline,
      2(85) 'Total'(017) CENTERED CURRENCY int_bsik-waers ,
      87 sy-vline,
      88 v_subtotal1 CURRENCY int_bsik-waers,
      104 sy-vline,
      105 v_subtotal2 CURRENCY int_bsik-waers,
      121 sy-vline,
      122 v_subtotal3 CURRENCY int_bsik-waers,
      138 sy-vline,
      139 v_subtotal4 CURRENCY int_bsik-waers,
      155 sy-vline,
      156 v_subtotal5 CURRENCY int_bsik-waers,
      172 sy-vline,
      173 v_subtotal6 CURRENCY int_bsik-waers,
      189 sy-vline,
      190 v_subtotal CURRENCY int_bsik-waers,
      206 sy-vline.
      FORMAT COLOR OFF.
      WRITE : /1(206) sy-uline.
      CLEAR : v_subtotal,v_subtotal1,v_subtotal2,v_subtotal3,
      v_subtotal4,v_subtotal5,v_gtotal1,v_gtotal2,v_gtotal3,
      v_gtotal4, v_gtotal5,v_gtotal,v_subtotal6,v_gtotal6.
    ENDFORM. " line_selection
    *& Form header1
    Secondary List Header
    FORM header1 .
    Standard header
      CLEAR: v_date1, v_str, v_str1, v_tage.
      WRITE p_allgst TO v_date1.
      MOVE p_tage4 TO v_tage.
      CONCATENATE '>' v_tage text-025 INTO v_str1.
      CONCATENATE
      'Details of Ageing Analysis for Vendor Open Invoices as on'(024)
      v_date1 INTO v_str SEPARATED BY space.
    CALL FUNCTION 'Z_STANDARD_HEADER'
       EXPORTING
         title1 = 'Saudi International Petrochemical Company'(012)
         title2 = v_str.
      FORMAT COLOR 1 INTENSIFIED.
      WRITE :/1(206) sy-uline.
      WRITE :/1 sy-vline,12 sy-vline ,
      23 sy-vline,59 sy-vline,76 sy-vline,87 sy-vline,
      88(101) 'Invoices Due For(In Days)'(014) CENTERED,
      189 sy-vline,206 sy-vline.
      WRITE : /1 sy-vline, 2(10) 'Doc Number'(021) CENTERED,
      12 sy-vline, 13(10) 'Vendor#'(015) CENTERED,
      23 sy-vline, 24(35) 'Vendor Name'(016) CENTERED,
      59 sy-vline, 60(16) 'Ref invoice#'(019) CENTERED,
      76 sy-vline, 77(10) 'Inv dt'(020) CENTERED,
      87 sy-vline, 88(101) sy-uline,
      189 sy-vline,190(16) 'Total'(017) CENTERED,
      206 sy-vline.
      WRITE : /1 sy-vline, 12 sy-vline,
      23 sy-vline,59 sy-vline,
      76 sy-vline,87 sy-vline,
      88(16) v_fir CENTERED, 104 sy-vline,
      105(16) v_sec CENTERED, 121 sy-vline,
      122(16) v_thir CENTERED, 138 sy-vline,
      139(16) v_four CENTERED, 155 sy-vline,
      156(16) v_str1 CENTERED,
      172 sy-vline,
      173(16) 'Already Overdue'(018) CENTERED,
      189 sy-vline,
      206 sy-vline.
      FORMAT COLOR OFF.
      WRITE : /1(206) sy-uline.
    ENDFORM.                                                    " header1

    Hi Abhay,
    After moving the whole data into final internal table, pass that internal table to function module REUSE_ALV_GRID_DISPLAY.
    before that you need to build field catalog and have to build layout with all the required columns.
    Go through the below links for your reference.
    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
    Check this for basic concepts of OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Tabstrip
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
    Editable ALV
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
    Tree
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    http://www.sap-img.com/abap/what-is-alv-programming.htm
    http://www.sap-img.com/abap-function.htm
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
    http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
    http://www.sap-img.com/abap-function.htm
    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
    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
    <b>Reward points for helpful answers,</b>
    Satish

  • Two  ALV Grid Display  format on the Single page

    Hi guru's
    I have two plant details. I want to be  display these two plant details in the single page with ALV Grid display format.. like
    plant no 1(Details):
    xxxx  xxxx xxxx xxxx with ALV Grid Display format
    plant no 2 (Details):
    xxx  xxxx xxxx xxxx ALV Grid Display format
    Can any body help on the .. if you have sample code pls paste.
    Thanks in Advance
    Surendra

    hi,
    Grid display is not possible but u can display two list on same page by Block ALV....
    TYPE-POOLS : slis.
    TABLES : mara,
             makt.
    SELECT-OPTIONS : mat FOR mara-matnr.
    DATA : BEGIN OF itab OCCURS 0,
            matnr LIKE mara-matnr,
            maktx LIKE makt-maktx,
            matkl LIKE mara-matkl,
            mtart LIKE mara-mtart,
           END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1.
    DATA : BEGIN OF itab1_col OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1_col.
    DATA : t_fcat1 TYPE slis_t_fieldcat_alv,
           t_fcat2 TYPE slis_t_fieldcat_alv,
           wa_fcat TYPE slis_fieldcat_alv,
           t_eve TYPE slis_t_event,
           wa_eve TYPE slis_alv_event,
           t_layout TYPE slis_layout_alv.
    DATA : v_repid LIKE sy-repid,
           t_mat LIKE mara-matnr.
    DEFINE create_fcat.
      clear wa_fcat.
      wa_fcat-fieldname = &1.
      wa_fcat-seltext_l = &2.
      wa_fcat-outputlen = &3.
      append wa_fcat to t_fcat1.
    END-OF-DEFINITION.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM dis_data.
    *&      Form  get_data
          text
    FORM get_data.
      SELECT amatnr bmaktx amtart amatkl INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara AS a INNER JOIN makt AS b ON
      amatnr = bmatnr
      WHERE a~matnr IN mat.
      LOOP AT itab.
        itab1-mtart = itab-mtart.
        itab1-count = 1.
        APPEND itab1.
      ENDLOOP.
      SORT itab1 BY mtart.
      LOOP AT itab1.
        MOVE-CORRESPONDING itab1 TO itab1_col.
        COLLECT itab1_col.
      ENDLOOP.
    ENDFORM.                    "get_data
    *&      Form  dis_data
          text
    FORM dis_data.
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program      = v_repid.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE1'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MATNR' 'Material' '10',
      'MAKTX' 'Material Description' '40',
      'MTART' 'Type' '10',
      'MATKL' 'Group' '10'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB'
          it_events   = t_eve
        TABLES
          t_outtab    = itab.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE2'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MTART' 'Type' '10',
      'COUNT' 'Total' '5'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB1_COL'
          it_events   = t_eve
        TABLES
          t_outtab    = itab1_col.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    ENDFORM.                    "dis_data
    *&      Form  top_of_page1
          text
    FORM top_of_page1.
      FORMAT COLOR COL_POSITIVE.
      WRITE:/ 'First Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    *&      Form  top_of_page2
          text
    FORM top_of_page2.
      FORMAT COLOR COL_NEGATIVE.
      WRITE /5 'Second Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    reward if usefull....

Maybe you are looking for

  • How do I change the name associated with my device?

    My iphone5 carries my husbands name and I would like it to reflect my name. Any way to do this wise people of the internet?

  • Without 3D option in my PS6, after upgrade web premium.

    my CS6 is standard version and volume license from my company. after i deployed cs6 web premium  from appplication server, dreamweaver, flash has come out. But my photoshop has not upgraded to be extended. How can i do next?

  • How long does it take? re: com.sun.rowset.*

    It's been years and we still don't have a solid disconnected RowSet implementation from Sun. What gives? My gripes: 1) If *RowSetImpl is "included in Java 1.5" then why didn't you add it to the javax.sql.rowset package and document it in the api java

  • Attempt to access invalid address error

    Been using PSE 5.0 for years with no problems, then all of a sudden, when I try and open it I get the following error:  attempt to access i nvalid address I cannot open my PSE 5 now - suspect it is because of MS Vista auto upgrade?  Any solutions or

  • Query based Authorization

    Hi, We have 3 queries Q1, Q2, Q3 We need for Profile 1 - Q1 and Q2 Profile 2 - Q2 and Q3 Any idea how to do this without including the actual name of the query in the authorization object Thanks