Dynamic context mapping
Hello,
Is it possible to create dynamic mapping between contexts of view and e.g. custom controller at runtime? If it is possible, so how. I have not found any documentation about this.
Thanks a lot for answers!
With best regards
Michael Belenki
Hi,
The problem is not getting solved.Am getting an error while trying to dynamically map a node in the view controller from the component controller in ABAP.
I have a node
Const_data(node)
|_
Value(attribute)
and it has an attribute 'value' .Both are created dynamically.
Now when I try to map this context in the view controller.I use the following code.
map_path = 'COMPONENTCONTROLLER.CONST_DATA.VALUE'.
insert map_path into table path_mapping_table.
struct_mapping_info-CONTROLLER = 'COMPONENTCONTROLLER'.
struct_mapping_info-PATH = path_mapping_table.
const_dat_info =
context_root-ADD_NEW_MAPPED_CHILD_NODE
( CHILD_NAME = 'CONST_DATA'
IS_STATIC = abap_false MAPPING_INFO = struct_mapping_info) .
Now when I try to get the value of attribute "value".
I get an error message :
Attribute COMPONENTCONTROLLER.1.VALUE could not be found
Since I am not trying an external mapping I dont think I need set_mapping_complete method.
Similar Messages
-
Dynamic Context Mapping in Web Dynpro ABAP
Hi Experts,
How can I create two dynamic Context nodes, one in ViewController and the other in Component Controller and finally create a context mapping between them?
Regards,
Johan Kriek.Hi Johan,
I found a method IF_WD_CONTEXT_NODE_INFO~ADD_NEW_MAPPED_CHILD_NODE that seems to be the one that I am looking for.
I do have same idea but i have been trying to give solution by using above method,unfortunately here my server is down.check the below code. i didnt check this code due to server down.
DATA: lo_nd_purchase_header TYPE REF TO if_wd_context_node,
lo_el_purchase_header TYPE REF TO if_wd_context_element,
ls_purchase_header TYPE wd_this->element_purchase_header,
lo_node_info type ref to if_wd_context_node_info,
lo_child_node_info type ref to if_wd_context_node_info,
MAPPING_INFO type WDR_CONTEXT_MAPPING_INFO.
* navigate from <CONTEXT> to <PURCHASE_HEADER> via lead selection
lo_nd_purchase_header = wd_context->get_child_node( name = wd_this->wdctx_purchase_header ).
CALL METHOD LO_ND_PURCHSE_HEADER->GET_NODE_INFO
RECEIVING
NODE_INFO = lo_node_info.
MAPPING_INFO-controller = 'ZWDC_ALV'. "conponent name
MAPPING_INFO-path = 'PURCHASE_HEADER'. "Controller context node name
CALL METHOD LO_NODE_INFO->ADD_NEW_MAPPED_CHILD_NODE
EXPORTING
CHILD_NAME = 'PURCHASE_HEADER'
MAPPING_INFO = MAPPING_INFO
* IS_STATIC = ABAP_TRUE
RECEIVING
CHILD_NODE_INFO = lo_child_node_info -
Dynamic reverse context mapping
hi,
can someone explain me how to use dynamic reverse context mapping in my web dynpro application?
I have read in other sdn-threads that in IF_WD_CONTEXT_NODE_INFO the methods ADD_NEW_MAPPED_CHILD_NODE and SET_MAPPING_COMPLETE might be the solution.
does anyone know where and how to use these methods? please explain me the priciple and which parameters I should use for example CONTEXT_PATH and MAPPED_CONTROLLER with the SET_MAPPING_COMPLETE method.Hi Thorsten,
I don't think you can acheive Dynamic Reverse Context Mapping using the above mentioned methods.
Please find the below scenario in which we can acheive Dynamic Reverse Context Mapping programatically.
The situation is, with in my WD component I created a context in the component controller dynamically or statically. Now I want to map this node to another node of a comonent at run time.
Here my WD component is the parent component and I am using a child component say SALV_WD_TABLE, which has a context DATA. Inorder to populate data in the ALV the DATA node must be supplied with the necessary contents either at run time or at design time.
The run tiime mapping is as follows.
DATA : lo_componentusage TYPW REF TO if_wd_component_usage,
lo_interfacecontroller TYPE REF TO IWCI_SALV_WD_TABLE.
lo_componentusage = wd_this->wd_cpuse_ref_salv( ).
if lo_componentusage ->HAS_ACTIVE_COMPONENT( ) is INITIAL.
CALL METHOD LO_COMPONENTUSAGE->CREATE_COMPONENT
endif.
lo_interfacecontroller = wd_this->wd_cpifc_ref_salv( ).
CALL METHOD lo_interfacecontroller ->SET_DATA
EXPORTING
R_NODE_DATA = lo_nd_flight_salv .
lo_nd_flight_salv is a reference to the node in your WD component which contains the data to be displayed.
Hope I could give you a clue...
Cheers,
Sankar -
Doing external context mapping *Dynamically*
Dear All,
Can anybody tell me how to do do external context mapping dynamically?
I have literally read thousands of documents/ blogs/ forum posts on external mapping. but not a single one is explaining DYNAMIC part of it properly.
If anybody has worked on this then please share your experiences with me.
Awaiting for helpful replies.
Thanks and regards,
Amey MogareHi
Check out this
http://help.sap.com/saphelp_nw2004s/helpdata/EN/67/cc744176cb127de10000000a155106/frameset.htm
Thanks -
How to implement Dynamic Context Node Mapping between Components
Hey genuis:
I am looking for how to implement context mapping bwteen two components. I read some threads, and try to use external context mapping. The example works fine. However, my requirement is more than that.
I have a context node in Component B, and the attributes in it are dynamically generated. Component A is the main component which use Component B's function. Both A and B work fine by theirselves.
When I assemble A and B (external mapping), the system gives me a exception:com.sap.tc.webdynpro.progmodel.context.ContextException: MappedNodeInfo(T8UploadCompInterface.data): cannot create nodes, no mapping defined yet.
Please give me some suggestion?
Any responses are appreciated.I miss this thread.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6fdae690-0201-0010-a580-d104b459cb44
This is almost the right solution for my problem. -
Dynamic component interface context mapping
Hi all,
I got 2 component A and B. Component A use component B.
I would like to know how to set interface context attribute value of comonent B within a view of component A in programatic mode.
It should be something like this:
wdThis.wdGetCompBInterface().wdGetContext.setAttr1("OK");
is it possible???
thank u in advance,
StefanoHi
In your query consider B has BA Context which you want to fill from main componetn A
Yes it is possible to add values from A to B but I did it only through context mapping instead of direct refrence of interface controller .
For that you need to do context mapping .
1) Add B into A as used Web dynpro component .
2) Add controller refrence in Component controller using properties of WDC.
3) Map the context element from Interface controller to Component controller
Set values of context of component controller which will set values for context
of A
4) Only issue here is if you want to refresh values frequently you might need to create and destroy component each time . Not sure about it . In my case I m intitalising all context of B in init of A itself.
Regards
Srushti -
Using Search Help with ALV and Dynamic context node
The topic subject already describes my situation.
I have to create, populate and remove context nodes at runtime, and bind them to an ALV, to let user display the data or modify the data. The nodes I create are always typed with a table name, but the table name is of course, dynamic.
This is all working: what's not working is help for entries inside the ALV; since the table has foreign keys and domains with check tables or fixed values, I expected that search helps were detected and managed by the framework.
Instead, no help search is displayed except the input help based on data-type of the one "Date" input fields.
I think I have to work on the dynamic node creation, and not on the ALV itself, since the latter only takes the node/attributes information, but i could be wrong. I tried with both the two following codings:
CALL METHOD lo_nd_info_root->add_new_child_node
EXPORTING
static_element_type = vs_tabname
name = 'SAMPLE_NODE_NAME'
* is_mandatory = abap_false
* is_mandatory_selection = abap_false
is_multiple = abap_true
is_multiple_selection = abap_false
* is_singleton = abap_false
is_initialize_lead_selection = abap_false
is_static = abap_false
RECEIVING
child_node_info = lo_nd_info_data .
cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = lo_nd_info_root
node_name = 'SAMPLE_NODE_NAME'
structure_name = vs_tabname
is_multiple = abap_true ).
The result is the same...is there any way to let the ALV know what search helps it has to use, and doesn't force me to manually build a VALUE_SET to be bound on the single attributes? There are many tables, with many fields, and maintaining this solution would be very costly.I have checked with method GET_ATTRIBUTE_VALUEHELP_TYPE of interface IF_WD_CONTEXT_NODE_INFO, on an attribute which i know to have a search help (Foreign key of a check table).
The method returns 'N', that is the constant IF_WD_VALUE_HELP_HANDLER~CO_VH_TYPE_NO_HELP. So, the framework was not able to find a suitable search help.
Using method GET_ATTRIBUTE_VALUE_HELP of the same interface, on the same attribute, returns me '111', which is constant C_VALUE_HELP_MODE-AUTOMATIC.
Therefore, the WD framework knows it has to automatically detect a value help, but fails to find one.
Also, this means in my opinion that the ALV and the dynamic external mapping are not the culprits: since node creation, no help is detected for any attribute but the date. Honestly, I don't have a clue on what's happening. -
hi,
can u plz explain about Dynamic value mapping and where it actually use this
thanks
gunaHi ,
Dynamic value mapping.is nothing but
It is FixValues and ValueMapping under Conversion Functions.
Eg:
You need such a requirement. Where the values in the source are mapped to someother value in the target as below.
1--> Mr
2--> MS
3--> MRS
FixValues is used when you know the entire set of Key value pair in the Design Time. You give the Key and the value in the FixValues and the mapping checks and maps the values to the target.
In the case of Value mapping, you maintain this Key - Value pair in the Integration Directory and thereby make changes easily and also use them in the Mapping in IR
Refer These blogs
ValueMapping using the Graphical Mapping Tool -value mapping using grapic mapping tool
Value Mapping replication - value mapping replication
Accessing Value Mapping defined in Directory using Java functions - accesing value mapping
Dynamic Date Conversion in Message Mapping - dynamic date conversion
Dynamic Configuration of Some Communication Channel Parameters using Message Mapping - dynamic confighuration
Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II - dynamic file name
and also
Refer this link
http://help.sap.com/saphelp_nw2004s/helpdata/en/d7/e551cf896c3a49bb87bb4ce38c99c8/frameset.htm - external context mapping
Regards,
Suryanarayana -
To access a dynamic context node defined in a Used Component
Hi Gurus,
I need your help with something.
I have a dynamic context node in ComponentA. I want it in Component B too.
Component B uses Component A, but I am not able to get access to the context node.
Is it possible to do this? Any suggestions how to proceed.
PS: I am trying to do a dynamic mapping. The initial scenario was here, Set data into Model Node on Navigating from a View
Thanks in advance,
Anjana R.
Message was edited by:
Anjana RaghavHi Gurus,
Its working now. Earlier, the code was something like this....
IWDNodeInfo compNode = wdThis.wdGet<i>Comp</i>Interface().wdGetAPI().getContext().getRootNodeInfo().getChild(nodeNm);
viewNodeInfo.setMapping(compNode,true);
and was trying to map it using
iewNodeInfo.addMappedAttribute("order",".<i>Comp</i>."+ nodeNm + ".order");
Now, I am mapping like this.
viewNodeInfo.addMappedAttribute("order","order");
Thanks,
Anjana R. -
Hi Experts,
I have tried the given example for Dynamic Context Node in Webdynpro ABAP
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783
But getting the Error when executing this application
Note
The following error text was processed in the system ISP : Adapter error in &VIEW_ELEMENT_TYPE& "TABLENAME" of view "ZWD_SACHIN_DYN_ALV.MAIN_VIEW": Context binding of property VALUE cannot be resolved: Node MAIN_VIEW.1.INPUT does not contain any elements
The error occurred on the application server usirs254_ISP_01 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: RAISE_FOR of program CX_WDR_ADAPTER_EXCEPTION======CP
Method: RAISE_BINDING_EXCEPTION of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP
Method: GET_BOUND_ELEMENT of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP
Please resolve this issue because when I am mapping the Attribute TableName in the InputGroup, it is throwing above Error.
Thanks in advance
Regards
SachinHi Sachin,
I am unable to understand why you are getting an error. I have tried the same tutorial myself and it works fine for me. Make sure that the TABLENAME attribute (which is of string type) is properly binded to the value property of the input field.
Regards
Arjun
Edited by: Arjun Thakur on Mar 17, 2009 1:46 PM -
Set Data from a Dynamic Context in ALV
Hi,
I've created an dynamic context and have binded the data. When I want to show this data in an dynamicly table with the following code, it works well.
cl_wd_dynamic_tool=>create_table_from_node( EXPORTING ui_parent = lo_container
table_id = 'DYN_ML_TABLE'
node = lo_nd_dyn_ml
RECEIVING table = lo_table ).
Unfortunately when I want to show the context data in an ALV table with the method set_data I will see the structure, but the binded data are lost.
lo_comp_alv = wd_this->wd_cpuse_usage_alv_dyn_ml( ).
IF lo_comp_alv->has_active_component( ) IS INITIAL.
lo_comp_alv->create_component( ).
ENDIF.
lo_comp_if_alv = wd_this->wd_cpifc_usage_alv_dyn_ml( ).
lo_comp_if_alv->set_data( lo_nd_dyn_ml ).
I've tested an manually created context node with this method, and I will see the data.
Could anybody help me?
Best Regards,
SaschaI created the node with rtti. Now, it works:
"Beschreibung zu interner Tabelle lesen
lo_tab_descr ?= cl_abap_typedescr=>describe_by_data( it_matchlist ).
"Zeilentyp zu interner Tabelle ermitteln
lo_str_descr ?= lo_tab_descr->get_table_line_type( ).
"Komponente der Zeile ausgeben, welche für die Erstellung der Knotenattribute benötigt werden
lt_comp = lo_str_descr->get_components( ).
data: ls_component type cl_abap_structdescr=>component,
lr_type type ref to cl_abap_datadescr,
lt_components type cl_abap_structdescr=>component_table,
lr_structdescr type ref to cl_abap_structdescr.
"Loop über Komponente und Einfügen in Attributenliste
loop at lt_comp into ls_comp.
lv_abs_name = ls_comp-type->absolute_name.
"Folgende Zeichen werden entfernt: '/TYPE='
shift lv_abs_name left by 6 places.
lr_type ?= cl_abap_typedescr=>describe_by_name( p_name = lv_abs_name ).
ls_component-name = ls_comp-name.
ls_component-type = lr_type .
append ls_component to lt_components.
endloop.
"Strukturtyp anhand der definierten Kompententen der internen Tabelle erzeugen
lr_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
* "Neuen Kindknoten anlegen
lo_nd_dyn_info = lo_nd_root_info->add_new_child_node( name = wd_this->gd_matchlist_nd_name
is_mandatory = abap_false
is_mandatory_selection = abap_false
is_multiple = abap_true
is_multiple_selection = abap_false
is_singleton = abap_false
is_initialize_lead_selection = abap_true
* attributes = lt_attributes
is_static = abap_false
static_element_rtti = lr_structdescr
"supply_method =
"supply_object =
"dispose_method =
"dispose_object =
"static_element_type = -
Problem with context mapping and data flow in a FPM application
Hi All,
I am trying to develop an ESS application using FPM. For the same, the requirement is to see the history of an employee in the second view.
The first view has got just the overview information and the second one has got the detail. So, the records or the fields are the same on both the views.
As per the FPM guidelines, the Model is residing in the Fc component and the respective Vc components are using the model data accordingly.
I am executing the model in the Fc component calling the executable method in the interfaceController of the first view and then trying to display the output data of the BAPI in the first view which provides the overview information.This is working fine.
But when i am trying to map the same output node to the Table UI for the second view, the record size is coming zero and thus no information is available.
For the above issue, I am again executing the RFC in the InterfaceController of the second view to populate the records, which is incorrect as it is already executed and the data is available for the first view.
I request you to let me know the correct approach to Context mapping and data flow when using FPM-roadmap. Is their any standard method or approach available to deal with such requirements? Please let me know.
Thanks in advance.
Regards
DKHi Idhaya,
I model node is available in Fc and the Fc interface controller is being used in the first Vc and the second Vc.
So the idea is, as the executable method is generated in the Fc, so i have created a custom method to call the executable method in Fc, where the input parameter is getting passed and this custom method is finally getting called is the first Vc.
So , now my first Vc is ready to call the custom method in Fc and execute the RFC. Once the RFC is executed, the nodes in the Fc should get populated which is the ideal case.
And as the Fc is used as a component in the second Vc, the same node is available to the UI elements.
But, when I check the record size for the output node, it is always zero, for the second Vc.
Regards
DK -
Error creating dynamic context node in Webdynpro for ABAP. Plesae help!
Hi
I am getting the following error while creating a dynamic context node with 2 attributes. Please help me resolve this problem.
Note
The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
My code is like the following:
TYPES: BEGIN OF t_type,
CARRID TYPE sflight-carrid,
CONNID TYPE sflight-connid,
END OF t_type.
Data: i_struc type table of t_type,
dyn_node type ref to if_wd_context_node,
rootnode_info type ref to if_wd_context_node_info,
i_node_att type wdr_context_attr_info_map,
wa_node_att type line of wdr_context_attr_info_map.
wa_node_att-name = 'CARRID'.
wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
insert wa_node_att into table i_node_att.
wa_node_att-name = 'CONNID'.
wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
insert wa_node_att into table i_node_att.
clear i_struc. refresh i_struc.
select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
rootnode_info = wd_context->get_node_info( ).
rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
attributes = i_node_att
is_multiple = abap_true ).
dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
dyn_node->bind_table( i_struc ).
l_ref_interfacecontroller->set_data( dyn_node ).
I am trying to create a new node. That is
CONTEXT
- DYNFLIGHT
CARRID
CONNID
As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
Also I cannot define the structure in the ABAP dictionary because it changes based on conditionOk, I think I found a bug... It seems for adobe forms in WD4A, the root context node must be 1-1 and you must nest the 1-n node within that... Not sure why, but it worked. So in my case my context would look like this:
FOO_NODE (1-1)
Widget (1-N)
-Widget_info (1-1)
*Name
*Sku
*Description
-Widget_plant (1-M)
*Plant_Code
*Plant_State
*Plant_City
-Widget_pic (1-1)
*Picture -
Hi,
I am having two components.
Comp A is main componenet and Comp B is Used component and using in Comp A.
Intially I am getting the data from the Comp A ( main Comp) to Comp B(used Comp) by context mapping.
it is working fine.
The same way I need in Reverse. From Comp B (Used Comp) to Comp A (Main Comp) i have to get the data .
how to do context mapping for this.
pl help.
Thanks in Advance.
KarHi,
To achieve reverse (external) context mapping, the attribute 'Input Element' in interface node of component B has to be marked. When you declare a component usage of component B in your component A, you will see the interface node under Component Usages->Interface Controllers (in your navigation tree). You can define the mapping here, between the 'Input element' node of component B and the component controller Node in comp A by right click->Define external context mapping.
Have a look at the [documentation |http://help.sap.com/saphelp_nw04s/helpdata/en/67/cc744176cb127de10000000a155106/frameset.htm] in detail.
You can have a look at the ALV component SALV_WD_TABLE, which uses external context mapping to render the ALV in any component using this component. This will give you a good idea.
Regards,
Nithya -
Context mapping problem in FPM
Hi all,
here is a samll example where i am going to display the Attributes from the SELECT perspective to the REVIEW perspective. where the Values from the SELECT View is To be Displayed in the Review view.
my Compnents are like..
cctest
FcTest
Vcfirst
VcNext
VcNavi
everything is working fine i am able to get RoadMap.
i have done mapping b/w the components as...
|ComponentController| -- | interFace Controller
CcTest -
FcTest -
FcTest IC
Vcfirst FcNavigation IC,FctestIC Vcfirst IC
VcNext FcNavigation IC,FctestIC VcNext IC
VcNavi -
FcNavi
i have one attribute in VcFirst Perspective ... i am not able to get that value in the VcNext perspective ...Hallo Bunny,
are you sure that both of your visual UI components VcNext and VcNavi point to the same instance of faceless component FcNavigation at runtime?
Read more on the reason in this forum thread: Re: Why Context Mapping is always null for my embeded view?
Regards, Bertram
Maybe you are looking for
-
i added a validator in the form when am running i got this error Mar 1, 2004 5:04:01 PM org.apache.commons.validator.ValidatorUtil getValueAsStri ng SEVERE: Unknown property 'username' java.lang.NoSuchMethodException: Unknown property 'username' at o
-
Error: 130200 upon updating Acrobat 9.0 Pro
Hi all, Acrobat 9.0 Pro keeps telling me that there is an update available. When trying to install the update there is an error message appearing: (translated from german): screenshot see below "Update Error An error has occured. Please try again to
-
Problem in formatting of long text -- line break not recognized.
Hi , We have a PO smartform in our SRM system and we are facing problem with formatting of long text on the smartform for long texts maintained for the PO. for ex, we maintain the long text as -- "this is long text for item 1. 1. this is line 1. 2. t
-
Numerous trace files are generating every minute causing space issue
Hi All, numerous trace files are generating every minute <SID>_<PID>_APPSPERF01.trc format. entry in trace file will be like.. EXEC #10:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=1734896627,tim=1339571764486430 WAIT #10: nam='SQL*Net message to
-
When viewing a document my screen goes dim after 2-3 minuetes if I don't touch anything. I'd like it to stay lit for 10-15 minuetes if possible.