cancel
Showing results for 
Search instead for 
Did you mean: 

How-To : bapi export table > webdynpro > bapi import table

Former Member
0 Kudos

Hi folks!

This is proving to be very difficult. my appreciation is <b>10 points to the first helpful answer!!</b>

I am receiving an export table from one bapi (z_xxx_getlist) into my webdynpro. I want to then import the same table into another bapi (z_xxx_savelist) so it can be saved in R/3.

- firstly I tried to map the the view's context attributes to the 2nd bapi, but that didn't work because it deleted the original mapping.

- then I created a new context node for the save bapi and tried to sync data between the nodes, but only ran into nullpointer exceptions.

What's the standard procedure for such a requirement?

Great thanks,

faB

ps. this is related to this previously posted topic:

></b><b></b><b></b>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Patric,

Thanks for the indepth reply. I will try you suggestion and the notify of the results.

One question in the meantime:

I have done the mappings a little bit differently (as demonstrated in the wd tutorials). Instead of mapping <b>RFC1_Output</b> to the custom controller I have mapped <b>RFC1_Input\Output</b> to it.

Does this matter?

Regards,

faB

Former Member
0 Kudos

Using RFC1_Input\RFC1_Output is totally correct; this is the context structure you get from the model structure (Input model class has a :1 relation to Output model class).

That's what I meant - but formatting of indentations to show the model / context structure were not shown in my posting the way I wanted.

Model:


RowStruct (model class, row type both for export and import table)
  ... (attributes for structure)
RFC1_Input (model class, input RFC1)
  ...
RFC1_Output (model class, output RFC1)
  Tbl_Export (:n relation to RowStruct from export)
RFC2_Input
  Output (:1 relation to Output)
  Tbl_Import (:n relation to RowStruct for import)
RFC2_Output
  ...

Context:


...
RFC1_Input
  RFC1_Output
    Tbl_Export
      ... (attributes of row structure)
RFC2_Input
  RFC2_Output
    ...
  Tbl_Import
    ... (attributes of row structure)

Regards,

Patric.

Former Member
0 Kudos

Never mind, the nullpointer exception was because ".currentZlo_Price_Display_InputElement()" should have been ".currentOutput_DisplayElement()"

-


Hi.

I have tried your suggestion, but I only get a nullpointer exception on the line shown below.

RFC1 was already called and the data shown in a table.

Many thanks,

faB

wdContext.currentZlo_Price_Change_InputElement()

.modelObject()

<b> .setRelatedModelObjects(</b>

"Zlo_Price_Ypr02",

wdContext

.currentZlo_Price_Display_InputElement()

.modelObject()

.getEt_Ypr02());

stack trace:

-


java.lang.NullPointerException

at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.retrieveListClass(DynamicRFCModelClass.java:1248)

at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setRelatedModelObjects(DynamicRFCModelClass.java:779)

at com.xxx.crm.pricemaintenance.PriceMaintCust.executeZlo_Price_Change_Input(PriceMaintCust.java:225)

at com.xxx.crm.pricemaintenance.wdp.InternalPriceMaintCust.executeZlo_Price_Change_Input(InternalPriceMaintCust.java:392)

at com.xxx.crm.pricemaintenance.ResultView.onActionUpdatePrices(ResultView.java:208)

at com.xxx.crm.pricemaintenance.wdp.InternalResultView.wdInvokeEventHandler(InternalResultView.java:233)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)

at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:100)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:299)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:635)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:249)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Message was edited by: faB

Former Member
0 Kudos

Patric,

This now works after days of standstill!!! <b>Very many thanks to you.</b> If I could buy you a beer I would, but max points will have to do for now!

Cheers,

faB

Former Member
0 Kudos

I don't know the structure of your model and context, but the most probable reason for this is you did not choose the first parameter of the setRelatedModelObjects method correctly.

This must be the name of the <b>model</b> relation from the Input model class to the import table for the second RFC.

In my sample the relation from

RFC2_Input --> TblImport

so the parameter is "TblImport".

Regards,

Patric.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

let's assume you have the following structure of your model (as seen under node "Model classes" in NWDS):

RowStruct (model class, row type both for export and import table)

... (attributes for structure)

RFC1_Input (model class, input RFC1)

...

RFC1_Output (model class, output RFC1)

Tbl_Export (:n relation to RowStruct from export)

RFC2_Input

Output (:1 relation to Output)

Tbl_Import (:n relation to RowStruct for import)

RFC2_Output

...

You now create a context bound to this model (note that it's recommended to create this in a custom controller

- usually the component controller - to be easily able to distribute data to several views).

Map the view context to this context; the context structure can then be as follows (only relevant parts shown):

Context

...

RFC1_Input

RFC1_Output

Tbl_Export

... (attributes of row structure)

RFC2_Input

RFC2_Output

...

Tbl_Import

... (attributes of row structure)

What is needed now - if I understand your question right - is to copy everything from TblExport to TblImport

(e.g. in the action event handler triggering the call of RFC2). The code snippet doing this is:

  
//copy list of model objects from RFC1 export to RFC2 import table
wdContext.currentRFC2_InputElement().modelObject().setRelatedModelObjects("Tbl_Import", 
    wdContext.currentRFC1_OutputElement().modelObject().getTbl_Export()); 
  wdContext.nodeTbl_Import().invalidate();  //sync context with model

Note that this assumes your input elements bound to the respective model

objects have been created and RFC1 has been executed.

Regards,

Patric.

Former Member
0 Kudos

I am facing exactly the same issue. Passing a table to function module is not working with adaptive RFC, but giving import parameters is no problem.

This cannot be found in any of the wd examples either.

Thanks in advance,

Tomas.