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

read itab

Former Member
0 Likes
847

Hi friends

I have one invoice no which is having 2 line items

for eg

invoice no value

101 5556

101 6666

in o/p of report

while reading inside loop its taking only the first value

for both invoice no...

can any one give me solution..

points will rewarded for helpful ans

8 REPLIES 8
Read only

Former Member
0 Likes
827

Hi,

use below code:

LOOP AT itab into wa.
write:
  / wa-invoice_no,
    wa-value.
ENDLOOP.

Regards,

Sunil.

Read only

Former Member
0 Likes
827

Sort the internal table by invoice no and then ADJACENT DUPLICATES from internal table comparing internal table.

Effect

With these additions, the statement DELETE deletes all lines in certain groups of lines, except for the first line of the group. These are groups of lines that follow one another and have the same content in certain components. If the addition COMPARING is not specified, the groups are determined by the content of the key fields.

Lines are considered to be doubled if the content of neighboring lines is the same in the components examined. In the case of several double lines following one another, all the lines - except for the first - are deleted.

Addition

... COMPARING {comp1 comp2 ...}|{ALL FIELDS}

Effect

If the addition COMPARING is specified, the groups are determined either by the content of the specified components comp1 comp2 ... or the content of all components ALL FIELDS. The specification of individual components comp is made as described in the section Specification of Components. Access to class attributes is possible through the object component selector only as of Release 6.10.

Example

Deleting all multiple-occurring lines in the internal table connection_tab. The result of this exanple corresponds to the one in the example for the position specification for INSERT.


DATA: BEGIN OF connection, 
        cityfrom TYPE spfli-cityfrom, 
        cityto   TYPE spfli-cityto, 
        distid   TYPE spfli-distid, 
        distance TYPE spfli-distance, 
      END OF connection. 

DATA connection_tab LIKE SORTED TABLE OF connection 
                    WITH NON-UNIQUE KEY cityfrom cityto 
                                        distid distance. 

SELECT cityfrom cityto distid distance 
       FROM spfli 
       INTO TABLE connection_tab. 

DELETE ADJACENT DUPLICATES FROM connection_tab. 

Read only

0 Likes
827

Hi friend,

its not duplicate enteries

one invoice no is haveing 2 line items both should display.

while reading its is taking first value .

as it reads only one value from itab index.

how to display both.

Read only

Former Member
0 Likes
827

hi,

do this way ...


loop at itab.
  write : itab-fld1, 
            itab-fld2.
endloop. 

Read only

Former Member
0 Likes
827

Hi,

Loop at itab.

Write .....

Endloop.

It reads all the values in that internal table and print it in o/p.

check once putting brack-point.

if posssible give tha code.

Regards,

Narasimha

Read only

Former Member
0 Likes
827

Hi,

Check with item value .

Loop at itab where header = invoice header

item = invoice item

Endloop

Read only

Former Member
0 Likes
827

Hi,

if you use READ stmt it'l pick only one record and display , if u want to display multiple records then go for loop ... endloop.

Regards,

Nisa

Read only

0 Likes
827

hello,

r u trying to display from loop with in loop? if yes then give condition for line item also

regards,

Nisa