cancel
Showing results for 
Search instead for 
Did you mean: 

Extract Data from R/3 to CRM

Former Member
0 Kudos

Hi Friends,

Pl see the below code.

REPORT ZUPLOAD_VCDATA .

DATA:TABNAM(30) VALUE 'ZAFFIDAVIT_ID'.

DATA: ITAB LIKE TAB512 OCCURS 0.

DATA: FIELDS LIKE RFC_DB_FLD OCCURS 0.

DATA: OPTIONS LIKE RFC_DB_OPT OCCURS 0.

DATA: IT_ZZAFF LIKE ZZAFF OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'RFC_READ_TABLE'

EXPORTING

QUERY_TABLE = TABNAM

  • DELIMITER = ' '

  • NO_DATA = ' '

  • ROWSKIPS = 0

  • ROWCOUNT = 0

TABLES

OPTIONS = OPTIONS

FIELDS = FIELDS

DATA = ITAB

  • EXCEPTIONS

  • TABLE_NOT_AVAILABLE = 1

  • TABLE_WITHOUT_DATA = 2

  • OPTION_NOT_VALID = 3

  • FIELD_NOT_VALID = 4

  • NOT_AUTHORIZED = 5

  • DATA_BUFFER_EXCEEDED = 6

  • OTHERS = 7

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

SELECT * FROM ZZAFF INTO TABLE IT_ZZAFF.

IF NOT IT_ZZAFF[] IS INITIAL.

DELETE ZZAFF FROM TABLE IT_ZZAFF.

IF SY-SUBRC = 0.

INSERT ZZAFF FROM TABLE ITAB.

IF SY-SUBRC = 0.

WRITE:/ 'TABLE UPDATED'.

ELSE.

WRITE:/ 'TABLE NOT UPDATED'.

ENDIF.

ENDIF.

ENDIF.

Using the above code i can update only one table.

If i want to update more than 5o z-tables like this can any body tell me what changes we require in the above code?

And also i want to create one more FM and i will put all the above code in that and i will set it as remote enabled.So that i can call this FM from CRM and update tables in CRM.Can any body suggest better solution for this?

Your help is highly appreciated..

Thanks in Advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member181962
Active Contributor
0 Kudos

HI Jak,

What yo ucan do is to create a Function Module which takes the input as a table of tables that are to be updated.

loop at it_tables.

Call the RFC_READ_TABLE for each table.

update the z table according to your logic.

endloop.

do not forget to the refresh the internal table (itab) that are used for each loop pass.

REgards,

Ravi

Former Member
0 Kudos

Hi Ravi,

Thanks for response.Points are given

But Can you clarify Function Module which takes the input as a table of tables ?

Regards

former_member181962
Active Contributor
0 Kudos

Hi Kumar,

What I meant was, to create a new Function Module in se37.

IN se37 create a function group first and then create a FM

This FM should also be RFC enabled.(There will be a radio-button in the attributes section of the FM.

In the TABLES tab, declare an internal table which is capable of holding names of tables.

In the source code section, you can copy the code (Modified according to my post, after removing the report statements etc.).

Hope it clarifies a bit.

REgards,

Ravi

Former Member
0 Kudos

Hi Jak,

I don't think you can do this with RFC_READ_TABLE.

try to make a wrapper function module which can pass number of tables at a time and inside the code, call the above function module in loop. Hope this should work.

(I am just throwing a stone in darkness..)

I used the RFC_READ_TABLE, but due to my constraints, i am passing single function module every time.