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
Similar Messages
-
Rfc function with table parameter
Hey,
im trying to call a RFC function from Webdynpro where i have to give a table as parameter. When creating the table i following exception:
java.lang.IllegalArgumentException: model object must not be null
at com.sap.tc.webdynpro.progmodel.context.ModelNodeElement.<init>(ModelNodeElement.java:66)
at be.vrt.wdp.IPublicPlanning_Validation$IP_Update_TableElement.<init>(IPublicPlanning_Validation.java:3667)
at be.vrt.wdp.IPublicPlanning_Validation$IContextNode.doCreateElement(IPublicPlanning_Validation.java:87)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.createElement(NodeInfo.java:854)
at com.sap.tc.webdynpro.progmodel.context.Node.createElementInternal(Node.java:1346)
at com.sap.tc.webdynpro.progmodel.context.Node.createElement(Node.java:1365)
at be.vrt.Planning_Validation.executeRFC_Z_Whatson_Sap_Update_Transmissio_Input(Planning_Validation.java:265)
The code from Planning_Validation (controller class)
public void executeRFC_Z_Whatson_Sap_Update_Transmissio_Input( java.util.Vector nodes, java.lang.String display_value )
//@@begin executeRFC_Z_Whatson_Sap_Update_Transmissio_Input()
Z_Whatson_Sap_Update_Transmiss_Input transmiss = new Z_Whatson_Sap_Update_Transmiss_Input();
//transmiss.addP_Update_Table(new Zmm_S_Update_Status_Table());
wdContext.nodeZ_WHATSON_SAP_UPDATE_TRANSMIS().bind(transmiss);
//wdContext.createP_Update_TableElement(new Zmm_S_Update_Status_Table());
for (int i = 0; i < nodes.size(); i++){
String [] node = (String[])nodes.get(i);
IWDNodeElement el = wdContext.nodeP_Update_Table().createElement();
el.setAttributeValue("Won_Id", node[0]);
el.setAttributeValue("Won_Status", node[1]);
el.setAttributeValue("Display_Status", display_value);
try {
// Call remote function
wdContext.currentZ_WHATSON_SAP_UPDATE_TRANSMISElement().modelObject().execute();
// synchronise data in context with data in model
wdContext.nodeOutput().invalidate();
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Line 265 is where i call wdContext.nodeP_Update_Table().createElement();
Any ideas ?
grtz,
HannesHey, thanks .. i managed to solve it
this is the code:
//@@begin javadoc:executeRFC_Z_Whatson_Sap_Update_Transmissio_Input()
/** Declared method. */
//@@end
public void executeRFC_Z_Whatson_Sap_Update_Transmissio_Input( java.util.Vector nodes, java.lang.String display_value )
//@@begin executeRFC_Z_Whatson_Sap_Update_Transmissio_Input()
Z_Whatson_Sap_Update_Transmiss_Input transmiss = new Z_Whatson_Sap_Update_Transmiss_Input();
wdContext.nodeZ_WHATSON_SAP_UPDATE_TRANSMIS().bind(transmiss);
for (int i = 0; i < nodes.size() ; i++){
String [] node = (String[])nodes.get(i);
Zmm_S_Update_Status_Table updEl = new Zmm_S_Update_Status_Table();
updEl.setWon_Id(node[0]);
updEl.setWon_Status(node[1]);
updEl.setDisplay_Status(display_value);
transmiss.addP_Update_Table(updEl);
wdComponentAPI.getMessageManager().reportSuccess("wohoo!");
try {
// Call remote function
wdContext.currentZ_WHATSON_SAP_UPDATE_TRANSMISElement().modelObject().execute();
// synchronise data in context with data in model
wdContext.nodeOutput().invalidate();
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
//@@end -
Functional module /table vs changing parameter
Hi ,
I am working in release 6.0 .
In program i have internal table and i have to pass it's content to FM. In FM I tried to declare TABLE parameter but it was not accepted because table parameter is obsolete. I declare Change parameter. like it was suggested in error message dialog.The parameter is declared after same table like internal table from program .
When I run program I saw that only one record is passed to FM parameter. Question is how to pass whole body content of IT to FM parameter .
Thanks
Source code /
- gt_cartscan & cartscan are created after the same DB table.
loop at scantbl.
gt_cartscan-zzcartag = scantbl-zzcartag.
append gt_cartscan.
endloop.
call function 'Z_WM_UPD_ZDTS_GR'
changing
cartscan = gt_cartscan.Hi
See the below example:
types:begin of ty_employee,
pernr type pa0002-pernr,
begda type pa0002-begda,
endda type pa0002-endda,
vorna type pa0002-vorna,
nachn type pa0002-nachn,
end of ty_employee.
*// Declate a types for employee data table
types:tt_employee type standard table of ty_employee.
*//Declate a workarea to hold the Employee data
data: gf_employee type ty_employee.
*Declate a table to hold the Employee data
data: gt_employee type tt_employee.
Letz say the gt_employee has 5 records when it is populated.
Then you have all the records of gt_employee when called through below perform in the subroutine.
perform shuffle_records changing gt_employee.
*& Form SHUFFLE_RECORDS
text
<--P_GT_EMPLOYEE[] text
form shuffle_records changing p_gt_employee type tt_employee.
endform. " SHUFFLE_RECORDS
Regards
Raj -
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.
ThanksI 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 -
Hi,
I am creating one RFC in that i need to declare one import parameter whose length is is.
when i am giving like i_exclide like kna1-loevm is not accepting.
when i am declaring like i_exclude like char1.
it is giving error like reference parameters are not allowed in RFC.
anybody can tell me how to declare.
thanks,
maheedharHi,
Go to se37,
Give ur RFC function module and click change.
Go to "Import" tab , you can find a checkbox "Pass Value" , check this checkbox.
Now you try to compile the code , you wont get that error.
Reward points for useful answer.
Thanks,
Jey -
In FM tables And Changing r bu default Pass by value or ref
hi friends ,
In Function Module Tables And Changing are by default Pass by value or reference.
with regards.hi all,
i got the answer from abap in 21 days (page No 591),
changing parameters are passed by value and result.
internal tables are pass by reference. -
XML Problem: RFC Function with XSTRING or raw table (4.6C)
hello,
I have a serialized XML-Document, i.e. a xstring or a raw table. Now I want to write a RFC Function Module that sends/receives this data. I'm running on 4.6C. Is this possible under 4.6C?
I've managed to write a Function module with appropriate parameters (XML in a raw table) that works fine, but I can't declare it as a <b>remote</b> function module. Is there a standard method of importing binary XML Data via RFC in 4.6C?
Regards,
Alexander SchulzCan you please share the answer?
-
Dear all
I like to create a dynamic table in a RFC function and pass this table to the calling programm. Is this possible?
HerbertHi,
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 -
RFC Function module needed for getting table details in APO from R/3
Hi,
I need a RFC function module where I can write a query from R/3 to access APO server database table and get the necessary records.
Regards
MacPossible ways
1. Call fm RFC_READ_TABLE and give destination and table name ( But i am not sure how it will work SCIF enviornment of APO)
or
2. Create a custom function module in APO side and call from R/3 side using destnation option
a® -
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,
AbhishekHi 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. -
RFC function to return number of records in a table
Hello,
I am looking for a RFC function to return just the number of records in a SAP table.
I don't want to use RFC_READ_TABLE since it takes too long when I query a big table.
Any advices?Check the following post: Link: [Re: RFC function module to count records in DB table;
-
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 -
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? -
How do I retrieve records from a table using JCO RFC Function Call
Hi
I am totally new to SAP Java Progamming. And I would like to know if I am writing code correctly. I read some tutorials in the Internet but I am still not sure if I am doing it the correct way.
This is what my vendor has given me.
My question is whether this is the correct optimum way to do get the customer detail based on an array of input values for the customer reference number.
Input:
I_CUSTNO - Any number customer IDs. This is a table similar to I_CUSTDETL
Output:
Structure name: I_CUSTDETL
Note: The CUSTID column has been added in the structure to identify the address of the relevant customer id
Field details:
Field Name Data Type Length
CUSTID Character 10
COMPANYNAME Character 40
EMAIL Character 40
This is my code:
JCoFunction function = connect.getFunction("Z_GET_CUSTOMER");
JCoTable cust = function.getTableParameterList().getTable("I_CUSTNO");
cust.appendRow();
cust.setValue("CUSTID", "10000700");
cust.appendRow();
cust.setValue("CUSTID", "10000701");
cust.appendRow();
cust.setValue("CUSTID", "10000702");
connect.execute(function);
JCoTable table = function.getTableParameterList().getTable("I_CUSTDETL");
System.out.println("Table size: " + table.getNumRows());
for (int i = 0; i < table.getNumRows(); i++, table.nextRow()) {
String custid= table.getValue("CUSTID").toString();
String companyname = table.getValue("COMPANYNAME").toString();
String email = table.getValue("EMAIL").toString();
System.out.println("----
System.out.println("Record Number::" + i + "::");
System.out.println("----
System.out.println("Value custidis::" + custid+ "::");
System.out.println("Value companyname is::" + companyname + "::");
System.out.println("Value email is::" + email + "::");Hi,
Answer to your question :whether this is the correct optimum way to do get the customer detail based on an array of input values for the customer reference number? is
YES.
Regards,
Ganga -
RFC function not displaying information correctly in internal table
Hi all. I have created a RFC function that interrogates another SAP system and collects data from that system. The problem i have noticed is that some fields like Unit of measure, values (currency) are not interpreted correctly in the target system and are shown as odd characters (@#$!@@$#%).
I have checked and both systems are UNICODE. Is there a way to correct this problem ? Are the systems using different code pages ?
Regards,
Cristian.Hi Cristian,
You need to verify the following:
1. The common Unit of Measure, Currency, etc. are available as part of the installation package. If there is an additional UoM (e.g. specific to a material), then, it must have added as a Master in the source system. In such a case, you will have to sync. the masters before executing the RFC.
2. There is also a possibility of the Patch levels being different which may have additional UoM or Currencies. You should speak to the BASIS Team for this.
Regards,
Pranav.
Maybe you are looking for
-
How to run logic one month at a time
Hi All I got a script logic funding.which contains 6 sub logics in it. for ex: funding calc tax lgf initialize lgf fund_ob lgf funding lgf dirtax lgf reservers lgf. my problem is if i run the above logic for full year my balance sheet is out of balac
-
my itunes in pc fails to secure link with itunes store it shows the process bar it automatically quits the process it also does not shows any on the screen. i am using windows xp service pack 3. what shoul i do? Diagnostics test Microsoft Windows XP
-
Wi-Fi shows joined in settings, but no icon on top and not working
Since what I believe to be after the 1.1.1 install, I can no longer connect to my home wi-fi, though my wife's iphone still does. I have reset x 2-3, tried to renew license, and even had our I.T. guy look at the problem to no avail. In settings, it s
-
Pdf email attachments won't open
After upgrading to IOS 7 the pdf email attachments are not opening...just says "loading" and never loads.
-
The scanner software will not load when installed with HP installer wizard. I have download the software many times and nothing seems to work. It say HP Photosmart needs to be reloaded. I have done that many times does not work. Print and Scan Dr.