cancel
Showing results for 
Search instead for 
Did you mean: 

Webdynpro component to view,view to controller,controller to model mapping

kiran_jakkaraju
Contributor
0 Kudos

HI

I am developing an enhancement for my project.

Here I am using a table in webdynpro. Already few fields are there, I have added 2 columns (header and text input).

I need to retrieve info form read_bapi, i created a model, maped to controller, controller to view, in view, in the table, created the fields and mapped field value to the view's model attribute.

Now for saving I am using save_bapi, i mapped same way from model ->controller->view, but view to table fields I have not mapped. Because already for the read I mapped the values. How can I map now?

But earlier, the developer taken value attributes.

I do not understand how they maped for saving using the model/value attribut from the GUI(table) text field ->view ->controller->model.

Please guide me.

-Kiran

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Create a dummy node that needs to be binded to UI.

When you enter values on UI ,copy the values from dummy node to both the Input models at runtime manually by writing the code.

Regards

Akshaya

kiran_jakkaraju
Contributor
0 Kudos

Hi Thanks a lot,

my question is , how can we do both

The "value attributes" created and mapped with UI's textfield's value.

Read_BAPI & Save_BAPI has "node attributes" in view & mapped to controller then controller to Model.

But, how this value attributes are mapped with View's node attributes of the BAPI?

I can add value attributes for new fields but how can I map them to the view's node attributes? And also the value attributes has to be mapped for both Read_BAPI and Save_BAPI for read and saving the data at the same time.

Can you please provide me some code example? with screenshots of the mapping ....it will help a lot.

Thanks in advance

Message was edited by:

kiran jakkaraju

Former Member
0 Kudos

Hi,

For mapping, if the model node comes in View, then it is fine. U wil not map value attribute and model node attribute. Instead u get and set value from them. When reading from Bapi, u have the model node attributes. So u will get value from the required node and set it to the value attribute. Say your value attribute is Va_Name. U want to read data from Bapi for this name, then, u can give

String stName = wdContext.currentContextElement().getVa_Name();	
wdThis.wdGetCO_GenerateNameappController().getDataInfm(stName);

This getDataInfm() is method in controller which executes a bapi which takes stName as input. So after execution, u can find response data in model node.

For saving with Bapi, similarly, u can use the similar code and execute the other Bapi. This name will be passed as input to the Bapi which will update some table in r3. Here setDataInfm() is written in controller for Saving some data using Bapi.

String stName = wdContext.currentContextElement().getVa_Name();	
wdThis.wdGetCO_GenerateNameappController().setDataInfm(stName);

Regards,

Harini S

Former Member
0 Kudos

Hi,

Saving something in R3 using BAPI works in same way like reading BAPI. The point is when u execute it, the BAPI will read/save data depending on its source code. So it doesn't matter with mapping in the reverse direction. U have done mapping for read-bapi. Similarly, mapping is same for save-bapi. U need not map between view-controller again if same attributes can be used. Now before executing the save-bapi, u will set the input paramters to be saved. Set it from the context variables to the Model context. If u execute, that should work fine.

Regards,

Harini S