Your SlideShare is downloading. ×
REPORT ZBDC_003 NO STANDARD PAGE HEADING LINE-SIZE 255.
TYPES: BEGIN OF TAB,
PERNR TYPE ZTAB_001-PERNR,
ENAME TYPE ZTAB_00...
* READ_BY_LINE

= 'X'

* DAT_MODE

=''

* CODEPAGE

=''

* IGNORE_CERR

= ABAP_TRUE

* REPLACEMENT

= '#'

* CHECK_BOM

='...
UNKNOWN_DP_ERROR

= 12

ACCESS_DENIED

= 13

DP_OUT_OF_MEMORY
DISK_FULL

= 15

DP_TIMEOUT
OTHERS

= 14

= 16
= 17

.
IF SY...
PERFORM BDC_FIELD

USING 'BDC_CURSOR' 'ZTAB_001-PERNR(01)'.

PERFORM BDC_FIELD

USING 'BDC_OKCODE' '=AEND'.

PERFORM BDC_D...
PERFORM BDC_FIELD

USING 'BDC_OKCODE'

'=YES'.
PERFORM BDC_DYNPRO
PERFORM BDC_FIELD

USING 'SAPMSVMA' '0100'.
USING 'BDC_O...
APPEND BDCDATA.

ENDFORM.

" bdc_dynpro

*&---------------------------------------------------------------------*
*&

Form...
*----------------------------------------------------------------------*
FORM BDC_TRANSACTION USING TCODE.
REFRESH MESSTAB...
Upcoming SlideShare
Loading in...5
×

Call transaction method of BDC

559

Published on

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

Published in: Education, Technology, Sports
1 Comment
0 Likes
Statistics
Notes
  • helpful.Thnx
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total Views
559
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Call transaction method of BDC"

  1. 1. 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
  2. 2. * 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
  3. 3. 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'.
  4. 4. 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'.
  5. 5. 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'.
  6. 6. 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
  7. 7. *----------------------------------------------------------------------* 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

×