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: 

Help to read a table with data source and convert time stamp

Former Member
0 Kudos

Hi Gurus,

I have a req and need to write a ABAP prog. As soon as i excute ABAP program it should ask me enter a data source name, then my ABAP prog has excute teh code, in ABAP code i have to read a table with this data source as key, sort time stamp from table and should display the data source and time stamp as output.

As follows:

Enter Data Source Name:

Then user enters : 2lis_11_vahdr

Then out put should be "Data source :" 10-15-2008.

The time stamp format in table is 20,050,126,031,520 (YYYYMMDDhhmmss). I have to display as 05-26-2005. Any help would be apprciated.

Thanks,

Ram

2 REPLIES 2

Former Member
0 Kudos

Hi Jayanthi Babu Peruri,

I tried to extract YEAR, MONTH, DAY separately and using

EDIT MASK written it.

Definitely there will be some STANDARD CONVERSION ROUTINE will be there. But no idea about it.


DATA : V_TS      TYPE TIMESTAMP,
       V_TS_T    TYPE CHAR16,
       V_YYYY    TYPE CHAR04,
       V_MM      TYPE CHAR02,
       V_DD      TYPE CHAR02.

START-OF-SELECTION.
  GET TIME STAMP FIELD V_TS.
  V_TS_T = V_TS.
  CONDENSE V_TS_T.
  V_YYYY = V_TS_T.
  V_MM   = V_TS_T+4(2).
  V_DD   = V_TS_T+6(2).
  V_TS_T(2) = V_MM.
  V_TS_T+2(2) = V_DD.
  V_TS_T+4(4) = V_YYYY.
  SKIP 10.
  WRITE : /10 V_TS," USING EDIT MASK '____-__-________'.
          /10 V_YYYY,
          /10 V_MM,
          /10 V_DD,
          /10 V_TS_T USING EDIT MASK '__-__-__________'.

If you want DATE alone, just declare the length of V_TS_T as 10.

Regards,

R.Nagarajan.

-


We can -


madan_ullasa
Contributor
0 Kudos

Hi,

Use parameters on the selection screen for your data source.. Then read your relevant table using this data source...You can edit the output using edit-mask... type this and F1 for help...

eg..

parameters: data_sou type (relevant type).

select time_stamp from table into structure where data_source = data_sou..

You will have the time_stamp in structure.... edit this before output...

regds

madan..