0% found this document useful (0 votes)
39 views16 pages

Conversion and Interfaces

The document outlines the processes for data conversion and interfaces in SAP, detailing the methods for transferring data between SAP and non-SAP systems. It explains the use of Batch Data Communication (BDC) for data uploads, including various methods such as Call Transaction and Session methods, and provides a sample BDC program for uploading customer master data. Additionally, it describes the importance of mapping sheets and the use of field symbols for data handling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views16 pages

Conversion and Interfaces

The document outlines the processes for data conversion and interfaces in SAP, detailing the methods for transferring data between SAP and non-SAP systems. It explains the use of Batch Data Communication (BDC) for data uploads, including various methods such as Call Transaction and Session methods, and provides a sample BDC program for uploading customer master data. Additionally, it describes the importance of mapping sheets and the use of field symbols for data handling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Conversion And Interfaces:

 These are the programs which are used to transfer the data from SAP SAP and SAP 
Non-SAP
 Conversions: This are called as the initial loads which are mainly used during the
implementation go-live and these are one time programs which are used to update the SAP
Data base with the initial data
 Interfaces: These are called as real time data transfer between SAP  SAP and SAP 
Non SAP systems.
 In these conversions we are going see the BDC, LSMW ( For SAP ECC systems) SAP HANA
systems we do have LTMC and LTMOM ( Conversion we can also called as Data migration )
 In these interfaces we are going to see about BAPI ( Which uses RFC FM Technology ) and
IDOC’s and OData services
o ALE Idoc’s  Transfer of data between SAP  SAP system.
o EDI Idoc’s  Transfer the data between SAP  Non SAP Systems.
 SAP  Middle Ware( Such as Mulesoft, TIBCO, SNOWFLAKE, SAP PI/PO )
3rd Party system
o Odata Service  This is a Microsoft tool which will convert the SAP Data in URL
based XML or JSON files
 These URL will be used to get the data directly from the 3rd party system this
we will call it as (PTP Contact( Point to Point contact ) ).
 Which the help of these URL we will CRUD operations
 GET  Is used to get the data from the date base and send back to
3rd party system
 POST  Its is used to create the data in SAP i.e., we will be receiving
the data from the 3rd the party system
 PUT(Update)  these are mainly used to changes the SAP DATA
 PATCH  These is also used to change the SAP Data
 DELETE  This is used to delete the data.
 In all the conversion and Interfaces we will have sit with the 3 rd party team and we need to
design how we are going to receive the file to SAP or how we are going to send the file from
SAP.
 For every interface we will create an excel sheet that sheet we will call it has the mapping
sheet
o Source tab
o Target tab
o Mapping and conversions

BDC  Batch Data communication:

 Its process to receive the data from an SAP system or from a Non SAP System
 Mainly we will use BDC for receiving of data and transferring the same data in SAP to create
the corresponding orders in SAP.
o Different method of BDC
 Call Transaction method
 Session Method
 Direct input method
 LSMW – Legacy system migration work bench
 When ever we are working on BDC we can upload the data on our own way or we can get
the SAP from 3rd party system directly
Conversion And Interfaces:
o Uploading from the Presentation server (Manual upload)
o Uploading the data from the Application Server ( 3rd party will keep the file )
o Downloading to presentation server manually
o Placing the file to the Application server ( to send the data to the 3rd party system )

When ever we are working on BDC, firstly we need to record the Tcode  For doing the Tcode
recording we will use a TCODE  SHDB

Steps for the recording the Tcode:

 Open the Tcode: SHDB


 Click on new recording
 Provide the recording name and provide the Tcode
 Click on start recording
 SAP will open the Tcode in this we need to pass what ever the details we required and click
on save the tcode, automatically SAP show what details which pass in the recording

Call Transaction method:

 In this technology we are going to transfer the data from a flat file or from an application
server file in to SAP by the calling the corresponding transaction.
 This method is used to transfer any master or transactional data.
 This method is used when we have less amount of data (< 10k ~ 15krecords)
 This method is used both synchronous and asynchronous update
 The error message/success messages which will come when we are using this call
transactions we have to store in an Internal table of Type BDCMSGCOLL.*****
 Syntax:
