Application Development and Automation 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: 
Read only

CONCATENATE - question

Former Member
0 Likes
540

Hi there,

I have a simple question. I want to give out the full name of a sap-user on a write list and so i want ro concatenate the first- and the lastname togehther divided by a single blank.

But how can I achieve this?

Here my coding:



      CALL FUNCTION 'BAPI_USER_GET_DETAIL'
        EXPORTING
          username = lv_username
        IMPORTING
          address  = ls_adress
        TABLES
          return   = lt_return.

      CONDENSE: ls_adress-firstname,
                ls_adress-lastname.
      CONCATENATE ls_adress-firstname 
                  ' ' 
                  ls_adress-lastname
        INTO lv_name
        RESPECTING BLANKS.

But the result is like this:

Firstname Lastname

I think the addition RESPECTING BLANKS also gives out the complete chars that are defined in the data element and not the filled one.

How can I recode this for a better solution?

Thanks a lot.

Kind regards

Max

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
518

Hi Max,

You need to use 'SEPARATED BY SPACE'.


       CONCATENATE ls_adress-firstname 
                  ls_adress-lastname
        INTO lv_name
        SEPARATED BY SPACE.

thanks,

Chidanand

Hi there,

I have a simple question. I want to give out the full name of a sap-user on a write list and so i want ro concatenate the first- and the lastname togehther divided by a single blank.

But how can I achieve this?

Here my coding:



      CALL FUNCTION 'BAPI_USER_GET_DETAIL'
        EXPORTING
          username = lv_username
        IMPORTING
          address  = ls_adress
        TABLES
          return   = lt_return.

      CONDENSE: ls_adress-firstname,
                ls_adress-lastname.
      CONCATENATE ls_adress-firstname 
                  ' ' 
                  ls_adress-lastname
        INTO lv_name
        RESPECTING BLANKS.

But the result is like this:

Firstname Lastname

I think the addition RESPECTING BLANKS also gives out the complete chars that are defined in the data element and not the filled one.

How can I recode this for a better solution?

Thanks a lot.

Kind regards

Max

2 REPLIES 2
Read only

Former Member
0 Likes
519

Hi Max,

You need to use 'SEPARATED BY SPACE'.


       CONCATENATE ls_adress-firstname 
                  ls_adress-lastname
        INTO lv_name
        SEPARATED BY SPACE.

thanks,

Chidanand

Read only

0 Likes
518

Thank you!!