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

Two internal table join

Former Member
0 Likes
376

Hi i am trying to pass some values from one internal table to another..the problem is my 1st internal table ( GT_BKPF2) is smaller than my 2nd internal table (GT_PAYR).

EX: GT_BKPF2 has one document no with two line items

GT_PAYR has one document number corresponding to GT_BKPF2 but it consist of 5 void check which i would like to display.But my report will only show the 1st void check and print beside the two line items and not the remanining...

should i be doing a loop statement?

2 REPLIES 2
Read only

anup_deshmukh4
Active Contributor
0 Likes
345

Yes you can very well Use loop if you don't have any perfromance issue ( Use Parallel Cursor...) , but more preferred you can use READ statement with KEY addition to it. (check subrc fro successful read )..

Read only

0 Likes
345

Hi i have use read statement but it doesn't seems to work..here is part of my code


 SELECT VOIDR
            CHECV
            CHECT
            ZBUKR
            GJAHR
            VBLNR
            FROM PAYR
         INTO CORRESPONDING FIELDS OF TABLE GT_PAYR
         FOR ALL ENTRIES IN GT_BKPF2
         WHERE ZBUKR = GT_BKPF2-BUKRS
           AND GJAHR = GT_BKPF2-GJAHR
           AND VBLNR = GT_BKPF2-BELNR.

*IF NOT GT_PAYR[] IS INITIAL.
*
*      SORT GT_PAYR BY ZBUKR GJAHR VBLNR.
*
*ENDIF.


* Get all documents except parked document.
    LOOP AT gt_bseg INTO wa_bseg.


      AT NEW gjahr.
        CLEAR: wa_bkpf, wa_ce40001_awkey, gt_PAYR.
        READ TABLE gt_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs
                                                 belnr = wa_bseg-belnr
                                                 gjahr = wa_bseg-gjahr.

       READ TABLE gt_PAYR WITH KEY               ZBUKR = wa_bseg-bukrs
                                                 VBLNR = wa_bseg-belnr
                                                 gjahr = wa_bseg-gjahr.


      ENDAT.