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 logic help

laxman_sankhla3
Participant
0 Likes
952

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.

8 REPLIES 8
Read only

Former Member
0 Likes
932

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,

Read only

Former Member
0 Likes
932

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.......

Read only

0 Likes
932

hi its giving bug no output.

help me .

Read only

0 Likes
932

hi...

what is the error u r getting,

Regards,

Suresh.

Read only

Former Member
0 Likes
932

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

Read only

0 Likes
932

hi

output is coming as per ur suggestion but

its repating again and again.

give me suggestion yar.

Read only

0 Likes
932

clear/refresh all internal tables after display.

Regards

Prabhu

Read only

Former Member
0 Likes
932

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