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

doubt in read table statement.

Former Member
0 Likes
1,266

hi friends

i have a doubt in read statement

please suggest me which one i can use.

i have one master table

with fields like

contract contract line wbs 
500060    10                XXX
500070     10               XXX
and the transaction table has
500060     10             01              01              01
500060      10            02              02              02
500070       10            01              01             01
500070       10            02              02              02

what i am doing is like

loop at master table into wamastertable
read table tranintertab into tranintertab1 with key contract=wamastertable-contract                                                                                
contractline = wamastertable-contractline.
endloop.

As my read query satifies multiple lines of transaction internal table i am in a posistion to do this

but if i do like the above it is giving error that tranintertab1 is not the line type of tranintertab

please provide me ur valuable suggestions.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,217

Is there any need of using into traininternaltab1 in READ statement.

You can use without this also.

I think the proble is in declaration of this traininternaltab1.

Regds,

Anil

11 REPLIES 11
Read only

Former Member
0 Likes
1,217

Hi,

Check the declaration of tranintertab1 in the Read statement. Tranintertab1 shjould be declared as workarea with the same structure of tranintertab.

Read only

0 Likes
1,217

hi avinash thanks for answering

but my doubt is

not exactly this

i need to transfer the contents of the that tranintertab into another intertab of same structure because it has mulitple lines satisfying the key of mastertab

so do i need to use read statement or someother

cheers

s.janagar

Read only

Former Member
0 Likes
1,218

Is there any need of using into traininternaltab1 in READ statement.

You can use without this also.

I think the proble is in declaration of this traininternaltab1.

Regds,

Anil

Read only

0 Likes
1,217

yes anil

i need to count the entries statisfying that condition.

based upon the no. of lines satisfying that condition.

i need to do some manipulation

with regards

s.janagar

Read only

0 Likes
1,217

Hi,

Loop at master into wamastertable.
Clear count.
Loop at transaction where contract=wamastertable-contract and contractline = wamastertable-contractline.
 Count = count + 1.
endloop.

" you get the count which satisfies the  given condition
Endloop.

Read only

0 Likes
1,217

Hi,

See if this helps.



" t_tran and t_final structures are the same
  LOOP AT t_master INTO wa_master.
    LOOP AT t_tran INTO wa_tran.
      IF wa_tran-vbeln EQ master-vbeln.
        MOVE-CORRESPONDING wa_tran TO wa_final.
        APPEND wa_final TO t_final.
        CLEAR wa_final.
        CLEAR wa_tran.
      ENDIF.
    ENDLOOP.
    CLEAR wa_master.
  ENDLOOP.
" Describe statement to count the number of records in t_final 
" that is those that have satisfied your condition

Edited by: Nitwick on Jul 16, 2009 11:43 AM

Read only

0 Likes
1,217

Hi Janagar,

If you wish to read all lines in the transaction table satisfying the criteria, then you shoudl loop at transaction type instead of master table.

loop at tranintertab into tranintertab1.
 read table master table into wamastertable with key 
                                                                       contract = tranintertab1-contract 
                                                                  contractline = tranintertab1-contractline.
 endloop.

Also check the declaration of tranintertab1. It should be of the same structure as tranintertab.

Regards,

Saumya

Read only

Former Member
0 Likes
1,217

>

>

contract contract line wbs 
> 500060    10                XXX
> 500070     10               XXX
> and the transaction table has
> 500060     10          01              01              01
> 500060     10          02              02              02
> 500070     10          01              01             01
> 500070     10          02              02              02

>

>

loop at master table into wamastertable
> read table tranintertab into tranintertab1 with key contract=wamastertable-contract 
>                                                                                contractline = wamastertable-contractline.
> endloop.

>

Try it like this..........

loop at tranintertab into tranintertab1.
 read table master table into wamastertable with key 
                                                                       contract = tranintertab1-contract 
                                                                  contractline = tranintertab1-contractline.
 endloop.

Regards,

Suneel G

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,217

Check the declaration tranintertab1 , this should be same structure as that of the tranintertab.

Read only

Former Member
0 Likes
1,217

Hi

Read Statement : reads a line from the internal table into work area of the internal

Even the condiction satisfy many lines , it reads only one line line that to first satisfied line.

So,

If you want all records to be displayed ,

Run a loop at transaction Table ,

Read a master table which will have one master record.

try and reply

Read only

Former Member
0 Likes
1,217

Hi,

use loop into loop because you have multiple entries in transaction table .

and read statement can read only one record at a time.

use like this..

Loop at master into wamastertable.

Loop at transaction where contract=wamastertable-contract and contractline = wamastertable-contractline.

endloop.

-


-


endloop.

Endloop.

Regards,

Vijay