cancel
Showing results for 
Search instead for 
Did you mean: 

Context mapping

Former Member
0 Kudos

Hi Experts,

I have 2 input parameters, first one is a drop down selection (context element is Value attribute, because these parameters are simple Type coming from Java Dirctionay), Second one is input field(context element is model attribute).

I have to pass these 2 parameters as Inputs to BAPI.

Customer controller has model attributes of these 2 parameters, how to map?.

Please guide me.

Thank you,

Accepted Solutions (0)

Answers (4)

Answers (4)

nikhil_bose
Active Contributor
0 Kudos

You can get both values from currentContexts

e.g:

Root

|-Model (model node)

|- -Table (sub node)

| contrylist (attribute)

onAction()


wdContext.currentTable().getID();
// give you current model value
wdContext.currentContext().getContrylist();
// give you selected drop down value

you can set it to the other BAPI provided you need to create one element of the BAPI and add to the corresponding node and the data type of BAPI input are same ( anyway you can type cast that)

nikhiL

Former Member
0 Kudos

Hello Jai,

You just need to create an exact type of the context elements of model in view and assign values to it.

Eg:

wdContext.currentModelNode.setInputValElement( wdContext.currentContextElement().getSimpleTypeElement());

Remember that you have to map the context elements of model from both view context and controller context.

Regards

Vinod V

Former Member
0 Kudos

Hi,

As per i know,You cannot map the attibutes to Input parameters.U can only set the values to RFC.

1.Get the DD value:

wdContext.currentY_Y_YElement().modelObject().setValueDD("XXX");

("XXX" = wdContext.currentContextElement().getDDValuew());

2.Get the IFld from the context and set it to BAPI.

wdContext.currentX_X_XElement().modelObject().setValueIField("YYY");

("YYY" = get the valeu from the model attribute)

Regards,

LG

Edited by: Lavanya Goriga on Apr 25, 2008 6:38 AM

former_member197348
Active Contributor
0 Kudos

Hi Jai,

You can only map model attribute to model attribute but you can not map model attribute to value attribute or vice versa. In this case you need to set the model attribute using setter methods.

So in your case, try this:

Create 2 model attributes and map them to custom controller's attributes using data modeler wizard (double click on your wd component).

For input field, directly bind this model attribute.

For dropdown, you are using value attribute, so just set the model attribute like this:

wdContext.current<bapi_input>Element().set<dropdownmodel;>(
wdContext.currentContextElement().get<dropdownvalueattr>());

reagrds,

Siva

Former Member
0 Kudos

Thank you all,

Please let me know whether I have to create the Value attributes for both view and custom controller contexts or model attributes.

1) If I create a model attributes for both, how can I pull the Java dictionary values(Simple types) to dropdown box?.

2) If I create value attributes for both view controller and custom controller.how to map & pass the values to BAPI?.

I will assign the points...

Former Member
0 Kudos

Hey Jai Is the BAPI accepting the 2 values which you want to pass to the bapi ( can we pass the parameters as import parameters..in the bapi ).If so then Import the BAPI and Set the values of the import parameters of the BAPI ( Which are available under the XXX_Input() structure of the model object )by capturing the values of the attributes from the Dropdown and the modal attribute with the getter methods.If you are unable to set values with Import parameter then type cast the or make use of the wrapper classes and Set the values( This is because if the BAPI import parameters data type may be different with attributes of the one you want to pass to the BAPI )

nikhil_bose
Active Contributor
0 Kudos

1) If I create a model attributes for both, how can I pull the Java dictionary values(Simple types) to dropdown box?.

static:

If your values are coming from dictionary, use value attribute of dictionary type.

OR

dynamic:

you can get ModifiableSimpleType for your attribute created and put values.

2) If I create value attributes for both view controller and custom controller.how to map & pass the values to BAPI?.

According to your BAPI input parameter type, you type cast the value attribute when assigning to BAPI input.

You can use wrapper classes to cast as you need.

Or you create dictionary type after importing the model so that you can create dictionary type of BAPI parameter type.

Hope you understood

nikhiL