Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

code needed ?

Former Member
0 Likes
362

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
341

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

2 REPLIES 2
Read only

Former Member
0 Likes
342

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

Read only

Former Member
0 Likes
341

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