Skip to Content

Introduction :

Most of the times it will become imperative to upload the bank details for the vendor master , when vendors  exists in multiple company codes and when the vendors operate in multiple countries and multiple areas .

In such cases vendors will have multiple bank accounts and updating the Bank Details into the vendor master will become tedious job for a manual entry. In order to reduce the time involved in updating the details and to reduce the manual intervention, BDC program can be much useful with an input file.

Vendor Master will have details like

Country Key,

Bank Key,

Bank Account,

Account Holder,

Bank Control Key,

IBAN

Swift Code

IBAN Value

Partner Bank Type

Reference Details .

A Typical Bank Details SCREEN of Vendor looks like this.

/wp-content/uploads/2013/05/10_223939.png

The program can be provided with an authorization object to restrict the users.

The Program can be as follows

REPORT  Z_VENDOR_MASTER_BANK  NO STANDARD PAGE HEADING
                                       
LINESIZE 255
                                       
LINECOUNT 300.

TYPE-POOLS: TRUXS.

*&———————————————————————*

*&———————————————————————*

*&  Types  Declarations

*&———————————————————————*

*&———————————————————————*

TYPES : BEGIN OF  TY_LFA1,
          VENDOR       
LIKE LFA1-LIFNR,
          COMP_ID      
LIKE LFB1-BUKRS,
          BANK_COUNTRY 
LIKE LFBK-BANKS,
          BANK_KEY     
LIKE LFBK-BANKL,
          BANK_ACC     
LIKE LFBK-BANKN,
          ACC_HOLDER   
LIKE LFBK-KOINH,

CRTL_KEY      LIKE LFBK-BKONT,
          IBAN         
LIKE TIBAN-IBAN,
          SWIFT_CODE   
LIKE BNKA-SWIFT,
          BANK_NAME    
LIKE BNKA-BANKA,
          PARTNER_TYPE 
LIKE LFBK-BVTYP,
          REF_DETAILS  
LIKE LFBK-BKREF,
          COLLECT_AUTH 
LIKE LFBK-XEZER,
       
END OF TY_LFA1.

TYPES : BEGIN OF  TY_BNKA,
          VENDOR       
LIKE LFA1-LIFNR,
          COMP_ID      
LIKE LFB1-BUKRS,
          BANK_COUNTRY 
LIKE LFBK-BANKS,
          BANK_KEY     
LIKE LFBK-BANKL,
          BANK_ACC     
LIKE LFBK-BANKN,
          ACC_HOLDER   
LIKE LFBK-KOINH,
          CRTL_KEY     
LIKE LFBK-BKONT,
          IBAN         
LIKE TIBAN-IBAN,
          SWIFT_CODE   
LIKE BNKA-SWIFT,
          BANK_NAME    
LIKE BNKA-BANKA,
          PARTNER_TYPE 
LIKE LFBK-BVTYP,
          REF_DETAILS  
LIKE LFBK-BKREF,
          COLLECT_AUTH 
LIKE LFBK-XEZER,
       
END OF TY_BNKA.

*&———————————————————————*

*&———————————————————————*

*&  Data  Declarations

*&———————————————————————*

*&———————————————————————*

DATA: IN_LFA1 TYPE TY_LFA1 OCCURS 0 WITH HEADER LINE,
      IN_BNKA
TYPE TY_LFA1 OCCURS 0 WITH HEADER LINE.
DATA: IT_RAW TYPE TRUXS_T_TEXT_DATA.
DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
       I_MSG 
LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE,
       TEMP
TYPE STRING,
       I_RESULT
TYPE STRING.
DATA : CNT(4) TYPE N.

*&———————————————————————*

*&———————————————————————*

*&  SELECTION-SCREEN

*&———————————————————————*

*&———————————————————————*

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT001.PARAMETERS: P_FILE LIKE RLGRAP-FILENAME.PARAMETERS: P_MODE(1) DEFAULT ‘N’.
SELECTION-
SCREEN END OF BLOCK B1.

*&——————————————————————–*

*&  INITIALIZATION

*&——————————————————————–*

INITIALIZATION.

  AUTHORITY-CHECK OBJECT ‘Z_VEND_CHG’
              
ID ‘ACTVT’ FIELD ’16’.
 
IF SY-SUBRC <> 0.
   
MESSAGE E999(M02) WITH ‘You are not Authorized to run the program’.
   
LEAVE PROGRAM.
 
ENDIF.
*&——————————————————————–**& AT SELECTION-SCREEN*&——————————————————————–*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
 
CALL FUNCTION ‘F4_FILENAME’
   
IMPORTING
      FILE_NAME = P_FILE.

*&——————————————————————–*

*&——————————————————————–*

*& START-OF-SELECTION

*&——————————————————————–*

*&——————————————————————–*

START-OF-SELECTION.
 
PERFORM EXCEL_UPLOAD.
 
PERFORM SPLIT_DATA.
 
PERFORM POPULATE_BDCDATA.

*&———————————————————————*

*&      Form  EXCEL_UPLOAD

