Skip to Content
0
Former Member
May 13, 2008 at 02:58 AM

Problem with Read Statement....

17 Views

Hi all,

here am trying to pass data from 2tables into final table.

First loop am passing data from it_proj into it_final after this it_final getting data ,

Then am looping other table ans passing data to it_final. this data also is moving into it_final. it_rpsco into it_final .

Now am displaying data using it_final.

But the problem is in out put am not getting all records of First loop data, but only getting last record of fields.

here am pasting my 2 loops plz anyone could check it.

LOOP AT it_prps into wa_it_prps.

READ TABLE it_proj WITH KEY pspnr = wa_it_prps-psphi

BINARY SEARCH.

IF sy-subrc EQ 0.

it_final-pspnr = it_proj-pspnr.

it_final-pspid = it_proj-pspid.

it_final-post1 = it_proj-post1.

ENDIF.

APPEND it_final.

ENDLOOP.

LOOP AT it_rpsco into wa_it_rpsco.

it_final-objnr = wa_it_rpsco-objnr.

it_final-posid = wa_it_rpsco-posid.

it_final-wrttp = wa_it_rpsco-wrttp.

it_final-vorga = wa_it_rpsco-vorga.

it_final-versn = wa_it_rpsco-versn.

READ TABLE it_aufk WITH KEY objnr = it_rpsco-objnr waers = it_rpsco-twaer

BINARY SEARCH.

IF sy-subrc EQ 0.

it_final-pspel = it_aufk-pspel.

ENDIF.

READ TABLE it_AFVC WITH KEY OBJNR = it_rpsco-OBJNR waers = it_rpsco-twaer

BINARY SEARCH.

IF SY-SUBRC EQ 0.

it_final-projn = it_afvc-projn.

it_final-vornr = it_afvc-vornr.

ENDIF.

APPEND it_final.

ENDLOOP.

am getting output like this:

papnr post1 posid wrttp vorga versn

-


sg-1000 ccccc sg-0143.01 32 kabg 000

sg-1000 ccccc sg-0143.02 04 kabg 000

sg-1000 ccccc sg0143.01 32 kmbe 000

sg-1000 ccccc sg-10000.01 4 coin 000

in the above o/p first 2 fields are wrong, it is from first loop.

my reqhired output will be like this:

papnr post1 posid wrttp vorga versn

-


sg-0143 aaaaa sg-0143.01 32 kabg 000

sg-0143 aaaaa sg-0143.02 04 kabg 000

sg0143 bbbbb sg0143.01 32 kmbe 000

sg-1000 ccccc sg-10000.01 4 coin 000

why am geting like this.

Thanks in advance,

kumar.