2007 Mar 22 12:53 PM
hi friends,
i have a small requirement in sap scripts. i have to print the time format as
03: 11 PM or AM . i am using SET TIME MASK = 'HH: MM'
but i need to print AM OR PM at the same time . which i am unable to do so.
please help me if you know .
Thanks and Regards
srinivas
Hi,
Why you need to print that AM or PM,
if the time is 3.11 PM it will be displayed as 15.11 no?
If you want you can put a condition such that :
if time+0(2) > 12 concatenate with PM else AM.
reward if useful
regards,
anji
2007 Mar 22 12:58 PM
Hi,
Why you need to print that AM or PM,
if the time is 3.11 PM it will be displayed as 15.11 no?
If you want you can put a condition such that :
if time+0(2) > 12 concatenate with PM else AM.
reward if useful
regards,
anji
2007 Mar 22 1:16 PM
Hi Srini,
Here is the code try to put it in the subroutine. before priniting the Time.
<b>Put this code inside your SAP Script before displaying the time</b>
DEFINE &L_SCH_TIME& = &RM06P-LTIME&
PERFORM GET_DATE_FORMAT IN PROGRAM ZW1MEDRUCK_INCLUDE
USING &RM06P-LFTIME& " This is the actual time
CHANGING &L_SCH_TIME& " This will hold the time with AM/PM
ENDPERFORM<b>Put Code Inside your Include ZW1MEDRUCK_INCLUDE</b>
FORM GET_DATE_FORMAT TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
DATA: L_TIMFM(10) TYPE C,
L_TIME2(10) TYPE C,
L_HOUR TYPE I,
L_MIN TYPE I.
READ TABLE IN_TAB WITH KEY 'RM06P-LFDAT'.
IF SY-SUBRC = 0.
L_TIME2 = IN_TAB-VALUE.
IF L_TIME2+0(2) GT 11.
L_HOUR = L_TIME2 - 12.
L_MIN = L_TIME +3(2).
CONCATENATE L_HOUR ':' L_MIN 'PM' INTO L_TIMFM .
ELSE.
CONCATENATE IN_TAB-VALUE 'PM' INTO L_TIMFM.
ENDIF.
ENDIF.
READ TABLE OUT_TAB WITH KEY L_SCH_TIME'.
IF SY-SUBRC = 0.
OUT_TAB-VALUE = L_TIMFM.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.<b>Now Put this code to SAP Script to print the time in AM/PM format.</b>
&L_SCH_TIME& "------>instead of your time variable.....Reward Point if helpfull....................
2011 Jul 25 2:51 PM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |