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: 

FM - READ_TEXT issue with data declaration

Former Member
0 Kudos

Dear All,

I am calling a FM - READ_TEXT.

I have declared as follows,

DATA : IL_TLINE TYPE TABLE OF TLINE,

IL_HEADER TYPE TABLE OF THEAD.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = ID

LANGUAGE = LANG

NAME = NAME

OBJECT = OBJECT

  • ARCHIVE_HANDLE =

  • LOCAL_CAT =

IMPORTING

HEADER = IL_HEADER[]

TABLES

LINES = IL_TLINE[]

But the program throws up an error as follows:

In the function module interface, you can specify only

fields of a specific type and length under "HEADER".

Although the currently specified field

"IL_HEADER[]" is the correct type, its length is incorrect

May i know what mistake i have done?

Vivek

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Ramesh & Thomas,

Thanks for the input, but it is still throwing up the dump.

Any alternative way i can read the data?

Vivek

18 REPLIES 18

Former Member
0 Kudos

Change the declaration as...

DATA : IL_TLINE TYPE TABLE OF TLINE,

IL_HEADER LIKE THEAD.

It will work..

ThomasZloch
Active Contributor
0 Kudos

DATA: ... IL_HEADER TYPE TABLE OF THEAD.

christine_evans
Active Contributor
0 Kudos

The fact that the exporting parameter HEADER is not an internal table and you are trying to receive it into an internal table might be the problem.

Using internal tables with header lines can be confusing and I find it is better to use a separate work area instead.

Former Member
0 Kudos

Ramesh & Thomas,

Thanks for the input, but it is still throwing up the dump.

Any alternative way i can read the data?

Vivek

0 Kudos

Try it like this, it will solve your problem.

DATA BEGIN OF i_tlines OCCURS 0.

INCLUDE STRUCTURE tline.

DATA END OF i_tlines.

DATA: w_textname(70) TYPE c.

w_textname = vbdkr-vbeln.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'Z006'

language = 'E'

name = w_textname

object = 'VBBK'

TABLES

lines = i_tlines.

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

IF sy-subrc = 0.

READ TABLE i_tlines INDEX 1.

.........

ENDIF.

Close the thread once your question is answered.

Regards,

SaiRam

0 Kudos

Sai,

The issue i am facing is not with TLINE, but with HEADER, can you please let me know how i should declare it ?

Vivek

0 Kudos

Hello

DATA : IL_HEADER LIKE THEAD.

...

IMPORTING

HEADER = IL_HEADER """ without []

0 Kudos

Dzed,

Still not working....

Vivek

0 Kudos

Hello

DATA : IL_TLINE LIKE TLINE,

IL_HEADER LIKE THEAD.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = ID

LANGUAGE = LANG

NAME = NAME

OBJECT = OBJECT

IMPORTING

HEADER = IL_HEADER

TABLES

LINES = IL_TLINE.

0 Kudos

You've had LOTS of examples here of how to declare this parameter properly, so you must have got it working by now. But, to be honest, you could have solved this by yourself without posting. All you need to do to set up a correct interface for a function module is to declare your import / export / tables parameters in EXACTLY the same way as they are declared in the function module. If you do this, there is really no way that you can get it wrong.

0 Kudos

Christine,

Thanks for your inputs, yes i would not have posted this thread if i had not got the dump. I posted it only after giving an earnest try & despite the excellent help provided by the forum members i am getting the dump.

I will try once again on monday to trace the reason for this dump & keep all of you posted.

Regards,

Vivek

0 Kudos

>

> Christine,

>

> Thanks for your inputs, yes i would not have posted this thread if i had not got the dump. I posted it only after giving an earnest try & despite the excellent help provided by the forum members i am getting the dump.

>

> I will try once again on monday to trace the reason for this dump & keep all of you posted.

>

>

> Regards,

> Vivek

I'm sorry but, as already mentioned here, you CANNOT have tried all the above suggestions (which really is one single suggestion posted multiple times), or even have read them properly, if you are still passing IL_HEADER[] into the FM which they are all saying that you SHOULD NOT DO (sorry for shouting).

Former Member
0 Kudos

Check...

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = xtxs-tdid

language = sy-langu

name = thead-tdname

object = text_object

IMPORTING

header = thead

TABLES

lines = lines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

Directly specify thead

0 Kudos

Ramesh,

Not working, i specified as mentioned by you, but still the dump.

Any alternatives?

Vivek

Former Member
0 Kudos

Dear All,

I have tried all the above suggestions, but the dump still occurs.

I notice the dump says

' In the function module interface, you can specify only fields of a specific type and length under "HEADER".

Although the currently specified field "IL_HEADER[]" is the correct type, its length is incorrect.'

So as per the dump, the type is correct, but the length is incorrect, can someone let me know how do i define the correct length???

Vivek

0 Kudos

Hi Vivek,

I don't understand why u r sticking to [] in passing IL_HEADER.

As suggested by all above.

the declaration should be -

1. data: IL_header type THEAD.

and don't use IL_HEADER with [] because header is not a table but a single data row.

So while passing IL_HEADER to FM

HEADER = IL_HEADER

and not

HEADER = IL_HEADER[]

I think it should have solved the problem by now.

Thanks,

Hitesh

0 Kudos

Hi Vivek,

The error mentioned will occur only when you declare the import parameter as a table else it is giving correct results.If you are still facing the issue just have a look.

DATA : IL_TLINE TYPE TABLE OF TLINE,

IL_HEADER like THEAD.

data: tdid TYPE THEAD-TDID,

TDSPRAS type THEAD-TDSPRAS,

TDNAME type THEAD-TDNAME,

TDobject type THEAD-tdobject.

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = TDID

LANGUAGE = TDSPRAS

NAME = TDNAME

OBJECT = TDOBJECT

IMPORTING

HEADER = IL_HEADER

TABLES

LINES = IL_TLINE[] .

Chnages required are marked in BOLD letters. This is same as the solution provided before also. Just have a look if you missed any of the changes.

Regards,

Swarna Munukoti.

Edited by: Swarna Munukoti on Aug 18, 2008 7:16 AM

Former Member
0 Kudos

Apologies for the delay in posting. The issue was not with the declaration part, but with the coding which followed the FM.

Anyways I thank each one of you for your inputs & time. My sincere apologies for the delay in closing the thread.

Regards,

Vivek