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: 

Cocatenate the two fields ERDAT and ERZET in one field

Former Member
0 Kudos

Hello Friends, Please suggest how to Cocatenate the two fields ERDAT and ERZET in one field . in my ZTABLE.ERDAT IS DATE 8 and ERZET tims 6

so what should be the new ZCOMBO field length and type

Please give the ABAP Code to write that in Exit to Populate this Cocatenation of these two fields.

Thanks

Sincerely

Soniya Kapoor

1 ACCEPTED SOLUTION

harimanjesh_an
Active Participant
0 Kudos

hi soniya,

u can declare ZCOMBO as CHAR with LENGTH 14 with any seperator.

<b>Concatenate ERDAT ERZET into ZCOMBO.

In this case, output would be like yyyymmddhhmmss.</b>

If u want any seperator b/w date and time then declare it wiht LENGTH 15.

<b>CONSTANTS : c_s TYPE c VALUE '/'.

CONCATENATE erdat erzet INTO zcombo SEPERATED BY c_s.

In this case, output would be like yyyymmdd/hhmmss.</b>

reward me if useful.........

Harimanjesh AN

3 REPLIES 3

Former Member
0 Kudos

concatenate ERDAT ERZET into ZCOMBO.

ZCOMBO length can be 14 and type N.

Regards

Nishant

harimanjesh_an
Active Participant
0 Kudos

hi soniya,

u can declare ZCOMBO as CHAR with LENGTH 14 with any seperator.

<b>Concatenate ERDAT ERZET into ZCOMBO.

In this case, output would be like yyyymmddhhmmss.</b>

If u want any seperator b/w date and time then declare it wiht LENGTH 15.

<b>CONSTANTS : c_s TYPE c VALUE '/'.

CONCATENATE erdat erzet INTO zcombo SEPERATED BY c_s.

In this case, output would be like yyyymmdd/hhmmss.</b>

reward me if useful.........

Harimanjesh AN

former_member195698
Active Contributor
0 Kudos

Hi Soniya,

Declare the field as Timestamp and use Convert To timestamp statement for Concatenating Date and Time into a single field

CONVERT for Timestamps

Converts a timestamp into the correct date and time for the current time zone.

Syntax

CONVERT TIME STAMP <tst> TIME ZONE <tz> INTO DATE <d> TIME <t>.

CONVERT DATE <d> TIME <t> INTO TIME STAMP <tst> TIME ZONE <tz>.

As long as <tst> has type P(8) or P(11) with 7 decimal placed, and <tz> has type C(6), the time stamp <tst> will be converted to the correct date <d> and time <t> for the time zone <tz>.

Regards,

Abhishek