on 12-11-2006 7:44 AM
Hi,
I have a question about sap scripts.
There're three fields in the form,devided with comma.
for example:
Location:&street&,&city&,&state&
but not every fields always have data, when &street& and &city& are empty,&state& = 'USA',result will be like this:
Location:,,USA
I want to hide the first two commas,how to deal with it.
a solution is:
If &street& = ' '
Location:&city&,&state&
endif
.
.
.
but if like that ,I must write many 'if' to shown different situation.A little prolixity.
Do you have some simple methods?
Message was edited by:
yang zou
Try to embed the comma with the field name.
E.g: &street','& &city','& &state& ...
The comma will be displayed only if the field it is attached to contains a value at run-time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just try this whether it is working.If so,kindly reward points.
data v1(40).
v1 = &street&.
if not &street& is initial.
concatenate v1 ',' into v1.
endif.
concatenate v1 &city& into v1.
if not &city& is initial.
concatenate v1 ',' into v1.
endif.
concatenate v1 &state& into v1.
Message was edited by:
Jayanthi Jayaraman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Yang,
I had encounter similar situation.
Here is what I did.
Tag SAPScript text
Location:,,
/: if &street& NE ' '
= &street&,
/: endif
/: if &city& NE ' '
= &city&,
/: endif
/: if &state& NE ' '
= &state&
/: endif
= tag means the texts will be on same line as ofg 'Location' text.
and If endif will ensure they are displayed only if NOT BLANK.
Regards,
Vivek Kute.
Reward points if helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi yang,
a solution is:
If &street& = ' '
Location:&city&,&state&
endif
U have to use the if and elseif nested condition.
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yang,
As you have given
If &street& = ' '
Location:&city&,&state&
endif.
.
..
Only this is possible .
There is no other option to avoid comma.
Regards,
Guru
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.