‎2006 Jan 17 2:41 AM
I need to display 2 fields value in a line, so I add two sysmbol '&field1&' and '&field2'. But '&field1' sometimes needed to suppress in some situation.
I handle it by creating 2 two text element 'Item1' and 'Item2'. Item1 contains only field2 while Item2 contains both. So I check it in my ABAP program, and determine which text element will be used.
Is there any better way to do this?
Can I use 'IF...ENDIF' in this case? How to use it if field1 is a numeric field and suppress when it is zero?
Thanks!
‎2006 Jan 17 3:01 AM
i THINK YOU CAN DO:
IF &FIELD1& = 0.
&FIELD2&
ELSE.
&FIELD1& &FIELD2&
ENDIF.
‎2006 Jan 17 2:58 AM
You can use conditional statements in SAPScript:
Visit <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/d1/80318f454211d189710000e8322d00/frameset.htm">SAP Script - Control Commands</a> for more details..
Any other problem please let us know.
‎2006 Jan 17 3:01 AM
i THINK YOU CAN DO:
IF &FIELD1& = 0.
&FIELD2&
ELSE.
&FIELD1& &FIELD2&
ENDIF.
‎2006 Jan 17 4:27 AM
I am using the graphical form painter.
When I click the insert command icon,
there are sysbols, command, text element, comment, sap characters and link for me to choose?
I have chosen 'Command' and type the following command
IF &FIELD1& <> 0. &FIELD1&. ENDIF.
but there is error....
‎2006 Jan 17 4:31 AM
You have to do multiple commands...line 1 has
IF &FIELD1& <> 0.
line2:
&FIELD1&
line3:
ENDIF.
‎2006 Jan 17 4:46 AM
Hi Neil
I have tried the same it
IF &FIELD1& <> 0.
line2: service tax &FIELD1&
line3: ENDIF.
but still it is not working. if field1 is zero then it is printing service tax 0, i donot want to print any line is field1 is zero. Please help
thanks
Vinayak
‎2006 Jan 17 4:53 AM
Hi Vinayak,
I think this is because the variable has decimal places and sapscript gets confused. Declare a constant in your abap say, c_zero, of the same type as field1 but with a value of 0. Change your sapscript to:
IF &FIELD1& <> &c_zero&.
line2: service tax &FIELD1&
line3: ENDIF.
‎2006 Jan 17 5:55 AM
Yes, I think there is something confused when passing value to SAPScript form.
I have field1 of data type CURR(13,2).
IF &field1& <> 0.
&field1&
ENDIF.
It doesn't work
But
IF &field1& <> ' 0.00'. <- 9 space before 0.00
&field1&
ENDIF.
It works.
Please correct me if I am wrong. Thanks!