Skip to Content
0
Former Member
Jun 26, 2009 at 07:34 AM

Looping over 1 document to fetch multiple invoices using "Appending"

248 Views

Hi gurus ,

I'm facing a peculiar problem where in , i use the code -

  SELECT KUNNR REBZG BUDAT DMBTR gjahr XBLNR HKONT UMSKZ SHKZG AUGGJ REBZJ AUGBL
     FROM BSAD
    APPENDING CORRESPONDING FIELDS OF TABLE I_BSAD_CL
    FOR ALL ENTRIES IN I_BSAD
     WHERE kunnr IN s_kunnr
         AND   bukrs EQ p_bukrs
         AND   AUGGJ EQ i_bsad-auggj
         AND   AUGBL EQ I_BSAD-belnr
         AND   shkzg EQ 'S'
     AND ( UMSKZ EQ 'A'
         OR    UMSKZ EQ 'M'
         OR    UMSKZ EQ ' ' ). 

There are 2 internal tables -

I_BSAD

I_BSAD_CL

I need to fetch multiple Invoice documents (REBZG) from BSAD table and place it in I_BSAD_CL , w.r.t. to the document numbers (BELNR) in I_BSAD internal table.

( There can be a scenario where in there r 5 invoices for 1 document number as well ).

So, to perform the task I use "appending corresponding fields of table" and "for all entries" .

Do u ppl have any other option by which i complete this task ? Because this code takes a while to execute in case of heavy data .

Thanks and Regards ,

Prithvi.

Edited by: Prithvi Sridhar on Jun 26, 2009 1:13 PM