‎2007 Jul 12 2:59 PM
Hi Friends,
Using this function module BAPI_MATERIAL_SAVEDATA how can we extend material master mass upload for customized fields ?? Is there any program please send me for my ref ...
Please help ASAP...
Thanks,
Varma
‎2007 Jul 12 3:02 PM
Read the documentation for the Parameters EXTENSIONIN of the bapi BAPI_MATERIAL_SAVEDATA in se37.
It is pretty detail.
In case you do not have access, here is the same:
Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIO
Description
You use this structure to transfer the material's customer-defined
fields. For information on transferring these fields, see the function
module documentation.
Note
Besides the table fields already defined, customer-defined table fields
can also be supplied with data. Since these fields are created by the
customer, they are known only during the runtime and must therefore be
determined dynamically.
The structures BAPI_TE_<NAME> (<NAME> = MARA, MARC, MARD, MBEW, MLGN,
MLGT, MVKE) and the relevant checkbox structures BAPI_TE_<NAME> (<NAME>
= MARAX, etc.) must first be extended by the customer to include the
fields required. The standard structures contain only the corresponding
key fields. When including new fields in these structures, make sure
that the field has the same name as the field in the database table. In
addition, the fields in the structures BAPI_TE_<NAME> may only be of the
type CHARACTER. The data element BAPIUPDATE must be used for the fields
in the checkbox structure (except for key fields).
The two parameters EXTENSIONIN and EXTENSIONINX are used to transfer the
data to the method. The field STRUCTURE contains the name of the
structure (for example, BAPI_TE_MARA or BAPI_TE_MARAX) used to identify
the work area (for example, WA_BAPI_TE_MARA or WA_BAPI_TE_MARAX) to
which the data is transferred. The remaining fields for the parameter
EXTENSIONIN or EXTENSIONINX contain the data for the key fields (for
example, the material number) and the data for the customer-defined
fields. The number of characters reserved in the two parameters for the
content of a customer-defined field must be the same as the number of
characters for the corresponding work area field. If the number of
characters required is smaller, the remaining characters in the two
parameters must be filled with blanks. Only then may the content of
another field be transferred. Here too, remember that the data is
written to the database only if the corresponding indicator has been set
in the work area.
REgards,
Ravi
‎2007 Jul 12 3:02 PM
Read the documentation for the Parameters EXTENSIONIN of the bapi BAPI_MATERIAL_SAVEDATA in se37.
It is pretty detail.
In case you do not have access, here is the same:
Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIO
Description
You use this structure to transfer the material's customer-defined
fields. For information on transferring these fields, see the function
module documentation.
Note
Besides the table fields already defined, customer-defined table fields
can also be supplied with data. Since these fields are created by the
customer, they are known only during the runtime and must therefore be
determined dynamically.
The structures BAPI_TE_<NAME> (<NAME> = MARA, MARC, MARD, MBEW, MLGN,
MLGT, MVKE) and the relevant checkbox structures BAPI_TE_<NAME> (<NAME>
= MARAX, etc.) must first be extended by the customer to include the
fields required. The standard structures contain only the corresponding
key fields. When including new fields in these structures, make sure
that the field has the same name as the field in the database table. In
addition, the fields in the structures BAPI_TE_<NAME> may only be of the
type CHARACTER. The data element BAPIUPDATE must be used for the fields
in the checkbox structure (except for key fields).
The two parameters EXTENSIONIN and EXTENSIONINX are used to transfer the
data to the method. The field STRUCTURE contains the name of the
structure (for example, BAPI_TE_MARA or BAPI_TE_MARAX) used to identify
the work area (for example, WA_BAPI_TE_MARA or WA_BAPI_TE_MARAX) to
which the data is transferred. The remaining fields for the parameter
EXTENSIONIN or EXTENSIONINX contain the data for the key fields (for
example, the material number) and the data for the customer-defined
fields. The number of characters reserved in the two parameters for the
content of a customer-defined field must be the same as the number of
characters for the corresponding work area field. If the number of
characters required is smaller, the remaining characters in the two
parameters must be filled with blanks. Only then may the content of
another field be transferred. Here too, remember that the data is
written to the database only if the corresponding indicator has been set
in the work area.
REgards,
Ravi
‎2007 Jul 12 3:02 PM
Hi,
This is a small note from fm documentation. it will clarify your doubt
Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIO
Description
You use this structure to transfer the material's customer-defined fields. For information on transferring these fields, see the function module documentation.
Note
Besides the table fields already defined, customer-defined table fields can also be supplied with data. Since these fields are created by the customer, they are known only during the runtime and must therefore be determined dynamically.
The structures BAPI_TE_<NAME> (<NAME> = MARA, MARC, MARD, MBEW, MLGN, MLGT, MVKE) and the relevant checkbox structures BAPI_TE_<NAME> (<NAME> = MARAX, etc.) must first be extended by the customer to include the fields required. The standard structures contain only the corresponding key fields. When including new fields in these structures, make sure that the field has the same name as the field in the database table. In addition, the fields in the structures BAPI_TE_<NAME> may only be of the type CHARACTER. The data element BAPIUPDATE must be used for the fields in the checkbox structure (except for key fields).
The two parameters EXTENSIONIN and EXTENSIONINX are used to transfer the data to the method. The field STRUCTURE contains the name of the structure (for example, BAPI_TE_MARA or BAPI_TE_MARAX) used to identify the work area (for example, WA_BAPI_TE_MARA or WA_BAPI_TE_MARAX) to which the data is transferred. The remaining fields for the parameter EXTENSIONIN or EXTENSIONINX contain the data for the key fields (for example, the material number) and the data for the customer-defined fields. The number of characters reserved in the two parameters for the content of a customer-defined field must be the same as the number of characters for the corresponding work area field. If the number of characters required is smaller, the remaining characters in the two parameters must be filled with blanks. Only then may the content of another field be transferred. Here too, remember that the data is written to the database only if the corresponding indicator has been set in the work area.
i_marae-material = bapi_head-material.
i_marae-yy_sellid = 'ABC'.
i_maraex-material = bapi_head-material.
i_maraex-yy_sellid = 'X'.
i_extn-structure = 'BAPI_TE_MARA'.
i_extn-valuepart1 = i_marae.
append i_extn.
i_extnx-structure = 'BAPI_TE_MARAX'.
i_extnx-valuepart1 = i_maraex.
append i_extnx.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = bapi_head
clientdata = bapi_mara1
clientdatax = bapi_marax
plantdata = bapi_marc1
plantdatax = bapi_marcx
storagelocationdata = bapi_mard
storagelocationdatax = bapi_mardx
valuationdata = bapi_mbew1
valuationdatax = bapi_mbewx
salesdata = bapi_mvke
salesdatax = bapi_mvkex
importing
return = bapi_return
tables
materialdescription = int_makt
taxclassifications = i_mlan
EXTENSIONIN = i_extn
EXTENSIONINX = i_extnx. .
aRs
‎2007 Jul 12 3:05 PM
Hi Varma,
This is the program I developed for extended materials using <b>BAPI_MATERIAL_SAVEDATA </b>
*&---------------------------------------------------------------------*
*& Report ZCN_MM_MATMASTER_BASICVIEW
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zcn_mm_matmaster_basicview MESSAGE-ID zmc_mm_messages.
TABLES: t001l, "Storage Locations
mara, "General Material Data
makt, "Material Descriptions
mbew, "Material Valuation
marc. "Plant Data for Material
DATA: bapi_head LIKE bapimathead,
bapi_makt LIKE bapi_makt, "Material Description
bapi_mara1 LIKE bapi_mara, "Client Data
bapi_marax LIKE bapi_marax,
bapi_marc1 LIKE bapi_marc, "Plant View
bapi_marcx LIKE bapi_marcx,
bapi_mbew1 LIKE bapi_mbew, "Accounting View
bapi_mbewx LIKE bapi_mbewx,
bapi_mard1 LIKE bapi_mard, "Storage View
bapi_mardx LIKE bapi_mardx,
bapi_return LIKE bapiret2.
DATA: BEGIN OF int_makt OCCURS 100.
INCLUDE STRUCTURE bapi_makt.
DATA: END OF int_makt.
DATA: BEGIN OF it_data OCCURS 0,
mat_type(4),
ind_sec(1),
plant(4),
stge_loc(4),
mat_desc(40),
base_uom(3),
old_matno(18),
matl_group(9),
document(22),
po_unit(3),
pur_valkey(4),
mfr_no(10),
manu_mat(40),
vendor_lookup(10),
mrp_type(2),
mrp_ctrler(3),
sm_key(3),
proc_type(1),
sloc_exprc(4),
stge_bin(10),
issue_unit(3),
cc_ph_inv(1),
price_ctrl(1),
val_class(4),
moving_pr(11),
price_unit(5),
profit_ctr(10),
matnr(18),
END OF it_data,
is_data LIKE it_data.
DATA: BEGIN OF it_error OCCURS 0,
mat_type(4),
ind_sec(1),
plant(4),
stge_loc(4),
mat_desc(40),
base_uom(3),
old_matno(18),
matl_group(9),
document(22),
po_unit(3),
pur_valkey(4),
mfr_no(10),
manu_mat(40),
vendor_lookup(10),
mrp_type(2),
mrp_ctrler(3),
sm_key(3),
proc_type(1),
sloc_exprc(4),
stge_bin(10),
issue_unit(3),
cc_ph_inv(1),
price_ctrl(1),
val_class(4),
moving_pr(11),
price_unit(5),
profit_ctr(10),
matnr(18),
END OF it_error,
is_error LIKE it_error.
DATA: bdc_tab LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA : g_file TYPE string.
DATA : BEGIN OF data_mat OCCURS 0,
datastring TYPE string,
END OF data_mat.
DATA: record(500).
DATA: gv_count TYPE i VALUE 0.
DATA lv_string TYPE string.
TYPES: BEGIN OF ty_string_tab,
line(255),
END OF ty_string_tab.
DATA i_string_tab TYPE STANDARD TABLE OF ty_string_tab.
********************------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.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-003.
PARAMETERS : p_downld LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b2.
*******************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.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_downld.
PERFORM get_local_file USING p_downld.
*----------------------------------------------------------------------*
* 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 conversion_extendedview.
PERFORM download_errors.
*&---------------------------------------------------------------------*
*& 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.
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.
APPEND it_data.
CLEAR it_data.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " upload
*&---------------------------------------------------------------------*
*& Form conversion_extendedview
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM conversion_extendedview .
DATA: lv_matnr LIKE mara-matnr,
lv_lifnr LIKE lfb1-lifnr.
LOOP AT it_data INTO is_data.
CLEAR: lv_matnr,
lv_lifnr.
SELECT SINGLE matnr FROM mara INTO lv_matnr
WHERE bismt = is_data-old_matno AND
meins = is_data-base_uom.
IF sy-subrc NE 0.
MOVE is_data TO is_error.
APPEND is_error TO it_error.
CLEAR is_error.
CONTINUE.
ENDIF.
SELECT SINGLE lifnr INTO lv_lifnr FROM lfb1
WHERE altkn = is_data-vendor_lookup.
IF sy-subrc EQ 0.
SELECT SINGLE lifnr INTO lv_lifnr FROM lfa1
WHERE lifnr = lv_lifnr AND
ktokk = 'ZMNF'.
IF sy-subrc NE 0.
lv_lifnr = ' '.
ENDIF.
ELSE.
lv_lifnr = ' '.
ENDIF.
* Header
bapi_head-material = lv_matnr.
bapi_head-ind_sector = 'C'.
bapi_head-matl_type = is_data-mat_type.
bapi_head-basic_view = 'X'.
bapi_head-purchase_view = 'X'.
bapi_head-account_view = 'X'.
bapi_head-storage_view = 'X'.
IF is_data-mat_type = 'ROH'.
bapi_head-mrp_view = 'X'.
bapi_head-cost_view = 'X'.
ENDIF.
* Material Description
REFRESH int_makt.
int_makt-langu = 'EN'.
int_makt-matl_desc = is_data-mat_desc.
APPEND int_makt.
* Client Data - Basic
bapi_mara1-matl_group = is_data-matl_group.
bapi_mara1-base_uom = is_data-base_uom.
bapi_mara1-old_mat_no = is_data-old_matno.
bapi_mara1-document = is_data-document.
bapi_mara1-po_unit = is_data-po_unit.
bapi_mara1-pur_valkey = is_data-pur_valkey.
bapi_mara1-mfr_no = lv_lifnr.
bapi_mara1-manu_mat = is_data-manu_mat.
bapi_marax-old_mat_no = 'X'.
bapi_marax-document = 'X'.
bapi_marax-po_unit = 'X'.
bapi_marax-pur_valkey = 'X'.
bapi_marax-mfr_no = 'X'.
bapi_marax-manu_mat = 'X'.
bapi_marax-matl_group = 'X'.
bapi_marax-base_uom = 'X'.
* Plant - Purchasing
bapi_marc1-plant = is_data-plant.
bapi_marc1-mrp_type = 'ND'.
bapi_marc1-mrp_ctrler = is_data-plant.
bapi_marc1-sm_key = '000'.
bapi_marc1-proc_type = 'F'.
bapi_marc1-issue_unit = is_data-issue_unit.
bapi_marc1-cc_ph_inv = is_data-cc_ph_inv.
bapi_marc1-profit_ctr = is_data-profit_ctr.
IF is_data-mat_type = 'ROH'.
bapi_marc1-availcheck = 'KP'.
bapi_marcx-availcheck = 'X'.
ENDIF.
bapi_marcx-plant = is_data-plant.
bapi_marcx-mrp_type = 'X'.
bapi_marcx-mrp_ctrler = 'X'.
bapi_marcx-sm_key = 'X'.
bapi_marcx-proc_type = 'X'.
bapi_marcx-issue_unit = 'X'.
bapi_marcx-cc_ph_inv = 'X'.
bapi_marcx-profit_ctr = 'X'.
* Storage View
bapi_mard1-plant = is_data-plant.
bapi_mard1-stge_loc = is_data-stge_loc.
bapi_mard1-stge_bin = is_data-stge_bin.
bapi_mardx-plant = is_data-plant.
bapi_mardx-stge_loc = is_data-stge_loc.
bapi_mardx-stge_bin = 'X'.
* Accounting
bapi_mbew1-val_area = is_data-plant.
IF is_data-mat_type = 'ROH'.
bapi_mbew1-val_class = '1000'.
ELSEIF is_data-mat_type = 'ERSA'.
bapi_mbew1-val_class = '1001'.
ENDIF.
bapi_mbew1-price_ctrl = 'V'.
bapi_mbew1-moving_pr = is_data-moving_pr.
bapi_mbew1-price_unit = '1'.
bapi_mbewx-val_area = is_data-plant.
bapi_mbewx-val_class = 'X'.
bapi_mbewx-moving_pr = 'X'.
bapi_mbewx-price_ctrl = 'X'.
bapi_mbewx-price_unit = 'X'.
* WRITE:/ bapi_head, bapi_marc1.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = bapi_head
clientdata = bapi_mara1
clientdatax = bapi_marax
plantdata = bapi_marc1
plantdatax = bapi_marcx
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
storagelocationdata = bapi_mard1
storagelocationdatax = bapi_mardx
valuationdata = bapi_mbew1
valuationdatax = bapi_mbewx
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA = BAPI_MVKE1
* SALESDATAX = BAPI_MVKEX
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
IMPORTING
return = bapi_return
TABLES
materialdescription = int_makt
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
* RETURNMESSAGES =
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
.
* IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
* ENDIF.
* IF bapi_return-type = 'E'.
* gv_count = gv_count + 1.
* is_error-old_matno = is_data-old_matno.
* is_error-plant = is_data-plant.
* is_error-stge_loc = is_data-stge_loc.
* APPEND is_error TO it_error.
* CLEAR is_error.
* WRITE:/'For Old Material Number',is_data-old_matno,bapi_return-message.
* ENDIF.
ENDLOOP.
* WRITE: 'Total Records in Error', gv_count.
PERFORM concatenate_into_string.
PERFORM download_data.
ENDFORM. "conversion_extendedview
*&---------------------------------------------------------------------*
*& Form get_local_file
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_DOWNLOAD text
*----------------------------------------------------------------------*
FORM get_local_file USING p_p_download.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
mask = ',*.*,*.*.'
mode = 'S'
title = 'Lookup for Upload file'(013)
IMPORTING
filename = p_p_download
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " get_local_file
*&---------------------------------------------------------------------*
*& Form concatenate_into_string
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM concatenate_into_string .
DATA: lw_error LIKE LINE OF it_error.
DATA: lw_tab_string LIKE LINE OF i_string_tab,
lw_matnr(10),
lw_plant(3),
lw_stloc(4).
LOOP AT it_error INTO is_error.
MOVE is_error-old_matno TO lw_matnr.
MOVE is_error-plant TO lw_plant.
MOVE is_error-stge_loc TO lw_stloc.
CONCATENATE lw_matnr lw_plant lw_stloc INTO lv_string SEPARATED BY '~'.
MOVE lv_string TO lw_tab_string.
APPEND lw_tab_string TO i_string_tab.
CLEAR: lv_string, lw_tab_string.
ENDLOOP.
ENDFORM. " concatenate_into_string
*&---------------------------------------------------------------------*
*& Form download_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_data .
DATA: lv_file TYPE string.
* Move file name to filename of type string acceptable by GUI_DOWNLOAD
lv_file = p_downld.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = lv_file
filetype = 'ASC'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
* data_tab = i_empdata
data_tab = i_string_tab
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 EQ 0.
MESSAGE s999 WITH 'File saved successfully'(001) 'to' p_file.
ELSE.
MESSAGE s999 WITH 'Error in creating File'(002).
ENDIF.
ENDFORM. " download_data
*&---------------------------------------------------------------------*
*& Form download_errors
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_errors .
DATA: gv_file TYPE string.
gv_file = p_downld.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = gv_file
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'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* WRITE_EOL = ABAP_TRUE
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_error
* FIELDNAMES =
* 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.
ENDFORM. " download_errorsRegards
Aneesh.