Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BDC programs

Former Member
0 Kudos
586

Hi,

I am new to do BDC. Please send me documents and links explaining BDC concepts in detail.................

1 ACCEPTED SOLUTION

Former Member
0 Kudos
103

check this code...

REPORT ZFC_VENDOR_CREATE LINE-SIZE 100

NO STANDARD PAGE HEADING

MESSAGE-ID ZZ.

************************************************************************

************************************************************************

  • TABLES

************************************************************************

TABLES : SSCRFIELDS. " Fields on selection screens

************************************************************************

  • CONSTANTS

************************************************************************

DATA : C_SPLIT TYPE C VALUE '#'. " Used for Has Separator in GUI_UPLAOD

************************************************************************

  • TYPES

************************************************************************

  • Int'table to hold Vendor Master Data

TYPES : BEGIN OF TY_VENDOR_MASTER,

FLAG TYPE C, " Update Flag

LIFNR TYPE LIFNR, " Vendor Number

BUKRS TYPE BUKRS, " Company Code

KTOKK TYPE KTOKK, " Account Group

ANRED TYPE ANRED, " Title

NAME1 TYPE NAME1_GP, " Name1

NAME2 TYPE NAME2_GP, " Name2

SORTL TYPE SORTL, " Search Term 1

SORT2 TYPE AD_SORT2UL, " Search Term 2

STRAS TYPE STRAS_GP, " Street

PSTLZ TYPE PSTLZ, " Postal Code

ORT01 TYPE ORT01_GP, " City

REGIO TYPE REGIO, " Region

LAND1 TYPE LAND1_GP, " Country

SPRAS TYPE SPRAS, " Language

VBUND TYPE RASSC, " Trading Partner

BANKS TYPE BANKS, " Country

BANKL TYPE BANKK, " Bank Key

BANKN TYPE BANKN, " Bank Account

BKONT TYPE BKONT, " Bank Control Key

BANKA TYPE BANKA, " Name of Bank

AKONT TYPE AKONT, " Reconciliation Account

FDGRV TYPE FDGRV, " Cash Management Group

ZTERM TYPE DZTERM, " Payment Terms

REPRF TYPE REPRF, " Check Double Invoice

ZWELS TYPE DZWELS, " Payment Methods

XPORE TYPE XPORE, " Pay all items separately

END OF TY_VENDOR_MASTER,

  • Int'table to hold Vendor Extend Data

BEGIN OF TY_VENDOR_EXTEND,

FLAG TYPE C, " Update Flag

LIFNR TYPE LIFNR, " Vendor Number

BUKRS TYPE BUKRS, " Company Code

KTOKK TYPE KTOKK, " Account Group

REF_LIFNR TYPE LIFNR, " Reference Vendor Number

REF_BUKRS TYPE BUKRS, " Reference Company Code

AKONT TYPE AKONT, " Reconciliation Account

FDGRV TYPE FDGRV, " Cash Management Group

ZTERM TYPE DZTERM, " Payment Terms

REPRF TYPE REPRF, " Check Double Invoice

ZWELS TYPE DZWELS, " Payment Methods

XPORE TYPE XPORE, " Pay all items separately

END OF TY_VENDOR_EXTEND,

  • Int'table to hold Error Records Data

BEGIN OF TY_ERROR,

MSG(200) TYPE C, " To hold Message

LIFNR TYPE LIFNR, " Vendor Number

BUKRS TYPE BUKRS, " Company Code

END OF TY_ERROR.

************************************************************************

  • DATA (Simple Fields)

************************************************************************

DATA : W_COUNT TYPE I, " Variable to hold count of Records

W_SUCC_REC TYPE I, " No. of Success Records

W_SUCC_REC1 TYPE I, " No. of Updated Records

W_ERR_REC TYPE I, " No. of Error Records

w_noupdate_rec type i. " No. of Records not Changed

************************************************************************

  • INTERNAL TABLES

************************************************************************

  • Int'table to hold uploaded data from File

DATA : IT_VENDOR_MASTER TYPE STANDARD TABLE OF TY_VENDOR_MASTER,

WA_IT_VENDOR_MASTER TYPE TY_VENDOR_MASTER,

IT_VENDOR_EXTEND TYPE STANDARD TABLE OF TY_VENDOR_EXTEND,

WA_IT_VENDOR_EXTEND TYPE TY_VENDOR_EXTEND,

WA_IT_BDCDATA TYPE BDCDATA,

IT_BDCDATA TYPE STANDARD TABLE OF BDCDATA,

WA_IT_MESSTAB TYPE BDCMSGCOLL,

IT_MESSTAB TYPE STANDARD TABLE OF BDCMSGCOLL,

IT_ERROR TYPE STANDARD TABLE OF TY_ERROR,

WA_IT_ERROR TYPE TY_ERROR,

it_error_fk01 type standard table of ty_error,

wa_it_error_fk01 type ty_error,

it_error_fk02 type standard table of ty_error,

wa_it_error_fk02 type ty_error,

it_succ_rec1 type standard table of ty_error,

wa_it_succ_rec1 type ty_error,

it_noupdate type standard table of ty_error,

wa_it_noupdate type ty_error.

************************************************************************

  • FLAGS

************************************************************************

DATA : FL_FLAG1 TYPE C, " Flag to check error upload file

FL_FLAG2 TYPE C, " Flag to hold value

FL_FLAG3 TYPE C, " Flag to hold value

FL_FLAG4 TYPE C. " Flag to hold value

************************************************************************

  • SELECTION-SCREEN

************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-001,

POSITION POS_LOW.

PARAMETERS : P_FILE(128) DEFAULT 'C:\UPLOAD.TXT' OBLIGATORY.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-002,

POSITION POS_LOW.

PARAMETERS : P_VENMAS RADIOBUTTON GROUP R1 DEFAULT 'X'.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-003,

POSITION POS_LOW.

PARAMETERS : P_VENEXT RADIOBUTTON GROUP R1.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN SKIP 2.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-004,

POSITION POS_LOW.

PARAMETERS : P_MODE(1) DEFAULT 'N'.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-005,

POSITION POS_LOW.

PARAMETERS : P_GROUP(12) DEFAULT 'ZFC_VENDOR_C' OBLIGATORY.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-016,

POSITION POS_LOW.

PARAMETERS : P_GROUP1(12) DEFAULT 'ZFC_VENDOR_U' OBLIGATORY.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN END OF BLOCK B1.

************************************************************************

  • AT SELECTION-SCREEN ON

************************************************************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  • Form to get file path for upload of data

PERFORM GET_FILE_PATH.

AT SELECTION-SCREEN ON BLOCK B1.

  • Form to Validate data specified on Selection Screen

CHECK SSCRFIELDS-UCOMM EQ 'ONLI'.

PERFORM VALIDATE_DATA.

************************************************************************

  • START - OF - SELECTION

************************************************************************

START-OF-SELECTION.

IF P_VENMAS = 'X'.

  • Form to upload data from Presentation Server for Vendor Master

PERFORM UPLOAD_DATA TABLES IT_VENDOR_MASTER.

IF FL_FLAG1 NE 'X'.

SORT IT_VENDOR_MASTER BY LIFNR BUKRS KTOKK.

DELETE IT_VENDOR_MASTER WHERE LIFNR = ' '

AND BUKRS = ' '

AND KTOKK = ' '.

  • Form to process data for Vendor Master

PERFORM INSERT_VENDOR_MASTER_DATA.

ENDIF.

ELSEIF P_VENEXT = 'X'.

  • Form to upload data from Presentation Server for Vendor Extend

PERFORM UPLOAD_DATA TABLES IT_VENDOR_EXTEND.

IF FL_FLAG1 NE 'X'.

SORT IT_VENDOR_EXTEND BY LIFNR BUKRS KTOKK.

DELETE IT_VENDOR_EXTEND WHERE LIFNR = ' '

AND BUKRS = ' '

AND KTOKK = ' '.

  • Form to process data for Vendor Master

PERFORM CHK_AND_INS_VENDOR_EXTEND_DATA.

ENDIF.

ENDIF.

************************************************************************

  • END - OF - SELECTION

************************************************************************

END-OF-SELECTION.

IF FL_FLAG1 NE 'X'.

FORMAT COLOR 7.

WRITE:/2 TEXT-O01. " Total Number of records read :

FORMAT COLOR OFF.

WRITE:40 W_COUNT.

FORMAT COLOR 7.

WRITE:/2 TEXT-O02. " Total Number of Success records :

FORMAT COLOR OFF.

WRITE:40 W_SUCC_REC.

FORMAT COLOR 7.

WRITE:/2 TEXT-O07. " Total Number of Updated records :

FORMAT COLOR OFF.

WRITE:40 W_SUCC_REC1.

FORMAT COLOR 7.

WRITE:/2 TEXT-O08. " Total Number of Unchanged records :

FORMAT COLOR OFF.

WRITE:40 W_noupdate_REC.

FORMAT COLOR 7.

WRITE:/2 TEXT-O03. " Total Number of Error records :

FORMAT COLOR OFF.

WRITE:40 W_ERR_REC.

if not it_succ_rec1 is initial.

skip 1.

perform display_changed_report.

endif.

if not it_noupdate is initial.

skip 1.

perform display_nochange_report.

endif.

IF NOT IT_ERROR IS INITIAL.

SKIP 3.

  • Form to display error data

PERFORM DISPLAY_ERROR_REPORT.

ENDIF.

IF FL_FLAG2 = 'X'.

SKIP 2.

FORMAT COLOR 4.

WRITE:/2 TEXT-O04. " BDC Session Name for Creation (FK01) :

FORMAT COLOR OFF.

WRITE:40 P_GROUP.

perform display_error_report_fk01.

ENDIF.

IF FL_FLAG3 = 'X'.

SKIP 2.

FORMAT COLOR 4.

WRITE:/2 TEXT-O09. " BDC Session Name for Updation (FK02) :

FORMAT COLOR OFF.

WRITE:40 P_GROUP1.

perform display_error_report_fk02.

ENDIF.

ENDIF.

&----


*& Form GET_FILE_PATH

&----


  • This form is used to get the specified path for uploading of data from

  • flat file with the help of F4 function key

----


FORM GET_FILE_PATH .

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_FILE.

ENDFORM. " GET_FILE_PATH

&----


*& Form VALIDATE_DATA

&----


  • This form is used to validate the data given by user on the Selection

  • Screen and the appropriate message is been displayed when an wrong

  • entry is inputted

----


FORM VALIDATE_DATA .

IF SY-BATCH EQ 'X'.

CLEAR SSCRFIELDS-UCOMM.

MESSAGE E001(ZZ) WITH TEXT-011.

" Excel file not to be used in Batch Mode

ENDIF.

IF P_MODE NE 'A' AND P_MODE NE 'N' AND P_MODE NE 'E'.

MESSAGE E001(ZZ) WITH TEXT-012.

" Session Mode should be either A or N or E

ENDIF.

ENDFORM. " VALIDATE_DATA

&----


*& Form UPLOAD_DATA

&----


  • This form is used to upload data from Presentation Server for either

  • Vendor Master or Vendor Extend

----


FORM UPLOAD_DATA TABLES P_IT_VENDOR.

DATA : L_FILENAME TYPE STRING,

L_FILETYPE TYPE CHAR10 VALUE 'ASC',

L_HEADER_LENGTH TYPE I VALUE 0,

L_READ_BY_LINE TYPE CHAR01 VALUE 'X'.

MOVE P_FILE TO L_FILENAME.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = L_FILENAME

FILETYPE = L_FILETYPE

HEADER_LENGTH = L_HEADER_LENGTH

READ_BY_LINE = L_READ_BY_LINE

HAS_FIELD_SEPARATOR = C_SPLIT

TABLES

DATA_TAB = P_IT_VENDOR

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 I001(ZZ) WITH TEXT-006 L_FILENAME.

MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

FL_FLAG1 = 'X'.

