06-26-2008 2:21 AM
Hi all
I have two variables, P_CPL and P_CPU.
I want to display variable which have minimum value.
How do I write the statement?
Thanks in advance.
az
06-26-2008 2:44 AM
If P_cpl GE P_cpu.
if sy-subrc eq 0.
write : P_Cpu.
else
write P_cpl.
endif.
regrads
Devanand
06-26-2008 2:44 AM
If P_cpl GE P_cpu.
if sy-subrc eq 0.
write : P_Cpu.
else
write P_cpl.
endif.
regrads
Devanand
06-26-2008 2:48 AM
one thing where do u want to display
if u wamt to display in the selection screen.
at selection-screen output.
If p_cpu ge p_cpl.
if sy-subrc eq 0.
loop at screen.
screen-field = p_cpu.
screen-active = 0.
endloop.
else.
loop at screen.
screen-field = p_cpl.
screen-active = 0.
endloop.
endif.
regards
Devanand
06-26-2008 2:47 AM
HI,
Try this
If P_CPL > P_CPU.
then..your code....
If P_CPU > P_CPL.
then..your code....
Or you could also do
your Itab has values
sort itab by field1 aescending.
read table itab index 1.
v_min = itab-field1.
Regards,
Nikhil
Edited by: Nikhil A Chitre on Jun 26, 2008 11:47 AM
06-26-2008 4:45 AM
Hi,
We can use relational operators like GT , GE , > , >= to compare the variables.
DATA: L_MIN TYPE I.
IF P_CPL > P_CPU.
L_MIN = P_CPU.
ELSE.
L_MIN = P_CPL
ENDIF.
WRITE: L_MIN.
This will surely help you.
Plz reward if useful.
Thanks,
Dhanashri.
06-26-2008 4:47 AM
Hi Alawiyah,
do this code.
if p_cpl > p_cpu.
write: p_cpu.
else.
write: p_cpl.
endif.
06-26-2008 12:19 PM