‎2007 Apr 13 8:12 AM
hi i want to display
<b>material no material short description material long description.</b>
im my output is coming .
<b>material no material short description material long description</b>
but long description is coming in only one line it may be possible that long material should be 2 or 3 lines .
SELECT A~MATNR A~WERKS B~MAKTX FROM
EKPO AS A
INNER JOIN MAKT AS B ON B~MATNR = A~MATNR
INTO CORRESPONDING
FIELDS OF TABLE INT_OUT WHERE A~WERKS IN S_WERKS
and b~spras = sy-langu.
sort int_OUT by MATNR WERKS.
delete adjacent duplicates from INT_OUT comparing matnr .
DATA: l_index LIKE sy-tabix.
SELECT
a~matnr
a~werks
b~maktx FROM ekpo AS a
INNER JOIN makt AS b
ON b~matnr = a~matnr
INTO CORRESPONDING FIELDS OF TABLE int_out
WHERE
* a~matnr = s_matnr and
a~werks IN s_werks.
*SORT int_out BY werks.
LOOP AT int_out.
l_index = sy-tabix.
thread-tdname = int_out-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'BEST'
language = sy-langu
name = thread-tdname
object = 'MATERIAL'
TABLES
lines = it_tlines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
loop at it_tlines.
IF sy-subrc = 0.
READ TABLE it_tlines INDEX 1.
int_out-tdline = it_tlines-tdline.
MODIFY int_out INDEX l_index.
* CLEAR: it_tlines.
REFRESH: it_tlines.
ENDIF.
delete adjacent duplicates from INT_OUT comparing matnr .
endloop.
ENDLOOP.
thanks in advanced.
‎2007 Apr 13 8:20 AM
hi,
loop at it_tlines.
IF sy-subrc = 0.
READ TABLE it_tlines INDEX 1.
Here you are reading only first line. After looping the it_tlines, Concatenate all the lines into one variable and get it displayed. Then you will get all the other lines and comment the statement read table it_lines index 1.
Regards,
‎2007 Apr 13 8:20 AM
hi
try this code...
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
and b~spras = sy-langu.
sort int_OUT by MATNR WERKS.
delete adjacent duplicates from INT_OUT comparing matnr .
DATA: l_index LIKE sy-tabix.
SELECT
a~matnr
a~werks
b~maktx FROM ekpo AS a
INNER JOIN makt AS b
ON bmatnr = amatnr
INTO CORRESPONDING FIELDS OF TABLE int_out
WHERE
a~matnr = s_matnr and
a~werks IN s_werks.
*SORT int_out BY werks.
LOOP AT int_out.
l_index = sy-tabix.
thread-tdname = int_out-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'BEST'
language = sy-langu
name = thread-tdname
object = 'MATERIAL'
TABLES
lines = it_tlines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
loop at it_tlines.
IF sy-tabix = 1.
int_out-tdline = it_tlines-tdline.
MODIFY int_out INDEX l_index.
ELSE.
int_out-tdline = it_tlines-tdline.
APPEND int_out .
ENDIF.
endloop.
REFRESH: it_tlines.
ENDLOOP.
Hope it helps you...
Let me know if u have any more doubt...
Reward points if useful......
Suresh.......
‎2007 Apr 13 8:44 AM
‎2007 Apr 13 9:15 AM
‎2007 Apr 13 9:21 AM
LOOP AT int_out.
l_index = sy-tabix.
int_out_new-matnr = int_out-matnr.
int_out_new-maktx = int_out-maktx.
thread-tdname = int_out-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'BEST'
language = sy-langu
name = thread-tdname
object = 'MATERIAL'
TABLES
lines = it_tlines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
loop at it_tlines.
int_out_new-tdline = it_tlines-tdline.
append int_out_new.
clear int_out_new.
endloop.
ENDLOOP.
sort int_out_new by matnr maktx.
Use the new internal table int_out_new to display.
Regards,
Ravi
‎2007 Apr 13 11:44 AM
hi
output is coming as per ur suggestion but
its repating again and again.
give me suggestion yar.
‎2007 Apr 13 11:46 AM
‎2007 Apr 13 9:35 AM
you can do like this in int_out table instead of tdline field
define
data : begin of int_out occurs 0,
< matnr
werks
maktx these fields as per ur need >
tline like tline occurs 0,
end of int_out.
data : wline like tline.
LOOP AT int_out.
l_index = sy-tabix.
thread-tdname = int_out-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'BEST'
language = sy-langu
name = thread-tdname
object = 'MATERIAL'
TABLES
lines = it_tlines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
loop at it_tlines.
move-corresponding it_lines to wline.
append wline to int_out-tline.
modify int_out index l_index.
endloop.
ENDLOOP.
now when showing the data
loop at int_out
write : / <matrl no>.
loop at int_out-tline into wline.
write : wline-tdline.
write : /.
endloop.
endloop.
regards
shiba dutta