ELSEIF P_IT_VENDOR[] IS INITIAL.

MESSAGE I001(ZZ) WITH TEXT-014. " Uploaded File contains no data

FL_FLAG1 = 'X'.

ENDIF.

ENDFORM. " UPLOAD_DATA

&----


*& Form INSERT_VENDOR_MASTER_DATA

&----


  • This form is used to process BDC data for Vendor Master

&----


FORM INSERT_VENDOR_MASTER_DATA .

DATA : L_LIFNR TYPE LIFNR.

CLEAR : L_LIFNR.

sort it_vendor_master by flag.

LOOP AT IT_VENDOR_MASTER INTO WA_IT_VENDOR_MASTER.

W_COUNT = W_COUNT + 1.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_MASTER-LIFNR

IMPORTING

OUTPUT = WA_IT_VENDOR_MASTER-LIFNR.

if wa_it_vendor_master-flag = 'A'.

SELECT SINGLE LIFNR

FROM LFB1

INTO L_LIFNR

WHERE LIFNR = WA_IT_VENDOR_MASTER-LIFNR

AND BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

IF SY-SUBRC EQ 0.

WA_IT_ERROR-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_ERROR-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

WA_IT_ERROR-MSG = TEXT-015.

APPEND WA_IT_ERROR TO IT_ERROR.

W_ERR_REC = W_ERR_REC + 1.

CLEAR : WA_IT_ERROR, L_LIFNR.

ELSE.

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM POPULATE_BDC_DATA_VEN_MASTER.

PERFORM CALL_TRANSACTION.

ENDIF.

CLEAR : WA_IT_VENDOR_MASTER.

elseif wa_it_vendor_master-flag = 'C'.

IF FL_FLAG2 = 'X' and fl_flag4 ne 'X'.

PERFORM CLOSE_BDC_SESSION.

fl_flag4 = 'X'.

ENDIF.

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM POPULATE_BDC_DATA_VEN_MASTER.

PERFORM CALL_TRANSACTION_FK02.

CLEAR : WA_IT_VENDOR_MASTER.

elseif wa_it_vendor_master-flag = 'N'.

WA_IT_noupdate-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_noupdate-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

WA_IT_noupdate-MSG = TEXT-018.

APPEND WA_IT_noupdate TO IT_noupdate.

W_noupdate_REC = W_noupdate_REC + 1.

CLEAR : WA_IT_noupdate, WA_IT_VENDOR_MASTER.

endif.

ENDLOOP.

IF FL_FLAG3 = 'X'.

PERFORM CLOSE_BDC_SESSION.

ENDIF.

ENDFORM. " INSERT_VENDOR_MASTER_DATA

&----


*& Form POPULATE_BDC_DATA_VEN_MASTER

&----


  • This form is used to populate BDC data of Vendor Master

----


FORM POPULATE_BDC_DATA_VEN_MASTER .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_MASTER-ZTERM

IMPORTING

OUTPUT = WA_IT_VENDOR_MASTER-ZTERM.

IF WA_IT_VENDOR_MASTER-REPRF = 'Y'.

WA_IT_VENDOR_MASTER-REPRF = 'X'.

ENDIF.

IF WA_IT_VENDOR_MASTER-XPORE = 'Y'.

WA_IT_VENDOR_MASTER-XPORE = 'X'.

ENDIF.

if wa_it_vendor_master-flag = 'A'.

PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0105',

BDC_FIELD USING 'RF02K-LIFNR' WA_IT_VENDOR_MASTER-LIFNR,

BDC_FIELD USING 'RF02K-BUKRS' WA_IT_VENDOR_MASTER-BUKRS,

BDC_FIELD USING 'RF02K-KTOKK' WA_IT_VENDOR_MASTER-KTOKK,

BDC_FIELD USING 'BDC_OKCODE' '/00'.

elseif wa_it_vendor_master-flag = 'C'.

PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0106',

BDC_FIELD USING 'RF02K-LIFNR' WA_IT_VENDOR_MASTER-LIFNR,

BDC_FIELD USING 'RF02K-BUKRS' WA_IT_VENDOR_MASTER-BUKRS,

BDC_FIELD USING 'BDC_OKCODE' '=MALL',

BDC_DYNPRO USING 'SAPMF02K' '0106',

BDC_FIELD USING 'RF02K-D0110' 'X',

BDC_FIELD USING 'RF02K-D0120' 'X',

BDC_FIELD USING 'RF02K-D0130' 'X',

BDC_FIELD USING 'RF02K-D0210' 'X',

BDC_FIELD USING 'RF02K-D0215' 'X',

BDC_FIELD USING 'RF02K-D0220' 'X',

BDC_FIELD USING 'BDC_OKCODE' '/00'.

endif.

perform :BDC_DYNPRO USING 'SAPMF02K' '0110',

BDC_FIELD USING 'LFA1-ANRED' WA_IT_VENDOR_MASTER-ANRED,

BDC_FIELD USING 'LFA1-NAME1' WA_IT_VENDOR_MASTER-NAME1,

BDC_FIELD USING 'LFA1-NAME2' WA_IT_VENDOR_MASTER-NAME2,

BDC_FIELD USING 'LFA1-SORTL' WA_IT_VENDOR_MASTER-SORTL,

BDC_FIELD USING 'LFA1-STRAS' WA_IT_VENDOR_MASTER-STRAS,

BDC_FIELD USING 'LFA1-ORT01' WA_IT_VENDOR_MASTER-ORT01,

BDC_FIELD USING 'LFA1-PSTLZ' WA_IT_VENDOR_MASTER-PSTLZ,

BDC_FIELD USING 'LFA1-LAND1' WA_IT_VENDOR_MASTER-LAND1,

BDC_FIELD USING 'LFA1-REGIO' WA_IT_VENDOR_MASTER-REGIO,

BDC_FIELD USING 'LFA1-SPRAS' WA_IT_VENDOR_MASTER-SPRAS,

BDC_FIELD USING 'BDC_OKCODE' '/00',

BDC_DYNPRO USING 'SAPMF02K' '0120',

BDC_FIELD USING 'LFA1-VBUND' WA_IT_VENDOR_MASTER-VBUND,

BDC_FIELD USING 'BDC_OKCODE' '/00',

BDC_DYNPRO USING 'SAPMF02K' '0130',

BDC_FIELD USING 'LFBK-BANKS(01)' WA_IT_VENDOR_MASTER-BANKS,

BDC_FIELD USING 'LFBK-BANKL(01)' WA_IT_VENDOR_MASTER-BANKL,

BDC_FIELD USING 'LFBK-BANKN(01)' WA_IT_VENDOR_MASTER-BANKN,

BDC_FIELD USING 'BDC_OKCODE' '=BANK',

BDC_DYNPRO USING 'SAPLBANK' '0100',

BDC_FIELD USING 'BNKA-BANKA' WA_IT_VENDOR_MASTER-BANKA,

BDC_FIELD USING 'BDC_OKCODE' '=ENTR',

BDC_DYNPRO USING 'SAPMF02K' '0130',

BDC_FIELD USING 'BDC_OKCODE' '=ENTR',

BDC_DYNPRO USING 'SAPMF02K' '0210',

BDC_FIELD USING 'LFB1-AKONT' WA_IT_VENDOR_MASTER-AKONT,

BDC_FIELD USING 'LFB1-FDGRV' WA_IT_VENDOR_MASTER-FDGRV,

BDC_FIELD USING 'BDC_OKCODE' '=/00',

BDC_DYNPRO USING 'SAPMF02K' '0215',

BDC_FIELD USING 'LFB1-ZTERM' WA_IT_VENDOR_MASTER-ZTERM,

BDC_FIELD USING 'LFB1-REPRF' WA_IT_VENDOR_MASTER-REPRF,

BDC_FIELD USING 'LFB1-ZWELS' WA_IT_VENDOR_MASTER-ZWELS,

BDC_FIELD USING 'LFB1-XPORE' WA_IT_VENDOR_MASTER-XPORE,

BDC_FIELD USING 'BDC_OKCODE' '=UPDA'.

ENDFORM. " POPULATE_BDC_DATA_VEN_MASTER

&----


*& Form BDC_DYNPRO

&----


  • This form is used to move data to BDCDATA int'table

----


FORM BDC_DYNPRO USING PROGRAM TYPE BDC_PROG

DYNPRO TYPE BDC_DYNR.

CLEAR WA_IT_BDCDATA.

WA_IT_BDCDATA-PROGRAM = PROGRAM.

WA_IT_BDCDATA-DYNPRO = DYNPRO.

WA_IT_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_IT_BDCDATA TO IT_BDCDATA.

ENDFORM. " BDC_DYNPRO

&----


*& Form BDC_FIELD

&----


  • This form is used to move data to BDCDATA int'table

----


FORM BDC_FIELD USING FNAM TYPE ANY

FVAL TYPE ANY.

CLEAR WA_IT_BDCDATA.

WA_IT_BDCDATA-FNAM = FNAM.

WA_IT_BDCDATA-FVAL = FVAL.

APPEND WA_IT_BDCDATA TO IT_BDCDATA.

ENDFORM. " BDC_FIELD

&----


*& Form CALL_TRANSACTION

&----


  • This form is used to Call FK01 for processing of data either for

  • Vendor Master or Vendor Extend. The error records are inserted to

  • Session which can be processed using SM35

----


FORM CALL_TRANSACTION .

DATA : L_OPTION TYPE CTU_PARAMS,

L_SUBRC TYPE SYSUBRC.

REFRESH IT_MESSTAB.

CLEAR IT_MESSTAB.

L_OPTION-DEFSIZE = 'X'.

L_OPTION-DISMODE = P_MODE.

L_OPTION-UPDMODE = 'S'.

CALL TRANSACTION 'FK01'

USING IT_BDCDATA

MESSAGES INTO IT_MESSTAB

OPTIONS FROM L_OPTION.

L_SUBRC = SY-SUBRC.

IF L_SUBRC = 0.

W_SUCC_REC = W_SUCC_REC + 1.

ELSE.

IF FL_FLAG2 NE 'X'.

PERFORM OPEN_BDC_SESSION.

FL_FLAG2 = 'X'.

ENDIF.

PERFORM BDC_INSERT.

W_ERR_REC = W_ERR_REC + 1.

PERFORM ERROR_RECORD_DATA.

ENDIF.

ENDFORM. " CALL_TRANSACTION

&----


*& Form OPEN_BDC_SESSION

&----


  • Form used to open session for Error out Records

----


FORM OPEN_BDC_SESSION .

DATA : L_USERID TYPE APQ_MAPN, " Variable to hold user-id

L_GROUP TYPE APQ_GRPN. " Variable to hold value

MOVE P_GROUP TO L_GROUP.

MOVE SY-UNAME TO L_USERID.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = L_GROUP

KEEP = SPACE

USER = L_USERID

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.

WRITE:/ TEXT-008. " Unable to open BDC Session

ENDIF.

ENDFORM. " OPEN_BDC_SESSION

&----


*& Form BDC_INSERT

&----


  • This form is used to insert error records to a Session method

----


FORM BDC_INSERT .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'FK01'

TABLES

DYNPROTAB = IT_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.

WRITE:/ TEXT-009. " Unable to Insert Data to BDC Session

ENDIF.

ENDFORM. " BDC_INSERT

&----


*& Form ERROR_RECORD_DATA

&----


  • This form is used to process the messages for the error records which

  • will be displayed on the output report

----


FORM ERROR_RECORD_DATA .

DATA : L_LINES TYPE I,

L_MSG(200) TYPE C.

DESCRIBE TABLE IT_MESSTAB LINES L_LINES.

READ TABLE IT_MESSTAB INTO WA_IT_MESSTAB INDEX L_LINES.

IF SY-SUBRC = 0.

CLEAR L_MSG.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = WA_IT_MESSTAB-MSGID

LANG = SY-LANGU

NO = WA_IT_MESSTAB-MSGNR

V1 = WA_IT_MESSTAB-MSGV1

