‎2014 May 18 8:11 AM
Hi Experts,
I have written a RFC enabled FM in ECC which will accept a table through TABLES parameter in which two columns will be filled and will update the rest two columns. I am using modify statement to update table from work area. When I am calling this FM from APO system, I am not receiving the updated table back. I am passing table with two columns filled in each row and I am getting back as it was passed. Please let me know how to get modified table from RFC enabled FM.
Thanks in advance!
‎2014 May 18 9:27 AM
Hi,
If I understand you want to change the input parameter so I the "Changing" parameters:
Using Java:
try {
final JCoFunction function = repository.getFunction("Y_R_EITAN_TESTS_05");
{
final JCoTable table = function.getChangingParameterList().getTable("IT_SCARR");
table.appendRow();
table.setValue("CARRID", "AA");
function.execute(destination);
MyDumper.dumpFunction(function);
}
} catch (final Exception exception) {
exception.printStackTrace();
}
On SAP:
Regards.
‎2014 May 18 9:08 AM
Hi Manju
Most probably it is a coding error. You want to update database as well as internal table and i think you have issue in this. Please share you sample code as an attachment
Nabheet
‎2014 May 18 2:18 PM
Hi Nabheet, Code block is given below and calling is explained in other replys I made. I am not updating any database tables.
TYPES: BEGIN OF lty_marc,
matnr TYPE matnr,
werks TYPE werks,
mmsta TYPE dismm,
END OF lty_marc.
TYPES: BEGIN OF lty_marm,
matnr TYPE matnr,
umrez TYPE umrez,
END OF lty_marm.
DATA: lt_marc TYPE STANDARD TABLE OF lty_marc,
lt_marm TYPE STANDARD TABLE OF lty_marm,
lx_marc TYPE lty_marc,
lx_marm TYPE lty_marm,
lx_materials TYPE zmpts_snp_mat.
FIELD-SYMBOLS: <st_materials> LIKE LINE OF ct_materials.
BREAK NAGMAN02.
IF ct_materials IS NOT INITIAL.
SELECT matnr
werks
mmsta
INTO TABLE lt_marc
FROM marc
FOR ALL ENTRIES IN ct_materials
WHERE matnr = ct_materials-matnr
AND werks = ct_materials-werks.
SELECT matnr
umrez
INTO TABLE lt_marm
FROM marm
FOR ALL ENTRIES IN ct_materials
WHERE matnr = ct_materials-matnr.
LOOP AT ct_materials ASSIGNING <st_materials>.
READ TABLE lt_marc
INTO lx_marc
WITH KEY matnr = <st_materials>-matnr"lx_materials-matnr
werks = <st_materials>-werks."lx_materials-werks.
<st_materials>-mmsta = lx_marc-mmsta.
READ TABLE lt_marm
INTO lx_marm
WITH KEY matnr = <st_materials>-matnr."lx_materials-matnr.
<st_materials>-umrez = lx_marm-umrez.
ENDLOOP.
ENDIF.
‎2014 May 18 9:27 AM
Hi,
If I understand you want to change the input parameter so I the "Changing" parameters:
Using Java:
try {
final JCoFunction function = repository.getFunction("Y_R_EITAN_TESTS_05");
{
final JCoTable table = function.getChangingParameterList().getTable("IT_SCARR");
table.appendRow();
table.setValue("CARRID", "AA");
function.execute(destination);
MyDumper.dumpFunction(function);
}
} catch (final Exception exception) {
exception.printStackTrace();
}
On SAP:
Regards.
‎2014 May 18 1:53 PM
Hi Eitan,
I tried this. Now actual parameters are not passed to formal pameters in ECC at all. I am calling from APO as below.
CALL FUNCTION 'ZMPTS_SNP_DATA_GET' DESTINATION lx_rfc_dest
CHANGING
ct_materials = lt_materials.
lt_materials has two columns filled and two blank.
Is this the right way of calling when it is pass by value? If yes, please help me understanding why values are not passed.
‎2014 May 18 4:05 PM
Hi,
I do not know what is APO is it SAP also ?
If this is the case you need to have the same function on both server.
(Maybe on the client side you only need the interface I did not check this).
Please check "ZMPTS_SNP_DATA_GET" at the server side is it working ? (As local function no "DESTINATION lx_rfc_dest") ?
Try to create a function like "Y_R_EITAN_TESTS_05" on both server see if this is working , if yes you have a working "environment" . Then the only thing left to do is to do the same with your data & logic.
Regards.
‎2014 May 18 4:41 PM
Hi, Thanks for your interest.
APO is SAP system. I cannot have function ZMPTS_SNP_DATA_GET in APO system because I don't have the tables and fields needed in APO system. I tested this function in ECC by giving the data manually and it is working fine.
Only problem now is when I am making a call from APO, values not appearing in actual parameter(table) in ECC. It was appearing when I was using TABLES parameter. It stopped appearing after I changed to CHANGING parameter with pass by value ticked as per your suggestion. Am I missing something?
Thanks!
‎2014 May 18 5:00 PM
Hi,
So I guess that in APO you have some user define structures as parameters ?
The same structures also define at ECC .
Can you use import and export instead of changing ?
You read from input table and write to output table .
Regards.
‎2014 May 18 1:38 PM
Hi Manjunatha,
You should define the table in CHANGING parameter of FM.
Check it and retest it.
Regards,
Sudeesh Soni
‎2014 May 18 1:57 PM
Hi Sudeesh,
I tried CHANGING which will only allow me to pass by value for table. Now when I am calling like below, data is not passed to ECC FM.
CALL FUNCTION 'ZMPTS_SNP_DATA_GET' DESTINATION lx_rfc_dest
CHANGING
ct_materials = lt_materials.
Can you see if something is problem in calling or something.
Thanks in advance!
‎2014 May 19 7:46 AM
Hi Manhunatha,
Please check whether changing parameter type is same in both source and target system?
Regards,
Sudeesh Soni
‎2014 May 19 9:32 AM
Hi,
You have to set update flag = 'X'. while updating thru your RFC eneble FM.
Thanks,
Prarthan