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

Issue with READ_TEXT

Former Member
0 Likes
1,429

Hello friends,

I am trying to read material Sales text using the FM Read_TEXT.

it works good for a numberic material but has a problem with the non mumberic material.

CONCATENATE material salesorg channel INTO tdname.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = '0001'

language = 'E'

name = tdname

object = 'MVKE'

TABLES

lines = i_lines

if the material is 999 , saleas org = 1234, channel = 01

then

tdname = 000000000000000999123401. tha functional Module works good here.

but when material is ABC

the tdname = ABC123401, here the functional module fails because it is excepting a value of

ABC 123401 ( 15 spaces).

Please suggest if there is something wrong with the way text name is created in SAP or do I need to do programming changes.

Thanks,

BOB

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,388
CONCATENATE material salesorg channel INTO tdname respecting blanks.

Try adding 'respecting blanks' to your concatenate statement:

or build your tdname by offset length...

like tdname= material.

tdname+17(4) = salesorg, etc.

7 REPLIES 7
Read only

Former Member
0 Likes
1,389
CONCATENATE material salesorg channel INTO tdname respecting blanks.

Try adding 'respecting blanks' to your concatenate statement:

or build your tdname by offset length...

like tdname= material.

tdname+17(4) = salesorg, etc.

Read only

0 Likes
1,388

i tried the respecting blangs option but i get the foloowing error,

".", "IN BYTE MODE", "SEPARATED BY ..." or "IN CHARACTER MODE" expected after "TDNAME".

if nothing works i will use the offset option but i want to try other bfr i use the offset option.

Thanks,

Bob

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,388

Pass the data directly to STXH and STXL tables and check how its stored there.

Read only

Subhankar
Active Contributor
0 Likes
1,388

Hi,

You can do the same thing using offset.

tdname = material.

CONCATENATE salesorg channel INTO tdname+18.

Then you can use the TDNAME.

Thanks.

Subhankar

Read only

Former Member
0 Likes
1,388

Hi,

What you can do is to define a structure for your text name:

TYPES:BEGIN OF typMatText,

matnr type mara-matnr,

vkorg type vbak-vkorg,

vtweg type vbak-vtweg,

END OF typMatText.

then you declare a variable of that type

DATA: lsMatText TYPE typMatText.

then you assign values to it:

lsMatText-matnr = material.

lsMatText-vkorg = salesorg.

lsMatText-vtweg = distChannel.

Finally you copy structure to the TDNAME variable

tdname = lsMatText.

Eric

Read only

Former Member
0 Likes
1,388

But the easiest way would be:

CLEAR tdname.

tdname = material.

tdname+18 = salesorg.

tdname+22 = distchannel.

Eric

Edited by: Eric Meunier on Mar 30, 2010 1:54 PM

Read only

0 Likes
1,388

DATA : f_len TYPE i. " Desides the length of the line.

DESCRIBE FIELD tdname LENGTH f_len IN CHARACTER MODE.

CONCATENATE material salesorg channel INTO tdname respecting blanks.

Hope it will work ..