V2 = WA_IT_MESSTAB-MSGV2

V3 = WA_IT_MESSTAB-MSGV3

V4 = WA_IT_MESSTAB-MSGV4

IMPORTING

MSG = L_MSG

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

IF SY-SUBRC = 0.

WA_IT_ERROR_fk01-MSG = L_MSG.

ENDIF.

IF P_VENMAS = 'X'.

WA_IT_ERROR_fk01-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_ERROR_fk01-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

ELSEIF P_VENEXT = 'X'.

WA_IT_ERROR_fk01-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.

WA_IT_ERROR_fk01-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

ENDIF.

APPEND WA_IT_ERROR_fk01 TO IT_ERROR_fk01.

CLEAR WA_IT_ERROR_fk01.

ENDIF.

ENDFORM. " ERROR_RECORD_DATA

&----


*& Form CLOSE_BDC_SESSION

&----


  • Form used to close session of the Error Records

----


FORM CLOSE_BDC_SESSION .

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

NOT_OPEN = 1

QUEUE_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

WRITE:/ TEXT-010. " Unable to Close BDC Session

ENDIF.

ENDFORM. " CLOSE_BDC_SESSION

&----


*& Form CHK_AND_INS_VENDOR_EXTEND_DATA

&----


  • This form is used to process BDC data for Vendor Extend

----


FORM CHK_AND_INS_VENDOR_EXTEND_DATA .

DATA : L_LIFNR TYPE LIFNR.

CLEAR : L_LIFNR, fl_flag4.

sort it_vendor_extend by flag.

LOOP AT IT_VENDOR_EXTEND INTO WA_IT_VENDOR_EXTEND.

W_COUNT = W_COUNT + 1.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_EXTEND-REF_LIFNR

IMPORTING

OUTPUT = WA_IT_VENDOR_EXTEND-REF_LIFNR.

if wa_it_vendor_extend-flag = 'A'.

SELECT SINGLE LIFNR

FROM LFB1

INTO L_LIFNR

WHERE LIFNR = WA_IT_VENDOR_EXTEND-REF_LIFNR

AND BUKRS = WA_IT_VENDOR_EXTEND-REF_BUKRS.

IF SY-SUBRC NE 0.

WA_IT_ERROR-LIFNR = WA_IT_VENDOR_EXTEND-REF_LIFNR.

WA_IT_ERROR-BUKRS = WA_IT_VENDOR_EXTEND-REF_BUKRS.

WA_IT_ERROR-MSG = TEXT-007.

APPEND WA_IT_ERROR TO IT_ERROR.

W_ERR_REC = W_ERR_REC + 1.

CLEAR : WA_IT_ERROR, L_LIFNR.

ELSE.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_EXTEND-LIFNR

IMPORTING

OUTPUT = WA_IT_VENDOR_EXTEND-LIFNR.

SELECT SINGLE LIFNR

FROM LFB1

INTO L_LIFNR

WHERE LIFNR = WA_IT_VENDOR_EXTEND-LIFNR

AND BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

IF SY-SUBRC EQ 0.

WA_IT_ERROR-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.

WA_IT_ERROR-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

WA_IT_ERROR-MSG = TEXT-015.

APPEND WA_IT_ERROR TO IT_ERROR.

W_ERR_REC = W_ERR_REC + 1.

CLEAR : WA_IT_ERROR, L_LIFNR.

ELSE.

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM POPULATE_BDC_DATA_VEN_EXTEND.

PERFORM CALL_TRANSACTION.

ENDIF.

ENDIF.

CLEAR : WA_IT_VENDOR_EXTEND.

elseif wa_it_vendor_extend-flag = 'C'.

IF FL_FLAG2 = 'X' and fl_flag4 ne 'X'.

PERFORM CLOSE_BDC_SESSION.

fl_flag4 = 'X'.

ENDIF.

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM POPULATE_BDC_DATA_VEN_extend.

PERFORM CALL_TRANSACTION_FK02.

CLEAR : WA_IT_VENDOR_EXTEND.

elseif wa_it_vendor_extend-flag = 'N'.

WA_IT_noupdate-LIFNR = WA_IT_VENDOR_extend-LIFNR.

WA_IT_noupdate-BUKRS = WA_IT_VENDOR_extend-BUKRS.

WA_IT_noupdate-MSG = TEXT-019.

APPEND WA_IT_noupdate TO IT_noupdate.

W_noupdate_REC = W_noupdate_REC + 1.

CLEAR : WA_IT_noupdate, WA_IT_VENDOR_EXTEND.

endif.

ENDLOOP.

IF FL_FLAG2 = 'X'.

PERFORM CLOSE_BDC_SESSION.

ENDIF.

if fl_flag3 = 'X'.

PERFORM CLOSE_BDC_SESSION.

ENDIF.

ENDFORM. " CHK_AND_INS_VENDOR_EXTEND_DATA

&----


*& Form POPULATE_BDC_DATA_VEN_EXTEND

&----


  • This form is used to populate BDC data of Vendor Extend

----


FORM POPULATE_BDC_DATA_VEN_EXTEND .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_EXTEND-ZTERM

IMPORTING

OUTPUT = WA_IT_VENDOR_EXTEND-ZTERM.

IF WA_IT_VENDOR_EXTEND-REPRF = 'Y'.

WA_IT_VENDOR_EXTEND-REPRF = 'X'.

ENDIF.

IF WA_IT_VENDOR_extend-XPORE = 'Y'.

WA_IT_VENDOR_extend-XPORE = 'X'.

ENDIF.

if wa_it_vendor_extend-flag = 'A'.

PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0105',

BDC_FIELD USING 'RF02K-LIFNR' WA_IT_VENDOR_EXTEND-LIFNR,

BDC_FIELD USING 'RF02K-BUKRS' WA_IT_VENDOR_EXTEND-BUKRS,

BDC_FIELD USING 'RF02K-KTOKK' WA_IT_VENDOR_EXTEND-KTOKK,

BDC_FIELD USING 'RF02K-REF_LIFNR'

WA_IT_VENDOR_EXTEND-REF_LIFNR,

BDC_FIELD USING 'RF02K-REF_BUKRS'

WA_IT_VENDOR_EXTEND-REF_BUKRS,

BDC_FIELD USING 'BDC_OKCODE' '/00'.

elseif wa_it_vendor_extend-flag = 'C'.

PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0106',

BDC_FIELD USING 'RF02K-LIFNR' WA_IT_VENDOR_extend-LIFNR,

BDC_FIELD USING 'RF02K-BUKRS' WA_IT_VENDOR_extend-BUKRS,

BDC_FIELD USING 'RF02K-D0210' 'X',

BDC_FIELD USING 'RF02K-D0215' 'X',

BDC_FIELD USING 'BDC_OKCODE' '/00'.

endif.

perform :BDC_DYNPRO USING 'SAPMF02K' '0210',

BDC_FIELD USING 'LFB1-AKONT' WA_IT_VENDOR_EXTEND-AKONT,

BDC_FIELD USING 'LFB1-FDGRV' WA_IT_VENDOR_EXTEND-FDGRV,

BDC_FIELD USING 'BDC_OKCODE' '=/00',

BDC_DYNPRO USING 'SAPMF02K' '0215',

BDC_FIELD USING 'LFB1-ZTERM' WA_IT_VENDOR_EXTEND-ZTERM,

BDC_FIELD USING 'LFB1-REPRF' WA_IT_VENDOR_EXTEND-REPRF,

BDC_FIELD USING 'LFB1-ZWELS' WA_IT_VENDOR_EXTEND-ZWELS,

BDC_FIELD USING 'LFB1-XPORE' WA_IT_VENDOR_extend-XPORE,

BDC_FIELD USING 'BDC_OKCODE' '=UPDA'.

ENDFORM. " POPULATE_BDC_DATA_VEN_EXTEND

&----


*& Form DISPLAY_ERROR_REPORT

&----


  • This form is used to display the error records on the output screen

----


FORM DISPLAY_ERROR_REPORT .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O05. " Error List for Vendor Master

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O06. " Error List for Vendor Master Extended

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H03, " Error Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_ERROR INTO WA_IT_ERROR.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_ERROR-LIFNR,

17 SY-VLINE,

18 WA_IT_ERROR-BUKRS,

31 SY-VLINE,

32 WA_IT_ERROR-MSG,

100 SY-VLINE.

CLEAR : WA_IT_ERROR.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

ENDFORM. " DISPLAY_ERROR_REPORT

&----


*& Form CALL_TRANSACTION_FK02

&----


  • Form used to Call Transaction FK02

----


form CALL_TRANSACTION_FK02 .

DATA : L_OPTION TYPE CTU_PARAMS,

L_SUBRC TYPE SYSUBRC.

REFRESH IT_MESSTAB.

CLEAR IT_MESSTAB.

L_OPTION-DEFSIZE = 'X'.

L_OPTION-DISMODE = P_MODE.

L_OPTION-UPDMODE = 'S'.

CALL TRANSACTION 'FK02'

USING IT_BDCDATA

MESSAGES INTO IT_MESSTAB

OPTIONS FROM L_OPTION.

L_SUBRC = SY-SUBRC.

IF L_SUBRC = 0.

W_SUCC_REC1 = W_SUCC_REC1 + 1.

WA_IT_succ_rec1-MSG = Text-017.

IF P_VENMAS = 'X'.

WA_IT_succ_rec1-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_succ_rec1-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

ELSEIF P_VENEXT = 'X'.

WA_IT_succ_rec1-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.

WA_IT_succ_rec1-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

ENDIF.

APPEND WA_IT_succ_rec1 TO IT_succ_rec1.

ELSE.

IF FL_FLAG3 NE 'X'.

PERFORM OPEN_BDC_SESSION_fk02.

FL_FLAG3 = 'X'.

ENDIF.

PERFORM BDC_INSERT_fk02.

W_ERR_REC = W_ERR_REC + 1.

PERFORM ERROR_RECORD_DATA1.

ENDIF.

endform. " CALL_TRANSACTION_FK02

&----


*& Form OPEN_BDC_SESSION_fk02

&----


  • Form used to Open session for FK02

----


form OPEN_BDC_SESSION_fk02 .

DATA : L_USERID TYPE APQ_MAPN, " Variable to hold user-id

L_GROUP TYPE APQ_GRPN. " Variable to hold value

MOVE P_GROUP1 TO L_GROUP.

MOVE SY-UNAME TO L_USERID.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = L_GROUP

KEEP = SPACE

USER = L_USERID

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.

WRITE:/ TEXT-008. " Unable to open BDC Session

ENDIF.

endform. " OPEN_BDC_SESSION_fk02

&----


*& Form BDC_INSERT_fk02

&----


  • Form used to insert data into BDC session using FK02

----


form BDC_INSERT_fk02 .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'FK02'

TABLES

DYNPROTAB = IT_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.

WRITE:/ TEXT-009. " Unable to Insert Data to BDC Session

ENDIF.

endform. " BDC_INSERT_fk02

&----


*& Form display_changed_report

&----


  • Form to display Updated Vendor data

----


form display_changed_report .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O10. " Updated List for Vendor Master

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O11. " Updated List for Vendor Master Extended

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H04, " Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_succ_rec1 INTO WA_IT_succ_rec1.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_succ_rec1-LIFNR,

17 SY-VLINE,

18 WA_IT_succ_rec1-BUKRS,

31 SY-VLINE,

32 WA_IT_succ_rec1-MSG,

100 SY-VLINE.

CLEAR : WA_IT_succ_rec1.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

endform. " display_changed_report

&----


*& Form display_nochange_report

&----


  • Form to display No Changed data for Vendors

----


form display_nochange_report .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O12. " No Changes List for Vendor Master

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O13. " No Changes List for Vendor Master Extended

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H04, " Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_noupdate INTO WA_IT_noupdate.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_noupdate-LIFNR,

17 SY-VLINE,

18 WA_IT_noupdate-BUKRS,