o CALL TRANSACTION <Tcode name >
Using< BDC Data >
UPDATE < A/S>
MODE <A/E/N>
Message into < Message internal table (BDCMSGCOLL).
 BDC Data:
o It’s a structures define the the data base with the following fields
 Program name  Name of the screen program
 Dynpro  Screen number
 Dynbegin  process we are doing
 FNam  SAP filed Name
 FVal  What ever the value we are passing.
o In simple words, it holds all the screen related information and field information to
be transferred to the corresponding fields.
o To prepare the BDC data either we can do it manually by pressing the F1 and get the
corresponding details or we can get the details by recording process which we will
do it in Tcode: SHDB.
 Update: we do have to types of Updates
o Asynchronous  I wont check if the record as completed or not
o Synchronous  I will wait till the first get completed
 Mode: How we are want to process the data
Conversion And Interfaces:
o A  All screen mode  we can see how transferring is happening in SAP.
o E  Error mode  once SAP see the Error the screen will open automatically
o N  No Screen Mode  We can able the see how the process is happening only we
can the if its success or error with the help of BDCMSGCOLL Itab.
o In real time we will always use ‘N’

SHDB  it’s a process which is used to records any SAP application transaction.

My Req is I’m going to get the material master data from 3rd party system, and same details has to
be transferred to SAP

1. From the presentation server  Call transaction method


2. Application Server  Session method

Note: when ever we want to work on a BDC the file format support is .TXT file.

Field symbols: These are like Wa, but field symbol will point to the variable of my ITAB. So if there is
an change in value automatically the value of the ITAB will get changes. We don’t to write a Modify
statement.

Syntax: FILED-SYMBOL: <gfs_(des)> TYPE <Data>.

Material Number Status

50065824 created

Req: Create A recording for Vendor master and customer master data and create own files ( which
contains errors and success message) and write the BDC program using call transaction and display
the details in the output

Fields in the output: Customer number/Vendor number status message

1234 created

1245 error account group is invalid


nd
2 jan 2023

Example program on BDC:


REPORT zc9am_custmaster_upload.

*-- Once uploading is done i need a o/p with customer and message

*-- Types Declarations


TYPES: BEGIN OF gty_upload,
cust_numb TYPE string,
Conversion And Interfaces:
comp_code TYPE string,
acc_grp TYPE string,
name TYPE string,
search TYPE string,
city TYPE string,
pincode TYPE string,
country TYPE string,
language TYPE string,
zone TYPE string,
recoacc TYPE string,
END OF gty_upload,

gty_tt_upload TYPE STANDARD TABLE OF gty_upload,


BEGIN OF gty_output,
cust_numb TYPE kunnr,
message TYPE bapi_msg,
END OF gty_output,
gtt_ty_op TYPE STANDARD TABLE OF gty_output.

*-- Data declarations


DATA: gt_upload TYPE gty_tt_upload,
gv_upload TYPE string,
gt_bdcdata TYPE STANDARD TABLE OF bdcdata,
gt_msg TYPE STANDARD TABLE OF bdcmsgcoll,
gt_op TYPE gtt_ty_op.

*-- Field symbols


*FIELD-SYMBOLS: <GFS_upload> TYPE gty_upload.

*-- Selection screen


PARAMETERS: p_upload TYPE ibipparms-path.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_upload.


CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = sy-repid
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
IMPORTING
file_name = p_upload.

START-OF-SELECTION.
*-- FM to upload the file --> GUI_UPLOAD
gv_upload = p_upload.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_upload
filetype = 'ASC'
has_field_separator = ','
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
Conversion And Interfaces:
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = gt_upload
* CHANGING
* ISSCANPERFORMED = ' '
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

DELETE gt_upload INDEX 1.

LOOP AT gt_upload ASSIGNING FIELD-SYMBOL(<gfs_upload>).


SPLIT <gfs_upload>-cust_numb AT ',' INTO
<gfs_upload>-cust_numb
<gfs_upload>-comp_code
<gfs_upload>-acc_grp
<gfs_upload>-name
<gfs_upload>-search
<gfs_upload>-city
<gfs_upload>-pincode
<gfs_upload>-country
<gfs_upload>-language
<gfs_upload>-zone
<gfs_upload>-recoacc.
ENDLOOP.

