RFC input structure

Hello,
I am trying to call a RFC from my WebDynpro application.
The RFC has a mandatory input structure called PERSDATA.
I am using the following test code to call the RFC:
     IWDMessageManager manager = wdComponentAPI.getMessageManager();
     try{
          wdContext.nodeZ_Portal_Get_Timesheet_Input().bind(new Z_Portal_Get_Timesheet_Input());
          wdContext.currentZ_Portal_Get_Timesheet_InputElement().setKeydate(new Date(105,9,27));
          wdContext.nodePersdata().bind(new Cats_Its_Persdata());
          wdContext.currentPersdataElement().setPernr("00003000");
          wdContext.currentZ_Portal_Get_Timesheet_InputElement().modelObject().execute();
          wdContext.nodeOutput().invalidate();
     } catch(WDDynamicRFCExecuteException ce) {
          manager.reportException(ce.getMessage(), false);
When I run this code I get the errormessage:
<b>Mandatory parameter PERSDATA of method Z_PORTAL_GET_TIMESHEET missing.</b>
When I display the input structure in my view (in a table) it displays one row with pernr set to 00003000 (so it seems to me that the input structure is ok).
What am I doing wrong here?

Hallo Johan,
your mistake is based on the fakt, that you did not correctly aggregate your model object graph. Instead you operated on the context itself. The context only references the model objects within the model object graph. Relations between context nodes and context node elements are not automatcally mirrored within the model object graph. Principally you have to aggregate your model object graph first (independant from the contex) and afterwards you can reference the executable model class within the toplevel context node element.
I assume, that your code should look like this:
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try {
  // Aggregate model object graph
  Z_Portal_Get_Timesheet_Input timeSheetInput =
  new Z_Portal_Get_Timesheet_Input();
  timeSheetInput.setKeydate(new Date(105, 9, 27));
  Cats_Its_Persdata persData = new Cats_Its_Persdata();
  persData.setPernr("00003000");
  timeSheetInput.setPersdata(persData);
  // Bind executable model object to context node 'Z_Portal_Get_Timesheet_Input'
  wdContext.nodeZ_Portal_Get_Timesheet_Input().bind(timeSheetInput);
  // Execute model object
  wdContext
    .currentZ_Portal_Get_Timesheet_InputElement()
    .modelObject()
    .execute();
  // Invalidate output node so that the context-to-model-object-references will be updated
  wdContext.nodeOutput().invalidate();
} catch (WDDynamicRFCExecuteException ce) {
manager.reportException(ce.getMessage(), false);
Also have a look at my related answer within the forum thread Executing model : deep structure in importing parameter of RFC which deals with the same issue.
Regards, Bertram
Regards, Bertram

Similar Messages

  • Passing RFC output structure to another RFC input structure.

    Hello Friends,
    I have 2 views (i.e. SearchView & ResultView). In search view, I pass input parameter (PO Number) to BAPI_PO_GETITEMS and get back the output table PO_ITEMS correctly. I display this table in the ResultView correctly. Now, after displaying the order details, I need to pass this input to BAPI_GOODSMVT_CREATE in its GOODSMVT_ITEM structure to create a Good Movement Note.
    Can somebody help me as to how could I pass values from PO_ITEMS to GOODSMVT_ITEM structure?
    Thanking you in advance,
    Maulin

    Hi,
    You can pass the input of BAPI_PO_GETITEMS  to the BAPI_GOODSMVT_CREATE .
    For this u need to first understand and read the BAPI throughly, means u must read how your two bapi's are working and what are the relation ship b/w them.
    Also, i assume that in a ur webdynpro application u already imported all required BAPI and just simple take the user Input from the context and pass it to the next Bapi.
    Hope so it can solve ur pb,If there is any more query, put in forum.
    Thanks
    Dheerendra Shukla

  • Passing values to RFC holding structure.

    Hi Experts,
    I have DC which needs to update backend table through RFC.  In this RFC i have a structure in import tab which holds 2 fields.
    From webDynpro Java code , i have to pass the those 2 fields as input before when i execute the model.
    How can i write code for inputing the values for this structure fields ?
    thanks in advance.
    Regards,
    suresh

    Hi Suresh,
    Steps to execute you Adaptive RFC Model:
    1. Create an instance of the BAPI's input structure-
    <Your BAPI Name>_Input input = new  <Your BAPI Name>_Input();
    2. Set the two input parameters to this input structure with desired parameter values-
    input.set<Your Para 1>(<Desired Parameter Value>);
    input.set<Your Para 2>(<Desired Parameter Value>);
    3. Create and Bind a model node in context to the input structural node of Your BAPI using model binding. Now using code bind the instance of the input structute to the model nodel in conext as stated below-
    wdConext.node<Your Custom created Model Node in Context>().bind(input);
    4. Execute the model and invalidate the output node-
    try{
                   wdContext.current<Your Model Node in Conext>().modelObject().execute();
                    wdConext.node<Output Node in the conext>().invalidate();
    }catch(Exception){
    5. Pick all the output parameters from the Output Node in the context.
    Hope it helps!!
    Regards,
    Tushar S

  • Duplicate records in input structure of model node

    Hi,
    Following is the way, I am assigning data to a model node:
    //Clearing the model input node
    for (int i = wdContext.nodeInsppointdata().size(); i > 0; i--)
         wdContext.nodeInsppointdata().removeElement(wdContext.nodeInsppointdata().getElementAt(i - 1));
    //Creating element of the input model node
    IPrivateResultsView.IInsppointdataElement eleInspPointData;
    //START A
    Bapi2045L4 objBapi2045L4_1 = new Bapi2045L4(); //Instance of the input structure type
    //Populating data
    eleInspPointData = wdContext.nodeInsppointdata().createInsppointdataElement(objBapi2045L4_1);
    wdContext.nodeInsppointdata().addElement(eleInspPointData);
    eleInspPointData.setInsplot(wdContext.currentContextElement().getInspectionLotNumber());
    eleInspPointData.setInspoper("0101");
    //Inspection_Validate_Input is the model node. Adding instance to main node
    wdContext.currentInspection_Validate_InputElement().modelObject().addInsppointdata(objBapi2045L4_1);
    //STOP A
    //Now executing the RFC
    Above code seems to be fine. Works very well for the first time. But, when the user clicks on the same button for the second time, I can see duplicate records getting passed to RFC [Debugged using external breakpoint]. When I am sending 4 records, I can see there are total of 6 records. The number keeps increasing when clicked on the button.
    I am adding multiple records to input model node using the code from START A to STOP A. Does the code look fine? Why do I see multiple records?
    Thanks,
    Sham

    Issue solved.
    After executing RFC, I used following code to clear the input model node:
    try
         wdContext.current<yourBAPI>_InputElement().modelObject().get<yourinputnode>().clear();
    catch (Exception e1)

  • How to force field to appear in input structure in content conversion

    Hi all,
    I am doing file content conversion in sender File adapter. Here is the structure
    Header
    Body
       field1 - length 2
       field2 - occurrence 1:1, length 3
       field3 - length 2
       field4  length 2
    Trailer
    Here is the fixed length file that is inputed into XI
    <b>header22   2211trailer</b>
    field2 occrence is 1:1 and as you se from the file example field2 from the body is empty(just space).But  When I do the content conversion I don;t have this field showing up in my structure!??!!
    I want to make sure that field2 appears even as empty field because that is screwing my mapping!?
    Can you please have any idea how to make sure that field is in my input structure when I pass spaces?Can I force it somehow?
    Thanks all.

    Hi Jon,
    Yes you are right.
    For Ex: ur XML is
    <1>a</1>
    <2>b</2>
    and sometime is there is no value ur FCC will become
    <1>a</1>
    So what you have to do is in the message mapping take the source element
    if <2> exists then <2>---->Target
    else
    <2>---->Constant(space)
    and this "exists" is a standard function in NodeFunctions.
    Regards,

  • Getting Data from Input Structure (in Web Dynpro)

    Hi All,
    in my Web Dynpro Application, i have problems to get the data form my Input-Structure. In the execution-method I implement the following code, to show the input parameters in my form (in context-nodes):
    IGPStructure inputStructure = executionContext.getInputStructure;
    node.setSolution((String)inputStructure.getStructure("FRS").getAttribute("Solution"));
    But that doesnt work I, my exception handler throws an exception. Exception.getMessage() returns null, so I cannot show the error-message. What is the problem?
    Hope someone can help me.
    Really thanks
    Bye Steve

    I solved it my own.
    It was an Null-Pointer exception, cause getStructure can also return null, when no structure is added.
    In my code I didnt catch null-structures, result was the error message.
    Right code example:
    IGPStructure inputStructure = executionContext.getInputStructure.getStructure("FRS");
    if(inputStructure != null){
        node.setSolution((String)inputStructure.getAttribute("Solution"));

  • LSMW  Field Mapping: can't map Batch Input Structure for Session Data

    In step 5 Maintain Field Mapping and Conversion Rules, I can not see Batch Input Structure for Session Data Fields.
    Can somebody tell what's wrong?
    Here's what I see:
    Field Mapping and Rule
            BGR00                          Batch Input Structure for Session Data
                Fields
                BMM00                          Material Master: Transaction Data for Batch Input

    Hi Baojing,
    To see structure BGR00  you have to map this structure first with input file structure in step 4 (maintain structure relationship).
    Regards
    Dhirendra

  • BRM 7.2 and input structure as a collection

    Hi there!
    I created a BRM project in NWDS 7.2 and I have an input structure with cardinality 0..n (it's a collection). Now I have to iterate through it and check the each value of the structure's attribute. But I can't see the way to iterate the collection. I created a rule script in flow ruleset, but I can't find the way to initialize List with my collection.
    How can I achieve ma task?

    My system is
      MacBook Pro Late 2011
      Processor Name:          Intel Core i7
      Processor Speed:          2.4 GHz
      Number of Processors:          1
      Total Number of Cores:          4
      Memory:          16 GB
    Same issue, initially, I believed the problem was "lumetri" effect related, but I see now that it appears to be GPU related, when i select Mercury Playback with GPU it is sluggish when handling clips with effects, and it says that it will take about 7 hours to export a 5 minute clip. 
    However when I select Mercury Playback "software only" seems to zip right on again, a work around for now I suppose, but I really do think that the GPU ought to be enabled, no?
    Everything worked fine 7.1 -more or less.... but still seemed a bit more stable than 7.2...
    I hope these guys release a patch in the next couple of weeks, cause this software only mode is a HUGE step backwards...

  • Help - using table as RFC input

    Dear all,
      I'm new to web dynpro.I've just created a program to create PI doc. I had already import the module as well as configure the JCO.
    Bapi_Matphysinv_Create_Input input = new Bapi_Matphysinv_Create_Input();
    wdContext.nodeBapi_Matphysinv_Create_Input().bind(input);
    input.setHead(new Bapi_Physinv_Create_Head());
    how should i declare the table as input for RFC? any example for using table as RFC input? i had already look into the TutWD_Flighlist...but it seems doesnt do me any good.. pls help and advice. Thank you.

    Hi Joan,
    1. Create a value node in your context.
    2. Add value attributes to this all those required for your input to BAPI(Keep its  
        type same).
    3. Bind this node to table UI element and keep all the column type as input field
        so that you can enter value in that at runtime.
    4. Now in you action where you execute BAPI just before that set all these values from node to model node.
    eg.
    Bapi_Matphysinv_Create_Input input = new Bapi_Matphysinv_Create_Input();
    Bapi_Physinv_Create_Head() head =new Bapi_Physinv_Create_Head();
    for(int i=0; i<wdContext.node<valueNode>().size();i++)
    head.set<Attribute>(wdContext.<valueNode>().get<ValueNode>ElementAt(<index>).get<attributeName>);...
    input.addHead(head);
    wdContext.nodeBapi_Matphysinv_Create_Input().bind(input);
        try
        wdContext.currentBapi_Matphysinv_Create_InputElement().modelObject().execute();
        wdContext.nodeOutput().invalidate();
        catch(Exception e)
    Regards,
    Murtuza

  • Passing values to a RFC table structure

    Hi
        I am using an RFC in which there is a table called Submit Details.I want to pass three rows to this table structure in the R/3 system.
                            Can anyone help me how to do this.
    regards
    Nayeem

    Hi,
    Private<name>View.I<value node name >Node node = wdContext.node<value node name >();
    Private<name>View.I<value node name>Element ele;
    <your rfc name> input = new <your rfc name>(); // your rfc name
    wdContext.node<your rfc name>().bind(input); // bind
    <table name> inputTable;
    for (int i=0; i < node.size(); i++ ) // value node - where data is available
    inputTable= new <table name>();
    ele = node.get<value node>ElementAt(i);
    inputTable.set<Attribute>(ele.get<Attribute>());
    input.add<table name>();
    // execute rfc.

  • RFC Model Structure BAPI_SALESORDER_CREATEFROMDAT2

    Hello Forum,
    i need help concerning Web Dynpro Java, i think i have a comprehension problem:
    When i import the Bapi_Salesorder_Getlist as Adaptive RFC, Map the Model to the context via Apply Template (Service Controller), Apply Template into the View and create a InputForm (Values are of InputField-Type), Button and an Output-Table (TextViews), i'm able to Deploy the Project and use the Input Fields CustomerNumber and Salesorganization to generate the wanted Results.
    If i to the same with Bapi_Salesorder_Createfromdat2 it doesn't work. What i can do is to hard-code the Entries for OrderHeaderIn etc., but i cannot use the Input Filds because they're blanked out.
    See this posting -> Creating Salesorder via Bapi_Salesorder_Createfromdat2
    I think this is because of the imported Model-Structure. When i test the Bapis i can directly enter the Test-Data, in Salesorder_Createfromdat2 there are underlying Structures like OrderHeaderIn.
    Do i have to manually create Sub-Model Nodes or something like that? How am i getting theese Structures filled? Could it be another Problem perhaps with the Apply-Template mechanism?
    Any help is appreciated!
    Regards

    Hi Stefan,
    Applying template mechanicanism could nor be the problem.
    You have to create the Object for the corresponding context values classes
    and set them to the corresponding attrributes.
    Bapi_Material_SaveData_Input input = new Bapi_Material_SaveData_Input ();
    wdcontext.nodeBapi_Material_SaveData_Input.bind(input);
    input.setMaterial(obj);  //Object ofcorresponding field
    (Or)
    You have to set some default values for those fields.
    Eg:
    Bapi_Material_SaveData_Input input = new Bapi_Material_SaveData_Input ();
    wdcontext.nodeBapi_Material_SaveData_Input.bind(input);
    input.setMaterial("");  //empty Values
    Regards,
    Ramganesan K.

  • RFC:Complex structure

    Dear experts,
    In my PI box,i used one RFC SXMB_GET_MESSAGES.I provided input to the table parameter with over 155 values.
    My attempt was to retrieve from output table parameter which is a deep structure
    If i drill EX_MSG_CONTENT , i get table MSG_VERS_T as one of table output and on further drilling this i get PROP again of type table line.
    <table>EX_MSG_CONTENT_LIST -> <table> MSG_VERS_T ->  <table> PROP
    Ultimately i fetched two fields from table PROP.Only issue is that if i am providing 155 input values i get 36 output values only.
    Further incase i put 222 input values then output values get affected in same ration ex 56 output values and so on..
    What should  i conclude.IS this because RFC (Remote Enabled) doesnot support complex nested structures and i should give up this assignment or may be i need to put something in addition. ?.For those of you familiar with java i am trying something like this
    _ob_c.function.execute(ob_c.destination);    //Problematic as it return less number of rows_
    call function statement:
    ArrayList<PayLoadType> payloads  = new ArrayList<PayLoadType>(fetchmessagepayloads(tableresout)); 
    //Works well as content fetched is actually equal to number of records fetched above.
    public ArrayList<PayLoadType> fetchmessagepayloads (JCoTable tableobj)
    int count = 0;
    ArrayList<PayLoadType> oba = new ArrayList<PayLoadType> ();
    while (count < tableobj.getNumRows()) {
    PayLoadType obj = new PayLoadType();
    JCoTable subtab1  = tableobj.getTable("MSG_VERS_T");
    count = count + 1;
    int rec = subtab1.getNumRows();
    int numrecs = 0;
    while ( numrecs < rec )
    subtab1.nextRow();
    numrecs = numrecs + 1;
    JCoTable subtab2  = subtab1.getTable("TPROP");
    numrecs = 0;
    rec = subtab2.getNumRows();
    while (numrecs < rec )
    numrecs = numrecs + 1;
    if (subtab2.getString("LCNAME").trim().equals("Main")) {
    obj.msgid = subtab2.getString("MSGGUID");
    obj.payload = subtab2.getString("CONTENT");
    oba.add(obj);
    subtab2.nextRow();
    tableobj.nextRow();
    return oba;
    Edited by: aditya  sharma on Aug 16, 2010 10:20 AM

    Hi,
    The problem is basically in message mapping from file to RFC external message.
    The option 2 is working now and I get correct converted file strcuture after FCC and into RFC and also a correct RFC payload.
    However, business is stressing that can send the file in the format as given in Option 1 where u have different structure - Header and Items. This is not coming out correct in RFC payload as the header has 5 fields as compared to more in item but the header and item are still being mapped to the flat RFC structure and this is creating a mismatch. The item line is missing the 5 fields from Header.
    How do i do the FCC in this situation to get the correct structure in RFC?
    This means that in RFC payload, the first line should be the one as below-
    H,100890,P100,A02,S101,AUD#
    The 2 records after this as received in RFC internal table should be as 2 given below-
    I,P,NULL,TH,Test PO TH,1,EA,100,10160000,A002,0001,720090,E.1.4.3,,,,VT#
    I,P,NULL,TH,Test PO TH1 2,2,EA,100,10160000,A002,0001,720090,E.1.4.3,,,,VT#
    However, the 2 structures contain variable field columns.
    Please help.
    Regards,
    Archana

  • SOAP - XI - RFC - Input parameters

    Hi,
    I'm trying to develop a SOAP-> XI -> RFC scenario and now i'm facing the following problem: I'm invoking a RFC through XI but for some reason the input parameters are not reaching the RFC. The RFC response indicates that RFC is not receiving any input parameters from XI.
    I've already cleared the cache and de-activate and re-activate the rfc receiver communication channel.
    Anyone has a hint for this?
    Thanks in advance,
    Pedro Leal

    Pedro,
    Few weeks before I also faced the same issue. I'm not sure if it's bug or not.  You are directly sending the RFC structure using SOAP client  is it? I mean your Inbound and Outbound Structure are same.
    Do onething, just do the mapping and check, It will work for sure!
    raj.

  • Perl SAP::Rfc - input tables - The specified type Typ rfcdes is unknown.

    I am pretty new to SAP and am working to understand the guts of it while also trying to do something useful, especially understanding how we could use Perl Sap::RFC.  I've been looking for days and making a little progress over time, but now I'm stuck.
    Problem Summary:
    I want to read the RFCDES table using RFC_READ_TABLE to get a dump of what's in there.   It is apparently too large for a plain RFC_READ_TABLE, but I discovered that by defining the fields that I want, I can get out what I need.  I did this by successfully executing RFC_READ_TABLE in SE37 for the RFCDES table by defining entries in the FIELDS table, but I can't figure out the right way to send a table as input to SAP via SAP::Rfc.
    Background:
    I am using SAP::Rfc v 1.55 on linux with 640,0,303 release of the rfcsdk.
    I am getting the error:
    RFC call failed: EXCEPT SYSTEM_FAILURE  GROUP   104     KEY     RFC_ERROR_SYSTEM_FAILURE        MESSAGE The specified type Typ rfcdes is unknown. at /home/<userid>/local/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/SAP/Rfc.pm line 1055.
    Here is my code block (minus connect info):
    my $it = $rfc->discover("RFC_READ_TABLE");
    $it->QUERY_TABLE("rfcdes");
    $it->ROWCOUNT( 30 );
    $it->OPTIONS( ["NAME LIKE 'SAP%'"] );
    my $str = $it->tab('FIELDS')->structure; # I think this line is extraneous
    $it->FIELDS([{ FIELDNAME => "RFCDEST", OFFSET=> "000000", LENGTH => "000000",  FIELDTEXT=> ""}]);
    $rfc->callrfc( $it );
    $rfc->close();
    The parameters to FIELDS are what worked in SE37.  I would eventually like to return more than just rfcdest (such as RFCOPTIONS) but at this point, anything working would be good
    I have successfully done an RFC_READ_TABLE with SAP::Rfc (using the tables.pl example) so I'm pretty sure I have that working but I think the FIELDS input/output table is throwing me off.  Maybe I'm not understanding the array of hashes correctly?
    I have looked at the thread SAP-::Rfc with Perl which got me this far but I'm still missing something.  Can anyone please help?
    Thank you for your time.

    You might want to check out the newer SAPNW::Rfc.  Not sure what version system you're connecting to.
    Anyway, here's how I did RFC_READ_TABLE with SAP::Rfc years ago:
    my $IT = $RFC->discover("RFC_READ_TABLE");
    $IT->QUERY_TABLE('TBTCO');
    $IT->OPTIONS( ["ENDDATE = '$MAXDATE' AND ENDTIME > '$MAXTIME' OR ENDDATE > '$MAXDATE'"] );
    my @FLDARRAY = qw(JOBNAME JOBCOUNT JOBCLASS PERIODIC REAXSERVER RELUNAME SDLUNAME
    AUTHCKMAN EVENTID SDLSTRTDT SDLSTRTTM STRTDATE STRTTIME ENDDATE ENDTIME STATUS);
    $IT->FIELDS([@FLDARRAY]);
    $RFC->callrfc( $IT );
    print "Num Rows in PRD matching selection criteria: ".$IT->tab('DATA')->rowCount()." \n";
    for my $ROW ( $IT->DATA ) {
       #do stuff;
    $RFC->close();
    Cheers,
    David.
    For reference, here's my wiki profile, where you can find my blogs on SAPNW::Rfc, and some sample scripts.
    http://wiki.sdn.sap.com/wiki/display/profile/David+Hull
    Edited by: David Hull on Mar 28, 2010 10:05 AM

  • OLD RFC export structure being referred to

    Hello all,
    I am testing a XI to RFC call in PI. The structure of the export parameter was changed after being imported into IR and accordingly I did re-import the modified RFC into IR. The export parameter in IR reflects the latest correct structure. Whereas when I test my scenario, the interface is failing because the response from the RFC is still referring to the old export parameter structure and not the new one.
    In fact the response XML has the old RFC export parameter and hence its failing in mapping runtime because its unable to generate the newer version of the export parameter as expected by IR.
    *This is the error i am getting.
    RuntimeException in Message-Mapping transformation: Cannot produce target element /ns1:Vista_MR2A_Response_MT/Rows/RECORD_ID. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd at com.sap.aii.mappingtool.tf3.AMappingProgram.start*
    Can anyone please help on how to solve this problem.
    Cheers,
    Babs

    Hi,
    you also need to refresh RFC cache (by restarting RFC adapter service in visual admin for example)
    or by restarting java stack if this will be faster in your case
    Regards,
    Michal Krawczyk

Maybe you are looking for

  • How do I stop notifications to upgrade to Yosemite?

    I'm on 10.6.8. I keep getting notifications to upgrade to Yosemite. I don't want to upgrade because I've heard Yosemite caused problems and lag issues to Logic Pro 9. I don't want to keep getting the notifications to upgrade. I've refused so many tim

  • How to Load file name in to Oracle table column

    hi, I am loading data from flat file(TEST_GRET.DMP) to oracle table. while the Target Oracle table has four coloumns, in which one is File_name. I want to load the FILE NAME into that table too. as there is no ???? how it can be done??? Regards,

  • Post jDev 903 cleanup: Classpath and Path.

    Having installed the new [complete set] 9.0.3 and having decided NOT use 9.0.2 or other developer suite tools, it's time to clean up my path and classpath settings. Please help me sort it all out. Thanks. Per instructions I did not install the new 9.

  • Req: Business Content

    hi Gurus, i Have installed Bw 3.1c in my Pc and integrated with R/3 doing Business content in bw i Have select options - only necessary objects - collect automatically, - install and transport  this is the procedure we do right, and afterwards we typ

  • Pdf soll's werden - tiff wird gespeichert :(

    Guten Tag, seit einigen Tagen habe ich Adobe Acrobat 9 Professional installiert. Vorher hatte ich die Version 7.xxx Die Vorlagen für die Formulare erstelle ich in PageMaker. Zum umwandeln in eine*.pdf-Datei habe ich bisher auf das Acrobat-Logo in der