This just an sample to demonstrate data transfer to SAP systems using RFC from Data Services.

To server the purpose of this blog, I am going to transfer data to SAP BW system from Data Services.

Sometimes we may need to load some lookup or reference data into SAP BW system from external sources.

Instead of creating a data source, this method will directly push data to the database table using RFC.

Below, will explain the steps that I used to test the sample.

1) Create a transparent table in SE11.

/wp-content/uploads/2014/03/1_409720.png

2) Create a function module in SE37 with import and export parameters.

/wp-content/uploads/2014/03/2_409754.png

/wp-content/uploads/2014/03/3_409755.png

3) The source code for the FM goes below.

FUNCTION ZBODS_DATE.
*”———————————————————————-
*”*”Local Interface:
*”  IMPORTING
*”     VALUE(I_DATE) TYPE  CHAR10
*”     VALUE(I_FLAG) TYPE  CHAR10
*”  EXPORTING
*”     VALUE(E_STATUS) TYPE  CHAR2
*”———————————————————————-

data: wa type zlk_date.

if not I_DATE is INITIAL.
clear wa.
CALL FUNCTION ‘CONVERT_DATE_TO_INTERNAL’
EXPORTING
DATE_EXTERNAL                  = i_date
* ACCEPT_INITIAL_DATE            =
IMPORTING
DATE_INTERNAL                  = wal_date
*     EXCEPTIONS
*       DATE_EXTERNAL_IS_INVALID       = 1
*       OTHERS                         = 2
.
IF SYSUBRC <> 0.
* Implement suitable error handling here
ENDIF.

waflag = i_flag.
insert zlk_date from wa.
if sysubrc ne 0.
update zlk_date from wa.
endif.

e_status = ‘S’.
endif.

ENDFUNCTION.


4) Remember to set the attribute of the FM to RFC enabled, otherwise it will not be accessible from Data Services.

/wp-content/uploads/2014/03/4_409756.png

5)  Make sure both the custom table and function module are activated in the system.

6) Login to DS Designer,Create new data store of type “SAP APPLICATION” using required details.

7) In the Object library, you will see an option for Functions.Right click on it and choose “Import By Name”.Provide the Function module name you just created in the BW system.

/wp-content/uploads/2014/03/8_409757.png

8) Now, build the job with source data, a query transform and an output table to store the result of function call.

/wp-content/uploads/2014/03/5_409758.png

9) Open the query transform editor, do not add any columns, right click and choose “New Function Call”.

10) The imported function will be available in the list of available objects. Now, just choose and required function and provide input parameters.

/wp-content/uploads/2014/03/9_409759.png

11) Note that for some reason, Data Services doesn’t recognizes DATS data type from SAP. Instead, you have to use as CHAR and do the conversion latter.

/wp-content/uploads/2014/03/6_409760.png

Hence, I am using to_char function to do the conversion to character format.

12) Now, save the Job and Execute. Once completed, check the newly created table in BW system to see the transferred data.

/wp-content/uploads/2014/03/7_409761.png

As this is just an sample, an RFC enabled function module can be designed appropriately to transfer data to any SAP system. The procedure is similar for BAPIs and IDOCs. You just need to provide the required parameters in correct format and it works.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply