Call transaction method of BDC
Upcoming SlideShare
Loading in...5
×
 

Call transaction method of BDC

on

  • 733 views

Hi This is a Sample Code of Call Transaction Method of BDC (Batch Data Conversion).

Hi This is a Sample Code of Call Transaction Method of BDC (Batch Data Conversion).

Statistics

Views

Total Views
733
Views on SlideShare
733
Embed Views
0

Actions

Likes
0
Downloads
8
Comments
1

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • helpful.Thnx
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Call transaction method of BDC Call transaction method of BDC Document Transcript

  • REPORT ZBDC_003 NO STANDARD PAGE HEADING LINE-SIZE 255. TYPES: BEGIN OF TAB, PERNR TYPE ZTAB_001-PERNR, ENAME TYPE ZTAB_001-ENAME, CITY TYPE ZTAB_001-CITY, END OF TAB. DATA: IT_TAB TYPE TABLE OF TAB, WA_TAB TYPE TAB, D_FILE TYPE STRING, BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE, MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE. PARAMETERS: P_FILE TYPE IBIPPARMS-PATH OBLIGATORY. AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE. CALL FUNCTION 'F4_FILENAME' IMPORTING FILE_NAME = P_FILE. D_FILE = P_FILE. CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME FILETYPE = D_FILE = 'ASC' HAS_FIELD_SEPARATOR * HEADER_LENGTH = 'X' =0
  • * READ_BY_LINE = 'X' * DAT_MODE ='' * CODEPAGE ='' * IGNORE_CERR = ABAP_TRUE * REPLACEMENT = '#' * CHECK_BOM ='' * VIRUS_SCAN_PROFILE = * NO_AUTH_CHECK ='' * IMPORTING * FILELENGTH * HEADER = = TABLES DATA_TAB = IT_TAB EXCEPTIONS FILE_OPEN_ERROR =1 FILE_READ_ERROR =2 NO_BATCH =3 GUI_REFUSE_FILETRANSFER INVALID_TYPE =4 =5 NO_AUTHORITY =6 UNKNOWN_ERROR =7 BAD_DATA_FORMAT =8 HEADER_NOT_ALLOWED =9 SEPARATOR_NOT_ALLOWED HEADER_TOO_LONG = 10 = 11
  • UNKNOWN_DP_ERROR = 12 ACCESS_DENIED = 13 DP_OUT_OF_MEMORY DISK_FULL = 15 DP_TIMEOUT OTHERS = 14 = 16 = 17 . IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. START-OF-SELECTION. *perform open_group. * LOOP AT IT_TAB INTO WA_TAB. PERFORM BDC_DYNPRO USING 'SAPMSVMA' '0100'. PERFORM BDC_FIELD USING 'BDC_CURSOR' 'VIEWNAME'. PERFORM BDC_FIELD USING 'BDC_OKCODE' '=UPD'. PERFORM BDC_FIELD USING 'VIEWNAME' 'ZTAB_001'. PERFORM BDC_FIELD USING 'VIMDYNFLDS-LTD_DTA_NO' 'X'. PERFORM BDC_DYNPRO USING 'SAPLZTAB_001' '0100'. PERFORM BDC_FIELD USING 'BDC_CURSOR' 'ZTAB_001-PERNR(01)'. PERFORM BDC_FIELD USING 'BDC_OKCODE'’=ANZG'. PERFORM BDC_DYNPRO USING 'SAPLZTAB_001' '0100'.
  • PERFORM BDC_FIELD USING 'BDC_CURSOR' 'ZTAB_001-PERNR(01)'. PERFORM BDC_FIELD USING 'BDC_OKCODE' '=AEND'. PERFORM BDC_DYNPRO USING 'SAPLZTAB_001' '0100'. PERFORM BDC_FIELD USING 'BDC_CURSOR' 'ZTAB_001-PERNR(01)'. PERFORM BDC_FIELD USING 'BDC_OKCODE' '=NEWL'. PERFORM BDC_DYNPRO USING 'SAPLZTAB_001' '0100'. PERFORM BDC_FIELD USING 'BDC_CURSOR' 'ZTAB_001-CITY(01)'. PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'. PERFORM BDC_FIELD USING 'ZTAB_001-PERNR(01)' WA_TAB-PERNR. PERFORM BDC_FIELD USING 'ZTAB_001-ENAME(01)' WA_TAB-ENAME. PERFORM BDC_FIELD USING 'ZTAB_001-CITY(01)' WA_TAB-CITY. PERFORM BDC_DYNPRO PERFORM BDC_FIELD USING 'SAPLZTAB_001' '0100'. USING 'BDC_CURSOR' 'ZTAB_001-PERNR(02)'. PERFORM BDC_FIELD USING 'BDC_OKCODE' '=BACK'. PERFORM BDC_DYNPRO PERFORM BDC_FIELD USING 'SAPLZTAB_001' '0100'. USING 'BDC_CURSOR' 'ZTAB_001-PERNR(02)'. PERFORM BDC_FIELD USING 'BDC_OKCODE' '=BACK'. PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0100'.
  • PERFORM BDC_FIELD USING 'BDC_OKCODE' '=YES'. PERFORM BDC_DYNPRO PERFORM BDC_FIELD USING 'SAPMSVMA' '0100'. USING 'BDC_OKCODE' '/EBACK'. PERFORM BDC_FIELD USING 'BDC_CURSOR' 'VIEWNAME'. PERFORM BDC_TRANSACTION USING 'SM30'. CLEAR: BDCDATA, BDCDATA[]. ENDLOOP. *perform close_group. *&---------------------------------------------------------------------* *& Form bdc_dynpro *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0154 text * -->P_0155 text *----------------------------------------------------------------------* FORM BDC_DYNPRO USING PROGRAM DYNPRO. CLEAR BDCDATA. BDCDATA-PROGRAM = PROGRAM. BDCDATA-DYNPRO = DYNPRO. BDCDATA-DYNBEGIN = 'X'.
  • APPEND BDCDATA. ENDFORM. " bdc_dynpro *&---------------------------------------------------------------------* *& Form bdc_field *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0304 text * -->P_0305 text *----------------------------------------------------------------------* FORM BDC_FIELD USING FNAM FVAL. * IF FVAL <> NODATA. CLEAR BDCDATA. BDCDATA-FNAM = FNAM. BDCDATA-FVAL = FVAL. APPEND BDCDATA. ENDFORM. " bdc_field *&---------------------------------------------------------------------* *& Form bdc_transaction *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0309 text
  • *----------------------------------------------------------------------* FORM BDC_TRANSACTION USING TCODE. REFRESH MESSTAB. CALL TRANSACTION TCODE USING BDCDATA MODE 'E'"CTUMODE UPDATE 'S' "CUPDATE MESSAGES INTO MESSTAB. ENDFORM. *include bdcrecx1. " bdc_transaction