on 07-26-2011 7:16 AM
hi friends,
i have developed an classical alv with sales header data successfully.
here i want to develope an interactive report by click on sales order no i have to display item details.
can we create an interactive report in webdynpro.
if it is possible can you explain me....?
thanks in advance
regards,
karunakar
Hello Karunakar,
there are multiple ways of achieving this. but you need to clarify when you want to display the item details. do you want to display the item details once sales order is lead selected or do you want to dispplay the item details once the user clicks on the sales order no?
if yours is second case, then
1. you need to display the sales order number column as 'LinkToAction'
data lo_cmp_usage type ref to if_wd_component_usage.
data lo_interfacecontroller type ref to iwci_salv_wd_table .
data lv_value type ref to cl_salv_wd_config_table.
data: lr_col type ref to cl_salv_wd_column,
lr_colh type ref to cl_salv_wd_column_header,
lr_link1 type ref to cl_salv_wd_uie_link_to_action.
lo_cmp_usage = wd_this->wd_cpuse_alv( ). "ALV is the component usage name
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
lv_value = lo_interfacecontroller->get_model( ).
lr_col = lv_value->if_salv_wd_column_settings~get_column( 'A1' ). "A1 is the attribute name
create object lr_link1.
lr_link1->set_text_fieldname( 'A1' ). "A1 is the attribute name
lr_col->set_cell_editor( value = lr_link1 ).
2. in the methods tab create an event handler method and map it to the ON_CLICK event of the ALV
3. in the event handler method retrieve the value of the sales order number that is clicked
field-symbols <fv_sales_order_no> type string.
assign r_param->value->* to <fv_sales_order_no>.
4. now write your logic to populate the item details
hope this helps.
BR, Saravanan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karunakar,
To crate column with link to action.. first get taht column and create Link to Action..
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
DATA lv_value TYPE REF TO cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model( ).
data: lr_col type ref to cl_salv_wd_column,
lr_colH type ref to cl_salv_wd_column_header,
lr_link TYPE REF TO cl_salv_wd_uie_link_to_action. "Link to action type
CALL METHOD lv_value->if_salv_wd_column_settings~get_column
EXPORTING
id = 'VBELN'
receiving
value = lr_col.
CREATE OBJECT lr_link.
lr_link->set_text_fieldname( 'VBELN' ).
CALL METHOD lr_col->set_cell_editor
EXPORTING
value = lr_link.
Please follow this wiki
http://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproABAP-UsingUIelementsinALVcomponentcells
Cheers,
Kris.
hi saravanan,
in my previous thread
i hav developed areport in a ui table
but now i am developed a report in alv table,
in that table after selection of sales order number i want to display item details.
can you explai clearly what method i have to create with reference i.e onclick
can you explain clearly..
thanks in advance,
karunakar
Hello Karunakar,
No Problem. we will definitely help you. I would like to get some few clarifications from you
1. have you already created the second view to display the item details. If so then let me know whether you have already created the navigation link for the same
2. have to already written the logic to populate the ITEM details context node based on the Sales Order number?
3. have you already incorporated the ALV for the Customer node? if yes provide me the ALV usage name
I can help you with the exact code once you provide me this information.
BR, Saravanan
hi saravanan,
i hav created second view with view container
in view container i had mapped alv2 component.
i created inboun,outbound plugs for views as out1to2,in2from1
in display button of the first view only i write link to action code then vbeln display the action .
i am display data in 1st view here
my requirement is after click on vbeln i want to go to second view.
in second view i have to display item details
i didn't write any code in second view for item data.
now can u explai clearly how i get item data in second view...?
regards,
karunakar
Hi Karuna,
Onclick event
field-SYMBOLS: <Value> TYPE ANY .
ASSIGN r_param->value->* to <value>.
wd_this->fire_main_out_plg(
vbeln = <value> " zitmnum
).
then u want to write code in Handlein(secondview)
pass the paramter of outboundplug parameter (vbeln)
and write the query to fetch the item details
Regards
Kishore
Hello Karunakar,
Still I'm not clear with your requirement. What I understood is that in the First View you are having a set of select options fields and a Display button. On clicking on the Display button you are displaying the Customer Data in ALV. In this ALV you want the VBELN to displayed as LinkToAction. And when user clicks on the VBELN, then you want to navigate to second view and display ITEM details in ALV2. Is this correct?
If my understanding is correct then do the following. If not kindly provide exact requirement.
1. I assume you have already integrated the ALV in the First view and displaying the Customer DAta
2. Now what you need to do is to convert the column VBELN(Sales Document) to LinkToAction. in the INIT method of the first view, write the following code to convert the VBELN column to LinkToAction
data lo_cmp_usage type ref to if_wd_component_usage.
data lo_interfacecontroller type ref to iwci_salv_wd_table .
data lv_value type ref to cl_salv_wd_config_table.
data: lr_col type ref to cl_salv_wd_column,
lr_colh type ref to cl_salv_wd_column_header,
lr_link1 type ref to cl_salv_wd_uie_link_to_action.
lo_cmp_usage = wd_this->wd_cpuse_alv( ). "ALV is the component usage name
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
lv_value = lo_interfacecontroller->get_model( ).
lr_col = lv_value->if_salv_wd_column_settings~get_column( 'VBELN' ). "'VBELN is the attribute name
create object lr_link1.
lr_link1->set_text_fieldname( ''VBELN' ). "'VBELN is the attribute name
lr_col->set_cell_editor( value = lr_link1 ).
3. In the Component, create the context node for ITEM Details
4. Create a method in Component Controller, say "populate_item_details" with VBELN as the input parameter. In this method write your logic to populate the ITEM details context based on the VBELN data
5. now you need to capture the ON_CLICK event of the ALV in the First View. For this you need to create a method in "Methods' tab of First view and the "Method type" should be "Event handler". for this method, in the "Event" and "Controller" columns, select ON_CLICK event of the 'ALV' Component.
6. In the event handler method, write the following code to get the VBELN data on which the user did the mouse click
field-symbols <fv_vbeln> type vbeln.
assign r_param->value->* to <fv_vbeln>.
7. In the same method, call WD_COMP_CONTROLLER->POPULATE_ITEM_DETAILS( <fv_vbeln> ). after that fire the outbound plug "out1to2" to navigate to the second view.
8. in the second view, embed the ALV2, and map the ITEM details context node to it (via the comp usage)
hope this helps
BR, Saravanan
yes saravanan,
what you understand is correct.
but i need some clarifications
1.whenever we are goining to give VBELN as onclick column
after click on display button only i am getting the data in alv,
so i am writing these logic in ONACTIONDISPLAY method
i am getting vbeln as onclick event now....
2.i have already created a node for item details
3.i have to create a event handler method for compaonent controller ....with what reference and what coding i hav to write?
4.i am already getting VBELN as onclick event now...
i have to create event handler method in first view with what reference..?
thanks,
karunakar
> 1.whenever we are goining to give VBELN as onclick column
> after click on display button only i am getting the data in alv,
> so i am writing these logic in ONACTIONDISPLAY method
> i am getting vbeln as onclick event now....
There is a difference here. First we need to inform the ALV component that VBELN column is a LinkToAction column. its like defining metadata for the column. So its prefered to write logic ot changing the ALV's VBELN column to LinkToAction in First View's INIT method. And you are populating the data for VBELN in ONACTIONDISPLAY which is perfect. If you are getting the expected the result then leave it as it is.
> 2.i have already created a node for item details
this is also perfect. hope you have defined this context in Component.
Now in the Customer ALV table, if the user clicks on the Sales Document number, then we need to know the data on which the user clicked right. For this you need to follow the step 5,6 which I mentioned in my previous memo.
then you need to follow the step 4. This for populating the ITEM_DETAILS node based on the VBELN(Sales Document number) on which the user clicked. you should probably write a SELECT statement to fetch the item_details. You need create a normal method in the Component Controller with VBELN as the importing parameter.
After that you need to follow step 7 and 8.
hope this clarifies.
BR, Saravanan
thanks saravanan,
i got the item data in second view
i hav create an method in component controller
and place the coding as below
DATA lo_nd_vbap TYPE REF TO if_wd_context_node.
lo_nd_vbap = wd_context->get_child_node( name = wd_this->wdctx_vbap ).
data: it_vbap TYPE TABLE OF vbap.
SELECT * from vbap into TABLE it_vbap.
lo_nd_vbap->bind_table( it_vbap ).
but when ever i am calling the method in onclick event i got the error
populate_item_details doesn't have parameters
and i place coding in onclick event as
field-symbols <fv_vbeln> type vbeln.
assign r_param->value->* to <fv_vbeln>.
WD_COMP_CONTROLLER->POPULATE_ITEM_DETAILS( <fv_vbeln> ).
wd_this->fire_out1to2_plg( ).
can you explai clearly ...?
thanks,
karunakar
in the POPULATE_ITEM_DETAILS method, define an importing parameter lv_VBELN type VBELN and change your coding like this
DATA lo_nd_vbap TYPE REF TO if_wd_context_node.
lo_nd_vbap = wd_context->get_child_node( name = wd_this->wdctx_vbap ).
data: it_vbap TYPE TABLE OF vbap.
SELECT * from vbap into TABLE it_vbap where vbeln = lv_vbeln.
lo_nd_vbap->bind_table( it_vbap ).
hi saravanan,
i hav defined lv_vbeln type vbeln as importing parameter
but i am facing an error
lv_vbeln canot be a table , reference.a string or contain any of these objects
and when i am going to the onclick method
i am finding the error
<fv_vbeln> is not type compatible with formal parameter lv_vbeln
these are the syntax errors.
thanks
karunakar
hi saravanan
i am created a onclick method with properties of event and controller as
on_click ,interface controller of alv
in onclick event handler method i write the following coding
field-symbols: <fv_vbeln> type vbeln.
assign r_param->value->* to <fv_vbeln>.
WD_COMP_CONTROLLER->POPULATE_ITEM_DETAILS( <fv_vbeln> ).
wd_this->fire_out1to2_plg( ).
here i am getting the error as
<fv_vbeln> is not type compatible with formal parameter "lv_vbeln"
Hello Karunakar,
I didnt understand how it can incompatible if you have defined the importing parameter in POPULATE_ITEM_DETAILS of same type?
Hope you have defined the importing paramter in POPULATE_ITEM_DETAILS method like the folllowing in the paramter definition section
PARAMATER = LV_VBELN
TYPE = IMPORTING
REFTO = unchecked
opt = unchecked
Associated Type = VBELN.
if you have defined like this then ideally you should not get this error.
BR, Saravanan
Hi Karuna,
Try this, field symbol: <fs_vbeln> type any.
ASSIGN r_param->value->* to <fs_vbeln>.
lo_componentcontroller->lv_vbeln = <fs_vbeln>.
and in second view directly use component
controller attribute in where condition to fetch the Item details.
Kishore.
Edited by: kishore venkat on Jul 27, 2011 3:08 PM
Hello Karunakar,
I'm glad to hear that its working. Displaying the data in the popup is very simple
1. First create a new Window by name ITEM_WINDOW
2. in the Window tab of the Window controller embed the Second view. this can be achieved by Right clicking on the ITEM_WINDOW and selecting hte option Embed view
3. in the On_click method instead of firing the out bound plug, write the code to create the popup window
data lo_window_manager type ref to if_wd_window_manager.
data lo_api_component type ref to if_wd_component.
data lo_window type ref to if_wd_window.
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window = lo_window_manager->create_window(
window_name = 'ITEM_WINDOW'
* title =
* close_in_any_case = abap_true
message_display_mode = if_wd_window=>co_msg_display_mode_selected
* close_button = abap_true
button_kind = if_wd_window=>co_buttons_ok
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_ok
).
lo_window->open( ).
BR, Saravanan.
P.S. Pls dont club two issues in one thread. This is against the forum rules.
hi,
Just click this link , your requirement exactly matches this pdf.
This is the best pdf for interactive alv report with click event using hotspot.
Thanks
Hi Karuna,
In Onclick Event If_salv_wd_table_click attribute Value. Eg: assign re_param->value->* to (field symbol).
Attribute Value capture the clicked Salesoreder no.
then fire the outbound plug and capture the selected value.
Regards
Kishore
Edited by: kishore venkat on Jul 26, 2011 12:29 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karunakar,
Yes you can display item details..
follow this example..
http://www.sapdev.co.uk/sap-webapps/sap-webdynpro/wdp-alv.htm
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes karunkar,
Its possible . In first alv table, you can use ONCLICK event or on leadselect event to generate new interactive table.
here you have to use one more alv component , just same as first alv.
In onclick event method, write the code to generate the data and bind the same to the node, which you have to bind to the data node of 2nd alv.
Regards
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
CHECK THIS
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/7020c76f-c40e-2e10-a795-d88e67740ee4
Regards
Srinivas
Edited by: sanasrinivas on Jul 26, 2011 8:33 AM
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.