Skip to Content
avatar image
Former Member

RFC-XI-JDBC Scenario: Help with RFC code

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 30, 2007 at 07:24 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 30, 2007 at 07:45 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Jakub,

      NOw if i go by this approach, then how would i map this table(source) with that of target message type( which happens to be Oracle in this case).

  • avatar image
    Former Member
    Aug 30, 2007 at 11:03 AM

    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)?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • avatar image
    Former Member
    Nov 14, 2007 at 05:13 AM

    Thanks fellow SDN members, I solved this problem from your inputs.

    Add comment
    10|10000 characters needed characters exceeded