0% found this document useful (0 votes)
101 views9 pages

BDC Call Transaction Method

This document describes the call transaction method for BDC (Batch Data Communication) in SAP. It is used to transfer or upload data from legacy systems to SAP in bulk. It allows for synchronous processing and database updates of individual transactions. Some key steps include creating a recording using transaction code SHDB, transferring the recording to ABAP Editor (SE38), defining type pools, and calling functions like F4_FILENAME and TEXT_CONVERT_XLS_TO_SAP to upload Excel files or GUI_UPLOAD for text files. Sample code is provided to demonstrate uploading customer master data from an Excel file using the call transaction method.

Uploaded by

Vishu N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views9 pages

BDC Call Transaction Method

This document describes the call transaction method for BDC (Batch Data Communication) in SAP. It is used to transfer or upload data from legacy systems to SAP in bulk. It allows for synchronous processing and database updates of individual transactions. Some key steps include creating a recording using transaction code SHDB, transferring the recording to ABAP Editor (SE38), defining type pools, and calling functions like F4_FILENAME and TEXT_CONVERT_XLS_TO_SAP to upload Excel files or GUI_UPLOAD for text files. Sample code is provided to demonstrate uploading customer master data from an Excel file using the call transaction method.

Uploaded by

Vishu N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

BDC call transaction method

BDC (Batch Data Communication):


       It Transfers or upload the data’s(records) from Legacy(Non SAP)
system to SAP system.
 Batch input means bulk amount of data.
It is a programming method. So technical consultants are use this method and
others using LSMW.
Types: It has two types
 1. CALL TRANSACTION METHOD.
 2. SESSION METHOD (C L A S S I C A L ) .
Call Transaction method:
          1. synchronous Processing. (Data or record)
2. Synchronous and Asynchronous database updates.
3. Transfer of data for individual transaction.
4. This is more faster than session method.
5. Not suited for bulk transfer.
6. No automatic error handling.
7. Error logs are not created.
8. The value of sy-subrc returned to 0 if successful.
9. The system won't store data for later processing. This is online
processing. 
10. It can handle small amount of data.
11. Function modules :
F4_FILENAME ( Open the legacy file [.txt or .xls]) .
TEXT_CONVERT_XSL_TO_SAP ( Convert the .xls file to sap
format) : Using for only .xls files.
GUI_UPLOAD : Using for only .txt files.
 
Step-by-Step creation:
Create the recording :
      Using   T-code SHDB.
      Click new recording then put the recoding name
and transaction code (xd01 – customer, xk01- vender, mm01 –
material master creation)  then click continue or press enter.
      Thereafter put all the required data’s into
the transaction screen.  Note:Must provide the mandatory fields
data’s.
      After finished recording to save and come back.
      Select your record then click program button.
Transfer the recording to ABAP Editor (SE38).
      Put the program name in the pop up window then click continue or
press enter.
      Automatically open the report in se38.
Define the type-pools and call the function modules.
 
Example 1: (call transaction to upload .xls file data) customer master
creation
REPORT ZVAIGUNDARAJABDC2
       NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE BDCRECX1.

TYPE-POOLS TRUXS. “This is use to data conversion in


TEXT_CONVERT_XLS_TO_SAP.  

***************internal table**************************************
DATA: BEGIN OF RECORD OCCURS 0,
* data element: BUKRS
        BUKRS_001(004),
* data element: KTOKD
        KTOKD_002(004),
* data element: NAME1_GP
        NAME1_003(035),
* data element: LAND1_GP
        LAND1_004(003),
* data element: REGIO
        REGIO_005(003),
* data element: SPRAS
        SPRAS_006(002),
* data element: CIVVE
        CIVVE_007(001),
* data element: AKONT
        AKONT_008(010),
      END OF RECORD.

*** End generated data section ***

DATA IT_RAW TYPE TRUXS_T_TEXT_DATA.
PARAMETERS PATH TYPE RLGRAP-FILENAME OBLIGATORY. 
AT SELECTION-SCREEN ON VALUE-REQUEST FOR PATH.
  CALL FUNCTION 'F4_FILENAME'
   EXPORTING
     PROGRAM_NAME        = SYST-CPROG
     DYNPRO_NUMBER       = SYST-DYNNR
     FIELD_NAME          = 'PATH'
   IMPORTING
     FILE_NAME           = PATH
            .
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
  EXPORTING
*   I_FIELD_SEPERATOR          =
*   I_LINE_HEADER              =
    I_TAB_RAW_DATA             = IT_RAW
    I_FILENAME                 = PATH
  TABLES
    I_TAB_CONVERTED_DATA       = RECORD
