2013 May 29 7:32 AM
Hi All,
I have created ALV Tree as shown in the attachment and I developed a report for Trail Balance - product wise, now my requirement is when I double click on the text node the detailed report should display on the right side.
Please help me on this, your help is much appreciated.
Regards
Naveen
2013 May 29 7:39 AM
How to link the report in this ALV tree...when I double click on this trail balance Product wise the detailed report should display on right side, please help me in acheiving this.
Regards
Naveen
2013 May 29 8:20 AM
you can try module pool. you can split screen, and display right hand side
2013 May 29 8:27 AM
Hi Naveen,
Have you used splitter container for this r ?
Many thanks
venkat
2013 May 29 9:13 AM
Hi Amarener,
This is Module Pool reuirement only, i have created the tree and developed a report need to link the report to that text element. When I double click it should display the detailed report.. to acheive that how do I proceed, i am stuck here....
Regards
naveen
2013 May 29 9:37 AM
2013 May 29 8:46 AM
Hi naveen,
You can achieve this by two ways, either by doing docking splitter and make two dock container or in module pool program go to the screen and create two container ( one is alv tree and other is alv report ).
ALV Tree is already done and will be displayed on the first container (CONT_01). and create an ALV table using internal table (say: IT_ALV) and assign it to the next container (CONT_02).
so, now in double click or link click event in the ALV tree do the coding to prepare the internal table data and pass the data to IT_ALV. and now refresh the ALV table in the same event itself. Then you will able to see the data on the right side on the click of the ALV tree.
2013 May 29 10:46 AM
Hi Naveen,
I have posted the code on how to split. The program demonstrates splitting of area into 3 different parts.
First split the container into 2 columns say colA and colB. Then I have splitted colB into 2 rows say rowA and rowB. On double clicking the record in colA, respective entries are listed in rowA and rowB of colB.
Here ZDRCOUNTRY, ZDRSTATE, ZDRCITY are the database tables which are related to each other.
Here's the code:
CLASS event_class DEFINITION DEFERRED.
DATA:
lt_country TYPE TABLE OF zdrcountry,
lt_state TYPE TABLE OF zdrstate,
lt_city TYPE TABLE OF zdrcity,
ls_country TYPE zdrcountry,
ls_state TYPE zdrstate,
**** Containers
l_ref_container TYPE REF TO cl_gui_custom_container, " Main Container
l_ref_container1 TYPE REF TO cl_gui_container, " Container for Country
l_ref_container2 TYPE REF TO cl_gui_container, " Container for State
l_ref_container3 TYPE REF TO cl_gui_container, " Container for City
**** Grids
l_ref_grid1 TYPE REF TO cl_gui_alv_grid, " Grid for Country
l_ref_grid2 TYPE REF TO cl_gui_alv_grid, " Grid for State
l_ref_grid3 TYPE REF TO cl_gui_alv_grid, " Grid for City
**** Layout workarea
ls_layo TYPE lvc_s_layo,
**** Splitters
l_ref_splitter1 TYPE REF TO cl_gui_splitter_container,
l_ref_splitter2 TYPE REF TO cl_gui_splitter_container,
l_ref_event TYPE REF TO event_class,
**** For sorting fields
ls_sort TYPE lvc_s_sort,
lt_sort TYPE lvc_t_sort,
**** Holds selected details
lv_sel_country TYPE string, " Country Name
lv_sel_state TYPE string, " State Name
**** Previous ID's
lv_prev_countryid TYPE i, " Country ID
lv_prev_stateid TYPE i. " State ID
DATA: BEGIN OF ls_out_country.
INCLUDE STRUCTURE zdrcountry.
DATA: light TYPE c,
END OF ls_out_country.
DATA: BEGIN OF ls_out_state.
INCLUDE STRUCTURE zdrstate.
DATA: light TYPE c,
END OF ls_out_state.
DATA:
lt_out_country LIKE TABLE OF ls_out_country,
lt_out_state LIKE TABLE OF ls_out_state.
*----------------------------------------------------------------------*
* CLASS event_class DEFINITION
*----------------------------------------------------------------------*
* Defination for event handler
*----------------------------------------------------------------------*
CLASS event_class DEFINITION.
PUBLIC SECTION.
METHODS:
display_state FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row,
display_city FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row.
ENDCLASS. "event_class DEFINITION
*----------------------------------------------------------------------*
* CLASS event_class IMPLEMENTATION
*----------------------------------------------------------------------*
* Handle events for country and state
*----------------------------------------------------------------------*
CLASS event_class IMPLEMENTATION.
METHOD display_state.
**** Read the selected data into a variable.
READ TABLE lt_out_country INTO ls_out_country INDEX e_row-index.
IF sy-subrc = 0.
CLEAR: lt_out_state.
ls_country-id = ls_out_country-id.
**** Move corresponding states into output table of state for displaying
LOOP AT lt_state INTO ls_state WHERE countryid = ls_out_country-id.
MOVE-CORRESPONDING ls_state TO ls_out_state.
APPEND ls_out_state TO lt_out_state.
CLEAR ls_out_state.
ENDLOOP.
**** Select all the corresponding cities
SELECT *
FROM zdrcity
INTO TABLE lt_city
WHERE countryid = ls_out_country-id.
**** Reset the previous highlighted field
lv_sel_country = ls_out_country-name.
READ TABLE lt_out_country INTO ls_out_country WITH KEY id = lv_prev_countryid.
IF sy-subrc = 0.
CLEAR ls_out_country-light.
MODIFY lt_out_country FROM ls_out_country INDEX sy-tabix.
CLEAR ls_out_country.
ENDIF.
**** Set the current field highlighted
READ TABLE lt_out_country INTO ls_out_country WITH KEY name = lv_sel_country.
IF sy-subrc = 0.
ls_out_country-light = '3'.
MODIFY lt_out_country FROM ls_out_country INDEX sy-tabix.
ENDIF.
lv_prev_countryid = ls_country-id.
ENDIF.
CLEAR ls_country.
* CALL METHOD l_ref_container->free. " For deleting the container
**** Refresh the table contents of all the grids
CALL METHOD l_ref_grid1->refresh_table_display.
CALL METHOD l_ref_grid2->refresh_table_display.
CALL METHOD l_ref_grid3->refresh_table_display.
ENDMETHOD. "display_state
METHOD display_city.
READ TABLE lt_out_state INTO ls_out_state INDEX e_row-index.
IF sy-subrc = 0.
lv_sel_state = ls_out_state-name.
ls_state-id = ls_out_state-id.
**** Select corresponding cities
SELECT *
FROM zdrcity
INTO TABLE lt_city
WHERE stateid = ls_out_state-id.
**** Reset previous highlighted record
READ TABLE lt_out_state INTO ls_out_state WITH KEY id = lv_prev_stateid.
IF sy-subrc = 0.
CLEAR ls_out_state-light.
MODIFY lt_out_state FROM ls_out_state INDEX sy-tabix.
CLEAR ls_out_state.
ENDIF.
**** Set current selected record highlighted
READ TABLE lt_out_state INTO ls_out_state WITH KEY name = lv_sel_state.
IF sy-subrc = 0.
ls_out_state-light = '3'.
MODIFY lt_out_state FROM ls_out_state INDEX sy-tabix.
CLEAR ls_out_state.
ENDIF.
lv_prev_stateid = ls_state-id.
ENDIF.
CLEAR ls_state.
**** Refresht the table contents
CALL METHOD l_ref_grid2->refresh_table_display.
CALL METHOD l_ref_grid3->refresh_table_display.
ENDMETHOD. "display_city
ENDCLASS. "event_class IMPLEMENTATION
START-OF-SELECTION.
**** Select all the countries
SELECT *
FROM zdrcountry
INTO TABLE lt_country.
**** Move corresponding to output table that is displayed
LOOP AT lt_country INTO ls_country.
MOVE-CORRESPONDING ls_country TO ls_out_country.
APPEND ls_out_country TO lt_out_country.
CLEAR ls_out_country.
ENDLOOP.
**** Select all the states
SELECT *
FROM zdrstate
INTO TABLE lt_state.
**** Call the screen
CALL SCREEN 9000.
*----------------------------------------------------------------------*
* MODULE status_9000 OUTPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
SET PF-STATUS 'STATUS'.
**********************************************************************
**** Create main container and split into two parts ( 2 columns )
**********************************************************************
CREATE OBJECT l_ref_container
EXPORTING
container_name = 'CCONTAINER'.
CREATE OBJECT l_ref_splitter1
EXPORTING
parent = l_ref_container
rows = 1
columns = 2
.
**** Get first container
CALL METHOD l_ref_splitter1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = l_ref_container1.
**** Get second container
CALL METHOD l_ref_splitter1->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = l_ref_container2.
**** Split second container into two parts ( 2 Rows )
CREATE OBJECT l_ref_splitter2
EXPORTING
parent = l_ref_container2
rows = 2
columns = 1
.
**** Get first container ( 1st row )
CALL METHOD l_ref_splitter2->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = l_ref_container2.
**** Get second container ( 2nd row )
CALL METHOD l_ref_splitter2->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = l_ref_container3.
**** Assign container 1 to grid 1
CREATE OBJECT l_ref_grid1
EXPORTING
i_parent = l_ref_container1
.
**** Set the layout for Traffic Light
ls_layo-excp_fname = 'LIGHT'. " Name of the field
ls_layo-excp_led = 'X'. " Enable traffic light
**** Sort using country name
PERFORM sort_details USING 'NAME' CHANGING lt_sort.
**** Fill contents of grid 1 with country details
CALL METHOD l_ref_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'ZDRCOUNTRY'
is_layout = ls_layo
CHANGING
it_outtab = lt_out_country
it_sort = lt_sort
.
**** Assign container 2 to Grid 2
CREATE OBJECT l_ref_grid2
EXPORTING
i_parent = l_ref_container2
.
**** Sort using state name
PERFORM sort_details USING 'NAME' CHANGING lt_sort.
**** Fill contents of grid 2 with state details
CALL METHOD l_ref_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'ZDRSTATE'
is_layout = ls_layo
CHANGING
it_outtab = lt_out_state
it_sort = lt_sort
.
**** Assign container 3 to grid 3
CREATE OBJECT l_ref_grid3
EXPORTING
i_parent = l_ref_container3.
**** Sort using city name
PERFORM sort_details USING 'NAME' CHANGING lt_sort.
**** Fill contents of grid 3 with city details
CALL METHOD l_ref_grid3->set_table_for_first_display
EXPORTING
i_structure_name = 'ZDRCITY'
CHANGING
it_outtab = lt_city
it_sort = lt_sort
.
**** Register event handler for double click
IF l_ref_event IS NOT BOUND.
CREATE OBJECT l_ref_event.
ENDIF.
SET HANDLER l_ref_event->display_state FOR l_ref_grid1.
SET HANDLER l_ref_event->display_city FOR l_ref_grid2.
ENDMODULE. "status_9000 OUTPUT
*----------------------------------------------------------------------*
* MODULE user_command_9000
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE user_command_9000.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. "user_command_9000
*&---------------------------------------------------------------------*
*& Form sort_details
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->LV_NAME Name of the fields for sorting
* -->LT_SORT internal table containing records that to be sorted
*----------------------------------------------------------------------*
FORM sort_details USING im_name TYPE any
CHANGING ch_sort TYPE lvc_t_sort.
CLEAR ch_sort.
ls_sort-fieldname = im_name.
ls_sort-up = 'X'.
APPEND ls_sort TO ch_sort.
CLEAR ls_sort.
ENDFORM. "sort_details
2013 May 30 5:39 AM
Hi,
I don't want to use splitter container..exactly my requirement is when I click on the first Text Node the detailed Report should display on the right side...how can I link the report to that text Node ..so that if I double click that Node ...Report will be displayed on the right side...
Suggestion: Do I need to create any subscreen to call that report?
Can I call the report direct..how?
Please help me out ...
2013 May 30 12:22 PM
You mean on double clicking node the details should be displayed in the next screen (new screen)? If so you need to call a subscreen. If this is not the case then without splitters it is not possible to display the contents. You have to split into two parts.
2013 May 31 10:48 AM
Hi Satish,
One of my colleague tried using double click method but it is not working to display the report, Is there any other to display the report by click the text node.
Regards
Naveen
2013 Jun 03 6:08 AM
2013 Jun 06 8:51 AM
go to SAP Report RFBILA00 it HAve Code as per your Requirement
2013 May 29 10:48 AM
2013 May 30 8:08 AM
2013 May 30 3:30 PM
Hi Naveen,
I am not sure if I understand you right.
Do you mean that you do not know how to call?
Do you mean that you have reports to be called, ready per text-node?
Have you tried with keyword SUBMIT? You can do this also in a subscreen.
So that the result is shown in a dialog box.
In any case you have to know at which text-node the user has double-clicked in order to call the right report.
Wendy
2013 May 31 5:20 AM
Hi Wendy,
I have shown 3 different text nodes on that attachment, if we click on each text node detailed report should display on the right space shown in that image. like that in the same way need to link 3 different reports to those 3 nodes and they need to display the exact report when we double click it.
Regards
Naveen
2013 Jun 03 5:18 AM
Yes naveen, you can do it by linking the tree node to show up the other report..
What you have to do is,
1. Create TWO containers... ( One is show ALV Tree on the left side and Other is to show ALV report on right side ).
2. Create ALV tree using container.. (this you already done).
3. Create ALV table using empty internal table ( that internal table contains the data in which you need to show on the right side ). Initially it may be empty
4. Get the double click event of the ALV tree, and there you can read the link that has been clicked. So read the link and its data. Then populate the data in the empty internal table which you used for ALV table on right side.
5. Refresh the second ALV... thats it
Then the corresponding data will be shown on the right side...
i have done this similar requirement by this way only....
2013 Jun 03 6:34 AM
2013 Jun 05 7:32 AM
Hi playsuji s,
Can be please provide me a sample code to call a report using a subscreen. I don't want want to call ALV, just need to send the data to an internal table then we need to call that internal table to display the report.
Regards
Naveen
2013 Jun 05 10:44 AM
Dear Naveen Kumar,
To call the report through Subscreen you can use , SUBMIT and Return statement or call screen statement from Sub screen .
2013 Jun 05 2:26 PM
2013 Jun 05 2:26 PM
Hi Madhu,
If I have 3 screen, eg: 101,102,103..I want to display the the report on 103 screen..how can I do using Submit and return statement. Please give me some refernce code so that i can use it...new to this module pool and screen programming.
Regards
Naveen
2013 Jul 23 12:26 PM
Dear Naveen,
I m writing the syntax of report.
PAI of screen 103
perform get_prg.
form get_prg .
Submit Prg_name and return via selection screen .
endform.
Pass input from PAI of 103 which is required for alv report using export statement / Set parameter.
Write a prg which should satisfy the output required in alv format.
inside the program u use import statement / Get parameter to get input from the sub screen.
2013 Jun 06 8:13 AM
What is your exact requirement, you can define a dynpro which actually display a list screen, with a code in PBO like :
MODULE call_list OUTPUT.
SUPPRESS DIALOG.
SET PF-STATUS space.
WRITE 'Basic List'.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
ENDMODULE.
But if you execute a SUBMIT AND RETURN list processing will be executed in the second report, in both cas previous screen wont be displayed,
You could
- display the detail in a ALV grid on right side of screen, search scn for docking container and OO ALV
- submit the report with an export list to memory, and get the spool data back, convert and display it in a subscreen on right side or using a container and an OO method for text, html or pdf (or check how SAP performs like in dialog DISPLAY_OTF)
Can you elaborate on your requirement more precisely ?
Regards,
Raymond