31 SY-VLINE,

32 WA_IT_noupdate-MSG,

100 SY-VLINE.

CLEAR : WA_IT_noupdate.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

endform. " display_nochange_report

&----


*& Form ERROR_RECORD_DATA1

&----


  • Form to get Error Message for Changed Vendors

----


form ERROR_RECORD_DATA1 .

DATA : L_LINES TYPE I,

L_MSG(200) TYPE C.

DESCRIBE TABLE IT_MESSTAB LINES L_LINES.

READ TABLE IT_MESSTAB INTO WA_IT_MESSTAB INDEX L_LINES.

IF SY-SUBRC = 0.

CLEAR L_MSG.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = WA_IT_MESSTAB-MSGID

LANG = SY-LANGU

NO = WA_IT_MESSTAB-MSGNR

V1 = WA_IT_MESSTAB-MSGV1

V2 = WA_IT_MESSTAB-MSGV2

V3 = WA_IT_MESSTAB-MSGV3

V4 = WA_IT_MESSTAB-MSGV4

IMPORTING

MSG = L_MSG

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

IF SY-SUBRC = 0.

WA_IT_ERROR_fk02-MSG = L_MSG.

ENDIF.

IF P_VENMAS = 'X'.

WA_IT_ERROR_fk02-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_ERROR_fk02-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

ELSEIF P_VENEXT = 'X'.

WA_IT_ERROR_fk02-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.

WA_IT_ERROR_fk02-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

ENDIF.

APPEND WA_IT_ERROR_fk02 TO IT_ERROR_fk02.

CLEAR WA_IT_ERROR_fk02.

ENDIF.

endform. " ERROR_RECORD_DATA1

&----


*& Form display_error_report_fk01

&----


  • Form to display Error Report for Master Vendors (FK01)

----


form display_error_report_fk01 .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O05. " Error List for Vendor Master (FK01)

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O06. " Error List for Vendor Master Extended (FK01)

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H04, " Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_ERROR_fk01 INTO WA_IT_ERROR_fk01.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_ERROR_fk01-LIFNR,

17 SY-VLINE,

18 WA_IT_ERROR_fk01-BUKRS,

31 SY-VLINE,

32 WA_IT_ERROR_fk01-MSG,

100 SY-VLINE.

CLEAR : WA_IT_ERROR_fk01.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

endform. " display_error_report_fk01

&----


*& Form display_error_report_fk02

&----


  • Form to display Error Report for changed Vendors (FK02)

----


form display_error_report_fk02 .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O14. " Error List for Vendor Master (FK02)

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O15. " Error List for Vendor Master Extended (FK02)

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H04, " Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_ERROR_fk02 INTO WA_IT_ERROR_fk02.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_ERROR_fk02-LIFNR,

17 SY-VLINE,

18 WA_IT_ERROR_fk02-BUKRS,

31 SY-VLINE,

32 WA_IT_ERROR_fk02-MSG,

100 SY-VLINE.

CLEAR : WA_IT_ERROR_fk02.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

endform. " display_error_report_fk02

14 REPLIES 14

Former Member
0 Kudos
103

Hi

BDC:

Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.

Features :

BDC is an automatic procedure.

This method is used to transfer large amount of data that is available in electronic medium.

BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).

BDC uses normal transaction codes to transfer data.

Types of BDC :

CLASSICAL BATCH INPUT (Session Method)

CALL TRANSACTION

BATCH INPUT METHOD:

This method is also called as ‘CLASSICAL METHOD’.

Features:

Asynchronous processing.

Synchronous Processing in database update.

Transfer data for more than one transaction.

Batch input processing log will be generated.

During processing, no transaction is started until the previous transaction has been written to the database.

CALL TRANSACTION METHOD :

This is another method to transfer data from the legacy system.

Features:

Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.

Updating the database can be either synchronous or asynchronous. The program specifies the update type.

Transfer data for a single transaction.

Transfers data for a sequence of dialog screens.

No batch input processing log is generated.

For BDC:

http://myweb.dal.ca/hchinni/sap/bdc_home.htm

http://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&;

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.sapdevelopment.co.uk/bdc/bdchome.htm

http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm

http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html

Check these link:

http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

http://www.sap-img.com/abap/question-about-bdc-program.htm

http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/

http://www.planetsap.com/bdc_main_page.htm

Regards

Anji

Edited by: Jason Lax on Mar 23, 2011 1:06 PM

0 Kudos
103

Hi,

I have searched help.sap.com a lot for some sample BDC call transcation programs...I could not find them in that website....Please send me some programs

0 Kudos
103

Thank u for ur immediate response...if u might have sent me some example that wud be more helpful............

0 Kudos
103

Hi Lakshmi,

This is the code for uploading material master using BDC.

REPORT zcn_mm_matmaster_basicview.

DATA: BEGIN OF it_data OCCURS 0,

mat_type LIKE mara-mtart,

ind_sec LIKE mara-mbrsh,

plant LIKE bapi_marc-plant,

stge_loc LIKE bapi_mard-stge_loc,

mat_desc LIKE makt-maktx,

base_uom LIKE mara-meins,

old_matno LIKE mara-bismt,

matl_group LIKE mara-matkl,

document LIKE mara-zeinr,

po_unit LIKE bapi_mara-po_unit,

pur_valkey LIKE bapi_mara-pur_valkey,

mfr_no LIKE bapi_mara-mfr_no,

manu_mat LIKE bapi_mara-manu_mat,

vendor_lookup(10) TYPE c,

mrp_type LIKE bapi_marc-mrp_type,

mrp_ctrler LIKE bapi_marc-mrp_ctrler,

sm_key LIKE bapi_marc-sm_key,

proc_type LIKE bapi_marc-proc_type,

sloc_exprc LIKE bapi_marc-sloc_exprc,

stge_bin LIKE bapi_mard-stge_bin,

issue_unit LIKE bapi_marc-issue_unit,

cc_ph_inv LIKE bapi_marc-cc_ph_inv,

price_ctrl LIKE bapi_mbew-price_ctrl,

val_class LIKE bapi_mbew-val_class,

moving_pr,

price_unit,

profit_ctr LIKE bapi_marc-profit_ctr,

matnr LIKE mara-matnr,

XMCNG like MARC-XMCNG,

END OF it_data,

is_data LIKE it_data.

DATA: bdc_tab LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA : g_file TYPE string.

DATA : BEGIN OF data_mat OCCURS 0,

datastring(120),

END OF data_mat.

DATA: record(500).

*******************----SELECTION SCREEN--*************************

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_file TYPE ibipparms-path.

PARAMETERS: r_local RADIOBUTTON GROUP radi,

r_apps RADIOBUTTON GROUP radi.

SELECTION-SCREEN END OF BLOCK b1.

*******************AT SELECTION SCREEN *********************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

----


  • S T A R T O F S E L E C T I O N

----


START-OF-SELECTION.

g_file = p_file.

PERFORM upload USING g_file. "Upload takes the file from the presentation

PERFORM bdc_opengroup.

PERFORM bdc_processing.

PERFORM bdc_closegroup.

&----


*& Form upload

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM upload USING lv_file .

IF r_apps = 'X'.

OPEN DATASET lv_file

FOR INPUT IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc <> 0.

WRITE: / text-002, sy-subrc.

STOP.

ELSE.

DO.

READ DATASET lv_file INTO record.

SPLIT record AT '~' INTO

it_data-mat_type

it_data-ind_sec

it_data-plant

it_data-stge_loc

it_data-mat_desc

it_data-base_uom

it_data-old_matno

it_data-matl_group

it_data-document

it_data-po_unit

it_data-pur_valkey

it_data-mfr_no

it_data-manu_mat

it_data-vendor_lookup

it_data-mrp_type

it_data-mrp_ctrler

it_data-sm_key

it_data-proc_type

it_data-sloc_exprc

it_data-stge_bin

it_data-issue_unit

it_data-cc_ph_inv

it_data-price_ctrl

it_data-val_class

it_data-moving_pr

it_data-price_unit

it_data-profit_ctr

it_data-matnr

it_data-XMCNG.

APPEND it_data.

CLEAR it_data.

ENDDO.

CLOSE DATASET lv_file.

ENDIF.

ELSEIF r_local = 'X'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = lv_file

filetype = 'ASC'

has_field_separator = '~'

header_length = 0

read_by_line = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

ignore_cerr = 'X'

replacement = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = data_mat

  • 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.

ELSE.

LOOP AT data_mat.

SPLIT data_mat-datastring AT '~' INTO

it_data-mat_type

it_data-ind_sec

it_data-plant

it_data-stge_loc

it_data-mat_desc

it_data-base_uom

it_data-old_matno

it_data-matl_group

it_data-document

it_data-po_unit

it_data-pur_valkey

it_data-mfr_no

it_data-manu_mat

it_data-vendor_lookup

it_data-mrp_type

it_data-mrp_ctrler

it_data-sm_key

it_data-proc_type

it_data-sloc_exprc

it_data-stge_bin

it_data-issue_unit

it_data-cc_ph_inv

it_data-price_ctrl

it_data-val_class

it_data-moving_pr

it_data-price_unit

it_data-profit_ctr

it_data-matnr

it_data-XMCNG.

APPEND it_data.

CLEAR it_data.

ENDLOOP.

ENDIF.

ENDIF.

ENDFORM. " upload

&----


*& Form bdc_opengroup

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_opengroup .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

group = 'Z_MAT_BASIC'

  • HOLDDATE = sy-datum

keep = 'X'

user = sy-uname

  • RECORD = FILLER1

prog = sy-cprog

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.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " bdc_opengroup

&----


*& Form bdc_processing

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_processing .

LOOP AT it_data INTO is_data.

IF is_data-document <> ' '.

PERFORM dynpro USING: 'X' 'SAPLMGMM' '0060',

' ' 'BDC_OKCODE' '/00',

' ' 'RMMG1-MBRSH' is_data-ind_sec,

' ' 'RMMG1-MTART' is_data-mat_type,

'X' 'SAPLMGMM' '0070',

' ' 'BDC_OKCODE' '=ENTR',

' ' 'MSICHTAUSW-KZSEL(01)' 'X',

' ' 'MSICHTAUSW-KZSEL(02)' 'X',

'X' 'SAPLMGMM' '5004',

' ' 'BDC_OKCODE' '=SP02',

' ' 'MAKT-MAKTX' is_data-mat_desc,

' ' 'MARA-MEINS' is_data-base_uom,

' ' 'MARA-MATKL' is_data-matl_group,

' ' 'MARA-BISMT' is_data-old_matno,

'X' 'SAPLMGMM' '5004',

' ' 'BDC_OKCODE' '=BU',

' ' 'MARA-ZEINR' is_data-document.

ELSE.

PERFORM dynpro USING: 'X' 'SAPLMGMM' '0060',

' ' 'BDC_OKCODE' '/00',

' ' 'RMMG1-MBRSH' is_data-ind_sec,

' ' 'RMMG1-MTART' is_data-mat_type,

'X' 'SAPLMGMM' '0070',

' ' 'BDC_OKCODE' '=ENTR',

' ' 'MSICHTAUSW-KZSEL(01)' 'X',

'X' 'SAPLMGMM' '5004',

' ' 'BDC_OKCODE' '=BU',

' ' 'MAKT-MAKTX' is_data-mat_desc,

' ' 'MARA-MEINS' is_data-base_uom,

' ' 'MARA-MATKL' is_data-matl_group,

' ' 'MARA-BISMT' is_data-old_matno.

ENDIF.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = 'MM01'

TABLES

dynprotab = bdc_tab

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.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

refresh bdc_tab.

clear is_data.

ENDLOOP.

ENDFORM. " bdc_processing

&----


*& Form dynpro

&----


  • text

----


  • -->P_0270 text

  • -->P_0271 text

  • -->P_0272 text

----


FORM dynpro USING dynbegin name value.

CLEAR bdc_tab.

IF dynbegin = 'X'.

