‎2007 Oct 30 10:07 AM
Hi all
how to pass the parameter over using the submit? What is the syntax and how to retieve the parameter over another program?
Any help. Many thanks!
‎2007 Oct 30 10:10 AM
SUBMIT - selscreen_parameters
Syntax
... [USING SELECTION-SET variant]
[USING SELECTION-SETS OF PROGRAM prog]
[WITH SELECTION-TABLE rspar]
[WITH expr_syntax1 WITH expr_syntax2 ...]
[WITH FREE SELECTIONS texpr] ... .
Extras:
1. ... USING SELECTION-SET variant
2. ... USING SELECTION-SETS OF PROGRAM prog
3. ... WITH SELECTION-TABLE rspar
4. ... WITH expr_syntax1 WITH expr_syntax2 ...
5. ... WITH FREE SELECTIONS texpr
Effect
USING-SELECTION-SET supplies all the selection screen components by means of a Variant variant. If you specify USING-SELECTION-SETS OF PROGRAM, you can use a variant from a different program; if you specify WITH SELECTION-TABLE, values for several selection screen components are transferred as the content of an internal table rspar; WITH expr_syntax supplies individual selection screen components with values. The addition WITH FREE SELECTIONS allows you to transfer free selections to the selection screen for alogical database.
Addition 1
... USING SELECTION-SET variant
Effect
If you specify this edition, the parameters and selection criteria for the selection screen are supplied with values from a variant. For variant, you must specify a character-like data object that contains the name of a variant for the program accessed when the statement is executed. If the variant does not exist, the system sends an error message. If the variant belongs to a different selection screen, it is ignored.
Note
You can create and manage variants for every program in which selection screens are defined, either in the ABAP Workbench or during execution of the program by choosing Goto - Variants on a selection screen.
Addition 2
... USING SELECTION-SETS OF PROGRAM prog
Effect
If you specify this addition, the variants of the program prog are used in the program accessed. For prog, you must specify a character-like data object that contains the name of a program when the statement is executed. The addition has the following effect:
If a variant variant is specified with USING SELECTION-SET, the system searches for this variant in the program prog.
If the selection screen is displayed with VIA SELECTION-SCREEN, all the functions that can be accessed by means of the menu path Goto - Variants affect the variants of the program prog. However, these functions are only active if prog is an executable program.
Note
The program prog should contain a selection screen that has the same parameters and selection criteria as the selection screen used in the program accessed.
Addition 3
... WITH SELECTION-TABLE rspar
Effect
If you specify this addition, parameters and selection criteria on the selection screen are supplied from an internal table rspar. You must specify an internal table with the row type RSPARAMS for rspar. The structured data type RSPARAMS is defined in the ABAP Dictionary and has the following components, all of which are data type CHAR:
SELNAME (length 8),
KIND (length 1),
SIGN (length 1),
OPTION (length 2),
LOW (length 45),
HIGH (length 45).
To supply parameters and selection criteria for the selection screen with specific values, the lines in the internal table rspar must contain the following values:
SELNAME must contain the name of a parameter or selection criterion for the selection screen in block capitals
KIND must contain the type of selection screen component (P for parameters, S for selection criteria)
SIGN, OPTION, LOW, and HIGH must contain the values specified for the selection table columns that have the same names as the selection criteria; in the case of parameters, the value must be specified in LOW and all other components are ignored.
If the name of a selection criterion is repeated in rspar, this defines a selection table containing several lines and passes it on to the selection criterion. If parameter names occur several times, the last value is passed on to the parameter.
The contents of the parameters or selection tables for the current program can be entered in the table by the function module RS_REFRESH_FROM_SELECTOPTIONS.
Notes
In contrast to selection tables, the data types of the components LOW and HIGH in table rspar are always of type CHAR and are converted to the type of the parameter or selection criterion during transfer, if necessary.
When entering values, you must ensure that these are entered in the internal format of the ABAP values, and not in the output format of the screen display.
Addition 4
... WITH expr_syntax1 WITH expr_syntax2 ...
Effect
This addition supplies values to individual parameters or selection criteria for the selection screen. Parameters are supplied with single values and selection criteria with selection tables that overwrite values already specified in the program accessed. The selection table to be transferred is compiled from all the expr_syntax additions that address the same selection criterion sel. You can specify the following statements for expr_syntax, where you have to specify the name of a parameter or a selection criterion directly for sel:
sel {EQ|NE|CP|NP|GT|GE|LT|LE} dobj [SIGN sign]
Transfer of a single value.
The operators before dobj correspond to the values specified for column OPTION for selection tables. For dobj, you must specify a data object whose data type can be converted to the data type of the selection screen component sel. For sign, you can specify a character-like field that must contain 'I' or 'E'. The standard value is 'I'.
If sel is a selection criterion, the system appends a line in the selection table to be transferred, placing the operator in column OPTION, the content of dobj in column LOW, and the content of sign in column SIGN.
If sel is a parameter, it is set to the value of dobj in the program accessed. The operator and the value of sign are not taken into account.
sel [NOT] BETWEEN dobj1 AND dobj2 [SIGN sign]
Transfer of an interval.
In this case, sel must be a selection criterion. For dobj, you must specify data objects whose data type can be converted to that of the columns LOW and HIGH for the selection criterion sel. For sign, you can specify a character-like field that must contain 'I' or 'E'. The standard value is 'I'.
A line is appended in the selection table to be transferred. If NOT is specified, the value 'NB' is placed in column OPTION; otherwise, the value entered is 'BT'. The content of the data objects dobj and sign is placed in the columns LOW, HIGH, and SIGN.
sel IN rtab
Transfer of a ranges table.
In this case, sel must be a selection criterion. For rtab, you must specify an internal table that has the same structure as the selection table for selection criterion sel. A table of this type can be created using the addition RANGE OF to the statements TYPES and DATA.
The lines in table rtab are appended to the selection table to be transferred.
You can specify the addition expr_syntax more than once, and you can also specify the same selection screen component more than once.
Notes:
= or INCL can also be used instead of the operator EQ.
When entering values, you must ensure that these have the internal format of the ABAP values, and not the output format of the screen display.
Example
The program report1 has a stand-alone selection screen with the screen number 1100. In the program report2, an internal table with row type RSPARAMS and a ranges table are filled for this selection screen. These are transferred at SUBMIT together with a single condition.
Program accessed
REPORT report1.
DATA text TYPE c LENGTH 10.
SELECTION-SCREEN BEGIN OF SCREEN 1100.
SELECT-OPTIONS: selcrit1 FOR text,
selcrit2 FOR text.
SELECTION-SCREEN END OF SCREEN 1100.
...
Calling program
REPORT report2.
DATA: text TYPE c LENGTH 10,
rspar_tab TYPE TABLE OF rsparams,
rspar_line LIKE LINE OF rspar_tab,
range_tab LIKE RANGE OF text,
range_line LIKE LINE OF range_tab.
...
rspar_line-selname = 'SELCRIT1'.
rspar_line-kind = 'S'.
rspar_line-sign = 'I'.
rspar_line-option = 'EQ'.
rspar_line-low = 'ABAP'.
APPEND rspar_line TO rspar_tab.
range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'H'.
APPEND range_line TO range_tab.
range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'K'.
APPEND range_line TO range_tab.
SUBMIT report1 USING SELECTION-SCREEN '1100'
WITH SELECTION-TABLE rspar_tab
WITH selcrit2 BETWEEN 'H' AND 'K'
WITH selcrit2 IN range_tab
AND RETURN.
Result
After report1 has been accessed by report2, the selection tables for the selection criteria selcrit1 and selcrit2 in the program accessed contain the following entries:
SIGN OPTION LOW HIGH
selcrit1 I EQ ABAP
selcrit2 I BT H K
selcrit2 E EQ H
selcrit2 E EQ K
Addition 5
... WITH FREE SELECTIONS texpr
Effect
This addition supplies values to the dynamic selections for the selection screen for a logical database. The program accessed must be linked to a logical database that supports dynamic selections. texpr must be an internal table of the type RSDS_TEXPR from type group RSDS.
In texpr, the selections for the dynamic selections are specified in an internal format (Reverse Polish Notation). You can use function modules FREE_SELECTIONS_INIT, FREE_SELECTIONS_DIALOG, and FREE_SELECTIONS_RANGE_2_EX from the function group SSEL to fill texpr in the calling program. While the first two function modules execute a user dialog, you can transfer ranges tables to FREE_SELECTIONS_RANGE_2_EX for each node in the dynamic selection in an internal table of the type RSDS_TRANGE. These are then converted to a table of the row type RSDS_TEXPR. If the calling program contains a selection screen with the same dynamic selections, you can transfer its content beforehand to a table of the type RSDS_TRANGE using the function module RS_REFRESH_FROM_DYNAMICAL_SEL.
The lines in the internal table type RSDS_TRANGE contain a flat component TABLENAME for each node and a table-like component FRANGE_T of the type RSDS_FRANGE_T for the fields in the node. The lines in RSDS_FRANGE_T contain a flat component FIELDNAME for each field and a table-like component SELOPT_T of the row type RSDSSELOPT from the ABAP Dictionary. RSDSSELOPT contains the four components SIGN, OPTION, LOW, and HIGH and can include the ranges table.
Example
Program report1 is linked to the logical database F1S, which supports dynamic selections for the node SPFLI. Program report2 enters conditions in a nested internal table of the type rsds_trange with selection conditions for field CONNID in node SPFLI; this is then converted to a table of the type rsds_texpr, which is transferred at SUBMIT.
Program accessed
REPORT report1.
NODES: spfli, sflight, sbook.
...
Calling program
REPORT report2.
TYPE-POOLS rsds.
DATA: trange TYPE rsds_trange,
trange_line
LIKE LINE OF trange,
trange_frange_t_line
LIKE LINE OF trange_line-frange_t,
trange_frange_t_selopt_t_line
LIKE LINE OF trange_frange_t_line-selopt_t,
texpr TYPE rsds_texpr.
trange_line-tablename = 'SPFLI'.
trange_frange_t_line-fieldname = 'CONNID'.
trange_frange_t_selopt_t_line-sign = 'I'.
trange_frange_t_selopt_t_line-option = 'BT'.
trange_frange_t_selopt_t_line-low = '0200'.
trange_frange_t_selopt_t_line-high = '0800'.
APPEND trange_frange_t_selopt_t_line
TO trange_frange_t_line-selopt_t.
trange_frange_t_selopt_t_line-sign = 'I'.
trange_frange_t_selopt_t_line-option = 'NE'.
trange_frange_t_selopt_t_line-low = '0400'.
APPEND trange_frange_t_selopt_t_line
TO trange_frange_t_line-selopt_t.
APPEND trange_frange_t_line TO trange_line-frange_t.
APPEND trange_line TO trange.
CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
EXPORTING
field_ranges = trange
IMPORTING
expressions = texpr.
SUBMIT report1 VIA SELECTION-SCREEN
WITH FREE SELECTIONS texpr.
SUBMIT - selscreen_options
Syntax
... [USING SELECTION-SCREEN dynnr]
[VIA SELECTION-SCREEN]
[selscreen_parameters] ... .
Extras:
1. ... USING SELECTION-SCREEN dynnr
2. ... VIA SELECTION-SCREEN
Effect
The addition USING SELECTION-SCREEN specifies the selection screen, VIA SELECTION-SCREEN specifies whether it is displayed. The additions selscreen_parameters provide values for the parameters, selection criteria, and the free selection of the called selection screen.
The values are transferred to the selection screen between the events INITIALIZATION and AT SELECTION-SCREEN OUTPUT The following hierarchy applies for transferring values:
First, the variant of the addition USING SELECTION-SET is transferred, which sets all parameters and selection criteria to the values of the variant. The values previously set in the called program are overwritten.
The values of the table of the addition WITH SELECTION-TABLE are then transferred. All parameters and selection criteria specified there are overwritten accordingly.
Finally, the values of the additions WITH sel value are transferred. All parameters and selection criteria are overwritten accordingly. If the addition WITH sel value is used more than once for the same parameter, this is overwritten with the last specified value. If the addition WITH sel value is used more than once for the same selection criterion, a selection table with the corresponding number of lines is transferred.
Providing values for free selections is independent of this hierarchy.
Notes
The options for parameter transfer enable a selection screen to be viewed as a parameter interface of an executable program. This applies particularly for background selection screen processing and for parameters and selection criteria that are defined without screen elements using the addition NO-DISPLAY
When transferring data, note that any adjustments made to the screen format, such as abbreviations or the execution of conversion routines, are not executed for fields for which there are no screen elements on the selection screen. This applies for all parameters and selection criteria defined with NO DISPLAY. It also applies for all lines of a selection table with the exception of the first line.
The additions selscreen_parameters only work the first time the called program is executed. If a selection screen is displayed in the called program, the runtime environment calls the program again after it is finished, thereby replacing the values specified in selscreen_parameters with the previous input values.
Addition 1
... USING SELECTION-SCREEN dynnr
Effect
This addition specifies which selection screen is called. dynnr is a data object that must contain the screen number of a selection screen defined in the called program when the SUBMIT statement is called.
If the addition USING SELECTION-SCREEN is omitted or the screen number 1000 is entered, the standard selection screen is called. If no standard selection screen is defined in the called program, no selection screen is called.
If a screen number that is not 1000 is entered in the addition USING SELECTION-SCREEN, the corresponding independent selection screen is called. If no selection screen with this screen number is defined in the called program, this leads to an untreatable exception.
Addition 2
... VIA SELECTION-SCREEN
Effect
If this addition is specified, the selection screen is displayed on the screen. Otherwise, background selection screen processing takes place. In background selection screen processing, the selection screen events are triggered without the selection screen being displayed.
‎2007 Oct 30 10:11 AM
Hi Karthikeyan,
Please refer to the below code for Submit:
REPORT zs_alr MESSAGE-ID zs_alr .
type-pools : truxs.
TABLES : ska1, skb1,bkpf.
DATA : rspar TYPE TABLE OF rsparams,
rspar_wa LIKE LINE OF rspar.
DATA : var1(15) TYPE c,
var2(15) TYPE c ,
temp(15) TYPE c.
DATA : listobject1 LIKE abaplist OCCURS 0.
DATA : BEGIN OF wa,
bukrs2(10) TYPE c,
bmonat2(10) TYPE c,
currtyp1(4) TYPE c,
saknr1(6) TYPE c,
text1(59) TYPE c,
totals(21) TYPE c,
END OF wa.
DATA : BEGIN OF wa2,
bukrs2(5) TYPE c,
saknr1(6) TYPE c,
totals(21) TYPE c,
END OF wa2.
data : itab type truxs_t_text_data.
DATA : ascitab LIKE TABLE OF wa.
DATA : ascitab1 LIKE TABLE OF wa2.
*DATA : ASCITAB LIKE LISTZEILE OCCURS 0 WITH HEADER LINE,
ASCITAB1 LIKE LISTZEILE OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF wa1,
bukrs3 TYPE skb1-bukrs,
saknr3 TYPE ska1-saknr,
totals1 TYPE p DECIMALS 2,
END OF wa1.
DATA : result LIKE TABLE OF wa1.
data : filenam1 type string.
SELECTION-SCREEN BEGIN OF BLOCK b1.
PARAMETERS: bilaver1 LIKE t011t-versn DEFAULT 'ss7b' NO-DISPLAY,
bilaspr1 LIKE t011-dspra DEFAULT 'EN' NO-DISPLAY,
bilbjah1 LIKE bkpf-gjahr DEFAULT '2007',
bmonat1 LIKE rfsdo-bilabmon,
bilvjah1 LIKE bkpf-gjahr DEFAULT '2006' NO-DISPLAY,
vmonat1 LIKE rfsdo-bilavmon NO-DISPLAY.
*parameters : BILAGRI1 LIKE RFBILA_ALV_SETTINGS-GRID
default 'X' RADIObutton group ALV ,
BILALIS1 LIKE RFBILA_ALV_SETTINGS-CLASSIC
RADIOBUTTON GROUP ALV.
PARAMETERS : currtype LIKE rfpdo2-allgcrtp DEFAULT '30' NO-DISPLAY.
SELECT-OPTIONS : bukrs1 FOR skb1-bukrs,
ktopl1 FOR ska1-ktopl DEFAULT 'ss7' NO-DISPLAY.
PARAMETERS : filename TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b1.
*break shahv.
IF bukrs1-low IS INITIAL AND bukrs1-high IS INITIAL.
MESSAGE i001.
LEAVE TO SCREEN 1000.
ENDIF.
IF bmonat1 IS INITIAL.
MESSAGE i001.
LEAVE TO SCREEN 1000.
ENDIF.
vmonat1 = bmonat1.
IF bilaver1 IS NOT INITIAL.
rspar_wa-selname = 'BILAVERS'.
rspar_wa-kind = 'P'.
rspar_wa-sign = 'I'.
rspar_wa-option = 'EQ'.
rspar_wa-low = bilaver1.
APPEND rspar_wa TO rspar.
CLEAR rspar_wa.
ENDIF.
IF bilaspr1 IS NOT INITIAL.
rspar_wa-selname = 'BILASPRA'.
rspar_wa-kind = 'P'.
rspar_wa-sign = 'I'.
rspar_wa-option = 'EQ'.
rspar_wa-low = bilaspr1.
APPEND rspar_wa TO rspar.
CLEAR rspar_wa.
ENDIF.
IF bilbjah1 IS NOT INITIAL.
rspar_wa-selname = 'BILBJAHR'.
rspar_wa-kind = 'P'.
rspar_wa-sign = 'I'.
rspar_wa-option = 'EQ'.
rspar_wa-low = bilbjah1.
APPEND rspar_wa TO rspar.
CLEAR rspar_wa.
ENDIF.
IF bmonat1 IS NOT INITIAL.
rspar_wa-selname = 'B-MONATE'.
rspar_wa-kind = 'P'.
rspar_wa-sign = 'I'.
rspar_wa-option = 'EQ'.
rspar_wa-low = bmonat1.
APPEND rspar_wa TO rspar.
CLEAR rspar_wa.
ENDIF.
IF bilvjah1 IS NOT INITIAL.
rspar_wa-selname = 'BILVJAHR'.
rspar_wa-kind = 'P'.
rspar_wa-sign = 'I'.
rspar_wa-option = 'EQ'.
rspar_wa-low = bilvjah1.
APPEND rspar_wa TO rspar.
CLEAR rspar_wa.
ENDIF.
IF vmonat1 IS NOT INITIAL.
rspar_wa-selname = 'V-MONATE'.
rspar_wa-kind = 'P'.
rspar_wa-sign = 'I'.
rspar_wa-option = 'EQ'.
rspar_wa-low = vmonat1.
APPEND rspar_wa TO rspar.
CLEAR rspar_wa.
ENDIF.
*IF BILAGRI1 IS NOT INITIAL.
*RSPAR_WA-SELNAME = 'BILAGRID'.
*RSPAR_WA-KIND = 'P'.
*RSPAR_WA-SIGN = 'I'.
*RSPAR_WA-OPTION = 'EQ'.
*RSPAR_WA-LOW = BILAGRI1.
*APPEND RSPAR_WA TO RSPAR.
*CLEAR RSPAR_WA.
*ENDIF.
*
*
*IF BILALIS1 IS NOT INITIAL.
*RSPAR_WA-SELNAME = 'BILALIST'.
*RSPAR_WA-KIND = 'P'.
*RSPAR_WA-SIGN = 'I'.
*RSPAR_WA-OPTION = 'EQ'.
*RSPAR_WA-LOW = BILALIS1.
*APPEND RSPAR_WA TO RSPAR.
*CLEAR RSPAR_WA.
*ENDIF.
*
IF ktopl1 IS NOT INITIAL.
rspar_wa-selname = 'SD_KTOPL'.
rspar_wa-kind = 'P'.
rspar_wa-sign = 'I'.
rspar_wa-option = 'EQ'.
rspar_wa-low = ktopl1-low.
rspar_wa-high = ktopl1-high.
APPEND rspar_wa TO rspar.
CLEAR rspar_wa.
ENDIF.
IF currtype IS NOT INITIAL.
rspar_wa-selname = 'SD_CURTP'.
rspar_wa-kind = 'P'.
rspar_wa-sign = 'I'.
rspar_wa-option = 'EQ'.
rspar_wa-low = currtype.
APPEND rspar_wa TO rspar.
CLEAR rspar_wa.
ENDIF.
var1 = bukrs1-low.
var2 = bukrs1-high.
move filename to filenam1.
IF bukrs1-low IS NOT INITIAL AND bukrs1-high IS INITIAL.
SUBMIT rfbila00
WITH SELECTION-TABLE rspar
WITH sd_bukrs EQ var1
EXPORTING LIST TO MEMORY
AND RETURN.
ELSEIF bukrs1-low LT bukrs1-high.
SUBMIT rfbila00
WITH SELECTION-TABLE rspar
WITH sd_bukrs BETWEEN var1 AND var2
EXPORTING LIST TO MEMORY
AND RETURN.
ELSEIF bukrs1-low GT bukrs1-high.
temp = var1.
var1 = var2.
var2 = temp.
SUBMIT rfbila00
WITH SELECTION-TABLE rspar
WITH sd_bukrs BETWEEN var1 AND var2
EXPORTING LIST TO MEMORY
AND RETURN.
ENDIF.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject1
EXCEPTIONS
not_found = 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 'LIST_TO_ASCI'
EXPORTING
list_index = -1
WITH_LINE_BREAK = ' '
TABLES
listasci = ascitab
listobject = listobject1
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3
.
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 'LIST_TO_TXT'
EXPORTING
LIST_INDEX = -1
TABLES
listtxt = ascitab
LISTOBJECT = listobject1
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3
.
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*break shahv.
*WRITE : 'HI'.
*LOOP AT ASCITAB FROM 13.
*MOVE ASCITAB TO ASCITAB1.
*APPEND ASCITAB1.
*ENDLOOP.
LOOP AT ascitab INTO wa FROM 13.
MOVE wa-bukrs2+2(4) TO wa2-bukrs2.
*MOVE WA-RYEAR+6(2) TO WA2-RYEAR.
MOVE wa-saknr1 TO wa2-saknr1.
*MOVE wa-BMONAT2 TO WA2-BMONAT2.
*MOVE wa-CURRTYP1 TO WA2-CURRTYP1.
MOVE wa-totals+1(14) TO wa2-totals.
*MOVE wa-TEXT1 TO WA2-TEXT1.
*CONDENSE WA2.
*CONDENSE WA2.
*CONDENSE WA2.
IF wa2-bukrs2 EQ '----'.
EXIT.
ELSEIF wa2-bukrs2 EQ ' '.
CONTINUE.
ELSEIF wa2-bukrs2 GE bukrs1-low OR wa2-bukrs2 LE bukrs1-high.
APPEND wa2 TO ascitab1.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
*sort ascitab1 by bukrs2.
*sort ascitab1 by bukrs2.
*loop at ascitab1 into wa2.
*write : / wa2-bukrs2,
wa2-saknr1,
wa2-totals.
*endloop.
*BREAK SHAHV.
*LOOP AT ASCITAB1 INTO WA2.
*WA1-BUKRS3 = WA2-BUKRS2.
*WA1-SAKNR3 = WA2-SAKNR1.
*WA1-TOTALS1 = WA2-TOTALS.
*APPEND WA1 TO RESULT.
*ENDLOOP.
*BREAK SHAHV.
*WRITE : 'HI'.
if ascitab1 is initial.
message i002.
leave to screen 1000.
endif.
*CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ','
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
TABLES
i_tab_sap_data = ascitab1
CHANGING
I_TAB_CONVERTED_DATA = itab
EXCEPTIONS
CONVERSION_FAILED = 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 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
i_field_seperator = ','
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
tables
i_tab_sap_data = ascitab1
CHANGING
I_TAB_CONVERTED_DATA = itab
EXCEPTIONS
CONVERSION_FAILED = 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 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = filenam1
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_LF_AFTER_LAST_LINE = ABAP_TRUE
IMPORTING
FILELENGTH =
tables
data_tab = itab
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 eq 0.
message s003.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.