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.
		
		

Dig Deeper on SAP ABAP

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchContentManagement

SearchHRSoftware

Close