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: 

Conversion of Value from Select Option

Former Member
0 Kudos
1,579

Hi,

I have created a select option fro a report where the input is taken from a table in the form 18.05.2011 15:37 however when i check in Debugging, the for that select option is 20110518153700. Is there a way to match the two. How do i convert the table entry on the selection screen to match the select option value?

1 ACCEPTED SOLUTION

mithun_shetty4
Contributor
0 Kudos
298

Date is a 8 char field with output lenght as 10.During Debugging you get date in the form YYYYMMDD and HHMMSS for time.

when u see the contents of the table the date and time gets formated based on the user settings.

in case you are fetching data from a table based on date u can specify


SELECT-OPTIONS:S_DATE for SY-DATUM.
*or 
PARAMETERS :P_DATE like sy-datum.

*and during SELECT

SELECT * from ZTABLE into table it_table where DATUM in S_DATE.

*or 
SELECT * from ZTABLE  into TABLE it_table where DATUM EQ P_DATE.

4 REPLIES 4

mithun_shetty4
Contributor
0 Kudos
299

Date is a 8 char field with output lenght as 10.During Debugging you get date in the form YYYYMMDD and HHMMSS for time.

when u see the contents of the table the date and time gets formated based on the user settings.

in case you are fetching data from a table based on date u can specify


SELECT-OPTIONS:S_DATE for SY-DATUM.
*or 
PARAMETERS :P_DATE like sy-datum.

*and during SELECT

SELECT * from ZTABLE into table it_table where DATUM in S_DATE.

*or 
SELECT * from ZTABLE  into TABLE it_table where DATUM EQ P_DATE.

0 Kudos
298

Hi Mithun,

The select option has a combination of both date and time which actually looks like this in the table 20.070.416.090.604 ( for 16.04.200709:06:04) but if I give this as an input, it does not accept it and the report is empty. Only if i give the input as YYYYMMDDHHMMSS the report is shown. How do I convert this value 20.070.416.090.604?

0 Kudos
298

From which table are you selecting the data ?

Regards,

Mithun

0 Kudos
298

Hi,

Your Select option value must be of TIMESTAMP type, instead of single value provide DATE and TIME value in the selection screen, then convert those date and time values into TIMESTAMP using Convert Time Stamp statements.

DATA : v_ltmstp TYPE timestamp,
       v_htmstp TYPE timestamp.

DATA : r_tmstp  TYPE RANGE OF timestamp,
       wa_tmstp LIKE LINE OF r_tmstp.

* Lower limit
PARAMETERS : p_ldate TYPE sy-datum,
             p_luzeit TYPE sy-uzeit.


* Higher limit
PARAMETERS : p_hdate TYPE sy-datum,
             p_huzeit TYPE sy-uzeit.

CONVERT DATE p_ldate TIME p_luzeit INTO TIME STAMP v_ltmstp TIME ZONE 'CET   '.

CONVERT DATE p_hdate TIME p_huzeit INTO TIME STAMP v_htmstp TIME ZONE 'CET   '.

wa_tmstp-sign   = 'I'.
wa_tmstp-option = 'BT'.
wa_tmstp-low    = v_ltmstp.
wa_tmstp-high   = v_htmstp.
APPEND wa_tmstp TO r_tmstp.

Now you can use R_TMSTP to get data from the table.

Thanks & Regards

Bala Krishna.