Problem solve Get help with specific problems with your technologies, process and projects.

Date to text conversion code

The code to convert the date to character. For example; 27-03-2002 will become 27th March, 2002.

The code to convert the date to character. For example; 27-03-2002 will become 27th March, 2002.
 DATA : V_NAME(10), V_TEXT(5),
       V_DATE(20).


PARAMETERS : S_DATE LIKE SY-DATUM.


case S_DATE+6(02) .
when  '01' or '21' or '31' .
V_TEXT = 'st'.
when  '02' OR '22'.
v_text = 'nd'.
WHEN '03' OR '23'.
V_TEXT = 'rd'.
WHEN OTHERS.
V_TEXT = 'th'.

endcase.

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

if S_DATE+6(2) < 10.
CONCATENATE S_DATE+7(1) V_TEXT into v_date.
else.
CONCATENATE S_DATE+6(2) V_TEXT into v_date.
endif.
concatenate v_date
V_NAME
INTO V_DATE separated by space.
concatenate v_date ',' into v_date.

concatenate v_date S_DATE+0(4) into v_date separated by space.

write / v_date.
		
		
This was last published in May 2002

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close