*&———————————————————————*

*       text

*———————————————————————-*

*  –>  p1        text

*  <–  p2        text

*———————————————————————-*

FORM EXCEL_UPLOAD.

*–To upload data from excel sheet to internal table
 
CALL FUNCTION ‘TEXT_CONVERT_XLS_TO_SAP’
   
EXPORTING
      I_FIELD_SEPERATOR    =
‘X’
      I_LINE_HEADER        =
‘X’
      I_TAB_RAW_DATA       = IT_RAW
      I_FILENAME           = P_FILE
   
TABLES
      I_TAB_CONVERTED_DATA = IN_LFA1
   
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.


ENDFORM.                    ” EXCEL_UPLOAD

*&———————————————————————*

*&      Form  POPULATE_BDCDATA*&———————————————————————**       text*———————————————————————-*

*  –>  p1        text

*  <–  p2        text

*———————————————————————-*

FORM POPULATE_BDCDATA .

*–Populating internal table data to BDC
 
LOOP AT IN_LFA1.
   
REFRESH BDCDATA.
   
CLEAR BDCDATA.

*–Vendor data
   
PERFORM BDC_DYNPRO      USING ‘SAPMF02K’ ‘0101’.
   
PERFORM BDC_FIELD       USING ‘BDC_CURSOR’
                                 
‘RF02K-D0130’.
   
PERFORM BDC_FIELD       USING ‘BDC_OKCODE’
                                 
‘/00’.

    PERFORM BDC_FIELD       USING ‘RF02K-LIFNR’
                                  IN_LFA1-VENDOR.          
“‘111111’.
   
PERFORM BDC_FIELD       USING ‘RF02K-BUKRS’
                                  IN_LFA1-COMP_ID.         
“‘0777’.

    PERFORM BDC_FIELD       USING ‘RF02K-D0130’


*–For Bank data

PERFORM BDC_DYNPRO      USING ‘SAPMF02K’ ‘0130’.*    PERFORM BDC_FIELD       USING ‘BDC_CURSOR’*                                ‘LFBK-XEZER(01)’.*    PERFORM BDC_FIELD       USING ‘BDC_OKCODE’*                                 ‘=BANK’.
   
CNT = 0.
   
LOOP AT IN_BNKA  WHERE VENDOR = IN_LFA1-VENDOR.

      CNT = CNT + 1.
* PERFORM BDC_DYNPRO      USING ‘SAPMF02K’ ‘0130’.
     
CONCATENATE ‘LFBK-XEZER(‘ CNT ‘)’ INTO TEMP.
     
PERFORM BDC_FIELD       USING ‘BDC_CURSOR’
                                  TEMP.
     
PERFORM BDC_FIELD       USING ‘BDC_OKCODE’
                                  
‘=BANK’.
     
CLEAR TEMP.

      CONCATENATE ‘LFBK-BANKS(‘ CNT ‘)’ INTO TEMP.
     
PERFORM BDC_FIELD       USING TEMP                        “‘LFBK-

BANKS(01)’
                                    IN_BNKA-BANK_COUNTRY.      
“‘br’.
     
CLEAR TEMP.

      CONCATENATE ‘LFBK-BANKL(‘ CNT ‘)’ INTO TEMP.
     
PERFORM BDC_FIELD       USING TEMP                        “‘LFBK-BANKL(01)’
                                    IN_BNKA-BANK_KEY.          
“‘34173197’.
     
CLEAR TEMP.

      CONCATENATE ‘LFBK-BANKN(‘ CNT ‘)’ INTO TEMP.
     
PERFORM BDC_FIELD       USING TEMP                       “‘LFBK-BANKN(01)’
                                    IN_BNKA-BANK_ACC.      
“‘311-8’.
     
CLEAR TEMP.

      CONCATENATE ‘LFBK-KOINH(‘ CNT ‘)’ INTO TEMP.
     
PERFORM BDC_FIELD       USING TEMP                        “‘LFBK-KOINH(01)’
                                    IN_BNKA-ACC_HOLDER.        
“‘XYZXYZ’.
     
CLEAR TEMP.

      CONCATENATE ‘LFBK-BKONT(‘ CNT ‘)’ INTO TEMP.
     
PERFORM BDC_FIELD       USING TEMP                        “‘LFBK-BKONT(01)’
                                    IN_BNKA-CRTL_KEY.      
“’01’.
     
CLEAR TEMP.

      CONCATENATE ‘LFBK-BVTYP(‘ CNT ‘)’ INTO TEMP.
     
PERFORM BDC_FIELD       USING TEMP                        “‘LFBK-BVTYP(01)’
                                    IN_BNKA-PARTNER_TYPE.      
“‘PA’.
     
CLEAR TEMP.

      CONCATENATE ‘LFBK-BKREF(‘ CNT ‘)’ INTO TEMP.
     
PERFORM BDC_FIELD       USING TEMP                        “‘LFBK-BKREF(01)’
                                    IN_BNKA-REF_DETAILS.       
