Skip to Content
0
Former Member
Jul 26, 2010 at 11:19 AM

Read statement from 2 different internal table.

20 Views

Hello,

I am new to ABAP and try to work out these statements. Please can someone help me in correcting the code.

Requirement is

1. I have Sales Header Table

2. Sales Item Table.

Both the above table has Doc_number as the key filed and both has CREATEDON date . While reading the Data from SALES ITem table i have copy the CREATEON Date from SAles Header Table.

For the above requirment i have used the following code which is going for unending loop.

Tables: /BIC/ASALHDR0100,/BIC/ASALORD0100.

DATA: CHDATE like /BIC/ASALHDR0100 occurs 0 with header line,
      WA_CHDATE type /BIC/ASALHDR0100,
      CiDATE like /BIC/ASALORD0100 occurs 0 with header line,
      WA_CiDATE type /BIC/ASALORd0100.


      SELECT * from /BIC/ASALORD0100 into table CIDATE.
  

      select * from /BIC/ASALHDR0100 into CHDATE for all entries in CIDATE where DOC_NUMBER = CIDATE-DOC_NUMBER.
Append CHDATE.
      endselect.



loop at CHDATE INTO WA_CHDATE.
    LOOP at CIDATE into WA_CIDATE.

    if WA_CHDATE-DOC_NUMBER = WA_CIDATE-DOC_NUMBER.
Read table CHDATE into WA_CHDATE with KEY doc_number = WA_CIDATE-doc_number .

          write: WA_CHDATE-DOC_NUMBER,
                  WA_chdate-createdon,
                 WA_CIDATE-DOC_NUMBER.
                 ENDIF.
                 ENDLOOP.

          endloop.

Thanks

Edited by: Rob Burbank on Jul 26, 2010 9:34 AM