on 08-30-2007 7:33 AM
HI,
I am doing RFC-XI-JDBC Scenario, where I have to poll the contents of my Ztable in SAP to Oracle.
The appraoach i am using here is :
1. Created a FM with import parameters as the fields of my Ztable and without any export parameter or source code.
2. Created a report to call that FM in background. The code of my report is as follows :
************************REPORT***********************************************************
Data: it_zrfc_read_table type table of zrfc_read_table,
wa_zrfc_read_table like line of it_zrfc_read_table.
PARAMETERS: tab_name like DD02L-TABNAME.
Data: l_tabname type DD02L-TABNAME.
At selection-screen.
select single tabname from DD02L into l_tabname where tabname = tab_name.
if sy-subrc <> 0.
message 'incorrect table name' type 'E'.
endif.
start-of-selection.
select * from (tab_name) into corresponding fields of table it_zrfc_read_table.
loop at it_zrfc_read_table into wa_zrfc_read_table.
CALL FUNCTION 'ZRFC_READ_TABLE2XI'
IN BACKGROUND TASK DESTINATION 'ORACLEGIS_RFC_SENDER'
EXPORTING
valve_id = wa_zrfc_read_table-valve_id
equnr = wa_zrfc_read_table-equnr
ernam = wa_zrfc_read_table-ernam
invnr = wa_zrfc_read_table-invnr
groes = wa_zrfc_read_table-groes
elief = wa_zrfc_read_table-elief
gwlen = wa_zrfc_read_table-gwlen
gwldt = wa_zrfc_read_table-gwldt
serge = wa_zrfc_read_table-serge
typbz = wa_zrfc_read_table-typbz.
endloop.
commit work.
********************************************************************************************
NOw my problem is that although I am able to send a table with a single record, but when my records > 1, it is not able to poll.
Please guide me what can be altered in the code or any other suggestion.
Thanks,
Puneet
Please suggest me if the Commit work statement is to be written before endloop or after endloop?
Prompt reply will be highly aprreciated.
Thanks,
Puneet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Instead of writing your function module in loop, first u execute it. take the data whatever is required in internal table. then create a dummy function module, pass this internal table to dummy FM. Dont write any code in dummy function module.
Now call this dummy function module in your code with BACKGROUND TASK and RFC destination. Also configure your scenario in XI using this dummy function module.
In case of any query, get back to me.
-Gouri
Award points if helpful.:)
Thanks Gouri, it was indeed a very helpful suggestion.
NOw, I would like to update few things here : the code i have pasted here is of my report which is calling the dummy FM.
NOw my problem is that if i create an internal table and pass the same to dummy FM then that dummy FM would not have fields which i need to map with my Target data type.
But if you do have a work around, please let me know .
Gouri,
Having said that Add the required fields in the internal table, did u mean to include the required fields in the internal table and the passing this internal table to the dummy FM with the required importing parameters.
The importing paramters of my dummy FM are :
VALVE_ID
EQUNR
ERNAM
INVNR
GROES
ELIEF
GWLEN
GWLDT
SERGE
TYPBZ
Can u also suggest me how can i pass an internal table into this dummy FM.
-- Puneet
Create a ztable in SE11 which will be having all the fields that are used in mapping. Now in report create your itab which will be of type this ztable.
Now first run your actual FM and fill this itab with target data. Now create your Dummy FM. this will be Remote enabled. in this go to table tab. add your itab over there and give the type ZTABLE. Dont write any code in this. Just activate it.
Now call this Dummy function module in your code with RFC. and use same dummy FM in IR too.
Hope u r clear.
In case of any doubt plz get back.
Warm Regards,
Gouri
Gouri,
I am doing exactly the same as you said..except using a report instead of a FM for calling the dummy RFM.
NOw, my question is If i import the Remotely enabled FM (with only table tab = itab) in my IR then would i be able to see all my fields there or just the table name in request tab of this RFM.
Puneet
Youre right,
if you import the FM in IR you´ll see the complete structure.
create a mapping, which creates a sqlstatement for all entries of the table
have a look at <a href="https://answers.sap.com/people/alessandro.berta/blog/2005/10/04/save-time-with-generalized-jdbc-datatypes:///people/alessandro.berta/blog/2005/10/04/save-time-with-generalized-jdbc-datatypes
I did it so and it works fine.
Christian
steps are as follows:
1. Call actually FM in report.
2. get the data in itab.
3. pass itab to dummy FM (In same report u shd call this dummy FM with RFC destination)
4. write commit work.
5. Execute the report.
After this do the necessary dev in IR and ID, and run your scenario.
It should work.
-Gouri
Thanks fellow SDN members, I solved this problem from your inputs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gouri,
I have one more query here.
I have done all the settings as suggested by you.
But now the occurences of the fields of my RFC (Sender) is 0...1 where it should be 1...unbounded.
Even my key field in the the table 0..1.
Please tell me how/where can i modify these occurences of source structure (RFC)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Puneet,
In your dummy RFC, in the Tables tab you must have specified your Itab and corresponding table. There you will find one optional checkbox. If you have not checked then it is mandatory. And if you click that checkbox then it bcome 0 to unbounded.
I think this is what u r looking for.
-Gouri
Hi Gouri,
As even i was doing same scenario wanted to know that as u said in order to make the fields appear 1..1 (mandatory ) table parameter in RFM shud be unchecked..thats right but will it make fields of that table mandatory in IR also?
if not then in case i hav one key field in that table how cna i make it mandatory in IR (se11 has got it as mandatory one),
also one doubt that, as per above discussion we hav to use 2 FM (FM, 1 RFM) in the report,
can u pls help in understanding wat actually is the use of FM created in rep as my selection screen passes the table name and select query populates the internal table that is used in RFM,
thanks
Hi Gouri,
As u said in order to make the fields appear 1..1 (mandatory ) table parameter in RFM shud be unchecked..thats right but will it make fields of that table mandatory in IR also?
if not then in case i hav one key field in that table how cna i make it mandatory in IR (se11 has got it as mandatory one),
Regards,
Puneet
Hi,
Instead of calling RFC many times I would:
1) create RFM with only one import parameter
TYPE your_table type
2) call only once RFM in the report:
CALL FUNCTION 'ZRFCNAME'
IN BACKGROUND TASK
DESTINATION 'RFCDEST'
EXPORTING
pt_table = i_table.
COMMIT WORK AND WAIT.
This will also improve the performance.
Regards,
Jakub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.