“‘SSSSSSSSS’.
     
CLEAR TEMP.

      CONCATENATE ‘LFBK-XEZER(‘ CNT ‘)’ INTO TEMP.
     
PERFORM BDC_FIELD       USING TEMP                        “‘LFBK-XEZER(01)’
                                    IN_BNKA-COLLECT_AUTH.      
“‘X’.
     
CLEAR TEMP.

      PERFORM BDC_FIELD       USING ‘BDC_OKCODE’
                                   
‘=BANK’.

      PERFORM BDC_DYNPRO      USING ‘SAPLBANK’ ‘0100’.
     
PERFORM BDC_FIELD       USING ‘BDC_CURSOR’
                                   
‘BNKA-SWIFT’.
     
PERFORM BDC_FIELD       USING ‘BDC_OKCODE’
                                   
‘=ENTR’.

      PERFORM BDC_FIELD       USING ‘BNKA-BANKA’                “‘BNKA-BANKA’
                                    IN_BNKA-BANK_NAME.         
“‘Banco Itaú’.
     
CLEAR TEMP.

      PERFORM BDC_FIELD       USING ‘BNKA-SWIFT’                “‘BNKA-SWIFT’
                                    IN_BNKA-SWIFT_CODE.        
“‘abcd3333’.
     
CLEAR TEMP.
     
PERFORM BDC_FIELD       USING ‘BDC_OKCODE’
                                   
‘=ENTR’.
     
PERFORM BDC_DYNPRO      USING ‘SAPMF02K’ ‘0130’.*      PERFORM BDC_FIELD       USING ‘BDC_CURSOR’*                                    ‘LFBK-BANKS’.               “‘LFBK-BANKS(01)’.
*– For records more than five entries
     
IF CNT = 5.
       
CNT = 0.
       
PERFORM BDC_FIELD    USING ‘BDC_CURSOR’ TEMP.
       
PERFORM BDC_FIELD    USING ‘BDC_OKCODE’   ‘=P+’.
     
ENDIF.

    ENDLOOP.
   
PERFORM BDC_FIELD       USING ‘BDC_OKCODE’
                                 
‘=UPDA’.*–Updating data into SAP
   
CALL TRANSACTION ‘XK02’ USING BDCDATA
                           
MODE  P_MODE
                            MESSAGES
INTO I_MSG.

  ENDLOOP.

*— Handling error records
 
LOOP AT I_MSG.

    CALL FUNCTION ‘FORMAT_MESSAGE’
    
EXPORTING
      
ID              = I_MSG-MSGID*   LANG            = ‘ ‘
      
NO              = I_MSG-MSGNR
       V1              = I_MSG-MSGV1
       V2              = I_MSG-MSGV2
       V3              = I_MSG-MSGV3
       V4              = I_MSG-MSGV4
    
IMPORTING
       MSG             = I_RESULT* EXCEPTIONS*   NOT_FOUND       = 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.

    WRITE / I_RESULT.

  ENDLOOP.
ENDFORM.                    ” POPULATE_BDCDATA

*&      Form  SPLIT_DATA*&———————————————————————*

*       text*———————————————————————-*

*  –>  p1     

text*  <– 

p2   

    text*———————————————————————-*

FORM SPLIT_DATA .

IN_BNKA[] = IN_LFA1[].

*–Intenal tables Sorting
 
SORT IN_LFA1 BY VENDOR COMP_ID DESCENDING.
 
SORT IN_BNKA BY VENDOR BANK_COUNTRY BANK_KEY BANK_ACCIBAN SWIFT_CODE BANK_NAME.
*–Deleting duplicated entries
 
DELETE ADJACENT DUPLICATES FROM  IN_LFA1 COMPARING VENDOR COMP_ID.
 
DELETE ADJACENT DUPLICATES FROM  IN_BNKA COMPARING VENDOR BANK_COUNTRY  BANK_KEY BANK_ACC IBAN SWIFT_CODE BANK_NAME.


ENDFORM.                    ” SPLIT_DATA

*———————————————————————-*

*        Start new screen                                              *

*———————————————————————-*

FORM BDC_DYNPRO USING PROGRAM DYNPRO.
 
CLEAR BDCDATA.
  BDCDATA-
PROGRAM  = PROGRAM.
  BDCDATA-
DYNPRO   = DYNPRO.
  BDCDATA-DYNBEGIN =
‘X’.
 
APPEND BDCDATA.ENDFORM.                    “BDC_DYNPRO


*———————————————————————-*

*        Insert field                                                  *

*———————————————————————-*

FORM BDC_FIELD USING FNAM FVAL.
 
CLEAR BDCDATA.
  BDCDATA-FNAM = FNAM.
  BDCDATA-FVAL = FVAL.
 
APPEND BDCDATA.ENDFORM.                    “BDC_FIELD

                             
                          

Conclusion :

It would be most useful , to create a BDC for an area , which is tedious to enter the master data for certain areas like Bank Data of vendor master . The above BDC program will update the bank data making sourcing consultant life easy .

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