2015 Jul 06 1:09 PM
Hi,
I am trying to assign data object of type Date in Select Query to field of interal table.
e.g.
Select trntry, @d_date as budat
from z_view to z_internal_table.
where z_internal_table is internal table of strutcure : trntyp type c,
budat type d.
d_date is data object of type d, which is assign date before select query.
However, when i check output of table it showing date field as empty
with two character : ' - - '.
I don't know, why it is not working, if i use host variable of other type like
char, numc, or p , its working good.
2015 Jul 06 1:32 PM
2015 Jul 06 1:59 PM
TABLES: zer2_dv_vt_011.
SELECT-OPTIONS: s_date FOR zer2_dv_vt_011-budat.
TYPES: BEGIN OF lty_final,
trantyp TYPE c LENGTH 1,
budat TYPE d,
END OF lty_final.
DATA : d_date TYPE d.
d_date = s_date-low.
DATA: lt_final TYPE STANDARD TABLE OF lty_final.
START-OF-SELECTION.
SELECT trantyp, @d_date AS budat
FROM zer2_dv_vt_011
INTO CORRESPONDING FIELDS OF TABLE @lt_final
WHERE budat IN @s_date.
Its just a sample code i have created, TRANTYP in ZER2_DV_VT_011 is of Char type with Length 1
after Query lt_final contain the data for TRANTYP, but showing empty for BUDAT.
2015 Jul 06 2:23 PM
Where are you writing this code, i don't see how this will even compile?
2015 Jul 06 2:41 PM
In SE38, and why it will not compile?
I have not mention REPORT Statement at top for obvious reason.
2015 Jul 06 2:50 PM
2015 Jul 06 2:55 PM
YES, JUST include the REPROT Statement (as it is executable Prog) at top, i don't think there is anything wrong there.
for displaying the data i have use CL_DEMO_OUTPUT=>DISPLAY( LT_FINAL ).
??
2015 Jul 06 2:57 PM
but my main concern is of select query, why it is not assign the date to internal table field.
2015 Jul 06 3:13 PM
My concern is the code.
SELECT trantyp, @d_date AS budat
FROM zer2_dv_vt_011
INTO CORRESPONDING FIELDS OF TABLE @lt_final
WHERE budat IN @s_date
maybe should be:
SELECT trantyp budat
FROM zer2_dv_vt_011
INTO CORRESPONDING FIELDS OF TABLE lt_final
WHERE budat IN s_date
Then the next question is why are you:
d_date = s_date-low.
i.e. only using the date-low value, what happens if person running this has no value here?
Probably your table doesn't have this value? What value are you entering on your selection screen?
Please post a copy of your table here i.e. the table definition and also the table contents.
2015 Jul 06 3:42 PM
we used , and @ from ABAP 7.4 , maybe before that and
its just sample code, not representing any actual Senior( actual code is bit complex and big).
you can write the code like.
REPORT ztemp1.
TABLES: zer2_dv_vt_011.
SELECT-OPTIONS: s_date FOR zer2_dv_vt_011-budat OBLIGATORY NO-EXTENSION.
TYPES: BEGIN OF lty_final,
trantyp TYPE c LENGTH 1,
MODIFIED_DATE TYPE d,
END OF lty_final.
DATA: lt_final TYPE STANDARD TABLE OF lty_final.
START-OF-SELECTION.
SELECT trantyp, @s_date-low AS MODIFIED_DATE
FROM zer2_dv_vt_011
INTO CORRESPONDING FIELDS OF TABLE @lt_final where budat in @s_date..
cl_demo_output=>display( lt_final ).
hope it make sense now.
Here Modified_date is just another field in ZER2_DV_VT_011 of type date.
2015 Jul 06 3:54 PM
2015 Jul 07 5:28 AM
Yes it has value for data entered on selection screen, even i removes where clause, data is not showing for field of type date.