MOVE: name TO bdc_tab-program,

value TO bdc_tab-dynpro,

'X' TO bdc_tab-dynbegin.

APPEND bdc_tab.

ELSE.

MOVE name TO bdc_tab-fnam.

MOVE value TO bdc_tab-fval.

APPEND bdc_tab.

ENDIF.

ENDFORM. " dynpro

&----


*& Form bdc_closegroup

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_closegroup .

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

not_open = 1

queue_error = 2

OTHERS = 3.

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. " bdc_closegroup

Reward points if useful.

Thanks

Aneesh.

Former Member
0 Kudos
103

Hello,

BDC are used for follwoing scenarios mostly:

1. Mass Upload of Data

2. allowed to do some activity repeatedly for large amout of data where User Interaction becomes Hectic.

Major use would be for DATA TRANSFER!!!!!

It allows us to automate some transaction for which we have data.

Following documents would give u some brief idea on Batch Data communication :

http://help.sap.com/saphelp_erp2005/helpdata/en/fa/097119543b11d1898e0000e8322d00/frameset.htm

Check out this example:

http://www.sapgenie.com/abap/bdc.htm

Regards,

Deepu.K

Former Member
0 Kudos
103

Hi,

Regards

Bala

Former Member
0 Kudos
103

this is a sample BDC Program which will guide you after knowing the BDC concept.

tables: equi.

TYPES: BEGIN OF t_tab,

equnr TYPE equi-equnr,

eqtyp type equi-eqtyp,

eqart TYPE equi-eqart,

  • decom_dat type d,

END OF t_tab.

DATA: i_tab TYPE STANDARD TABLE OF t_tab.

DATA: wa_tab TYPE t_tab.

DATA : lt_bdcdata TYPE bdcdata,

lw_bdcdata type standard table of bdcdata.

DATA: v_fname TYPE string.

DATA: BEGIN OF FLDITAB OCCURS 0,

FLDNAME(11) TYPE C,

END OF FLDITAB.

*DATA BEGIN OF ZDFIES OCCURS 0.

  • INCLUDE STRUCTURE DFIES.

*DATA END OF ZDFIES.

DATA TNAME LIKE DD02L-TABNAME.

DATA: ZX030L LIKE X030L.

PARAMETERS: p_fname TYPE rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

field_name = ' '

IMPORTING

file_name = p_fname.

v_fname = p_fname.

start-of-selection.

SELECT equnr eqtyp eqart FROM equi INTO CORRESPONDING FIELDS OF TABLE i_tab up to 10 rows.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = v_fname

  • FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

tables

data_tab = i_tab.

  • FIELDNAMES = t_tab.

clear i_tab[].

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = v_fname

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = i_tab

  • 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.

*CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

  • EXPORTING

    • I_FIELD_SEPERATOR =

  • i_line_header = 'X'

  • i_tab_raw_data = wa_tab " WORK TABLE

  • i_filename = v_fname

  • TABLES

  • i_tab_converted_data = i_tab[] "ACTUAL DATA

  • 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.

loop at i_tab into wa_tab.

write:/5 wa_tab-equnr ,wa_tab-eqtyp , wa_tab-eqart.

endloop.

Former Member
0 Kudos
103

Hi,

I am giving one simple e.g. of BDC using table control.

BDC XK01 using Table control:
REPORT Y730_BDC5 .
*HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
       DUMMY(100) TYPE C,
       END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
       LIFNR(10) TYPE C,
       BUKRS(4)  TYPE C,
       EKORG(4)  TYPE C,
       KTOKK(4)  TYPE C,
       NAME1(30) TYPE C,
       SORTL(10) TYPE C,
       LAND1(3)  TYPE C,
       SPRAS(2)  TYPE C,
       AKONT(6)  TYPE C,
       FDGRV(2)  TYPE C,
       WAERS(3)  TYPE C,
       END OF IT_XK01,
       BEGIN OF IT_BANK OCCURS 0,
       BANKS(3)  TYPE C,
       BANKL(10) TYPE C,
       BANKN(10) TYPE C,
       KOINH(30) TYPE C,
       LIFNR(10) TYPE C,
       END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
       IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'WS_UPLOAD'
 EXPORTING
   FILENAME                      = 'C:VENDOR.TXT'
   FILETYPE                      = 'ASC'
 TABLES
   DATA_TAB                      = IT_DUMMY.

LOOP AT IT_DUMMY.
  IF IT_DUMMY-DUMMY+0(2) = '11'.
    IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
    IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
    IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
    IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
    IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
    IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
    IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
    IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
    IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
    IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
    IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
    APPEND IT_XK01.
  ELSE.
    IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
    IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
    IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
    IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
    IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
    APPEND IT_BANK.
  ENDIF.
ENDLOOP.

LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro      using 'SAPMF02K' '0100'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF02K-REF_LIFNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RF02K-LIFNR'
                              IT_XK01-LIFNR.
perform bdc_field       using 'RF02K-BUKRS'
                              IT_XK01-BUKRS.
perform bdc_field       using 'RF02K-EKORG'
                              IT_XK01-EKORG.
perform bdc_field       using 'RF02K-KTOKK'
                              IT_XK01-KTOKK.
perform bdc_dynpro      using 'SAPMF02K' '0110'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFA1-TELX1'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFA1-NAME1'
                              IT_XK01-NAME1.
perform bdc_field       using 'LFA1-SORTL'
                              IT_XK01-SORTL.
perform bdc_field       using 'LFA1-LAND1'
                              IT_XK01-LAND1.
perform bdc_field       using 'LFA1-SPRAS'
                              IT_XK01-SPRAS.
perform bdc_dynpro      using 'SAPMF02K' '0120'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFA1-KUNNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPMF02K' '0130'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFBK-KOINH(02)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
DATA : FNAM(20) TYPE C,
       IDX      TYPE C.
  MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
  CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
  perform bdc_field       using FNAM
                                IT_BANK-BANKS.

  CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
  perform bdc_field       using FNAM
                                IT_BANK-BANKL.

  CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
  perform bdc_field       using FNAM
                                IT_BANK-BANKN.

  CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
  perform bdc_field       using FNAM
                                IT_BANK-KOINH.
  IDX = IDX + 1.
ENDLOOP.