BREAK-POINT.
LOOP AT gt_upload ASSIGNING <gfs_upload>.
PERFORM bdc_dynpro USING 'SAPMF02D' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02D-BUKRS'.
Conversion And Interfaces:
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02D-KUNNR'
<gfs_upload>-cust_numb.
PERFORM bdc_field USING 'RF02D-BUKRS'
<gfs_upload>-comp_code.
PERFORM bdc_field USING 'RF02D-KTOKD'
<gfs_upload>-acc_grp.
PERFORM bdc_dynpro USING 'SAPMF02D' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-SPRAS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNA1-NAME1'
<gfs_upload>-name.
PERFORM bdc_field USING 'KNA1-SORTL'
<gfs_upload>-search.
PERFORM bdc_field USING 'KNA1-ORT01'
<gfs_upload>-city.
PERFORM bdc_field USING 'KNA1-PSTLZ'
<gfs_upload>-pincode.
PERFORM bdc_field USING 'KNA1-LAND1'
<gfs_upload>-country.
PERFORM bdc_field USING 'KNA1-SPRAS'
<gfs_upload>-language.
PERFORM bdc_dynpro USING 'SAPMF02D' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-LZONE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNA1-LZONE'
<gfs_upload>-zone.
PERFORM bdc_dynpro USING 'SAPMF02D' '0125'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-NIELS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0340'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVA-ABLAD(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0370'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNEX-LNDEX(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'KNA1-CIVVE'
'X'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0360'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
Conversion And Interfaces:
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0210'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-AKONT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNB1-AKONT'
<gfs_upload>-recoacc.
PERFORM bdc_dynpro USING 'SAPMF02D' '0215'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-ZTERM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0220'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB5-MAHNA'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0230'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-VRSNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_transaction USING 'XD01' <gfs_upload>-cust_numb.
CLEAR: gt_bdcdata.
ENDLOOP.

*-- Display the data

LOOP AT gt_op INTO DATA(gs_op).


WRITE:/ gs_op-cust_numb,
gs_op-message .
ENDLOOP.

FORM bdc_dynpro USING program dynpro.


* CLEAR BDCDATA.
DATA: ls_bdcdata TYPE bdcdata.

ls_bdcdata-program = program.
ls_bdcdata-dynpro = dynpro.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO gt_bdcdata.
ENDFORM.

*----------------------------------------------------------------------*
* Insert field
*
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
DATA: ls_bdcdata TYPE bdcdata.

CLEAR ls_bdcdata.
ls_bdcdata-fnam = fnam.
ls_bdcdata-fval = fval.
APPEND ls_bdcdata TO gt_bdcdata.
Conversion And Interfaces:
ENDFORM.
*&---------------------------------------------------------------------*
*& Form BDC_TRANSACTION
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0446 text
*----------------------------------------------------------------------*
FORM bdc_transaction USING p_0446 TYPE tcode
p_cust_numb TYPE string.

DATA: ls_op TYPE gty_output.

CALL TRANSACTION p_0446 USING gt_bdcdata UPDATE 'A' MODE 'N' MESSAGES INT
O gt_msg.

READ TABLE gt_msg INTO DATA(ls_msg) WITH KEY msgtyp = 'S'.


ls_op-cust_numb = p_cust_numb.
IF sy-subrc = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = ls_msg-MSGID
lang = sy-langu
no = ls_msg-msgnr
v1 = ls_msg-msgv1
v2 = ls_msg-msgv2
v3 = ls_msg-msgv3
v4 = ls_msg-msgv4
IMPORTING
msg = ls_op-message
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
APPEND ls_op TO gt_op.
ENDIF.
ELSE.
READ TABLE gt_msg INTO ls_msg WITH KEY msgtyp = 'E'.
ls_op-cust_numb = p_cust_numb.
IF sy-subrc = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = ls_msg-msgid
lang = sy-langu
no = ls_msg-msgnr
v1 = ls_msg-msgv1
v2 = ls_msg-msgv2
v3 = ls_msg-msgv3
v4 = ls_msg-msgv4
IMPORTING
msg = ls_op-message
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
APPEND ls_op TO gt_op.
ENDIF.
Conversion And Interfaces:
ENDIF.
ENDIF.
BREAK-POINT.
CLEAR: gt_msg, ls_op.
ENDFORM.

How to get the file from the application layer or how to place file in the application layer:

Application Layer  To create the corresponding documents in SAP automatically or to place the
SAP related documents so that the 3rd party can able to consume these filed Automatically.

The Tcode: AL11  we will have different directories where we will get/keep the filed so that either
3rd party or SAP can read these files.

How to create the directories: FILE  these will be created by SAP BASIS in real time

To upload the file / to download the file from application we have different Tcode  ****

1. CG3Z  Upload the file to application server from your local machine
2. CG3Y  download the to the local machine from your application server.

In the program logic what we need to do?

To keep the file in the application server:

OPEN DATA SET <File name>

Loop at the final internal table.

Concatenate statetement to the final variable.

Transfer final variable to application server file path

Endloop.

CLOSE DATASET.

Example code:
OPEN DATASET p_upappl FOR OUTPUT ENCODING DEFAULT IN TEXT MODE.
IF sy-subrc = 0.

LOOP AT gt_msg ASSIGNING FIELD-SYMBOL(<gfs_msg>).


CONCATENATE <gfs_msg>-msgid <gfs_msg>-msgv1 INTO DATA(lv_text).
TRANSFER lv_text TO p_upappl.
ENDLOOP.

ENDIF.
CLOSE DATASET p_upappl

Session Method: this method is used to transfer the large amount of data into SAP, this session
method is basically of 2 steps

1. Creating of session
2. Processing of the session.
Conversion And Interfaces:
To create the session, we do have 3 fm’s

1. BDC_OPEN_GROUP
2. BDC_INSERT
3. BDC_CLOSE_GROUP

Once we call these FM’s SAP Will generate a session with all the data that is going to add into SAP
DB.

To Process the session we do have a Tcode: SM35.

Once the session got created, we need to go the TCode: SM35 and select the corresponding session
and click on process, SAP will creates the corresponding details. To see the errors/success in the
Session it self we have a tab called as processing log.

BDC_OPENGROUP: this fm is used to create a session with the following parameters.

Client no: sy-mandt

User name: sy-uname

Group name: ‘session name’

Keep :‘X’

Hold data: to lock the session.

BDC_INSERT: This FM is used to transfer the data from BDCDATA structure into the session.

We just need to call this FM and provide the tcode name and BDCDATA internal table.

BDC_CLOSEGROUP: this is used close the session which we have created in BDC_OPENGROUP, once
we completed calling these three FM’s SAP will go head and generate the session, to process the
session we will use SM35.

Example program on BDC Session method:


REPORT zc9am_custmaster_up_session.

*-- My req is i will have my customer master details file in application


i need to create the customer master records in SAP
*-- Via session method.

*-- Input file strucutre


TYPES: BEGIN OF gty_input,
cust_numb TYPE string,
comp_code TYPE string,
acc_grp TYPE string,
name TYPE string,
search TYPE string,
city TYPE string,
pincode TYPE string,
country TYPE string,
language TYPE string,
zone TYPE string,
recoacc TYPE string,
Conversion And Interfaces:
END OF gty_input,

gtt_ty_input TYPE STANDARD TABLE OF gty_input.

*-- Data declarations


DATA: gt_input TYPE gtt_ty_input,
gs_input TYPE gty_input,
gv_string TYPE string,
gv_session TYPE apqi-putactive,
gt_bdcdata TYPE STANDARD TABLE OF bdcdata.

*-- selection screen design


PARAMETERS: p_app TYPE string.

*-- Main logic


START-OF-SELECTION.
IF p_app IS INITIAL.
EXIT. " Replaces with message
ENDIF.

OPEN DATASET p_app FOR INPUT ENCODING DEFAULT IN TEXT MODE.


IF sy-subrc = 0.
DO.
READ DATASET p_app INTO gv_string.
IF sy-subrc = 0.
IF sy-index = 1.
CONTINUE.
ENDIF.
SPLIT gv_string AT ',' INTO
gs_input-cust_numb
gs_input-comp_code
gs_input-acc_grp
gs_input-name
gs_input-search
gs_input-city
gs_input-pincode
gs_input-country
gs_input-language
gs_input-zone
gs_input-recoacc.
APPEND gs_input TO gt_input.
CLEAR gs_input.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET p_app.

BREAK-POINT.

*-- BDC with session method


CONCATENATE sy-uname sy-datum INTO gv_session SEPARATED BY '_'.
*-- Create the session
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
Conversion And Interfaces:
GROUP = conv APQ_GRPN( gv_session )
* HOLDDATE = 'X'
KEEP = 'X'
USER = sy-uname
PROG = SY-repid
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

IF sy-subrc = 0.
LOOP AT gt_input ASSIGNING FIELD-SYMBOL(<gfs_upload>).
PERFORM bdc_dynpro USING 'SAPMF02D' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02D-BUKRS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02D-KUNNR'
<gfs_upload>-cust_numb.
PERFORM bdc_field USING 'RF02D-BUKRS'
<gfs_upload>-comp_code.
PERFORM bdc_field USING 'RF02D-KTOKD'
<gfs_upload>-acc_grp.
PERFORM bdc_dynpro USING 'SAPMF02D' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-SPRAS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNA1-NAME1'
<gfs_upload>-name.
PERFORM bdc_field USING 'KNA1-SORTL'
<gfs_upload>-search.
PERFORM bdc_field USING 'KNA1-ORT01'
<gfs_upload>-city.
PERFORM bdc_field USING 'KNA1-PSTLZ'
<gfs_upload>-pincode.
PERFORM bdc_field USING 'KNA1-LAND1'
<gfs_upload>-country.
PERFORM bdc_field USING 'KNA1-SPRAS'
<gfs_upload>-language.
PERFORM bdc_dynpro USING 'SAPMF02D' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-LZONE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
Conversion And Interfaces:
PERFORM bdc_field USING 'KNA1-LZONE'
<gfs_upload>-zone.
PERFORM bdc_dynpro USING 'SAPMF02D' '0125'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-NIELS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0340'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVA-ABLAD(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0370'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNEX-LNDEX(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'KNA1-CIVVE'
'X'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0360'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0210'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-AKONT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNB1-AKONT'
<gfs_upload>-recoacc.
PERFORM bdc_dynpro USING 'SAPMF02D' '0215'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-ZTERM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0220'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB5-MAHNA'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0230'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-VRSNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'XD01'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
* SIMUBATCH = ' '
Conversion And Interfaces:
* CTUPARAMS = ' '
TABLES
dynprotab = gt_bdcdata
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
IF sy-subrc = 0.
CLEAR gt_bdcdata.
ENDIF.

ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

ENDIF.

FORM bdc_dynpro USING program dynpro.


* CLEAR BDCDATA.
DATA: ls_bdcdata TYPE bdcdata.

ls_bdcdata-program = program.
ls_bdcdata-dynpro = dynpro.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO gt_bdcdata.
ENDFORM.

*----------------------------------------------------------------------*
* Insert field
*
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
DATA: ls_bdcdata TYPE bdcdata.

CLEAR ls_bdcdata.
ls_bdcdata-fnam = fnam.
ls_bdcdata-fval = fval.
APPEND ls_bdcdata TO gt_bdcdata.

ENDFORM.
Conversion And Interfaces:
Me req: I have the customer file in my application server, I need to process this file from the
application and create the customer is SAP.

1. The tcode is SHDB


2. Tcode for creating a customer: XD01.
3. Create the file and then we need upload the file to my application server: CG3Z
4. We must run the program, SAP will generate a session
5. SM35 and process the session.

Direct Input Method: This method is also used upload the values into SAP.

We will rarely use this method to upload the data in SAP.

The Limitations are:

1. Example file struc is not been provided by SAP, i.e., as a developer we need to understand
the program and we need to create the file
2. With the help of this method we cant able to determine whether the record has been
created successfully or not bcaz SAP will not provide any logs.
3. With the help of method we cant able to fill the custom filed of a application.

For example if we need to upload the material master data then we will use the program
RMDATIND.
Conversion And Interfaces:

You might also like