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: 

Appending a text line

Former Member
0 Kudos
245

Hi,

In my scenario i have to concatenate all the contents of the text and then pass to a FM.

The sample contents is like this.The vendor details should be taken from internal table.The value to be passed to internal table is present in gi_objtxt.In my case all the lines are coming in a single line.How to get it like the below mentioned contents.Please help.

Code:

gv_text0 = 'Hi,'.

*Getting vendor number

LOOP AT gi_vendor INTO gw_vendor.

CONCATENATE gv_vendor gv_text4 gw_vendor-lifnr INTO gv_vendor SEPARATED BY space.

CONCATENATE gv_line gv_text4 gw_vendor-lineitems INTO gv_line SEPARATED BY space.

gv_text4 = ','.

ENDLOOP.

CONCATENATE gv_text0 gv_text gv_vendor gv_text1 gv_line gv_text2 gv_text3 INTO gv_mtext SEPARATED BY space.

gv_text5 = 'Please check .'.

gv_text6 = 'Thanks.'.

CONCATENATE gv_mtext gv_text5 gv_text6 INTO gv_mtext.

APPEND gv_mtext TO gi_objtxt.

Hi,

The vendors 71,72 are not paid due to this reason.

Please check.

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
172

Hi Saranya

Try this



gv_text0 = 'Hi,'.
APPEND gv_text0 TO gi_objtxt.

*Getting vendor number
LOOP AT gi_vendor INTO gw_vendor.
CONCATENATE gv_vendor gv_text4 gw_vendor-lifnr INTO gv_vendor SEPARATED BY space.
CONCATENATE gv_line gv_text4 gw_vendor-lineitems INTO gv_line SEPARATED BY space.
gv_text4 = ','.
ENDLOOP.

* i don't get what you are doing in the loop here

CONCATENATE gv_text0 gv_text gv_vendor gv_text1 gv_line gv_text2 gv_text3 INTO gv_mtext SEPARATED BY space.
APPEND gv_mtext TO gi_objtxt.

gv_text5 = 'Please check .'.
APPEND gv_text5 TO gi_objtxt.

gv_text6 = 'Thanks.'.
APPEND gv_text6 TO gi_objtxt.

Could you tel us what's in teh varaibles

Pushpraj

3 REPLIES 3

Former Member
0 Kudos
172

Hi,

Do like this :


gv_text0 = 'Hi,'.
append gv_text0 to gi_objtxt.

*Getting vendor number
LOOP AT gi_vendor INTO gw_vendor.
CONCATENATE gv_vendor gv_text4 gw_vendor-lifnr INTO gv_vendor SEPARATED BY space.
CONCATENATE gv_line gv_text4 gw_vendor-lineitems INTO gv_line SEPARATED BY space.
gv_text4 = ','.
ENDLOOP.

CONCATENATE gv_text0 gv_text gv_vendor gv_text1 gv_line gv_text2 gv_text3 INTO gv_mtext SEPARATED BY space.

append gv_mtext  to gi_objtxt.
append gv_text5  to gi_objtxt.
append gt_text6 to gi_objtxt.

Now the output should be as expected.

regards,

Advait

Former Member
0 Kudos
173

Hi Saranya

Try this



gv_text0 = 'Hi,'.
APPEND gv_text0 TO gi_objtxt.

*Getting vendor number
LOOP AT gi_vendor INTO gw_vendor.
CONCATENATE gv_vendor gv_text4 gw_vendor-lifnr INTO gv_vendor SEPARATED BY space.
CONCATENATE gv_line gv_text4 gw_vendor-lineitems INTO gv_line SEPARATED BY space.
gv_text4 = ','.
ENDLOOP.

* i don't get what you are doing in the loop here

CONCATENATE gv_text0 gv_text gv_vendor gv_text1 gv_line gv_text2 gv_text3 INTO gv_mtext SEPARATED BY space.
APPEND gv_mtext TO gi_objtxt.

gv_text5 = 'Please check .'.
APPEND gv_text5 TO gi_objtxt.

gv_text6 = 'Thanks.'.
APPEND gv_text6 TO gi_objtxt.

Could you tel us what's in teh varaibles

Pushpraj

former_member404244
Active Contributor
0 Kudos
172

Hi,

do like this

APPEND gv_mtext TO gi_objtxt.

APPEND gv_text5 TO gi_objtxt.

APPEND gv_text6 TO gi_objtxt.

or try this

DATA:BEGIN OF ls_delimiter, "<CR/LF> delimiter

up_crlf(2) TYPE c, "CR/LF (ASCII Hex'0D0A')

END OF ls_delimiter.

CALL FUNCTION 'FI_DME_CHARACTERS'

IMPORTING

e_crlf = ls_delimiter-up_crlf.

CONCATENATE gv_mtext ls_delimiter-up_crlf gv_text5 ls_delimiter-up_crlf gv_text6 INTO gv_mtext.

Regards,

Nagaraj

APPEND gv_mtext TO gi_objtxt.