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 with 'enter' on a variable

Former Member
0 Likes
668

Hello!

How can I concatenate text with 'enter' in a variable of text.

For example:

IF p_pais IS INITIAL.

CONCATENATE v_msg ' - v_1000' INTO v_msg.

ENDIF.

IF p_est IS INITIAL.

CONCATENATE v_msg ' - b_1000' INTO v_msg.

ENDIF.

MESSAGE i000(su) WITH v_msg.

I try that the result in a message.

- v_1000

- b_1000

not v_1000-b1000

thanks!

Hello!

How can I concatenate text with 'enter' in a variable of text.

For example:

IF p_pais IS INITIAL.

CONCATENATE v_msg ' - v_1000' INTO v_msg.

ENDIF.

IF p_est IS INITIAL.

CONCATENATE v_msg ' - b_1000' INTO v_msg.

ENDIF.

MESSAGE i000(su) WITH v_msg.

I try that the result in a message.

- v_1000

- b_1000

not v_1000-b1000

thanks!

3 REPLIES 3
Read only

Former Member
0 Likes
628

You could try


concatenate v_msg '-v1000' cl_abap_char_utilities=>cr_lf into v_msg.

But I'm not sure that the message will be displayed as you want it

Read only

Former Member
0 Likes
628

Your code seems to work ok on 4.6c.


DATA:
  v_msg(132)   TYPE c.

PARAMETERS:
  p_pais AS CHECKBOX,
  p_est AS CHECKBOX.

START-OF-SELECTION.

  v_msg = 'Here''s the message '.

  IF p_pais IS INITIAL.
    CONCATENATE v_msg ' - v_1000' INTO v_msg.
  ENDIF.

  IF p_est IS INITIAL.
    CONCATENATE v_msg ' - b_1000' INTO v_msg.
  ENDIF.

  WRITE:/ v_msg.

And the output is


Here's the message - v_1000 - b_1000 

Read only

Former Member
0 Likes
628

Hai

Raphel barbros,

it is better to display messages in two different messges.because , u are checking two conditions. u are not assure that two conditions always true.

Solution:

IF p_pais IS INITIAL.

CONCATENATE v_msg ' - v_1000' INTO v_msg1.

ENDIF.

MESSAGE i000(su) WITH v_msg1.

IF p_est IS INITIAL.

CONCATENATE v_msg ' - b_1000' INTO v_msg2.

ENDIF.

new-line.

MESSAGE i000(su) WITH v_msg2.

U got the output like

- v_1000

- b_1000

if useful reward points.

thank you

G.V.K.Prasad