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

problem in loop

laxman_sankhla3
Participant
0 Likes
561

hi

<b>i want all matnr , maktx and long description for each and every material no

but in my output in read text functionnal module its passing only one matnr so

only for one material no long text is coming even though another matnr also having material long descrtiption</b>.

check below code

Form Get_Data.

SELECT AMATNR AWERKS B~MAKTX FROM

EKPO AS A

INNER JOIN MAKT AS B ON BMATNR = AMATNR

INTO CORRESPONDING

FIELDS OF TABLE INT_OUT WHERE A~WERKS IN S_WERKS.

sort int_OUT by WERKS.

LOOP AT INT_OUT.

thread-tdname = INT_OUT-MATNR.

ENDLOOP.

thread-tdid = 'BEST'.

thread-tdobject = 'MATERIAL'.

*

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = thread-tdid

LANGUAGE = sy-langu

NAME = thread-tdname

OBJECT = thread-tdobject

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = it_tlines.

LOOP AT it_tlines.

read table INT_OUT with key matnr = INT_OUT-MATNR.

IF sy-tabix <> 1.

CLEAR :int_out-matnr, int_out-maktx.

ENDIF.

int_out-tdline = it_tlines-tdline.

delete adjacent duplicates from INT_OUT .

APPEND int_out.

modify INT_OUT index sy-tabix.

ENDLOOP.

suggest me please.

thanks

5 REPLIES 5
Read only

Former Member
0 Likes
536

<b>LOOP AT it_tlines.

read table INT_OUT with key matnr = INT_OUT-MATNR.</b>

what is this ? check this statement , and one more thing , it_tlines will not any ant matnr.u have to pass complete object number.

Regards

Prabhu

Read only

Former Member
0 Likes
536

Hi,

use the code:

LOOP AT INT_OUT.

thread-tdname = INT_OUT-MATNR.

ENDLOOP.

thread-tdid = 'BEST'.

thread-tdobject = 'MATERIAL'.

*

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = thread-tdid

LANGUAGE = sy-langu

NAME = thread-tdname

OBJECT = thread-tdobject

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = it_tlines.

<b>clear it_lines.

read table it_lines index 1. (Only 1st line of text will come)

IF sy-tabix = 0.

int_out-tdline = it_tlines-tdline.

endif.</b>modify INT_OUT index sy-tabix.

ENDLOOP.

to get more lines of long text fetch them into different variables and pass that to int_out-tdline.

in the above only one line of text is passed into table.

reward points if useful

regards,

ANJI

Read only

0 Likes
536

now long text not coming for single material no .

suggest me man.

thanks

Read only

0 Likes
536

hi anji can u give me more idea please

thanks .

Read only

former_member632991
Active Contributor
0 Likes
536

Hi,

write ur FM in loop and insted of thread-tdname, give the variable for matnr

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = thread-tdid

LANGUAGE = sy-langu

<b>NAME = thread-tdname</b>

<b>NAME = matnr</b>

OBJECT = thread-tdobject

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = it_tlines.

hope it works.

Regards,

Sonika