Professional Documents
Culture Documents
ZBDC - Ctran Heading: No Standard Page
ZBDC - Ctran Heading: No Standard Page
ZBDC - Ctran Heading: No Standard Page
*&---------------------------------------------------------
------------*
*& Report ZBDC_CTRAN
*&
*&---------------------------------------------------------
------------*
*&
*&
*&---------------------------------------------------------
------------*
perform upload_data.
PERFORM call_tran.
PERFORM summry.
form call_tran.
loop at it_emp .
refresh it_bdcdata.
*& copy paste the req code from SHDB gen program
*& all the BDC_DYNPRO and BDC_FIELD as it is .
*& edit the code as required
endloop.
endform. " BDC_SES_INSERT
*----------------------------------------------------------
------------*
* Insert field
*
*----------------------------------------------------------
------------*
form bdc_field using fnam fval.
* if fval <> nodata.
clear it_bdcdata.
it_bdcdata-fnam = fnam.
it_bdcdata-fval = fval.
append it_bdcdata.
* endif.
endform.
form upload_data .
call function 'GUI_UPLOAD'
exporting
filename = 'C:\Users\farooq.sank
anur\Documents\upload.txt'
filetype = 'ASC'
has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = it_emp
* 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 and it_emp is not initial.
message 'data uploaded' type 'S'.
else.
message 'No data found' type 'S'.
* Implement suitable error handling here
endif.
*&---------------------------------------------------------
------------*
*& Report ZBDC_SES
*&
*&---------------------------------------------------------
------------*
*&
*&
*&---------------------------------------------------------
------------*
perform upload_data.
perform check_data.
perform bdc_session_open_group.
perform bdc_ses_insert.
perform bdc_close.
*&---------------------------------------------------------
------------*
*& Form UPLOAD_DATA
*&---------------------------------------------------------
------------*
* text
*----------------------------------------------------------
------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------
------------*
form upload_data .
call function 'GUI_UPLOAD'
exporting
filename = 'C:\Users\farooq.sank
anur\Documents\upload.txt'
filetype = 'ASC'
has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = it_emp
* 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 and it_emp is not initial.
message 'data uploaded' type 'S'.
else.
message 'No data found' type 'S'.
* Implement suitable error handling here
endif.
endloop.
endform. " CHECK_DATA
*&---------------------------------------------------------
------------*
*& Form BDC_SESSION_OPEN_GROUP
*&---------------------------------------------------------
------------*
* text
*----------------------------------------------------------
------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------
------------*
form bdc_session_open_group .
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = 'SESSION' " session name
holddate = date
keep = keep
user = sy-uname
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 'Session created check SM35 Tcode' type 'I'.
* Implement suitable error handling here
endif.
*& copy paste the req code from SHDB gen program
*& all the BDC_DYNPRO and BDC_FIELD as it is .
*& edit the code as required
*----------------------------------------------------------
------------*
* Insert field
*
*----------------------------------------------------------
------------*
form bdc_field using fnam fval.
* if fval <> nodata.
clear it_bdcdata.
it_bdcdata-fnam = fnam.
it_bdcdata-fval = fval.
append it_bdcdata.
* endif.
endform.
*&---------------------------------------------------------
------------*
*& Form BDC_CLOSE
*&---------------------------------------------------------
------------*
* text
*----------------------------------------------------------
------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------
------------*
form bdc_close .
call function 'BDC_CLOSE_GROUP'
* EXCEPTIONS
* NOT_OPEN = 1
* QUEUE_ERROR = 2
* OTHERS = 3
.
if sy-subrc <> 0.
* Implement suitable error handling here
endif.