cancel
Showing results for 
Search instead for 
Did you mean: 

Binding Model with UI Element drives me crazy

Former Member
0 Kudos

I created a Webdynpro application with a model used a Bapi in SAP. I bind the model with my 2 views, controller. But When I deployed my application, The first input field Pernr is enabled to write but not the other fields, it is not possible to write inside ! But configuration of UI Elements is OK.Well I don't know where to find ! Model ? Controller ?

My BAPI is BAPI_TRIP_CREATE_FROM_DATA on 4.6C.

Well, thanks for your help !

Cheers

Aurel'

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello,

I assume that you cannot i/e enter the data for RECEIPTS, ADDINFO, ADVANCE and other data structures for that BAPI.

If so, this is because these are R/3 Table structures, which are initially empty. In WebDynpro model those are available as separate context nodes with no elements initially. If there is no element accesible the input field which is bound to the element is "blanked out" and cannot be edited. Why - because there is no place that the entered data would go.

If you would like to add a Receipt to your trip in WD, you would first have to add an empty Receipt element to proper node - for example:

Bapitrvrec receiptRec = new Bapitrvrec();
IReceiptsElement recEl = wdContext.nodeReceipts().createReceiptsElement(receiptRec);
wdContext.nodeReceipts().addElement(recEl);

The code above could be entered for example in wdDoInit() method of the controller.

Hope this helps. In your case the example code might not work just after Copy/Paste. Try then to reorganize imports (CtrlShiftO) and consider context nodes names.

--

regards

Marcin

Former Member
0 Kudos

Hi Henry

Could you post the BAPI structure and let me know how you mapped the structure?

Kishore

Former Member
0 Kudos

Hi

In the BAPI that you use the field PERNR is not a structure. The remaining import parameters in the BAPI are structures.

I guess you have bound the import parameters directly to input fields. If your cardinality is 0..n or 1..n then you will have that problem when you try to bind to a input field.

Do the following.

Lets say we want to read the data from screen and populate the data structure "BAPITRMAIN"

Lets use these 2 attributes of the structure namely

1. "DEP_DATE" and

2. "DEP_TIME"

Create local value attributes for say "DEP_DATE" and "DEP_TIME"

Map these 2 local attributes to a input field ui element.

Then in your event read the values of the 2 attributes

For eg

String depdate = wdContext.currentContextElement().getDEP_DATE();
String deptime = wdContext.currentContextElement().getDEP_TIME();

Now for passing values to the structure "BAPITRMAIN"

write code like

BAPI_TRIP_CREATE_FROM_DATA_INPUT inp = new BAPI_TRIP_CREATE_FROM_DATA_INPUT();
wdContext.currentBAPI_TRIP_CREATE_FROM_DATA_INPUT().bind(inp);

BAPITRMAIN minp = new BAPITRMAIN();
minp.setDEP_DATE(depdate);
minp.setDEP_TIME(deptime);
inp.setsetFramedata(minp);
try
{
  wdContext.currentBAPI_TRIP_CREATE_FROM_DATA_INPUT().modelObject().execute();
}
catch(Exception e)
{
  //Some exception
}

Check for the syntax :). Just a approximation of what you need to do.

Hope that helps you. If this doesnt really answer your scenario let me know you scenario in more detail and i will be able to help you out in detail.

regards

ravi