Application Development and Automation 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: 
Read only

date time issue

Former Member
0 Likes
1,243

I am trying to extract data from CRMD_ORDERADM_H table (SRM) using the date contract was changed. On the selection screen I have contract change date. But the CHANGED_AT field is combination of date and time in the table. How should I extract the data. When I pass only date it gives me error 'pass time also'.

Please advice.

Thanks.

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
1,042

Hi,

Please try this.


RANGES: R_TSTAMPS FOR TZONREF-TSTAMPS.
                                                                        
DATA: WA_TSTAMPS1 TYPE TZONREF-TSTAMPS,
      WA_TSTAMPS2 TYPE TZONREF-TSTAMPS.
                                                                        
CONSTANTS: C_TIME1 TYPE SY-TIMLO VALUE '000000',
           C_TIME2 TYPE SY-TIMLO VALUE '235959'.
                                                                        
CONVERT DATE P_DATE TIME C_TIME1
INTO TIME STAMP WA_TSTAMPS1 TIME ZONE SY-ZONLO.
                                                                        
CONVERT DATE P_DATE TIME C_TIME2
INTO TIME STAMP WA_TSTAMPS2 TIME ZONE SY-ZONLO.
                                                                        
R_TSTAMPS-SIGN   = 'I'.
R_TSTAMPS-OPTION = 'BT'.
R_TSTAMPS-LOW    = WA_TSTAMPS1.
R_TSTAMPS-HIGH   = WA_TSTAMPS2.
APPEND R_TSTAMPS.

Next, you can use the above range to select/extract the data from table.

Regards,

Ferry Lianto

8 REPLIES 8
Read only

Former Member
0 Likes
1,042

Make it a range with one date, but the time from 00:00:00 to 23:59:59.

Rob

Read only

0 Likes
1,042

Rob-

I have a range (select option) for the date on the selection screen. Is there a function module to take care of this.

Thanks,

AP

Read only

0 Likes
1,042

Can't you just use BETWEEN?

Rob

Read only

0 Likes
1,042

hello friends,

I have a field in a table which is of data type dec 15 with a conversion exit TSTLC on the domain. So the values inserted will be converted into timestamp.

Now my problem is to select records from the table on the basis of this feild less then or greater then value inserted by user.

how can i do this? in the program.

Please help.

Read only

ferry_lianto
Active Contributor
0 Likes
1,042

Hi,

You can use FM IB_CONVERT_INTO_TIMESTAMP to convert date and time to timestamp.

Also use FM IB_CONVERT_FROM_TIMESTAMP to convert timestamp to date and time.

Regards,

Ferry Lianto

Read only

0 Likes
1,042

Those function modules are not available in SRM.

I am trying to extract data from CRMD_ORDERADM_H table (SRM) using the date the contract was changed. On the selection screen I have contract change date. But the CHANGED_AT field is combination of date and time in the table. How should I extract the data. When I pass only date it gives me error 'pass time also'.

Please advice.

Thanks.

Read only

ferry_lianto
Active Contributor
0 Likes
1,043

Hi,

Please try this.


RANGES: R_TSTAMPS FOR TZONREF-TSTAMPS.
                                                                        
DATA: WA_TSTAMPS1 TYPE TZONREF-TSTAMPS,
      WA_TSTAMPS2 TYPE TZONREF-TSTAMPS.
                                                                        
CONSTANTS: C_TIME1 TYPE SY-TIMLO VALUE '000000',
           C_TIME2 TYPE SY-TIMLO VALUE '235959'.
                                                                        
CONVERT DATE P_DATE TIME C_TIME1
INTO TIME STAMP WA_TSTAMPS1 TIME ZONE SY-ZONLO.
                                                                        
CONVERT DATE P_DATE TIME C_TIME2
INTO TIME STAMP WA_TSTAMPS2 TIME ZONE SY-ZONLO.
                                                                        
R_TSTAMPS-SIGN   = 'I'.
R_TSTAMPS-OPTION = 'BT'.
R_TSTAMPS-LOW    = WA_TSTAMPS1.
R_TSTAMPS-HIGH   = WA_TSTAMPS2.
APPEND R_TSTAMPS.

Next, you can use the above range to select/extract the data from table.

Regards,

Ferry Lianto

Read only

0 Likes
1,042

Thank you. It resolved the issue.