perform bdc_dynpro      using 'SAPMF02K' '0130'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFBK-BANKS(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_dynpro      using 'SAPMF02K' '0210'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB1-FDGRV'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFB1-AKONT'
                              IT_XK01-AKONT.
perform bdc_field       using 'LFB1-FDGRV'
                              IT_XK01-FDGRV.
perform bdc_dynpro      using 'SAPMF02K' '0215'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB1-ZTERM'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPMF02K' '0220'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB5-MAHNA'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPMF02K' '0310'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFM1-WAERS'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFM1-WAERS'
                              IT_XK01-WAERS.
perform bdc_dynpro      using 'SAPMF02K' '0320'.
perform bdc_field       using 'BDC_CURSOR'
                              'WYT3-PARVW(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_dynpro      using 'SAPLSPO1' '0300'.
perform bdc_field       using 'BDC_OKCODE'
                              '=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
                        MODE  'A'
                       UPDATE 'S'
                     MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.

FORM BDC_DYNPRO USING PROG SCR.
  CLEAR IT_BDCDATA.
  IT_BDCDATA-PROGRAM = PROG.
  IT_BDCDATA-DYNPRO  = SCR.
  IT_BDCDATA-DYNBEGIN = 'X'.
  APPEND IT_BDCDATA.
ENDFORM.

FORM BDC_FIELD USING FNAM FVAL.
  CLEAR IT_BDCDATA.
  IT_BDCDATA-FNAM = FNAM.
  IT_BDCDATA-FVAL  = FVAL.
  APPEND IT_BDCDATA.
ENDFORM.
&#8195;

Hope this simple e.g. will help u with therotical details u may get in other post.

Jogdand M B

0 Kudos
103

Thank u very much for giving an example program......

May I request you to pls explain me what the progarm is doing in detail?

Thanks in advance.....

0 Kudos
103

Hi Jogdand,

The program which u hav eposted is really very useful.Thanks for sending.....

I have awarded you with "Helpful Answer".

Here in recording u have distinguished teh BANKS details seperately may I know the reason why?

And in recording also u have given some caoncatenate ststement and put that value in FNAM. PLease explain me the logic here....

Awaiting for ur reply......

Former Member
0 Kudos
104

check this code...

REPORT ZFC_VENDOR_CREATE LINE-SIZE 100

NO STANDARD PAGE HEADING

MESSAGE-ID ZZ.

************************************************************************

************************************************************************

  • TABLES

************************************************************************

TABLES : SSCRFIELDS. " Fields on selection screens

************************************************************************

  • CONSTANTS

************************************************************************

DATA : C_SPLIT TYPE C VALUE '#'. " Used for Has Separator in GUI_UPLAOD

************************************************************************

  • TYPES

************************************************************************

  • Int'table to hold Vendor Master Data

TYPES : BEGIN OF TY_VENDOR_MASTER,

FLAG TYPE C, " Update Flag

LIFNR TYPE LIFNR, " Vendor Number

BUKRS TYPE BUKRS, " Company Code

KTOKK TYPE KTOKK, " Account Group

ANRED TYPE ANRED, " Title

NAME1 TYPE NAME1_GP, " Name1

NAME2 TYPE NAME2_GP, " Name2

SORTL TYPE SORTL, " Search Term 1

SORT2 TYPE AD_SORT2UL, " Search Term 2

STRAS TYPE STRAS_GP, " Street

PSTLZ TYPE PSTLZ, " Postal Code

ORT01 TYPE ORT01_GP, " City

REGIO TYPE REGIO, " Region

LAND1 TYPE LAND1_GP, " Country

SPRAS TYPE SPRAS, " Language

VBUND TYPE RASSC, " Trading Partner

BANKS TYPE BANKS, " Country

BANKL TYPE BANKK, " Bank Key

BANKN TYPE BANKN, " Bank Account

BKONT TYPE BKONT, " Bank Control Key

BANKA TYPE BANKA, " Name of Bank

AKONT TYPE AKONT, " Reconciliation Account

FDGRV TYPE FDGRV, " Cash Management Group

ZTERM TYPE DZTERM, " Payment Terms

REPRF TYPE REPRF, " Check Double Invoice

ZWELS TYPE DZWELS, " Payment Methods

XPORE TYPE XPORE, " Pay all items separately

END OF TY_VENDOR_MASTER,

  • Int'table to hold Vendor Extend Data

BEGIN OF TY_VENDOR_EXTEND,

FLAG TYPE C, " Update Flag

LIFNR TYPE LIFNR, " Vendor Number

BUKRS TYPE BUKRS, " Company Code

KTOKK TYPE KTOKK, " Account Group

REF_LIFNR TYPE LIFNR, " Reference Vendor Number

REF_BUKRS TYPE BUKRS, " Reference Company Code

AKONT TYPE AKONT, " Reconciliation Account

FDGRV TYPE FDGRV, " Cash Management Group

ZTERM TYPE DZTERM, " Payment Terms

REPRF TYPE REPRF, " Check Double Invoice

ZWELS TYPE DZWELS, " Payment Methods

XPORE TYPE XPORE, " Pay all items separately

END OF TY_VENDOR_EXTEND,

  • Int'table to hold Error Records Data

BEGIN OF TY_ERROR,

MSG(200) TYPE C, " To hold Message

LIFNR TYPE LIFNR, " Vendor Number

BUKRS TYPE BUKRS, " Company Code

END OF TY_ERROR.

************************************************************************

  • DATA (Simple Fields)

************************************************************************

DATA : W_COUNT TYPE I, " Variable to hold count of Records

W_SUCC_REC TYPE I, " No. of Success Records

W_SUCC_REC1 TYPE I, " No. of Updated Records

W_ERR_REC TYPE I, " No. of Error Records

w_noupdate_rec type i. " No. of Records not Changed

************************************************************************

  • INTERNAL TABLES

************************************************************************

  • Int'table to hold uploaded data from File

DATA : IT_VENDOR_MASTER TYPE STANDARD TABLE OF TY_VENDOR_MASTER,

WA_IT_VENDOR_MASTER TYPE TY_VENDOR_MASTER,

IT_VENDOR_EXTEND TYPE STANDARD TABLE OF TY_VENDOR_EXTEND,

WA_IT_VENDOR_EXTEND TYPE TY_VENDOR_EXTEND,

WA_IT_BDCDATA TYPE BDCDATA,

IT_BDCDATA TYPE STANDARD TABLE OF BDCDATA,

WA_IT_MESSTAB TYPE BDCMSGCOLL,

IT_MESSTAB TYPE STANDARD TABLE OF BDCMSGCOLL,

IT_ERROR TYPE STANDARD TABLE OF TY_ERROR,

WA_IT_ERROR TYPE TY_ERROR,

it_error_fk01 type standard table of ty_error,

wa_it_error_fk01 type ty_error,

it_error_fk02 type standard table of ty_error,

wa_it_error_fk02 type ty_error,

it_succ_rec1 type standard table of ty_error,

wa_it_succ_rec1 type ty_error,

it_noupdate type standard table of ty_error,

wa_it_noupdate type ty_error.

************************************************************************

  • FLAGS

************************************************************************

DATA : FL_FLAG1 TYPE C, " Flag to check error upload file

FL_FLAG2 TYPE C, " Flag to hold value

FL_FLAG3 TYPE C, " Flag to hold value

FL_FLAG4 TYPE C. " Flag to hold value

************************************************************************

  • SELECTION-SCREEN

************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-001,

POSITION POS_LOW.

PARAMETERS : P_FILE(128) DEFAULT 'C:\UPLOAD.TXT' OBLIGATORY.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-002,

POSITION POS_LOW.

PARAMETERS : P_VENMAS RADIOBUTTON GROUP R1 DEFAULT 'X'.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-003,

POSITION POS_LOW.

PARAMETERS : P_VENEXT RADIOBUTTON GROUP R1.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN SKIP 2.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-004,

POSITION POS_LOW.

PARAMETERS : P_MODE(1) DEFAULT 'N'.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-005,

POSITION POS_LOW.

PARAMETERS : P_GROUP(12) DEFAULT 'ZFC_VENDOR_C' OBLIGATORY.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN : BEGIN OF LINE,

COMMENT 1(30) TEXT-016,

POSITION POS_LOW.

PARAMETERS : P_GROUP1(12) DEFAULT 'ZFC_VENDOR_U' OBLIGATORY.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN END OF BLOCK B1.

************************************************************************

  • AT SELECTION-SCREEN ON

************************************************************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  • Form to get file path for upload of data

PERFORM GET_FILE_PATH.

AT SELECTION-SCREEN ON BLOCK B1.

  • Form to Validate data specified on Selection Screen

CHECK SSCRFIELDS-UCOMM EQ 'ONLI'.

PERFORM VALIDATE_DATA.

************************************************************************

  • START - OF - SELECTION

************************************************************************

START-OF-SELECTION.

IF P_VENMAS = 'X'.

  • Form to upload data from Presentation Server for Vendor Master

PERFORM UPLOAD_DATA TABLES IT_VENDOR_MASTER.

IF FL_FLAG1 NE 'X'.

SORT IT_VENDOR_MASTER BY LIFNR BUKRS KTOKK.

DELETE IT_VENDOR_MASTER WHERE LIFNR = ' '

AND BUKRS = ' '

AND KTOKK = ' '.

  • Form to process data for Vendor Master

PERFORM INSERT_VENDOR_MASTER_DATA.

ENDIF.

ELSEIF P_VENEXT = 'X'.

  • Form to upload data from Presentation Server for Vendor Extend

PERFORM UPLOAD_DATA TABLES IT_VENDOR_EXTEND.

IF FL_FLAG1 NE 'X'.

SORT IT_VENDOR_EXTEND BY LIFNR BUKRS KTOKK.

DELETE IT_VENDOR_EXTEND WHERE LIFNR = ' '

AND BUKRS = ' '

AND KTOKK = ' '.

  • Form to process data for Vendor Master

PERFORM CHK_AND_INS_VENDOR_EXTEND_DATA.

ENDIF.

ENDIF.

************************************************************************

  • END - OF - SELECTION

************************************************************************

END-OF-SELECTION.

IF FL_FLAG1 NE 'X'.

FORMAT COLOR 7.

WRITE:/2 TEXT-O01. " Total Number of records read :

FORMAT COLOR OFF.

WRITE:40 W_COUNT.

FORMAT COLOR 7.

WRITE:/2 TEXT-O02. " Total Number of Success records :

FORMAT COLOR OFF.

WRITE:40 W_SUCC_REC.

FORMAT COLOR 7.

WRITE:/2 TEXT-O07. " Total Number of Updated records :

FORMAT COLOR OFF.

WRITE:40 W_SUCC_REC1.

FORMAT COLOR 7.

WRITE:/2 TEXT-O08. " Total Number of Unchanged records :

FORMAT COLOR OFF.

WRITE:40 W_noupdate_REC.

FORMAT COLOR 7.

WRITE:/2 TEXT-O03. " Total Number of Error records :

FORMAT COLOR OFF.

WRITE:40 W_ERR_REC.

if not it_succ_rec1 is initial.

skip 1.

perform display_changed_report.

endif.

if not it_noupdate is initial.

skip 1.

perform display_nochange_report.

endif.

IF NOT IT_ERROR IS INITIAL.

SKIP 3.

  • Form to display error data

PERFORM DISPLAY_ERROR_REPORT.

ENDIF.

IF FL_FLAG2 = 'X'.

SKIP 2.

FORMAT COLOR 4.

WRITE:/2 TEXT-O04. " BDC Session Name for Creation (FK01) :

FORMAT COLOR OFF.

WRITE:40 P_GROUP.

perform display_error_report_fk01.

ENDIF.

IF FL_FLAG3 = 'X'.

SKIP 2.

FORMAT COLOR 4.

WRITE:/2 TEXT-O09. " BDC Session Name for Updation (FK02) :

FORMAT COLOR OFF.

WRITE:40 P_GROUP1.

perform display_error_report_fk02.

ENDIF.

ENDIF.

&----


*& Form GET_FILE_PATH

&----


  • This form is used to get the specified path for uploading of data from

  • flat file with the help of F4 function key

----


FORM GET_FILE_PATH .

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_FILE.

ENDFORM. " GET_FILE_PATH

&----


*& Form VALIDATE_DATA

&----


  • This form is used to validate the data given by user on the Selection

  • Screen and the appropriate message is been displayed when an wrong

  • entry is inputted

----


FORM VALIDATE_DATA .

IF SY-BATCH EQ 'X'.

CLEAR SSCRFIELDS-UCOMM.

MESSAGE E001(ZZ) WITH TEXT-011.

" Excel file not to be used in Batch Mode

ENDIF.

IF P_MODE NE 'A' AND P_MODE NE 'N' AND P_MODE NE 'E'.

MESSAGE E001(ZZ) WITH TEXT-012.

" Session Mode should be either A or N or E

ENDIF.

ENDFORM. " VALIDATE_DATA

&----


*& Form UPLOAD_DATA

&----


  • This form is used to upload data from Presentation Server for either

  • Vendor Master or Vendor Extend

----


FORM UPLOAD_DATA TABLES P_IT_VENDOR.

DATA : L_FILENAME TYPE STRING,

L_FILETYPE TYPE CHAR10 VALUE 'ASC',

L_HEADER_LENGTH TYPE I VALUE 0,

L_READ_BY_LINE TYPE CHAR01 VALUE 'X'.

MOVE P_FILE TO L_FILENAME.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = L_FILENAME

FILETYPE = L_FILETYPE

HEADER_LENGTH = L_HEADER_LENGTH

READ_BY_LINE = L_READ_BY_LINE

HAS_FIELD_SEPARATOR = C_SPLIT

TABLES

DATA_TAB = P_IT_VENDOR

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 I001(ZZ) WITH TEXT-006 L_FILENAME.

MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

FL_FLAG1 = 'X'.

ELSEIF P_IT_VENDOR[] IS INITIAL.

MESSAGE I001(ZZ) WITH TEXT-014. " Uploaded File contains no data

FL_FLAG1 = 'X'.

ENDIF.

ENDFORM. " UPLOAD_DATA

&----


*& Form INSERT_VENDOR_MASTER_DATA

&----


  • This form is used to process BDC data for Vendor Master

&----


FORM INSERT_VENDOR_MASTER_DATA .

DATA : L_LIFNR TYPE LIFNR.

CLEAR : L_LIFNR.

sort it_vendor_master by flag.

LOOP AT IT_VENDOR_MASTER INTO WA_IT_VENDOR_MASTER.

W_COUNT = W_COUNT + 1.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_MASTER-LIFNR

IMPORTING

OUTPUT = WA_IT_VENDOR_MASTER-LIFNR.

if wa_it_vendor_master-flag = 'A'.

SELECT SINGLE LIFNR

FROM LFB1

INTO L_LIFNR

WHERE LIFNR = WA_IT_VENDOR_MASTER-LIFNR

AND BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

IF SY-SUBRC EQ 0.

WA_IT_ERROR-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_ERROR-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

WA_IT_ERROR-MSG = TEXT-015.

APPEND WA_IT_ERROR TO IT_ERROR.

W_ERR_REC = W_ERR_REC + 1.

CLEAR : WA_IT_ERROR, L_LIFNR.

ELSE.

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM POPULATE_BDC_DATA_VEN_MASTER.

PERFORM CALL_TRANSACTION.

ENDIF.

CLEAR : WA_IT_VENDOR_MASTER.

elseif wa_it_vendor_master-flag = 'C'.

IF FL_FLAG2 = 'X' and fl_flag4 ne 'X'.

PERFORM CLOSE_BDC_SESSION.

fl_flag4 = 'X'.

ENDIF.

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM POPULATE_BDC_DATA_VEN_MASTER.

PERFORM CALL_TRANSACTION_FK02.

CLEAR : WA_IT_VENDOR_MASTER.

elseif wa_it_vendor_master-flag = 'N'.

WA_IT_noupdate-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_noupdate-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

WA_IT_noupdate-MSG = TEXT-018.

APPEND WA_IT_noupdate TO IT_noupdate.

W_noupdate_REC = W_noupdate_REC + 1.

CLEAR : WA_IT_noupdate, WA_IT_VENDOR_MASTER.

endif.

ENDLOOP.

IF FL_FLAG3 = 'X'.

PERFORM CLOSE_BDC_SESSION.

ENDIF.

ENDFORM. " INSERT_VENDOR_MASTER_DATA

&----


*& Form POPULATE_BDC_DATA_VEN_MASTER

&----


  • This form is used to populate BDC data of Vendor Master

----


FORM POPULATE_BDC_DATA_VEN_MASTER .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_MASTER-ZTERM

IMPORTING

OUTPUT = WA_IT_VENDOR_MASTER-ZTERM.

IF WA_IT_VENDOR_MASTER-REPRF = 'Y'.

WA_IT_VENDOR_MASTER-REPRF = 'X'.

ENDIF.

IF WA_IT_VENDOR_MASTER-XPORE = 'Y'.

WA_IT_VENDOR_MASTER-XPORE = 'X'.

ENDIF.

if wa_it_vendor_master-flag = 'A'.

PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0105',

BDC_FIELD USING 'RF02K-LIFNR' WA_IT_VENDOR_MASTER-LIFNR,

BDC_FIELD USING 'RF02K-BUKRS' WA_IT_VENDOR_MASTER-BUKRS,

BDC_FIELD USING 'RF02K-KTOKK' WA_IT_VENDOR_MASTER-KTOKK,

BDC_FIELD USING 'BDC_OKCODE' '/00'.

elseif wa_it_vendor_master-flag = 'C'.

PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0106',

BDC_FIELD USING 'RF02K-LIFNR' WA_IT_VENDOR_MASTER-LIFNR,

BDC_FIELD USING 'RF02K-BUKRS' WA_IT_VENDOR_MASTER-BUKRS,

BDC_FIELD USING 'BDC_OKCODE' '=MALL',

BDC_DYNPRO USING 'SAPMF02K' '0106',

BDC_FIELD USING 'RF02K-D0110' 'X',

BDC_FIELD USING 'RF02K-D0120' 'X',

BDC_FIELD USING 'RF02K-D0130' 'X',

BDC_FIELD USING 'RF02K-D0210' 'X',

BDC_FIELD USING 'RF02K-D0215' 'X',

BDC_FIELD USING 'RF02K-D0220' 'X',

BDC_FIELD USING 'BDC_OKCODE' '/00'.

endif.

perform :BDC_DYNPRO USING 'SAPMF02K' '0110',

BDC_FIELD USING 'LFA1-ANRED' WA_IT_VENDOR_MASTER-ANRED,

BDC_FIELD USING 'LFA1-NAME1' WA_IT_VENDOR_MASTER-NAME1,

BDC_FIELD USING 'LFA1-NAME2' WA_IT_VENDOR_MASTER-NAME2,

BDC_FIELD USING 'LFA1-SORTL' WA_IT_VENDOR_MASTER-SORTL,

BDC_FIELD USING 'LFA1-STRAS' WA_IT_VENDOR_MASTER-STRAS,

BDC_FIELD USING 'LFA1-ORT01' WA_IT_VENDOR_MASTER-ORT01,

BDC_FIELD USING 'LFA1-PSTLZ' WA_IT_VENDOR_MASTER-PSTLZ,

BDC_FIELD USING 'LFA1-LAND1' WA_IT_VENDOR_MASTER-LAND1,

BDC_FIELD USING 'LFA1-REGIO' WA_IT_VENDOR_MASTER-REGIO,

BDC_FIELD USING 'LFA1-SPRAS' WA_IT_VENDOR_MASTER-SPRAS,

BDC_FIELD USING 'BDC_OKCODE' '/00',

BDC_DYNPRO USING 'SAPMF02K' '0120',

BDC_FIELD USING 'LFA1-VBUND' WA_IT_VENDOR_MASTER-VBUND,

BDC_FIELD USING 'BDC_OKCODE' '/00',

BDC_DYNPRO USING 'SAPMF02K' '0130',

BDC_FIELD USING 'LFBK-BANKS(01)' WA_IT_VENDOR_MASTER-BANKS,

BDC_FIELD USING 'LFBK-BANKL(01)' WA_IT_VENDOR_MASTER-BANKL,

BDC_FIELD USING 'LFBK-BANKN(01)' WA_IT_VENDOR_MASTER-BANKN,

BDC_FIELD USING 'BDC_OKCODE' '=BANK',

BDC_DYNPRO USING 'SAPLBANK' '0100',

BDC_FIELD USING 'BNKA-BANKA' WA_IT_VENDOR_MASTER-BANKA,

BDC_FIELD USING 'BDC_OKCODE' '=ENTR',

BDC_DYNPRO USING 'SAPMF02K' '0130',

BDC_FIELD USING 'BDC_OKCODE' '=ENTR',

BDC_DYNPRO USING 'SAPMF02K' '0210',

BDC_FIELD USING 'LFB1-AKONT' WA_IT_VENDOR_MASTER-AKONT,

BDC_FIELD USING 'LFB1-FDGRV' WA_IT_VENDOR_MASTER-FDGRV,

BDC_FIELD USING 'BDC_OKCODE' '=/00',

BDC_DYNPRO USING 'SAPMF02K' '0215',

BDC_FIELD USING 'LFB1-ZTERM' WA_IT_VENDOR_MASTER-ZTERM,

BDC_FIELD USING 'LFB1-REPRF' WA_IT_VENDOR_MASTER-REPRF,

BDC_FIELD USING 'LFB1-ZWELS' WA_IT_VENDOR_MASTER-ZWELS,

BDC_FIELD USING 'LFB1-XPORE' WA_IT_VENDOR_MASTER-XPORE,

BDC_FIELD USING 'BDC_OKCODE' '=UPDA'.

ENDFORM. " POPULATE_BDC_DATA_VEN_MASTER

&----


*& Form BDC_DYNPRO

&----


  • This form is used to move data to BDCDATA int'table

----


FORM BDC_DYNPRO USING PROGRAM TYPE BDC_PROG

DYNPRO TYPE BDC_DYNR.

CLEAR WA_IT_BDCDATA.

WA_IT_BDCDATA-PROGRAM = PROGRAM.

WA_IT_BDCDATA-DYNPRO = DYNPRO.

WA_IT_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_IT_BDCDATA TO IT_BDCDATA.

ENDFORM. " BDC_DYNPRO

&----


*& Form BDC_FIELD

&----


  • This form is used to move data to BDCDATA int'table

----


FORM BDC_FIELD USING FNAM TYPE ANY

FVAL TYPE ANY.

CLEAR WA_IT_BDCDATA.

WA_IT_BDCDATA-FNAM = FNAM.

WA_IT_BDCDATA-FVAL = FVAL.

APPEND WA_IT_BDCDATA TO IT_BDCDATA.

ENDFORM. " BDC_FIELD

&----


*& Form CALL_TRANSACTION

&----


  • This form is used to Call FK01 for processing of data either for

  • Vendor Master or Vendor Extend. The error records are inserted to

  • Session which can be processed using SM35

----


FORM CALL_TRANSACTION .

DATA : L_OPTION TYPE CTU_PARAMS,

L_SUBRC TYPE SYSUBRC.

REFRESH IT_MESSTAB.

CLEAR IT_MESSTAB.

L_OPTION-DEFSIZE = 'X'.

L_OPTION-DISMODE = P_MODE.

L_OPTION-UPDMODE = 'S'.

CALL TRANSACTION 'FK01'

USING IT_BDCDATA

MESSAGES INTO IT_MESSTAB

OPTIONS FROM L_OPTION.

L_SUBRC = SY-SUBRC.

IF L_SUBRC = 0.

W_SUCC_REC = W_SUCC_REC + 1.

ELSE.

IF FL_FLAG2 NE 'X'.

PERFORM OPEN_BDC_SESSION.

FL_FLAG2 = 'X'.

ENDIF.

PERFORM BDC_INSERT.

W_ERR_REC = W_ERR_REC + 1.

PERFORM ERROR_RECORD_DATA.

ENDIF.

ENDFORM. " CALL_TRANSACTION

&----


*& Form OPEN_BDC_SESSION

&----


  • Form used to open session for Error out Records

----


FORM OPEN_BDC_SESSION .

DATA : L_USERID TYPE APQ_MAPN, " Variable to hold user-id

L_GROUP TYPE APQ_GRPN. " Variable to hold value

MOVE P_GROUP TO L_GROUP.

MOVE SY-UNAME TO L_USERID.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = L_GROUP

KEEP = SPACE

USER = L_USERID

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.

WRITE:/ TEXT-008. " Unable to open BDC Session

ENDIF.

ENDFORM. " OPEN_BDC_SESSION

&----


*& Form BDC_INSERT

&----


  • This form is used to insert error records to a Session method

----


FORM BDC_INSERT .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'FK01'

TABLES

DYNPROTAB = IT_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.

WRITE:/ TEXT-009. " Unable to Insert Data to BDC Session

ENDIF.

ENDFORM. " BDC_INSERT

&----


*& Form ERROR_RECORD_DATA

&----


  • This form is used to process the messages for the error records which

  • will be displayed on the output report

----


FORM ERROR_RECORD_DATA .

DATA : L_LINES TYPE I,

L_MSG(200) TYPE C.

DESCRIBE TABLE IT_MESSTAB LINES L_LINES.

READ TABLE IT_MESSTAB INTO WA_IT_MESSTAB INDEX L_LINES.

IF SY-SUBRC = 0.

CLEAR L_MSG.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = WA_IT_MESSTAB-MSGID

LANG = SY-LANGU

NO = WA_IT_MESSTAB-MSGNR

V1 = WA_IT_MESSTAB-MSGV1

V2 = WA_IT_MESSTAB-MSGV2

V3 = WA_IT_MESSTAB-MSGV3

V4 = WA_IT_MESSTAB-MSGV4

IMPORTING

MSG = L_MSG

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

IF SY-SUBRC = 0.

WA_IT_ERROR_fk01-MSG = L_MSG.

ENDIF.

IF P_VENMAS = 'X'.

WA_IT_ERROR_fk01-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_ERROR_fk01-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

ELSEIF P_VENEXT = 'X'.

WA_IT_ERROR_fk01-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.

WA_IT_ERROR_fk01-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

ENDIF.

APPEND WA_IT_ERROR_fk01 TO IT_ERROR_fk01.

CLEAR WA_IT_ERROR_fk01.

ENDIF.

ENDFORM. " ERROR_RECORD_DATA

&----


*& Form CLOSE_BDC_SESSION

&----


  • Form used to close session of the Error Records

----


FORM CLOSE_BDC_SESSION .

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

NOT_OPEN = 1

QUEUE_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

WRITE:/ TEXT-010. " Unable to Close BDC Session

ENDIF.

ENDFORM. " CLOSE_BDC_SESSION

&----


*& Form CHK_AND_INS_VENDOR_EXTEND_DATA

&----


  • This form is used to process BDC data for Vendor Extend

----


FORM CHK_AND_INS_VENDOR_EXTEND_DATA .

DATA : L_LIFNR TYPE LIFNR.

CLEAR : L_LIFNR, fl_flag4.

sort it_vendor_extend by flag.

LOOP AT IT_VENDOR_EXTEND INTO WA_IT_VENDOR_EXTEND.

W_COUNT = W_COUNT + 1.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_EXTEND-REF_LIFNR

IMPORTING

OUTPUT = WA_IT_VENDOR_EXTEND-REF_LIFNR.

if wa_it_vendor_extend-flag = 'A'.

SELECT SINGLE LIFNR

FROM LFB1

INTO L_LIFNR

WHERE LIFNR = WA_IT_VENDOR_EXTEND-REF_LIFNR

AND BUKRS = WA_IT_VENDOR_EXTEND-REF_BUKRS.

IF SY-SUBRC NE 0.

WA_IT_ERROR-LIFNR = WA_IT_VENDOR_EXTEND-REF_LIFNR.

WA_IT_ERROR-BUKRS = WA_IT_VENDOR_EXTEND-REF_BUKRS.

WA_IT_ERROR-MSG = TEXT-007.

APPEND WA_IT_ERROR TO IT_ERROR.

W_ERR_REC = W_ERR_REC + 1.

CLEAR : WA_IT_ERROR, L_LIFNR.

ELSE.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_EXTEND-LIFNR

IMPORTING

OUTPUT = WA_IT_VENDOR_EXTEND-LIFNR.

SELECT SINGLE LIFNR

FROM LFB1

INTO L_LIFNR

WHERE LIFNR = WA_IT_VENDOR_EXTEND-LIFNR

AND BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

IF SY-SUBRC EQ 0.

WA_IT_ERROR-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.

WA_IT_ERROR-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

WA_IT_ERROR-MSG = TEXT-015.

APPEND WA_IT_ERROR TO IT_ERROR.

W_ERR_REC = W_ERR_REC + 1.

CLEAR : WA_IT_ERROR, L_LIFNR.

ELSE.

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM POPULATE_BDC_DATA_VEN_EXTEND.

PERFORM CALL_TRANSACTION.

ENDIF.

ENDIF.

CLEAR : WA_IT_VENDOR_EXTEND.

elseif wa_it_vendor_extend-flag = 'C'.

IF FL_FLAG2 = 'X' and fl_flag4 ne 'X'.

PERFORM CLOSE_BDC_SESSION.

fl_flag4 = 'X'.

ENDIF.

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM POPULATE_BDC_DATA_VEN_extend.

PERFORM CALL_TRANSACTION_FK02.

CLEAR : WA_IT_VENDOR_EXTEND.

elseif wa_it_vendor_extend-flag = 'N'.

WA_IT_noupdate-LIFNR = WA_IT_VENDOR_extend-LIFNR.

WA_IT_noupdate-BUKRS = WA_IT_VENDOR_extend-BUKRS.

WA_IT_noupdate-MSG = TEXT-019.

APPEND WA_IT_noupdate TO IT_noupdate.

W_noupdate_REC = W_noupdate_REC + 1.

CLEAR : WA_IT_noupdate, WA_IT_VENDOR_EXTEND.

endif.

ENDLOOP.

IF FL_FLAG2 = 'X'.

PERFORM CLOSE_BDC_SESSION.

ENDIF.

if fl_flag3 = 'X'.

PERFORM CLOSE_BDC_SESSION.

ENDIF.

ENDFORM. " CHK_AND_INS_VENDOR_EXTEND_DATA

&----


*& Form POPULATE_BDC_DATA_VEN_EXTEND

&----


  • This form is used to populate BDC data of Vendor Extend

----


FORM POPULATE_BDC_DATA_VEN_EXTEND .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WA_IT_VENDOR_EXTEND-ZTERM

IMPORTING

OUTPUT = WA_IT_VENDOR_EXTEND-ZTERM.

IF WA_IT_VENDOR_EXTEND-REPRF = 'Y'.

WA_IT_VENDOR_EXTEND-REPRF = 'X'.

ENDIF.

IF WA_IT_VENDOR_extend-XPORE = 'Y'.

WA_IT_VENDOR_extend-XPORE = 'X'.

ENDIF.

if wa_it_vendor_extend-flag = 'A'.

PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0105',

BDC_FIELD USING 'RF02K-LIFNR' WA_IT_VENDOR_EXTEND-LIFNR,

BDC_FIELD USING 'RF02K-BUKRS' WA_IT_VENDOR_EXTEND-BUKRS,

BDC_FIELD USING 'RF02K-KTOKK' WA_IT_VENDOR_EXTEND-KTOKK,

BDC_FIELD USING 'RF02K-REF_LIFNR'

WA_IT_VENDOR_EXTEND-REF_LIFNR,

BDC_FIELD USING 'RF02K-REF_BUKRS'

WA_IT_VENDOR_EXTEND-REF_BUKRS,

BDC_FIELD USING 'BDC_OKCODE' '/00'.

elseif wa_it_vendor_extend-flag = 'C'.

PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0106',

BDC_FIELD USING 'RF02K-LIFNR' WA_IT_VENDOR_extend-LIFNR,

BDC_FIELD USING 'RF02K-BUKRS' WA_IT_VENDOR_extend-BUKRS,

BDC_FIELD USING 'RF02K-D0210' 'X',

BDC_FIELD USING 'RF02K-D0215' 'X',

BDC_FIELD USING 'BDC_OKCODE' '/00'.

endif.

perform :BDC_DYNPRO USING 'SAPMF02K' '0210',

BDC_FIELD USING 'LFB1-AKONT' WA_IT_VENDOR_EXTEND-AKONT,

BDC_FIELD USING 'LFB1-FDGRV' WA_IT_VENDOR_EXTEND-FDGRV,

BDC_FIELD USING 'BDC_OKCODE' '=/00',

BDC_DYNPRO USING 'SAPMF02K' '0215',

BDC_FIELD USING 'LFB1-ZTERM' WA_IT_VENDOR_EXTEND-ZTERM,

BDC_FIELD USING 'LFB1-REPRF' WA_IT_VENDOR_EXTEND-REPRF,

BDC_FIELD USING 'LFB1-ZWELS' WA_IT_VENDOR_EXTEND-ZWELS,

BDC_FIELD USING 'LFB1-XPORE' WA_IT_VENDOR_extend-XPORE,

BDC_FIELD USING 'BDC_OKCODE' '=UPDA'.

ENDFORM. " POPULATE_BDC_DATA_VEN_EXTEND

&----


*& Form DISPLAY_ERROR_REPORT

&----


  • This form is used to display the error records on the output screen

----


FORM DISPLAY_ERROR_REPORT .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O05. " Error List for Vendor Master

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O06. " Error List for Vendor Master Extended

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H03, " Error Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_ERROR INTO WA_IT_ERROR.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_ERROR-LIFNR,

17 SY-VLINE,

18 WA_IT_ERROR-BUKRS,

31 SY-VLINE,

32 WA_IT_ERROR-MSG,

100 SY-VLINE.

CLEAR : WA_IT_ERROR.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

ENDFORM. " DISPLAY_ERROR_REPORT

&----


*& Form CALL_TRANSACTION_FK02

&----


  • Form used to Call Transaction FK02

----


form CALL_TRANSACTION_FK02 .

DATA : L_OPTION TYPE CTU_PARAMS,

L_SUBRC TYPE SYSUBRC.

REFRESH IT_MESSTAB.

CLEAR IT_MESSTAB.

L_OPTION-DEFSIZE = 'X'.

L_OPTION-DISMODE = P_MODE.

L_OPTION-UPDMODE = 'S'.

CALL TRANSACTION 'FK02'

USING IT_BDCDATA

MESSAGES INTO IT_MESSTAB

OPTIONS FROM L_OPTION.

L_SUBRC = SY-SUBRC.

IF L_SUBRC = 0.

W_SUCC_REC1 = W_SUCC_REC1 + 1.

WA_IT_succ_rec1-MSG = Text-017.

IF P_VENMAS = 'X'.

WA_IT_succ_rec1-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_succ_rec1-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

ELSEIF P_VENEXT = 'X'.

WA_IT_succ_rec1-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.

WA_IT_succ_rec1-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

ENDIF.

APPEND WA_IT_succ_rec1 TO IT_succ_rec1.

ELSE.

IF FL_FLAG3 NE 'X'.

PERFORM OPEN_BDC_SESSION_fk02.

FL_FLAG3 = 'X'.

ENDIF.

PERFORM BDC_INSERT_fk02.

W_ERR_REC = W_ERR_REC + 1.

PERFORM ERROR_RECORD_DATA1.

ENDIF.

endform. " CALL_TRANSACTION_FK02

&----


*& Form OPEN_BDC_SESSION_fk02

&----


  • Form used to Open session for FK02

----


form OPEN_BDC_SESSION_fk02 .

DATA : L_USERID TYPE APQ_MAPN, " Variable to hold user-id

L_GROUP TYPE APQ_GRPN. " Variable to hold value

MOVE P_GROUP1 TO L_GROUP.

MOVE SY-UNAME TO L_USERID.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = L_GROUP

KEEP = SPACE

USER = L_USERID

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.

WRITE:/ TEXT-008. " Unable to open BDC Session

ENDIF.

endform. " OPEN_BDC_SESSION_fk02

&----


*& Form BDC_INSERT_fk02

&----


  • Form used to insert data into BDC session using FK02

----


form BDC_INSERT_fk02 .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'FK02'

TABLES

DYNPROTAB = IT_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.

WRITE:/ TEXT-009. " Unable to Insert Data to BDC Session

ENDIF.

endform. " BDC_INSERT_fk02

&----


*& Form display_changed_report

&----


  • Form to display Updated Vendor data

----


form display_changed_report .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O10. " Updated List for Vendor Master

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O11. " Updated List for Vendor Master Extended

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H04, " Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_succ_rec1 INTO WA_IT_succ_rec1.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_succ_rec1-LIFNR,

17 SY-VLINE,

18 WA_IT_succ_rec1-BUKRS,

31 SY-VLINE,

32 WA_IT_succ_rec1-MSG,

100 SY-VLINE.

CLEAR : WA_IT_succ_rec1.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

endform. " display_changed_report

&----


*& Form display_nochange_report

&----


  • Form to display No Changed data for Vendors

----


form display_nochange_report .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O12. " No Changes List for Vendor Master

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O13. " No Changes List for Vendor Master Extended

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H04, " Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_noupdate INTO WA_IT_noupdate.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_noupdate-LIFNR,

17 SY-VLINE,

18 WA_IT_noupdate-BUKRS,

31 SY-VLINE,

32 WA_IT_noupdate-MSG,

100 SY-VLINE.

CLEAR : WA_IT_noupdate.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

endform. " display_nochange_report

&----


*& Form ERROR_RECORD_DATA1

&----


  • Form to get Error Message for Changed Vendors

----


form ERROR_RECORD_DATA1 .

DATA : L_LINES TYPE I,

L_MSG(200) TYPE C.

DESCRIBE TABLE IT_MESSTAB LINES L_LINES.

READ TABLE IT_MESSTAB INTO WA_IT_MESSTAB INDEX L_LINES.

IF SY-SUBRC = 0.

CLEAR L_MSG.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = WA_IT_MESSTAB-MSGID

LANG = SY-LANGU

NO = WA_IT_MESSTAB-MSGNR

V1 = WA_IT_MESSTAB-MSGV1

V2 = WA_IT_MESSTAB-MSGV2

V3 = WA_IT_MESSTAB-MSGV3

V4 = WA_IT_MESSTAB-MSGV4

IMPORTING

MSG = L_MSG

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

IF SY-SUBRC = 0.

WA_IT_ERROR_fk02-MSG = L_MSG.

ENDIF.

IF P_VENMAS = 'X'.

WA_IT_ERROR_fk02-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.

WA_IT_ERROR_fk02-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.

ELSEIF P_VENEXT = 'X'.

WA_IT_ERROR_fk02-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.

WA_IT_ERROR_fk02-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.

ENDIF.

APPEND WA_IT_ERROR_fk02 TO IT_ERROR_fk02.

CLEAR WA_IT_ERROR_fk02.

ENDIF.

endform. " ERROR_RECORD_DATA1

&----


*& Form display_error_report_fk01

&----


  • Form to display Error Report for Master Vendors (FK01)

----


form display_error_report_fk01 .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O05. " Error List for Vendor Master (FK01)

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O06. " Error List for Vendor Master Extended (FK01)

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H04, " Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_ERROR_fk01 INTO WA_IT_ERROR_fk01.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_ERROR_fk01-LIFNR,

17 SY-VLINE,

18 WA_IT_ERROR_fk01-BUKRS,

31 SY-VLINE,

32 WA_IT_ERROR_fk01-MSG,

100 SY-VLINE.

CLEAR : WA_IT_ERROR_fk01.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

endform. " display_error_report_fk01

&----


*& Form display_error_report_fk02

&----


  • Form to display Error Report for changed Vendors (FK02)

----


form display_error_report_fk02 .

IF P_VENMAS = 'X'.

WRITE:/ TEXT-O14. " Error List for Vendor Master (FK02)

ELSEIF P_VENEXT = 'X'.

WRITE:/ TEXT-O15. " Error List for Vendor Master Extended (FK02)

ENDIF.

WRITE:/ SY-ULINE(100).

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,

2 TEXT-H01, " Vendor Number

17 SY-VLINE,

18 TEXT-H02, " Company Code

31 SY-VLINE,

32 TEXT-H04, " Message

100 SY-VLINE.

FORMAT COLOR OFF.

WRITE:/ SY-ULINE(100).

LOOP AT IT_ERROR_fk02 INTO WA_IT_ERROR_fk02.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,

2 WA_IT_ERROR_fk02-LIFNR,

17 SY-VLINE,

18 WA_IT_ERROR_fk02-BUKRS,

31 SY-VLINE,

32 WA_IT_ERROR_fk02-MSG,

100 SY-VLINE.

CLEAR : WA_IT_ERROR_fk02.

FORMAT COLOR OFF.

ENDLOOP.

WRITE:/ SY-ULINE(100).

endform. " display_error_report_fk02

0 Kudos
103

Hi ramesh babu,

i would like give some points here for the code you posted.

please advise you email address.