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: 

Problem with GDATU field to get the year

0 Kudos

Dear Friends,

I am writing select query on TCURR table , but unable to get the values from table because of the GDATU field as I am passing this  from input screen as fiscal year in where condition and this is not matching with the GDATU as this is in different format.

I mean to say i have to fetch year from this GDATU so that I can pass this to input screen in where condition so that I can get the records from TCURR.

Please help me if you have idea .

MY query is as follows.

SELECT    kurst

                  tcurr

                  gdatu

                  ukurs

                  FROM tcurr

                  INTO TABLE gt_tcurr1

                  WHERE kurst = 'F'

                    AND tcurr = 'GBP'

                    AND gdatu = if2.  (input screen project defintion(for ex: fiscal year as 2013 as I have to take year from gdatu))

soon reply  is highly appreciated .

Thanks

6 REPLIES 6

JasonLax
Product and Topic Expert
Product and Topic Expert
0 Kudos

About SCN is for general SAP Community Network related discussions only.

To get a quick (or any) response, create your new discussion in a space related to your query.  This way it will be visible to topic experts who will then see and reply to it.  The SCN Site Index contains a full listing of all SCN spaces.

I believe this belongs in so I will move it to that space now.

jack_graus2
Active Contributor
0 Kudos
Hi, the date GDATU in table TCURR is an inverted date. To get it you need to subtract the date from 99999999.
Regards Jack
DATA gdatu(08)   TYPE n.
DATA gdatu_inv   TYPE gdatu_inv.
DATA gdatu_where TYPE wheretxt.

CONCATENATE if2 '0000' INTO gdatu.
gdatu_inv = 99999999 - gdatu.
CONCATENATE gdatu_inv(04) '____' INTO gdatu_where.

SELECT kurst
       tcurr
       gdatu
       ukurs
       FROM tcurr
       INTO TABLE gt_tcurr1
       WHERE kurst = 'F'
       AND   tcurr = 'GBP'
       AND   gdatu LIKE gdatu_where.

0 Kudos

Hi jack.

Thanks for your reply,

Could you let me know how to  pass this year to selection screen fiscal year from this select qyery. So that i can get the records depending on this condition.

raymond_giuseppi
Active Contributor
0 Kudos
  • First convert fiscal year to a date range with a FM like FIRST_AND_LAST_DAY_IN_YEAR_GET
  • Then convert it into an inverted date with statement CONVERT DATE wa_date INTO INVERTED-DATE wa_gdatu. (CONVERT - INVERTED-DATE)
    NB: don't forget to switch between low and high values in the range.

Regards,

Raymond

0 Kudos

Hi,

can you please write the code for the above query to get records from the tcurr table based on year from gdatu and fiscal year from selection screen..

thanks,

0 Kudos

Moderator Message : Spoon feeding is not allowed here, enough details are already provided. Try to complete it yourself, if you still fail to get it then place your code here and ask for correction.