on 10-21-2009 5:04 AM
Hi Experts,
I need to pass data from View1 to View2. Scenario is as follows:-
On Click of a line in VIEW1 i am getting a SAP Material No, based on which i am selecting data from 4 SAP master tables. That data will be displayed in display mode in my next view VIEW2 which has fields(in context & layout) to display data (Display/ Change scenario).
There may be a case where i have to get data from 4 ztables which will be displayed in VIEW2 (create scenario)
My Question is where (in which view V1 or V2) i have to right the select query to get data based on customer. and how can i display it in my View2.
Regards,
Nik
hi,
If you want to transfer data from one view to another use this approach :
1. Create an Attribute in Component controller.
2. Pass the value of Material no to this attribute of component controller.
data lv type string.
wd_comp_controller->Att = lv.
<Here Lv has your value which needs to be passed to second view.>
3. Now you can access the Attribute Att of componnent controller in View2 using :
data lv2 type string.
lv2 = wd_comp_controller->Att.
4. So , you get the value of variable lv in View1 to lv2 in View2. This is the way to transfer data between two views.
For your case, you can either pass the Value of Material no to View2 and based on this write select query in View2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Saurav.
In case of display existing material data its fine i will pass that mat_no to view2 and there in WDINIT i will right the select query to get the data in a structure. Now how to display that data in V2.
but what in case of create where i have data in different ztables (which can also require changes) where do i have to right the code, in the same WDINIT with conditions like if its change then do select from MARA etc else if its create then do select from z tables. This is a saparate ALV table where i click to get the internal material No. based on which selection is frm z tables.
Regards,
Nik
Now how to display that data in V2
You have written the query in View2 based on Material no, it depends whether on your requriemnt how you want to display the data.
You can display the data in a Table.
Create a Table UI -> Bind it with Node of same attributes as in internal table(Select query).
finally display data fetched in internal table to this Table UI.
Please explain your scenario on Change/Create then i would be able to help you out.
Yes you can have conditions in Wddoinit and based on the create/change write the code.
Edited by: Saurav Mago on Oct 21, 2009 10:23 AM
hi Saurav,
I have 2 components Comp1 & comp 2. Comp1 displayes list of maretials in View VM (with internal Numbers) to be created in SAP. On Click of a line, it opens COMP2 V3(for Dsiplay) in V3 we have so many input fields in display mode which shows the material data like plant, storage loc, etc etc.in different tabs as in MM03.
In comp 2 i have create change & display views (u say it V1 V2 V3). layout is same just a difference of edit nd display mode.
It also gives a list of existing SAP materials which needs some changes. On Click of a line it opens V2 of COMP2 (for change). or u can also say it call V3 of COMP2 in edit mode. Whihc will display that materials related data for changes in edit mode.
Hope i explained the business requirement.
Regards,
Nik
I would suggest you to use Component controller for this.
1. Have all the values selected in the node and use this node for all the views v1 , v2 and v3.
2. Now when you are in V1 and you want to change your entries then on the click of line in table, make an action on Lead Selection.
3. Get the lead selected values and pass it to another view V2.
4. Bind all the attribute's Read Only with wdy_boolean so as to make them read only at runtime.
U can send data with view's inbound plug. U have to define same data at outbound plug too. After that when u connect this plugs.. Data flows between this views.
Add a attribute name "Xyz type string" to outbound plug of view.
add a attribute same name "Xyz type string" to inbound plug of view.
link this views at window perspective.
When u fire the outbound plug with attribute,
u can access ur data at inbound plug's method..
İf u can't see name of attrribute, Add "Xyz type string" parameter to method..
Now i cant connect any netveawer system. Maybe inbound plug doesnt have a a parameter, add ur parameter to inbound plug's method..
Good luck
Volkan Bekci
Edited by: Volkan Bekçi on Oct 21, 2009 9:24 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Nikhil ,
whenever u need to pass data between two views , u can make use of the component controller .
the context attributes created in the component controller and thus data , is accessible across all the vews of the componenent
so in ur case u proceeed as folllow :
1 create all the context atttributes in ur componenet controller , under a suitable node
2 map ur context attributes to views , from ur component controller
3 create a attribute say attr1 under the attributes tab , in ur component controller
4 u fetch ur material no ( say matnr ) in ur first view
5 using wd_comp_controller , u assign value to attr1
wd_Comp_controller->attr1 = matnr
6 in ur second view , u can access the same material no , using set_attribute method
7 suppose u have a context attribute ca_gddb under node cn_gddb and u want to set it to matnr , u can procced like this
in ur second view
DATA : lv_matnr type string.
lv_matnr = wd_Comp_controller->attr1.
DATA lo_nd_cn_gddb TYPE REF TO if_wd_context_node.
DATA lo_el_cn_gddb TYPE REF TO if_wd_context_element.
DATA ls_cn_gddb TYPE wd_this->element_cn_gddb.
DATA lv_ca_gddb LIKE ls_cn_gddb-ca_gddb.
* navigate from <CONTEXT> to <CN_GDDB> via lead selection
lo_nd_cn_gddb = wd_context->get_child_node( name = wd_this->wdctx_cn_gddb ).
* get element via lead selection
lo_el_cn_gddb = lo_nd_cn_gddb->get_element( ).
* set single attribute
lo_el_cn_gddb->set_attribute(
EXPORTING
name = `CA_GDDB`
value = lv_matnr).
if u r new to WD ABAP , u may like to see this :
http://help.sap.com/saphelp_nw2004s/helpdata/en/03/0048413e466e24e10000000a155106/content.htm
Main Topic Page:
http://sdn.sap.com/irj/sdn/nw-wdabap#section2
Tutorials for Beginners:
eLearning Videos:
/people/thomas.jung/blog/2006/06/20/web-dynpro-abap-demonstration-videos
regards,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.