cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Date display in sap script

Former Member
0 Kudos

Hi Experts,

I created sap script... in my sap script one field is date... date is coming form database table like: 11/15/2007(mm/dd/yyyy) but i want to display date like

November 15, 2007

so give me suggetion.

zeni

Accepted Solutions (1)

Accepted Solutions (1)

naimesh_patel
Active Contributor
0 Kudos

I think we don't have any FM which can suit your requirement.

You can use the table T247 to get the Month name. and use the concatenate to build up the date.

Like:


SELECT SINGLE LTX
              INTO L_LTX
              FROM T247
              WHERE SPARS = SY-LANGU
              AND      MNR = L_DATE+4(2).

CONCATENATE L_LTX L_DATE+6(2) INTO L_TXT_DATE SEPARATED BY ' '.
CONCATENATE L_TXT_DATE L_DATE+0(4) INTO L_TXT_DATE SEPARATED BY ', '.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

in query i think is no problem but when i see on debugging mode so becaus of this query i got a short dump... so any problem in query.....

suggest me.

Zeni

naimesh_patel
Active Contributor
0 Kudos

Oh sorry,

SPRAS should be there in Where clause.

Check out this entire code:


REPORT  ZTEST_NP.

DATA: L_DATE LIKE SY-DATUM,
      L_LTX LIKE T247-LTX,
      L_TXT_DATE(30).

L_DATE = SY-DATUM.

SELECT SINGLE LTX
              INTO L_LTX
              FROM T247
              WHERE SPRAS = SY-LANGU
              AND      MNR = L_DATE+4(2).

CONCATENATE L_LTX L_DATE+6(2) INTO L_TXT_DATE SEPARATED BY ' '.
CONCATENATE L_TXT_DATE L_DATE+0(4) INTO L_TXT_DATE SEPARATED BY ', '.


WRITE: L_TXT_DATE.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

Now its working.... but what i write in text element variable or date

actually we can write date directly in text elemet for that i use move statement

"MOVE L_TXT_DATE TO REGUH-ZALDT." is it correct???

give me suggetion

zeni

naimesh_patel
Active Contributor
0 Kudos

You can use the L_TXT_DATA in the SAPScript also.

Define L_TXT_DATA(30) type c as a global variable.

and use in the SAPScript. instead of the ZALDT.

&L_TXT_DATA&

Regards,

Naimesh Patel

naimesh_patel
Active Contributor
0 Kudos

I found some SAPScript system symbol which can directly set the date in your required format.

In your SAPScirpt write like this:

<b>/: SET DATE MAST = 'MMMM DD, YYYY'</b>

So, all your dates will print like:

REGUH - ZLDAT = '20071115'

.

&REGUH-ZLDAT&

will give out put as 'November 15, 2007'.

In this case no need to do all the logic, which we have already did.

Sorry for that, but I found this little late.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi patel,

Thanks a lot.......

zeni

Answers (2)

Answers (2)

Former Member
0 Kudos

In the SAPScript, output the date like this:

&zdate(Z)&

(Where zdate is your date variable.)

Rob

Former Member
0 Kudos

Hi Rob,

But i got a short dump in abap codding not in sap script.........

zeni

Former Member
0 Kudos

Hi Zeni,

what dump says?

Satish

Former Member
0 Kudos

Hi,

Build a subroutine in Print Program and call that in your script.

use FM IDWT_READ_MONTH_TEXT to get the MONTH in Text

Search Function module like this 'CONVERSION_EXIT_DAT_OUTPUT', you may get some function module which can directly change to the required format.

Satish