Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member185181
Active Contributor

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.

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

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                  = wa-l_date
*     EXCEPTIONS
*       DATE_EXTERNAL_IS_INVALID       = 1
*       OTHERS                         = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

wa-flag = i_flag.
insert zlk_date from wa.
if sy-subrc 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.

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.

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

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.

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.

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.

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.

Labels in this area