* EXCEPTIONS
*   CONVERSION_FAILED          = 1
*   OTHERS                     = 2
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
START-OF-SELECTION.
LOOP AT RECORD.

  PERFORM OPEN_GROUP.

    PERFORM BDC_DYNPRO      USING 'SAPMF02D' '0100'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RF02D-KTOKD'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'RF02D-BUKRS'
                                  RECORD-BUKRS_001.
    PERFORM BDC_FIELD       USING 'RF02D-KTOKD'
                                  RECORD-KTOKD_002.
    PERFORM BDC_DYNPRO      USING 'SAPMF02D' '0110'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'KNA1-REGIO'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'KNA1-NAME1'
                                  RECORD-NAME1_003.
    PERFORM BDC_FIELD       USING 'KNA1-LAND1'
                                  RECORD-LAND1_004.
    PERFORM BDC_FIELD       USING 'KNA1-REGIO'
                                  RECORD-REGIO_005.
    PERFORM BDC_FIELD       USING 'KNA1-SPRAS'
                                  RECORD-SPRAS_006.
    PERFORM BDC_DYNPRO      USING 'SAPMF02D' '0120'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'KNA1-LIFNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    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'
                                  'RF02D-KUNNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM BDC_DYNPRO      USING 'SAPMF02D' '0370'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RF02D-KUNNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM BDC_FIELD       USING 'KNA1-CIVVE'
                                  RECORD-CIVVE_007.
    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'
                                  RECORD-AKONT_008.
    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_DYNPRO      USING 'SAPMF02D' '0610'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RF02D-KUNNR'.
    PERFORM BDC_TRANSACTION USING 'XD01'.

  PERFORM CLOSE_GROUP.

  ENDLOOP.
Excel sheet data: ( .xls file)
1000  ZMUM        RAJ1   IN    20      EN     x        16443100    
1000  ZMUM        RAJ2   IN    20      EN     x        16443100    
Example 2: (call transaction to upload .txt file data) customer master
creation:
report ZVAIGUNDARAJABDC3
       no standard page heading line-size 255.

include bdcrecx1.
data: begin of record OCCURS 0,
* data element: BUKRS
        BUKRS_001(004),
* data element: KTOKD
        KTOKD_002(004),
* data element: ANRED
        ANRED_003(015),
* data element: NAME1_GP
        NAME1_004(035),
* data element: LAND1_GP
        LAND1_005(003),
* data element: SPRAS
        SPRAS_006(002),
* data element: CIVVE
        CIVVE_007(001),
* data element: AKONT
        AKONT_008(010),
      end of record.

*** End generated data section ***

data: file1 TYPE string.

PARAMETERS: file TYPE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN on VALUE-REQUEST FOR file.

 CALL FUNCTION 'F4_FILENAME'
   EXPORTING
     PROGRAM_NAME        = SYST-CPROG
     DYNPRO_NUMBER       = SYST-DYNNR
     FIELD_NAME          = 'file'
   IMPORTING
     FILE_NAME           = file
            .

file1 = file.

 CALL FUNCTION 'GUI_UPLOAD'
   EXPORTING
     FILENAME                      = file1
   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'x'
*    HEADER_LENGTH                 = 0
*    READ_BY_LINE                  = 'X'
*    DAT_MODE                      = ' '
*    CODEPAGE                      = ' '
*    IGNORE_CERR                   = ABAP_TRUE
*    REPLACEMENT                   = '#'
*    CHECK_BOM                     = ' '
*    VIRUS_SCAN_PROFILE            =
*    NO_AUTH_CHECK                 = ' '
*  IMPORTING
*    FILELENGTH                    =
*    HEADER                        =
   TABLES
     DATA_TAB                      = record
*  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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
 ENDIF.

start-of-selection.

loop at record.

perform open_group.

perform bdc_dynpro      using 'SAPMF02D' '0100'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF02D-KTOKD'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RF02D-BUKRS'
                              record-BUKRS_001.
perform bdc_field       using 'RF02D-KTOKD'
                              record-KTOKD_002.
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-ANRED'
                              record-ANRED_003.
perform bdc_field       using 'KNA1-NAME1'
                              record-NAME1_004.
perform bdc_field       using 'KNA1-LAND1'
                              record-LAND1_005.
perform bdc_field       using 'KNA1-SPRAS'
                              record-SPRAS_006.
perform bdc_dynpro      using 'SAPMF02D' '0120'.
perform bdc_field       using 'BDC_CURSOR'
                              'KNA1-LIFNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
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'
                              'RF02D-KUNNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_dynpro      using 'SAPMF02D' '0370'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF02D-KUNNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using 'KNA1-CIVVE'
                              record-CIVVE_007.
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'
                              record-AKONT_008.
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_dynpro      using 'SAPMF02D' '0610'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF02D-KUNNR'.
perform bdc_transaction using 'XD01'.

perform close_group.

ENDLOOP.
 
Record: ( .txt file)
1000  ZMUM        mr      RAJ1   IN    EN     x        16443100    
1000  ZMUM        mr      RAJ2   IN    EN     x        16443100     

Contribute!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy