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: 

Field Length.

amit_khare
Active Contributor
0 Kudos

Hi All,

I want to read data from the table having fields with greater than 512 and upto 8000 char length in 4.5, with the white spaces if there any.

How can i do that?

My problem is I can only use type c data element.

A sample code will be more than helpful.

Points will be rewarded accordingly.

Amit

Message was edited by: Amit Khare

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

Hi Amit,

What stops you from using other data types?

If you are using a select statement to get the data froma table, you have to have aninternal table with fields of the same data type.

YOu have to declare ain internal table of the same structure of the table.

Then if you want, you can transfer that itab contents into a character internal table.

Eg:

data: begin of itab occurs 0.

include structure <tablename>.

data: end of itab.

data: begin of itab1 occurs 0,

data(<lenghth of the table>,

end of itab1.

select *

from <table>

into table itab

where <cinditions>.

loop at itab.

itab1 = itab.

append itab1.

clear itab1.

endloop.

Let us know if this is what you wanted.

Regards,

Ravi

15 REPLIES 15

former_member188685
Active Contributor
0 Kudos

Please Can you explain clearly...

vijay

0 Kudos

Hi Vijay,

I want to read data from fields having length more than 512 characters but type c can go max upto 255, then i know about char339, but still it is short from data.

As i want to read maximum of 8000 characters using type c only in SAP 4.5.

Amit

0 Kudos

Hi

I want to know is there any field which can hold 8000 chars in SAP 4.*

please let me know..

vijay

former_member181962
Active Contributor
0 Kudos

Hi Amit,

What stops you from using other data types?

If you are using a select statement to get the data froma table, you have to have aninternal table with fields of the same data type.

YOu have to declare ain internal table of the same structure of the table.

Then if you want, you can transfer that itab contents into a character internal table.

Eg:

data: begin of itab occurs 0.

include structure <tablename>.

data: end of itab.

data: begin of itab1 occurs 0,

data(<lenghth of the table>,

end of itab1.

select *

from <table>

into table itab

where <cinditions>.

loop at itab.

itab1 = itab.

append itab1.

clear itab1.

endloop.

Let us know if this is what you wanted.

Regards,

Ravi

0 Kudos

Hi Ravi,

The problem is that i am reading any table according to the input provided by the user and after internal tables are generating dynamically.and client wants only type c.

Amit

0 Kudos

Hi Amit,

I'm currently on 5.0.

It allowed me upto 65535 characters for a field in the internal table.

<b>data: begin of itab occurs 0,

desc(65535),

end of itab.</b>

I don't know abt 4.5. CHeck declaring the same way as i did an see if you getting any error in syntax check.

Regards,

Ravi

Former Member
0 Kudos

Hi Amit.

Try this way.

Example

data: mat(16), d(4), x type i value 0.

mat = 'aaaabbbbccccdddd'. "length = 16

do 4 Times.

d = mat+x(4).

write d.

x = x + 4.

enddo.

<b>for ur case.

Algorithm

itab:

field: diffrent datatype 8000 char long

data: c(n) "n= is less 339

integer: y = 0.

copy contents into into a int table.

loop at itab.

do 8000 div n Times

c = field + y(n or n-1)" u check with ur value

y = y + n.

write c.

enddo.

write:/ .

endloop.</b>

Hope this will be useful answer.

get if u ve further doubt.

Regards

vijay

<b>Provide points if u r satisfied with the reply.</b>

Message was edited by: vijayasarathy raghunathan

0 Kudos

Hi All,

I tried the valuable suggetions given by you all but my problem still remains as it is.

Amit

0 Kudos

Hi,

or use type

regards Andreas

Former Member
0 Kudos

Hi Amit,

1. If u see the documentation of concatenate,

it clearly specified the problem

related to white spaces.

2. Moreover it also tells something about STRING.

3. Use this code (Just copy paste)

There are different type of variables,

and notice how they behave differently.

REPORT zauth .

DATA : matnr TYPE STRING.

DATA : pernr LIKE pa0001-pernr.

DATA : ebeln LIKE ekko-ebeln.

DATA : ernam LIKE ekko-ernam.

DATA : ab(100) TYPE c.

DATA : cd(100) TYPE c.

DATA : ef TYPE STRING.

matnr = ' 001 '.

pernr = '776'.

EBELN = '25 '.

ernam = 'SAPUSER'.

CONCATENATE matnr ernam INTO ab .

CONCATENATE pernr ernam INTO cd .

CONCATENATE ebeln ernam INTO ef .

WRITE 😕 ab.

WRITE 😕 cd.

WRITE 😕 ef.

I hope it helps.

Regards,

Amit M.

Former Member
0 Kudos

Try using the read_texxt function module. This might solve your problem

Former Member
0 Kudos

Sorry function module name is read_text

0 Kudos

Hi All,

If oyu go thru cluster tables you will come across fields like clust_d and etc,e.g., in STXL, ADRC,etc.

I want to read those fields with type c.

Amit

Former Member
0 Kudos

Hi,

Try to use the datatype "LCHR".

Data type: LCHR

Description: Long character

Range: 256 to max

goto se11 and you can search on this, think you can get it if not let me know for further help.

Regards,

Suman

Former Member
0 Kudos

Hi Amit,

Declare the fields in your table with data element

BU_TXT15000 --> 15000 characters

CHAR13K

CHAR20K

CHAR30K

CHAR8000_D --> 8000 Byte length

Hope this helps.

Lokesh

Pls. Reward appropriate points