‎2007 Aug 28 3:34 PM
Hi all
How can i add or reduce a value to the field sy-uzeit?
i want to do this, for example
sy-uzeit = 103358
da_uzeit = 040000
da_uzeit = da_uzeit + sy-uzeit = 143358
which fm can i use? it's possible to do this??
Thanks for your help
Gregory
‎2007 Aug 28 3:48 PM
if both variables are type T then you can just use +
data: time1 type t,
time2 type t.
time1 = '012030'.
time2 = '100102'.
time1 = time1 + time2.
==> time1 = '112132'
time1 = '112030'.
time2 = '180102'.
time1 = time1 + time2.
==> time1 = '052132'
‎2007 Aug 28 3:44 PM
Hi!
Try using this FM:
EWU_ADD_TIME
You have to give the date also, because of the possible time overflow to the next day... For example if it is 20 o'clock and you wanted to add 10, it will be tomorrow 06...
Regards
Tamá
‎2007 Aug 28 3:51 PM
hi
This fm work, but i forgot to say that i'm working in CRM. This FM don´t exist in CRM.
Thanks
Gregory
‎2007 Aug 28 5:53 PM
Hi Gregory..
If the standard SAP function module is not available, you can write your own. If you are going to use this at lot many places, then go and create a new FM.
Take Import parameters as TIME1 type sy-uzeit and TIME2 type sy-uzeit, and OPTION type char1. and Export parameter as TIME_OUT.
In the logic, check the value of OPTION, (A for add, S for subtract).
IF OPTION eq 'A'.
TIME_OUT = TIME1 + TIME2.
ELSEIF OPTION eq 'S'.
TIME_OUT = TIME1 - TIME2.
ENDIF.
Thanks and Best Regards,
Vikas Bittera.
**Points for useful answers**
‎2007 Aug 28 3:48 PM
if both variables are type T then you can just use +
data: time1 type t,
time2 type t.
time1 = '012030'.
time2 = '100102'.
time1 = time1 + time2.
==> time1 = '112132'
time1 = '112030'.
time2 = '180102'.
time1 = time1 + time2.
==> time1 = '052132'
‎2007 Aug 28 3:49 PM
Hi,
You can use one of the below function modules
ADD_TIME_TO_DATE
EWU_ADD_TIME
C14B_ADD_TIME
Regards
Sudheer
‎2007 Aug 28 7:16 PM
Hi
Ready it's solved. i created a new FM in CRM
Thanks for your helps
Regards
Gregory
‎2007 Aug 28 7:19 PM
Hi Gregory,
Look this, maybe can help you.
Here have three PARAMETERS (Hrs, Mins and Secs), and two radiobuttons (add and subt), is easy to understand.
DATA: TIME(6),
NUM(6),
HOUR(8),
H(3),
M(3),
S(3).
SELECTION-SCREEN BEGIN OF BLOCK BLC WITH FRAME TITLE TEXT-001.
PARAMETERS: HOU(2),
MIN(2),
SEC(2),
RBADD RADIOBUTTON GROUP 001,
RBSUBT RADIOBUTTON GROUP 001.
SELECTION-SCREEN END OF BLOCK BLC.
TIME = SY-UZEIT.
IF RBADD = 'X'.
H = TIME+0(2) + HOU.
M = TIME+2(2) + MIN.
S = TIME+4(2) + SEC.
ELSE.
H = TIME+0(2) + 23 - HOU.
M = TIME+2(2) + 59 - MIN.
S = TIME+4(2) + 60 - SEC.
ENDIF.
WHILE S >= 60.
M = M + 1.
S = S - 60.
ENDWHILE.
WHILE M >= 60.
H = H + 1.
M = M - 60.
ENDWHILE.
WHILE H >= 24.
H = H - 24.
ENDWHILE.
CONCATENATE H(2) ':' M(2) ':' S(2) INTO HOUR.
WRITE: HOUR.
Regards
Allan Cristian