Application Development 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: 

TCURR-GDATU

Former Member
0 Kudos

Hi all,

I created a download program for exchange currency rates(tcurr), i'm getting the tcurr-gdatu format in the file, but my client need the file with normal date format , my logic is

DATA: BEGIN OF itab OCCURS 0, "Input / Output File

kurst LIKE tcurr-kurst, "Exchange Rate Type

fcurr LIKE tcurr-fcurr, "From Currency

tcurr LIKE tcurr-tcurr, "To Currency

gdatu LIKE tcurr-gdatu, "Effective Date

ukurs(11) TYPE c, "Exchange Rate

ffact(11) TYPE c, "From Factor

tfact(11) TYPE c, "To Factor

END OF itab.

FORM select_data.

SELECT * FROM tcurr WHERE kurst IN s_kurst

AND fcurr IN s_fcurr

AND tcurr IN s_tcurr.

*

  • MOVE-CORRESPONDING tcurr TO itab.

write: tcurr-kurst to itab-kurst, "Exchange Rate Type

tcurr-fcurr to itab-fcurr, "From Currency

tcurr-tcurr to itab-tcurr, "To Currency

tcurr-gdatu to itab-gdatu , "Effective Date

tcurr-ukurs to itab-ukurs, "Exchange Rate

tcurr-ffact to itab-ffact, "From Factor

tcurr-tfact to itab-tfact. "To Factor

APPEND itab.

CLEAR itab.

ENDSELECT.

ENDFORM. " SELECT_DATA

FORM download_source_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = w_file

filetype = 'ASC'

TABLES

data_tab = itab

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.

  • End CDSK904243

CASE sy-subrc.

WHEN '0'.

WHEN '1'.

MESSAGE e023(zh).

WHEN OTHERS.

MESSAGE e026(zh).

ENDCASE.

ENDFORM. " DOWNLOAD_SOURCE

so please any body let me know how to correct this issue, advance thanks for your help

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

change

MOVE :tcurr-gdatu to itab-gdatu , "Effective Date

FOR

WRITE: :tcurr-gdatu to itab-gdatu DDMMYY, "Effective Date

Check on documentation for the format you can use. Press F1 on write

bye

Gabriel

9 REPLIES 9

Former Member
0 Kudos

Hello,

change

MOVE :tcurr-gdatu to itab-gdatu , "Effective Date

FOR

WRITE: :tcurr-gdatu to itab-gdatu DDMMYY, "Effective Date

Check on documentation for the format you can use. Press F1 on write

bye

Gabriel

0 Kudos

hello,

i tried but there is no change in the output

0 Kudos

Hello,

sorry the delay,

try using concatenate....into a string....

and replace the type of gdate for variable type char(10)

Bye

Gabriel

0 Kudos

I mean

instead of

WRITE: :tcurr-gdatu to itab-gdatu DDMMYY, "Effective Date

use

CONCATENATE tcurr-gdatu(2) tcurr-gdatu2(2) tcurr-gdatu4(4) INTO itab-new_date separated by '/'.

Try checking the values....I cant tell you if they are in the correct order.

Bye

Gabriel

Dont Forget to reward

Message was edited by:

Gabriel Fernando Pulido V.

0 Kudos

hi its not working

0 Kudos

hello,

Je je ....why not?

Whats happening??

Gabriel

0 Kudos

Thank you very much, the write statement solved the problem

mohammed_moqeeth
Active Participant
0 Kudos

Hi Sudhir,

If you are getting date format <b>YYYYMMDD</b> in tcurr-gdatu and you want the date format as <b>DD/MM/YYYY</b>

Instead of moving defining gadu like tcurr-gadu, define a GDATU field with character data type as shown below:

DATA: BEGIN OF itab OCCURS 0, "Input / Output File

kurst LIKE tcurr-kurst, "Exchange Rate Type

fcurr LIKE tcurr-fcurr, "From Currency

tcurr LIKE tcurr-tcurr, "To Currency

<u><b>*gdatu LIKE tcurr-gdatu, "Effective Date "<< instead of this, code as below:

gdatu(10) type c, "Effective Date</b></u>

ukurs(11) TYPE c, "Exchange Rate

ffact(11) TYPE c, "From Factor

tfact(11) TYPE c, "To Factor

END OF itab.

  • MOVE-CORRESPONDING tcurr TO itab.

write: tcurr-kurst to itab-kurst, "Exchange Rate Type

tcurr-fcurr to itab-fcurr, "From Currency

tcurr-tcurr to itab-tcurr, "To Currency

<b>*<u>tcurr-gdatu to itab-gdatu , "Effective Date * <<instead of this, write the below code:

concatenate tcurr-gdatu6(2) tcurr-gdatu4(2) tcurr-gdatu(4) into date separated by '/' into itab-gdatu.</u></b>

tcurr-ukurs to itab-ukurs, "Exchange Rate

tcurr-ffact to itab-ffact, "From Factor

tcurr-tfact to itab-tfact. "To Factor

Cheers !

Moqeeth.

0 Kudos

Hi ,

but the TCURR-GDATU is not in MMDDYYYY format, it is different sap date,