on 05-16-2007 4:09 PM
hi
I need to change the time format from 17:00 Hrs to 5:00 PM. Right now the form is showing time like 17:00 HRS. it should be 5 PM.
your help will be extremely appreciated.
Regards
Waseem
HI,
sorry paste didn't work..
try this logic...
If &time+0(2)& GE 13
&time+0(2)& - 12
Endif.
Regards
SAB
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Waseem,
then try the code Ferry posted.. in ur print program... if u cant access print program then u need to write a PERFORM routine in script.
/: PERFORM TEST IN PROGRAM Z_PROG
/: USING &TIME&
/: CHANGING &TIME_PM&
/: ENDPERFORM
in ZTEST report program for routine.....
FORM test TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
READ TABLE in_par WITH KEY 'TIME'.
CHECK sy-subrc = 0.
l_time = in_par-value.
CALL FUNCTION 'HRVE_CONVERT_TIME'
EXPORTING
type_time = 'A'
input_time = l_time
INPUT_AM_PM = 'AM'
IMPORTING
OUTPUT_TIME = o_time
OUTPUT_AM_PM = o_stamp
EXCEPTIONS
PARAMETER_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE out_par WITH KEY 'TIME_PM'.
CHECK sy-subrc = 0.
out_par-value = o_time.
MODIFY out_par INDEX sy-tabix.
ENDFORM. "TEST
Regards
SAB
HI Waseem,
there r 2 possiblities as i known for that error message.
1. Program name in PERFORM in script is not matching with Z_PROG name or Routine name TEST is not matching in Z_PROG name.
2. May be u have written the perform in editor mode but not in Command editor mode.
GOTO --> Change Editor
now u can see the left side command /: or /E or * and right side u have to paste the perform statement.
save and activate.
Now in Z_prog
look for the errors .. if it still say same then double clcik on ITCSY, is it exist in ur SAP or not?
Regards
SAB
AOA Syed
Well I have checked that. I had made the changes in Command Mode with
/: in the Tag Column. I have checked the name of program and form and they are correct. Then I checked for the strcture by double clicking on it and it takes me to the Dictionary where it is present.
The called program type is executable. I have changed it to M but still it gives the same error.
Did this code worked for you. or if you have have snippet of code of the ABAP program with routine, please send it to me and I will compare it with my code.
Regards
waseem
AOA Waseem,
i created a new executable program and pasted this code and i activated it without any problem.
I am not sure whats wrong with ur program...
Sapscript:
/: PERFORM TEST IN PROGRAM Z_PROG
/: USING &TIME&
/: CHANGING &TIME_PM&
/: ENDPERFORM
Report: Z_PROG ( Executable)
REPORT Z_PROG.
FORM test TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
data: l_time type sy-uzeit,
o_time type sy-uzeit,
o_stamp(2) type c.
READ TABLE in_par WITH KEY 'TIME'.
CHECK sy-subrc = 0.
l_time = in_par-value.
CALL FUNCTION 'HRVE_CONVERT_TIME'
EXPORTING
type_time = 'A'
input_time = l_time
INPUT_AM_PM = 'AM'
IMPORTING
OUTPUT_TIME = o_time
OUTPUT_AM_PM = o_stamp
.
READ TABLE out_par WITH KEY 'TIME_PM'.
CHECK sy-subrc = 0.
out_par-value = o_time.
MODIFY out_par INDEX sy-tabix.
ENDFORM. "TEST
Regards
SAB
Hi,
Try the FM: HRVE_CONVERT_TIME
TYPE_TIME A
INPUT_TIME 17:00:00
INPUT_AM_PM PM
Export parameters Value
OUTPUT_TIME 05:00:00
OUTPUT_AM_PM PM
Regards,
Ferry Lianto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.