Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Extract Data from R/3 to CRM

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.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question