0

In select statement i gave right conditions but not getting data back.

When i try from se16n with these conditions it turns me one row but when i try in a program with select statement it turns me empty internal table. Here is the sample code.

gt_tcurr is an internal table that contains kurst fcurr tcurr gdatu ukurs components.

SELECT kurst fcurr tcurr gdatu ukurs
    INTO TABLE gt_tcurr
    FROM tcurr
    WHERE kurst = p_kurst    " as M
      AND gdatu = p_budat    " as 21.09.2011
      AND fcurr = p_waers    " as EUR
      AND tcurr = lv_waers.  " as TRY

as i said; with these conditions se16n->tcurr table turns me one row, but select statement turns me an empty row. Does anyone has any idea?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
EkremG
  • 131
  • 1
  • 13
  • Can't the problem be connected to the date format? It should not be "21.09.2011", but "20110921" --- SE16N performs internal/external formatting, so it shows 21.09.2011, but in plain ABAP you need to use internal format. – Tom Burger Sep 21 '12 at 10:31
  • 1
    do u know which conversion function does this job? – EkremG Sep 21 '12 at 11:04
  • when i am debugging in report i see my date variable as '21092011' so it should bring the row back. – EkremG Sep 21 '12 at 11:14
  • 1
    If you're seeing 21092011 then something is not correct. It should be 20110921. How is p_budat defined on your selection screen? What is the default format for dates in your user profile? – Bryan Cain Sep 21 '12 at 13:49
  • i didnt say that i see 21092011 :) I send p_budat as 21.09.2011. p_budat is type in budat. It turns me 79889078. In select statement i gave this number and it turned me the right record. – EkremG Sep 21 '12 at 13:54
  • Yes you did? in the comment right above mine... "when i am debugging in report i see my date variable as '21092011' so it should bring the row back. " – Bryan Cain Sep 21 '12 at 13:55
  • sorry Brian i changed the code after i write you the comment. thats why i answered my question – EkremG Sep 21 '12 at 14:16

1 Answers1

0
CONVERT DATE p_budat INTO INVERTED-DATE gv_date." solution :)
SELECT ukurs
INTO gs_tcurr-ukurs
FROM tcurr
WHERE kurst = p_kurst
  AND gdatu = gv_date
  AND fcurr = p_waers
  AND tcurr = lv_waers.
EkremG
  • 131
  • 1
  • 13
  • Are you sure that is the right solution ? How did you get 21.09.2011 in the first place ? If your SAP runs in multiple countries, date formats can be different per country. – tomdemuyt Sep 21 '12 at 12:18
  • i am getting record that i want with this solution :) 'convert date' gives you a number which tcurr table gets it as 21092011 – EkremG Sep 21 '12 at 12:36
  • 2
    If this is a "solution" of your "problem", you have a larger issue somewhere else in your code. – vwegert Sep 21 '12 at 13:15
  • i was just trying to read a record in Tcurr table and problem was about date. CONVERT DATE p_budat INTO INVERTED-DATE gv_date. gives me a number and with this number Tcurr understand which record it should give back. I didn't change anything else. – EkremG Sep 21 '12 at 13:27
  • @vwegert actually it seems the code is valid. Name of the data element is GDATU_INV based on domain DATUM_INV which has has as description "Inverted date". A quick look at the content of TCURR confirms that the dates are stored in this hare brained manner. – tomdemuyt Sep 21 '12 at 20:26