RFC function : passing a table as input

Hi,
I have no trouble passing input values to an RFC model in web dynpro, but I have difficulties to pass an input table.
By default, the input "it_table" node of the model I use, is defined like this : card 0..n, selec 0..1 Singleton True.
Do I have to change something?
Then, what is the correct code for creating the node (because card is 0..n) and then add items (for each line of my table)?
For the moment, I get this error : value node is created without a reference.
Thanks

I finally managed to get it work.
Here is the COMPLETE solution.
Note that in my solution, it was easier for me to put data in a value Node FIRST and THEN to copy it to the model Node.
--> In the RFC function, declare the table "TYPE TLINE_T", and not "LIKE TLINE".
GestionAvisComp - Context
- Z2_I_Gestion_Simplifiee_Avis_Input (Model Node, card 0..1, sel 0..1, singleton true)
         + It_Ajout_Texte_Avis (card 0..n, sel 0..1, singleton true) Class Tline
            - Tdformat
            - Tdline
         - Qmart
- It_Texte_Avis (Value node, card 0..n, sel 0..1, singleton true)
  public void wdDoInit()
    //@@begin wdDoInit()
     //$$begin Service Controller(1353609186)
     Z2_I_Gestion_Simplifiee_Avis_Input input = new Z2_I_Gestion_Simplifiee_Avis_Input();
     wdContext.nodeZ2_I_Gestion_Simplifiee_Avis_Input().bind(input);
     //$$end
    //@@end
