Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting Spaces in Address

tarangini_katta
Active Contributor
0 Kudos

Hi All,

I have a requirement in SAP Script to print the address.

i am geeting the address everything is perfect.

I have 5 fields in the address like

adrs-name1 , adrs-ort01,adrs-ort02 adrs-stars adrs-regio.

I am displaying the address perfectly in the script.

If any one of the field name1 ort01 ort02 stras regio is initial.I am getting the space in the the print form

for example if ort02 is intial

i am printing like this.

XXXX,

YYYY,

zzzzzz,

aaaaa.

Now my client wants we should not display space is the value is initial.IF it is initial he wants the ouptut like this.

XXXX

YYYYY

ZZZZZZ

AAAA

I have tried using If statement.

BUt if i have space in 2 fields it is not working.

Can any body give quick response on this.

Thanks

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor
0 Kudos

you should simply not print if the field does not have value:

IF &ORT02& NE &SPACE&.
&ORT02&
ENDIF.

4 REPLIES 4

Former Member
0 Kudos

Hi

use "condense" to remove space

or this is the sample code by which i removed the space between street , city and country name

lv_city = wa_itab-city.

lv_street = wa_itab-street.

lv_country = wa_itab-country.

  • CONCATENATING CITY,STREET AND COUNTRY WITH PROPER USAGE OF ','.

IF wa_itab-city IS INITIAL OR wa_itab-street IS INITIAL .

  • CONCATENATING STREET,CITY AND COUNTRY IN A VARIABLE FOR CURRENT LOCATION

CONCATENATE lv_street lv_city INTO lv_curdesc SEPARATED BY space .

ELSE.

CONCATENATE lv_street lv_city lv_country INTO lv_curdesc SEPARATED BY ' , '.

ENDIF.

  • CONCATENATING STREET,CITY AND COUNTRY IN A VARIABLE FOR CURRENT LOCATION

IF wa_itab-country IS NOT INITIAL.

CONCATENATE lv_curdesc lv_country INTO lv_curdesc SEPARATED BY ' , '.

ENDIF.

  • CONCATENATING STREET,CITY AND COUNTRY IN A VARIABLE FOR CURRENT LOCATION

IF wa_itab-city IS NOT INITIAL AND wa_itab-street IS NOT INITIAL AND wa_itab-country IS NOT INITIAL.

CONCATENATE lv_street lv_city lv_country INTO lv_curdesc SEPARATED BY ' , '.

ENDIF.

Edited by: Neha Thukral on Dec 10, 2008 11:03 AM

Former Member
0 Kudos

Hi,

Suppose you are using the paragraph format say 'XX' to print the address. Go to paragraph format 'XX' & simply tick the check box 'No Blank lines'.

Regards

Raju Chitale

JozsefSzikszai
Active Contributor
0 Kudos

you should simply not print if the field does not have value:

IF &ORT02& NE &SPACE&.
&ORT02&
ENDIF.

Former Member
0 Kudos

Hi..

use ADDRESS.. ENDADDRESS.

pass the variables in between address-- endaddress.. you will get your desired result.

all the best..

Thanks,

GSANA