*----------------------------------------------------------------------*
* Report Z_M_BDCBOM *
* *
*----------------------------------------------------------------------*
* *
* Created by: sambasivarao.M *
* TCode : CS01 *
* Created on 26.04.2006 *
* Modified on 05.07.2006. *
* Modified on 25.08.2006. *
* *
* This BDC program uploads the input file in .TXT format and uploads *
* the BOM accordingly. The flat file is to be left-justified and fit *
* columns and stored in the path C:/temp/bom.txt. In excel, for the *
* different line items, the parent material column has to be *
* repeated. Also for different sub-items, the columns in child *
* material has to be repeated for each sub-item. *
*----------------------------------------------------------------------*
REPORT Z_M_BDCBOM
no standard page heading
line-size 255.
tables: mara.
* SELECTION SCREEN
selection-screen: Begin of block b1 with frame title text-001.
parameters: filename like rlgrap-filename
default 'C:\temp\bom1.txt' obligatory,
P_DOWNLD like rlgrap-filename
default 'C:\Log.xls' obligatory,
P_parent like rlgrap-filename
default 'C:\parent' obligatory,
P_child like rlgrap-filename
default 'C:\child.xls' obligatory,
parentc like rlgrap-filename
default 'C:\parentc.xls' obligatory.
selection-screen: end of block b1.
* INCLUDES
include bdcrecx1.
* INTERNAL TABLES DECLARATION
* Internal table to upload from flat file.
data: begin of record occurs 0,
matnr(18), " Material
posnr(04), " Item Number
postp(01), " Item Category
idnrk(18), " Child Component
menge(18), " Quantity
sortf(10), " Sort string
nlfzt(03), " Lead Time Offset
auskz(01), " Indicator: Sub-item exits
potx1(40), " Item Text 1
potx2(40), " Item Text 2
doknr(25), " Document Number
dokar(03), " Document Type
doktl(03), " Document Part
dokvr(02), " Document Version
ebort(20), " Installation Pt. for sub-item
upmng(13), " Sub-item Qty
uptxt(40), " Sub-item Text
end of record.
* Internal table for storing data related to Sub-items.
data: begin of itab occurs 0,
matnr(18), " Material
idnrk(18), " Child Component
ebort(20), " Installation Pt. for sub-item
upmng(13), " Sub-item Qty
uptxt(40), " Sub-item Text
end of itab.
* Internal table for recording Error Messages.
DATA: BEGIN OF I_MESSTAB OCCURS 0,
matnr LIKE mara-matnr, "Material
MSGTYP LIKE BDCMSGCOLL-MSGTYP,
L_MSTRING(480),
MSGV1 LIKE BDCMSGCOLL-MSGV1,
MSGV2 LIKE BDCMSGCOLL-MSGV2,
MSGV3 LIKE BDCMSGCOLL-MSGV3,
MSGV4 LIKE BDCMSGCOLL-MSGV4,
END OF I_MESSTAB.
data: begin of itab1 occurs 0,
matnr like mara-matnr,
end of itab1.
data: begin of itab2 occurs 0,
idnrk like mara-matnr,
end of itab2.
data: begin of itab3 occurs 0,
matnr like mara-matnr,
idnrk like mara-matnr,
end of itab3.
* VARIABLES DECLARATION
DATA FLAGEND(1).
DATA: M TYPE C VALUE 1, " Incrementor for line items in record
n type c value 1, " Incrementor for line items in itab
A(15), " Child Item index ( idnrl)
B(15), " Qty index ( menge)
C(15), " Item Category index ( postp)
D(15), " UOM index ( meins)
e(15), " Line item index ( posnr)
f(15), " Indicator index ( auskz)
g(15), " Sort String index ( sortf)
a1(15), " Installation Pt. ( ebort)
b1(15), " Sub-item Qty ( upmng)
c1(15). " Sub-item Text ( uptxt)
data: v_dat(10), " Valid-from Date
v_day(02), " Day
v_month(02), " Month
v_year(04), " Year
count(05). " Serial Number
data: p_fname type string.
* START OF SELECTION
start-of-selection.
A = 'rc29p-idnrk( )'.
B = 'rc29p-menge( )'.
C = 'rc29p-postp( )'.
D = 'rc29p-meins( )'.
E = 'rc29p-posnr( )'.
F = 'rc29p-auskz( )'.
G = 'RC29P-SORTF( )'.
A1 = 'rc29u-ebort( )'.
B1 = 'rc29u-upmng( )'.
C1 = 'rc29u-uptxt( )'.
* CALLING FUNCTION 'UPLOAD'
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = filename
FILETYPE = 'DAT'
* HEADLEN = ' '
* LINE_EXIT = ' '
* TRUNCLEN = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* DAT_D_FORMAT = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = record
* EXCEPTIONS
* CONVERSION_ERROR = 1
* FILE_OPEN_ERROR = 2
* FILE_READ_ERROR = 3
* INVALID_TYPE = 4
* NO_BATCH = 5
* UNKNOWN_ERROR = 6
* INVALID_TABLE_WIDTH = 7
* GUI_REFUSE_FILETRANSFER = 8
* CUSTOMER_ERROR = 9
* NO_AUTHORITY = 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.
* Material master validation.
loop at record.
*CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
* EXPORTING
* INPUT = record-matnr
* IMPORTING
* OUTPUT = record-matnr
** EXCEPTIONS
** LENGTH_ERROR = 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.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = record-idnrk
IMPORTING
OUTPUT = record-idnrk
* EXCEPTIONS
* LENGTH_ERROR = 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.
modify record index sy-tabix.
endloop.
*Material Master validation part.
loop at record.
select single * from mara where matnr eq record-matnr.
if sy-subrc ne 0.
move record-matnr to itab1-matnr.
append itab1.
endif.
endloop.
delete adjacent duplicates from itab1 comparing matnr.
loop at itab1.
delete record where matnr eq itab1-matnr.
endloop.
loop at record.
if not record-idnrk is initial.
select single * from mara where matnr eq record-idnrk.
if sy-subrc ne 0.
move record-idnrk to itab2-idnrk.
append itab2.
move record-matnr to itab3-matnr.
move record-idnrk to itab3-idnrk.
append itab3.
endif.
endif.
endloop.
delete adjacent duplicates from itab2 comparing idnrk.
delete adjacent duplicates from itab3 comparing matnr.
loop at itab3.
delete record where matnr eq itab3-matnr.
endloop.
p_fname = p_parent.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = p_fname
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = ';'
TABLES
DATA_TAB = itab1.
p_fname = p_child.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = p_fname
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = ';'
TABLES
DATA_TAB = itab2.
p_fname = parentc.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = p_fname
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = ';'
TABLES
DATA_TAB = itab3.
* Moving the contents of record(sub-item related) to itab.
loop at record.
move record-matnr to itab-matnr.
move record-idnrk to itab-idnrk.
move record-ebort to itab-ebort.
move record-upmng to itab-upmng.
move record-uptxt to itab-uptxt.
append itab.
endloop.
* Date format calculation
v_dat = sy-datum.
v_year = v_dat+0(4).
v_month = v_dat+4(2).
v_day = v_dat+6(2).
concatenate v_month v_day v_year into v_dat separated by '-'.
* START OF BDC SESSION
perform open_group.
loop at record.
count = sy-tabix.
on change of record-matnr.
CLEAR FLAGEND.
*First screen in CS01 to enter material, plant and usage.
perform bdc_dynpro using 'SAPLCSDI' '0100'.
perform bdc_field using 'RC29N-MATNR'
record-MATNR.
perform bdc_field using 'RC29N-WERKS'
'6400'.
perform bdc_field using 'RC29N-STLAN'
'1'.
perform bdc_field using 'RC29N-DATUV'
v_dat.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*Next screen - no values entered.
perform bdc_dynpro using 'SAPLCSDI' '0110'.
perform bdc_field using 'BDC_OKCODE'
'=KDGS'.
*Next screen - no values entered.
perform bdc_dynpro using 'SAPLCSDI' '0111'.
perform bdc_field using 'BDC_OKCODE'
'=UEBP'.
endon.
* Screens to enter the line items of the BOM, when item category = L
MOVE M TO A+12(2).
MOVE M TO B+12(2).
MOVE M TO C+12(2).
MOVE M TO D+12(2).
move M to E+12(2).
move M to F+12(2).
move M to G+12(2).
M = M + 1.
IF M GT 2.
M = 2.
ENDIF.
if record-postp eq 'L'.
*Line items entering screen
perform bdc_dynpro using 'SAPLCSDI' '0140'.
* perform bdc_field using 'BDC_CURSOR'
* F.
* 'RC29P-AUSKZ(01)'.
if record-auskz eq 'X'.
perform bdc_field using 'BDC_OKCODE'
'=FCUH'.
else.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endif.
* perform bdc_field using 'RC29P-AUSKZ(01)'
perform bdc_field using G
record-sortf.
perform bdc_field using F
record-AUSKZ.
perform bdc_field using E
record-POSNR.
* perform bdc_field using 'RC29P-IDNRK(01)'
perform bdc_field using A
record-IDNRK.
* perform bdc_field using 'RC29P-MENGE(01)'
perform bdc_field using B
record-MENGE.
* perform bdc_field using 'RC29P-POSTP(01)'
perform bdc_field using C
record-POSTP.
* Next screen to enter Lead Time Offset.
perform bdc_dynpro using 'SAPLCSDI' '0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
* perform bdc_field using 'BDC_CURSOR'
* 'RC29P-POSNR'.
* perform bdc_field using 'RC29P-POSNR'
* record-POSNR_011.
* perform bdc_field using 'RC29P-IDNRK'
* record-IDNRK_012.
* perform bdc_field using 'RC29P-MENGE'
* record-MENGE_013.
* perform bdc_field using 'RC29P-MEINS'
* record-MEINS_014.
perform bdc_field using 'RC29P-NLFZT'
record-NLFZT.
* Next screen to enter item texts 1 and 2.
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29P-POTX1'
record-POTX1.
perform bdc_field using 'RC29P-POTX2'
record-POTX2.
* perform bdc_field using 'BDC_CURSOR'
* 'RC29P-POTX1'.
* perform bdc_field using 'RC29P-SANKA'
* record-SANKA_015.
* Screen to enter Sub items in a loop.
if record-auskz = 'X'.
perform bdc_dynpro using 'SAPLCSDI' '0191'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
* perform bdc_field using 'BDC_CURSOR'
* C1.
* 'RC29U-UPTXT(02)'.
* perform bdc_field using 'RC29U-EBORT(01)'
n = 1.
loop at itab where matnr eq record-matnr and
idnrk eq record-idnrk.
MOVE n TO A1+12(2).
MOVE n TO B1+12(2).
MOVE n TO C1+12(2).
n = n + 1.
* IF n GT 2.
* n = 2.
* ENDIF.
perform bdc_field using A1
itab-EBORT.
* perform bdc_field using 'RC29U-EBORT(02)'
* record-EBORT_02_017.
* perform bdc_field using 'RC29U-UPMNG(01)'
perform bdc_field using B1
itab-UPMNG.
* perform bdc_field using 'RC29U-UPMNG(02)'
* record-UPMNG_02_019.
* perform bdc_field using 'RC29U-UPTXT(01)'
perform bdc_field using C1
itab-UPTXT.
* perform bdc_field using 'RC29U-UPTXT(02)'
* record-UPTXT_02_021.
endloop.
endif.
endif.
* Screen to enter the line items of the BOM, when item category = N
if record-postp eq 'N'.
* Line items entering screen.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
* perform bdc_field using 'BDC_CURSOR'
* F.
* 'RC29P-AUSKZ(01)'.
if record-auskz eq 'X'.
perform bdc_field using 'BDC_OKCODE'
'=FCUH'.
else.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endif.
* perform bdc_field using 'RC29P-AUSKZ(01)'
perform bdc_field using G
record-sortf.
perform bdc_field using F
record-AUSKZ.
perform bdc_field using E
record-POSNR.
* perform bdc_field using 'RC29P-IDNRK(01)'
perform bdc_field using A
record-IDNRK.
* perform bdc_field using 'RC29P-MENGE(01)'
perform bdc_field using B
record-MENGE.
* perform bdc_field using 'RC29P-POSTP(01)'
perform bdc_field using C
record-POSTP.
* Next screen to enter Lead Time Offset.
perform bdc_dynpro using 'SAPLCSDI' '0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
* perform bdc_field using 'BDC_CURSOR'
* 'RC29P-POSNR'.
* perform bdc_field using 'RC29P-POSNR'
* record-POSNR_026.
* perform bdc_field using 'RC29P-IDNRK'
* record-IDNRK_027.
* perform bdc_field using 'RC29P-MENGE'
* record-MENGE_028.
* perform bdc_field using 'RC29P-MEINS'
* record-MEINS_029.
perform bdc_field using 'RC29P-NLFZT'
record-NLFZT.
* Next screen to enter item texts 1 & 2.
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29P-POTX1'
record-POTX1.
perform bdc_field using 'RC29P-POTX2'
record-POTX2.
* perform bdc_field using 'BDC_CURSOR'
* 'RC29P-POTX1'.
* perform bdc_field using 'RC29P-SANKA'
* record-SANKA_030.
* Next screen no values entered.
perform bdc_dynpro using 'SAPLCSDI' '0133'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
* perform bdc_field using 'BDC_CURSOR'
* 'RC29P-EKORG'.
* perform bdc_field using 'RC29P-EKORG'
* record-EKORG_031.
* perform bdc_field using 'RC29P-EKGRP'
* record-EKGRP_032.
* perform bdc_field using 'RC29P-SAKTO'
* record-SAKTO_033.
* perform bdc_field using 'RC29P-LIFZT'
* record-LIFZT_034.
* perform bdc_field using 'RC29P-MATKL'
* record-MATKL_035.
* perform bdc_field using 'RC29P-WEBAZ'
* record-WEBAZ_036.
* Screen to enter subitems in a loop.
if record-auskz eq 'X'.
perform bdc_dynpro using 'SAPLCSDI' '0191'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
* perform bdc_field using 'BDC_CURSOR'
* C1.
* 'RC29U-UPTXT(02)'.
* perform bdc_field using 'RC29U-EBORT(01)'
n = 1.
loop at itab where matnr eq record-matnr and
idnrk eq record-idnrk.
MOVE n TO A1+12(2).
MOVE n TO B1+12(2).
MOVE n TO C1+12(2).
n = n + 1.
* IF n GT 2.
* n = 2.
* ENDIF.
perform bdc_field using A1
itab-EBORT.
* perform bdc_field using 'RC29U-EBORT(02)'
* record-EBORT_02_017.
* perform bdc_field using 'RC29U-UPMNG(01)'
perform bdc_field using B1
itab-UPMNG.
* perform bdc_field using 'RC29U-UPMNG(02)'
* record-UPMNG_02_019.
* perform bdc_field using 'RC29U-UPTXT(01)'
perform bdc_field using C1
itab-UPTXT.
* perform bdc_field using 'RC29U-UPTXT(02)'
* record-UPTXT_02_021.
endloop.
endif.
endif.
* Screen to enter the line items of the BOM, when item category = T
if record-postp eq 'T'.
* Line items entering screen.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
F.
* 'RC29P-AUSKZ(01)'.
*if record-auskz eq 'X'.
*
* perform bdc_field using 'BDC_OKCODE'
* '=FCUH'.
*else.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*endif.
* perform bdc_field using 'RC29P-AUSKZ(01)'
perform bdc_field using G
record-sortf.
* perform bdc_field using F
* record-AUSKZ.
perform bdc_field using E
record-POSNR.
* perform bdc_field using 'RC29P-IDNRK(01)'
perform bdc_field using A
record-IDNRK.
* perform bdc_field using 'RC29P-MENGE(01)'
perform bdc_field using B
record-MENGE.
* perform bdc_field using 'RC29P-POSTP(01)'
perform bdc_field using C
record-POSTP.
* Next screen , no values entered.
perform bdc_dynpro using 'SAPLCSDI' '0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
* perform bdc_field using 'BDC_CURSOR'
* 'RC29P-POSNR'.
* perform bdc_field using 'RC29P-POSNR'
* record-POSNR_046.
* perform bdc_field using 'RC29P-MENGE'
* record-MENGE_047.
* perform bdc_field using 'RC29P-MEINS'
* record-MEINS_048.
* perform bdc_field using 'RC29P-FMENG'
* record-FMENG_049.
* Next screen to enter the Item text1( mandatory field) & 2 .
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POTX1'.
perform bdc_field using 'RC29P-POTX1'
record-POTX1.
perform bdc_field using 'RC29P-POTX2'
record-POTX2.
endif.
* Screen to enter the line items of the BOM, when item category = D
if record-postp eq 'D'.
* Line items entering screen.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
F.
* 'RC29P-AUSKZ(01)'.
*if record-auskz eq 'X'.
*
* perform bdc_field using 'BDC_OKCODE'
* '=FCUH'.
*else.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*endif.
* perform bdc_field using 'RC29P-AUSKZ(01)'
perform bdc_field using G
record-sortf.
* perform bdc_field using F
* record-AUSKZ.
perform bdc_field using E
record-POSNR.
* perform bdc_field using 'RC29P-IDNRK(01)'
perform bdc_field using A
record-IDNRK.
* perform bdc_field using 'RC29P-MENGE(01)'
perform bdc_field using B
record-MENGE.
* perform bdc_field using 'RC29P-POSTP(01)'
perform bdc_field using C
record-POSTP.
* Next screen to enter, Document number, type, part, version.
perform bdc_dynpro using 'SAPLCSDI' '0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-DOKVR'.
* perform bdc_field using 'RC29P-POSNR'
* record-POSNR_053.
perform bdc_field using 'RC29P-DOKNR'
record-DOKNR.
perform bdc_field using 'RC29P-DOKAR'
record-DOKAR.
perform bdc_field using 'RC29P-DOKTL'
record-DOKTL.
perform bdc_field using 'RC29P-DOKVR'
record-DOKVR.
* perform bdc_field using 'RC29P-MENGE'
* record-MENGE.
* Next screen to enter Item texts1 and 2.
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC29P-POTX1'
record-POTX1.
perform bdc_field using 'RC29P-POTX2'
record-POTX2.
* perform bdc_field using 'BDC_CURSOR'
* 'RC29P-POTX1'.
* perform bdc_field using 'RC29P-SANFE'
* record-SANFE_059.
endif.
* Line items entering screen, where the whole BOM is saved.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_CURSOR'
'RC29P-POSTP(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FCNP'.
* perform bdc_field using 'BDC_OKCODE'
* '=FCBU'.
at end of matnr.
perform bdc_dynpro using 'SAPLCSDI' '0140'.
perform bdc_field using 'BDC_OKCODE'
'=FCBU'.
perform bdc_dynpro using 'SAPLCSDI' '0130'.
perform bdc_field using 'BDC_OKCODE'
'weit'.
perform bdc_dynpro using 'SAPLCSDI' '0131'.
perform bdc_field using 'BDC_OKCODE'
'weit'.
perform bdc_transaction using 'CS01'.
IF MESSTAB-MSGTYP = 'E'.
CONDENSE record-matnr.
WRITE:/ 'The Material No: ',
record-matnr COLOR COL_NEGATIVE ON ,
'was not uploaded', MESSTAB-MSGV1, MESSTAB-MSGV2.
else.
CONDENSE record-matnr.
WRITE:/ 'The Material number uploaded is',
record-matnr COLOR COL_POSITIVE ON.
endif.
I_MESSTAB-matnr = record-matnr.
I_MESSTAB-MSGTYP = MESSTAB-MSGTYP.
I_MESSTAB-L_MSTRING = T100-TEXT.
I_MESSTAB-MSGV1 = MESSTAB-MSGV1.
condense i_messtab-msgv1.
replace '&' with i_messtab-msgv1 into i_messtab-l_mstring.
i_messtab-msgv1 = ' '.
I_MESSTAB-MSGV2 = MESSTAB-MSGV2.
I_MESSTAB-MSGV3 = MESSTAB-MSGV3.
I_MESSTAB-MSGV4 = MESSTAB-MSGV4.
APPEND I_MESSTAB. CLEAR I_MESSTAB.
refresh bdcdata.
M = 1.
FLAGEND = 'X'.
ENDAT.
endloop.
p_fname = p_downld.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = p_fname
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = ';'
* 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'
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = i_messtab
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
perform close_group.
* END OF BDC SESSION.