WhateverView
public void onActionSauvegarderAvis(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
     // Add two elements to the value node
     IIt_Texte_Avis_InputElement firstTexte_AvisEl = wdContext.nodeIt_Texte_Avis_Input().createIt_Texte_Avis_InputElement();
     IIt_Texte_Avis_InputElement secondTexte_AvisEl = wdContext.nodeIt_Texte_Avis_Input().createIt_Texte_Avis_InputElement();
     firstTexte_AvisEl.setTdformat("/*");
     firstTexte_AvisEl.setTdline("Line 1");
     secondTexte_AvisEl.setTdformat("/*");
     secondTexte_AvisEl.setTdline("Line 2");
     wdContext.nodeIt_Texte_Avis_Input().addElement(firstTexte_AvisEl);
     wdContext.nodeIt_Texte_Avis_Input().addElement(secondTexte_AvisEl);
     // Moving the elements of the value node into the model node
     int size = wdContext.nodeIt_Texte_Avis_Input().size();
     for (int i = 0; i < size; i++) {
          wdContext.nodeIt_Texte_Avis_Input().setLeadSelection(i);
          Tline x = new Tline();
          x.setTdformat(wdContext.currentIt_Texte_Avis_InputElement().getTdformat());
          x.setTdline(wdContext.currentIt_Texte_Avis_InputElement().getTdline());
          wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().modelObject().addIt_Ajout_Texte_Avis(x);
     wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().setQmart("ZE");
     // Execute the RFC model
     // Clear the Value Node
     while ( wdContext.nodeIt_Texte_Avis_Input().size() > 0 )
               wdContext.nodeIt_Texte_Avis_Input().removeElement(
                    wdContext.nodeIt_Texte_Avis_Input().getElementAt(0)
     // Clear the Model Node          
          if (wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().modelObject().getIt_Ajout_Texte_Avis() != null) {
          while(wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().modelObject().getIt_Ajout_Texte_Avis().size() > 0)
               wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().modelObject().getIt_Ajout_Texte_Avis().remove(0)
Edited by: Emanuel Champagne on Jan 17, 2008 9:32 PM
Edited by: Emanuel Champagne on Jan 18, 2008 10:20 PM

Similar Messages

  • Passing a table as input to a query

    Hi Experts,
    I am new to Visual Composer so this might be a fairly simple question.
    My query takes in a input parameter (CUSTOMER ID) and generates an output table. I can easily display this output table in Visual Composer. However my problem is that the query takes in a one CUSTOMER ID, and not a table of CUSTOMER IDs. What I need to do is pass a table of CUSTOMER IDs to the query and iteratively run the Query for each CUSTOMER ID. The output table from the query would be a cumulative output table of all the data from each output table associated with each CUSTOMER ID.
    I am not sure how I can do this in Visual Composer.
    Thanks!
    Osman

    Hi Osman,
    you can pass a whole table into your query. You have to flip port of the table, which is used as input (the table with your customer IDs). In your query (I think it's an ABAP function module) you can bring your result together to an cumulative output table as you need it. Hope this helps.
    Also check the Wiki entries:
    [ Multiple tables into one dataservice|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/multipletablesintoonedataservice]
    [ Combining two tables, BAPIs or queries|https://wiki.sdn.sap.com/wiki/display/VC/Combiningtwotables%2CBAPIsor+queries]
    Best Regards,
    Marcel

  • ABAP RFC Function to merger table data?

    Hi All,
    Has anybody tried to merger that from multiple table in 1 table using ABAP RFC function module.
    I have to merger 3 table into 1 which I am not able to do using Combine or Union operater.
    One solution suggested in the below thread by Marcel was to use ABAP RFC function mod..I dont know how to do that.
    If anybody has tried please share.
    Union operator between tables
    Thanks,
    Murtuza.

    Thank you for the reply,
    I got the solution without ABAP code.
    I created a structure of table (Key Figures) in Column of query designer and then use that structure in VC to output table.
    There I had used formula for each KeyFigures using IF ...something like this:-
    NVAL(IF(@Key_Figures=="Prior Sales",0,IF(@Key_Figures=="Price",NVAL(IF(#ID[ACA257]@Price_Impact_value>=0,#ID[ACA257]@Prior_Sales_Value,#ID[ACA257]@Prior_Sales_Value+#ID[ACA257]@Price_Impact_value)),IF(@Key_Figures=="FX",#ID[ACA257]@GAP_3,IF(@Key_Figures=="Volume",#ID[ACA257]@GAP_4,IF(@Key_Figures=="Lost Mix",#ID[ACA257]@GAP_5_6,IF(@Key_Figures=="Gain Mix",#ID[ACA257]@GAP_5_6,IF(@Key_Figures=="Current Sales",0,123))))))))
    This way I got the output table as required.
    Pls see this thread for the requirement.
    link: Table with Formula Values as output table?

  • To upload a data into SAP Table with the help of RFC function in BODS

    Hi,
    Please provide me step-by-step solution to upload data into any SAP table with the help of RFC function in Data Services.
    I have created RFC function that upload data into SAP table. RFC Function contains one table that has same structure as my database table.
    In the data services how can i filled the table of RFC function, i am using this function in query transform of data services but it gives me error.
    I am also follow link http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsDataServicesTipsand+Tricks
    but it did not help me.
    Thanks,
    Abhishek

    Hi Abhishek,
    Did you import the function module in the SAP datastore first? When you open the SAP datastore, the function should be listed in the 'functions' section. If not, import it. Make sure your function is remote executable.
    Once the function is there, you can use it in a transformation. In 'Schema Out' right-click on 'Query' (top level) and choose 'New Function Call'. You can then select a datastore and a function in the datastore. The wizard will show you which output parameters are available. I believe you have to add at least one and can select as many as you like.
    After confirming your selection the function and the output parameters appear in Schema Out. You can then right-click on the function and choose 'Modify function call'. A popup will appear where you can specify the input parameters.
    I hope this helps.
    Jan.

  • Invoke RFC function without input parameters

    Is it possible to invoke RFC function that doesn't have input parameters? It returns all data from reference.

    Hi Denis,
    pls keep in mind that no reference parameter is allowed in RFC, you have to check that "Pass Value" flag.
    Thanks
    Luis

  • How to pass Dynamic Table(s) to FM

    Hello All i hv an requirement in which i need to process a block of code recursively. right now i am trying to do the same with Subroutine but its hard i know. I have an option to use FM instead but i am not sure if we can pass dynamic tables to FM, so is there anybody who had solution for the same. otherwise i can use it using TOP include to declare dynamic table in comon arae as im calling it from another FM(RFC) but i  dont want to use that as it will consume more memory.
    So i have 2 question
    1. should i use FM instead of subroutine for recursive operation if yes how can know if i reached the maximum alloted size of memory for a program. is there any FM which can tell me about the memory used or somethign like that so that i can avoid any ABAP dump.
    2.how can i pass dynamic tables as input to parameters.
    Note : i allready seen https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f50dcd4e-0501-0010-3596-b686a7b51492

    Hello Mani
    Perhaps the sample report ZUS_SDN_TABLE_READ_VIA_RFC_XML in thread
    How to return back a structure of dynamic tables in a Function Module
    might be a useful approach for you.
    Regards
      Uwe

  • RFC function is called with null paremeters on SAP side

    I used the new version of .Net Connector 2.0.1.
    I created a simple client called RFC function with one table parameter and simple RFC function inserts record to simple table on SAP side.
    If I call this RFC function from SAP side the record is inserted to my table with correct value.
    If I call this RFC function from NET side the record is inserted with null value.
    What's wrong ?
    Could anybody help me ?
    Code :
    SAP side
    FUNCTION ZRVFRFCNV.
    *"  TABLES
    *"      ITDATA STRUCTURE  ZRVNAMEVALUE
    insert into ZRVNAMEVALUE values ITDATA.
    ENDFUNCTION.
    Net side                    
    ZRVNAMEVALUE nam_val2 = new ZRVNAMEVALUE();
    nam_val2.Name = "100";
    nam_val2.Value = "NORD";
    ZRVNAMEVALUETable tblTest = new ZRVNAMEVALUETable();
    tblTest.Add(nam_val2);
    // for testing : dataGrid show correct values
    dataGrid1.SetDataBinding(tblTest, "");
    this.sapProxy11.Zrvfrfcnv(ref tblTest);

    The problem was in insert statement. I changed insert to modify on SAP side and solved it.

  • Problem passing a table parameter in rfc call using the function control

    I try to pass a Table as parameter to a Function Module using the SAP.Functions library (part of SAP frontend controls) from a Visual Basic (VBA) program.
    The function module has been verified to work when invoked from SAP FrontEnd Function Builder.
    The SAP RFC Control is created with
    Set sapFunctions=CreateObject("SAP.Functions")
    Following code snippet shows how I attempt to set exports and add a table row before calling the function module:
    sapFunctions.Connection = sapConnection
    Set sapMaterialUpd = sapFunctions.Add("Z_SD_BAPI_SALES_DATA_UPD")
    With sapMaterialUpd
    <i>'set exports</i>
         .Exports("PA_GLPUPDLEVEL") = "S"
         .Exports("PA_VKORG") = "FI14"
    <i>'append table row</i>
         .Tables("IT_SALES_DATA_UPD").AppendRow
         .Tables("IT_SALES_DATA_UPD")(1, "VKORG") = "FI14"
         .Tables("IT_SALES_DATA_UPD")(1, "MATNR") = "W_3100"
         .Tables("IT_SALES_DATA_UPD")(1, "DATBI") = "99991231"
         .Tables("IT_SALES_DATA_UPD")(1, "DATAB") = "20041231"
         .Tables("IT_SALES_DATA_UPD")(1, "KBETR") = "2222"
         .Tables("IT_SALES_DATA_UPD")(1, "KONWA") = "EUR"
    End With
    <i>'call the function module</i>
    If sapMaterialUpd.Call() = True Then
        <i>'do something with the return tables here...</i>Else
        Debug.Print sapMaterialUpd.Exception
    End If
    The Call() returns <b>FALSE</b> and the exception is <b>"SYSTEM_FAILURE"</b>. The connection also resets.
    The local logfile that the control generates shows that an exception occurs at the point of the call:
    <i>10.02.2005  17:54:20.766 Packing Parameters for Z_SD_BAPI_SALES_DATA_UPD
    Packing Parameter PA_GLPUPDLEVEL.
    Packing Parameter PA_VKORG.
    Packing Table 0.
    Packing Table 1.
      10.02.2005  17:54:20.766 *** Calling  RFC Function 'Z_SD_BAPI_SALES_DATA_UPD'
      10.02.2005  17:54:20.986 RFC CALL status = RFC_SYS_EXCEPTION
      10.02.2005  17:54:20.986 RFC Error: RFC_IO27
      -Status:CODE=CM_DEALLOCATED_NORMAL STATUS=CM_NO_STATUS_RECEIVED DATA=CM_COMPLETE_DATA_RECEIVED ID=69415076
      -Message:connection closed
      -Internal Status:IO HANDLE=23 DRV=EXT LINE=1420 CODE=27 : GET ID=ffff LINE=861 CODE=7
      10.02.2005  17:54:20.986 Function call finished.</i>
    Seen next code snippet. If the Table object is not touched, the function call goes through without any problems:
    sapFunctions.Connection = sapConnection
    Set sapMaterialUpd = sapFunctions.Add("Z_SD_BAPI_SALES_DATA_UPD")
    With sapMaterialUpd
    'set exports
        .Exports("PA_GLPUPDLEVEL") = "S"
        .Exports("PA_VKORG") = "FI14"
        'do <b>not</b> append a table row, for testing only ;-)</b>
    End With
    <i>'call the function module</i>
    If sapMaterialUpd.Call() = True Then
    <i>    'do something with the return tables here...</i>
    Else
        Debug.Print sapMaterialUpd.Exception
    End If
    This code works perfectly when calling the function. It returns TRUE and behaves normally. The function module returns descriptive response text in a table telling that the table was empty, according to the BAPI implementation.
    So is there something special needed here <i>after</i> appending the table row and <i>before</i> making the Call to properly attach the table as a parameter for the function module?
    Can this be a bug in the SAP RFC Control? The version of the wdtfuncs.ocx is 6206.6.45.54.
    Any hints are welcome!

    hi All partner,
    who solved this problem , I meet it too and
    can't clear it.
    SAPfunc := sapfunctions1.Add('z_get_sfcs_dn_mo');    
    SAPitab := sapfunc.tables.item ('I_DNMO');
    SAPitab.appendrow;                                       SAPitab.value(1,'MANDT') := '220'; 
    SAPitab.Value(1,'VBELN') := '2150000001';
    SAPitab.Value(1,'POSNR') := '50';
    SAPitab.value(1,'MATNR') := '19-99999-00'; 
    SAPitab.value(1,'AUFNR') := '921241512001';
    SAPitab.value(1,'DEDAT') := '2005/09/09';
    SAPitab.value(1,'LFIMG') := '100';  
    IF  SAPfunc.call = true then
      begin
      end
    else
        begin
        showmessage('call fail!!') ;
        end;
    end;
    RFC source code as below
    FUNCTION z_get_sfcs_dn_mo.
    ""Local interface:
    *"  TABLES
    *"      I_DNMO STRUCTURE  ZDN_MO
      data: wa type zdn_mo.
      LOOP AT i_dnmo.
        wa-mandt = i_dnmo-mandt.
        wa-vbeln = i_dnmo-vbeln.
        wa-posnr = i_dnmo-posnr.
        wa-matnr = i_dnmo-matnr.
        wa-aufnr = i_dnmo-aufnr.
        wa-dedat = i_dnmo-dedat.
        wa-lfimg = i_dnmo-lfimg.
       modify  zdn_mo from wa.
        insert into zdn_mo values wa.  --dump at here
        commit work.
      ENDLOOP.
    T/C: ST22 error message say at
      insert into zdn_mo values wa. ---dump at here
    the sapfunc.call returns fail.
    Message was edited by: jorry wang

  • Passing request table to Jco function

    Hello Experts,
      We have one requirement where we need to pass the table data from the BLS to SAP Jco Function Module call.  For example we are reading the material numbers from the oracle database and then we need to pass these material numbers to SAP Function Module as a table to read the further details from SAP for the given material numbers. 
      We wrote a custom function module in SAP which accepts the material number as table.  Is it possible to pass the table request parameter to Function Module?  If possible how can we do this?  I tried to pass the XML document to Function Module table, but no luck.
    Thanks
    Mohan

    Mohan,
    in the BLT, configure the JCO action to use you custom function. After pressing enter, MII reads the xml structure of the function (if the connection MII to SAP is working). In the further processing of the BLT, you can fill the RFC table which you can see in the link editor using your query results and the link editor types "AppendXML" or "AppendAfter".
    The following thread might help: [RFC call with multiple input|http://forums.sdn.sap.com/click.jspa?searchID=34070350&messageID=8134561].
    Michael

  • How to pass table in RFC and use that table to populate fields in Mapping?

    Hi,
    I have a requirement FIle to CSV, the file consists of thousand lines...
    What I did first is to put RFC look up per line. It is taking too long to process the message.
    One work around that I could think of is to pass all the values to a table then pass the table to RFC then RFC returns another table, so only one RFC call is required.
    How am I going to use the table returned by the RFC? Please advise how to achieve this scenario.

    Hi,
    I use an ABAP RFC function, which has a parameter that contains many rows.
    In ABAP, I create a two types. First is a ROW - contains some fields, for example, param1, param2, etc.
    Second is a TABLE - contains multiple count of ROW.
    Then I create a Remotecallable Function that has this TABLE-type as parameter (you can make this parameter as INPUT and OUTPUT). So in my mapping program after import RFC Function, I see a message looks like this:
    MY_TABLE_PARAM (Occurences: 1)
    item (Occureces: 0..unbounded)
    param1 (Occureces: 1)
    param2 (Occureces: 1)
    etc (Occureces: 1)
    Regards.

  • Dynamic table in RFC function

    Dear all
    I like to create a dynamic table in a RFC function and pass this table to the calling programm. Is this possible?
    Herbert

    Hi,
    check the Below FM to create Dynamic table in RFC function ..
    RFC_READ_TABLE              --   External access to R/3 tables via RFC
    RFC_GET_TABLE_ENTRIES     --     Read table entries
    Prabhu

  • PB in RFC function declaring table as CHANGING

    Hi all,
    I wrote an RFC function to get data between 2 SAP systems. I've to transmit to this function select-options felds. Therefor I've created a changing parameter in the function  I_LFDAT type RSPARAMS_TT which is a table type with structure RSPARAMS.
    I did it by this way as 'Tables are obsolete' in RFC functions.
    My problem is that by calling the function I've a dump saying ' (ungültiger Datentyp 17)'. This means the parameter is not correct.
    I checked anything and the table I'm sending has the same structure as the receiving parameter
    thanks in advance for your help

    Hello Fred
    I am not really a fan of CHANGING parameters in fm's.
    Since you have the table type RSPARAMS_TT I would recommend to use the following approach:
    DATA:
      lt_seloptions   TYPE rsparams_tt.  " itab with select-options
    " fm signature with 2 parameters:
      IMPORTING
        it_selopts = lt_seloptions
      EXPORTING
       et_selopts = lt_seloptions
    The RFC-fm gets IT_SELOPTS as input, can change them, and returns them as EXPORTING parameter ET_SELOPTS.
    Regards
      Uwe

  • Function module in crystal reports using tables as input

    We had a function module created with a few import parameters. We successfully linked it in crystal and were able to retrieve the data.
    To accommodate the requirement of being able to pick multiple values for some of the parameters, the import parameters were changed to tables. When testing in ECC, we are able to retrieve the data using the function module.
    However, when we're using the same approach as before in crystal reports, we are not able to retrieve the data.
    Is it possible in crystal to pass the input parameters to tables ?
    Any ideas what I might be doing wrong?
    Thanks,
    Mat

    Hi John,
    The solution is very simple. 
    You create a function module in ECC (t-code SE37) that will receive you input parameters, process them, and export a table with your results.
    In the function module you define an input parameter using a CHAR120 data type (ex. PERNR).
    In the function module source code you add logic to split the input parameter
    [SPLIT i_PERNR AT ',' INTO TABLE itab_PERNRS.]
    You then create a crystal report against your function module.
    In your crystal report you create a parameter using type "string" (ex. I_PERNR).
    When you execute the crystal report, you input a comma delimited string in the parameter.
    [00001234,00005678,00009123]
    The function module will receive the string of values, split the string to an internal table, and process accordingly.
    I still have no solution for the 120 character restriction in the CR->ECC interface.  In the meantime, I get around this by creating multiple parameters (PERNR1, PERNR2, PERNR3, etc.). 
    Each parameter is set up to pass a string of 120 characters to ECC.
    The function module is set up to concatenate the parameters before splitting.
    [CONCATENATE PERNR1 PERNR2 PERNR3 into I_PERNR]
    Hope this helps.

  • Pass a table from my webdynpro JAVA application to an RFC in R/3

    Hi All,
    I need to Pass a table from my webdynpro JAVA application to an RFC in R/3. How can I do that?
    Regards
    Sarath

    Hi,
    Please have a look at this thread,
    Pass Table as Input to Adaptive RFC
    Regards,
    Saravanan K

  • Table type in import parameter in rfc function module

    Hi we don't have the table type in our system which exist in the other system which is the import parameter of the rfc function module.so how can we pass the parameter. shell we create the same table type in our system also.it is a table type for a deep structure.

    Hello,
    I donot have access to CRM box I cannot view the FM. You can verify with the CRM counterpart what exactly is the TYPE for param DATA.
    Else you can define a generic internal table (TYPE TABLE) & try calling the FM.
    BR,
    Suhas

Maybe you are looking for

  • Cannot open, uninstall or reinstall itunes

    I am getting increasingly frustrated and am about to abort the Ipod scene. The following happens. When I attempt to open itunes from the desktop or programs, "the action is only valid for products that are currently installed" comes up, and iTunes do

  • Copy and paste pictures from preview to ebay problem

    Hi. I am creating adverts on eBay with my macbook and when I copy and paste a picture from preview, into the body of the advert it works fine and displays fine. I then save the advert and go to view it on my mac and all displays ok. However my proble

  • Call transaction from jco

    Hi, I'm trying to call a transaction from jco. It is successful till a point - transaction actually start but there is not way to read the resulting screen. Is it possible to achieve this at all? Here is a little snippet:                 JCoFunction

  • Smart forms debugging

    Hi experts, Any body pls explain how to debug smartforms ? Is it necessary to write print program for smart forms ?

  • 11.0.3 to 11i

    Hi, Anybody know of a simple guide to the functional differences between the modules within the Finance suite. I have 11.0.3 and would wish to implement (not upgrade) 11i but I have bespoke application on top which hooks in and i need to check the ho