‎2008 Feb 14 2:58 AM
hi all,,
in the selection screen am using a parameter.
eg:
PARAMETERS : P_AERCST TYPE P DECIMALS 2.
I HAVE TO ALLOW ONLY TWO DECIMAL PLACES IN THE FIELD. i HAD TO VALIDATE THIS, OS THAT USER WOULD ENTER ONLY TWO VALUES.
ALSO,,,
I HAVE SO MANY FIELDS IN AN INTERNAL TABLE. I HAD TO WRITE IT THAT INTO A FILE. BUT IT SHOULS BE TAB SEPERATED.
HOW CAN I DO IT.
PLEASE ADVISE AS EARLY AS POSSIBLE.
THANKS IN ADV.
‎2008 Feb 14 3:48 AM
Hi Naveena
Firstly why do you want to validate for the decimals? If you specify DECIMALS 2 then it will not allow more than 2 digits after the decimal as it is. Do you mean that you want to give a custom message to the user?
Secondly , use method CL_GUI_FRONTEND_SERVICES->GUI_DFOWNLOAD to write data from your internal table to the file and in this if you want to use a tab separator , check the parameter write_field_separator to 'X'.
Hope this helps.
Cheers
Shivika
‎2008 Feb 14 3:48 AM
Hi Naveena
Firstly why do you want to validate for the decimals? If you specify DECIMALS 2 then it will not allow more than 2 digits after the decimal as it is. Do you mean that you want to give a custom message to the user?
Secondly , use method CL_GUI_FRONTEND_SERVICES->GUI_DFOWNLOAD to write data from your internal table to the file and in this if you want to use a tab separator , check the parameter write_field_separator to 'X'.
Hope this helps.
Cheers
Shivika
‎2008 Feb 14 4:03 AM
Hi ,
Here is the Code for Downloading the Internal table to File with field separated.
Method : 1
Download internal table to presentation server file(PC)
Separating fields/columns by a tab
DATA: ld_filename TYPE string,
Pre version 4.7 declaration e_file like rlgrap-filename.
DATA: begin of it_datatab occurs 0,
col1(50) type c,
col2(50) type c,
col3(50) type c,
etc....
end of it_datatab.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_filename
filetype = 'ASC'
APPEND = 'X'
write_field_separator = 'X'
CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_datatab[]
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
Method: 2
This method of file download with check uses the latest techniques
and achieves a very neat solution
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i.
Display save dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = ' '
DEFAULT_EXTENSION = 'XLS'
default_file_name = 'accountsdata'
INITIAL_DIRECTORY = 'c:\temp\'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
Check user did not cancel request
CHECK ld_result EQ '0'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_fullpath
filetype = 'ASC'
APPEND = 'X'
write_field_separator = 'X'
CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_datatab[] "need to declare and populate
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
Reward points if it is usefull...
Girish