Hi All,
Lets say in VBRK, I have the following billing docs: 1,2,3,4,5
In custom table ZFFORM_R, I have the following billing docs: 1,2,3
Now using AMDP, I need the result set containing billing docs 4,5 i.e. one which is available in VBRK but not in custom table.
I have following 2 approaches in mind. However, if there is another approach which is more optimized for performance then please let me know.
Approach 1:
* Left outer join on VBRK & Custom table in view ZV_LO_ZFFORM_R
lt_prof_inv2 = apply_filter ( zv_lo_zfform_r, :im_where ) ;
* Inner join on VBRK & Custom table in view ZV_IN_ZFFORM_R
lt_prof_inv3 = apply_filter ( zv_in_zfform_r, :im_where ) ;
* Obtaining the desired result set
lt_prof_inv = SELECT * FROM :lt_prof_inv2 WHERE vbeln1 NOT IN ( SELECT vbeln1 FROM :lt_prof_inv3 );
Approach 2:
* Left outer join on VBRK & Custom table in view ZV_LO_ZFFORM_R
lt_prof_inv2 = apply_filter ( zv_lo_zfform_r, :im_where ) ;
* Obtaining the desired result set by removing entries found in ZFFORM_R
lt_prof_inv = SELECT * FROM :lt_prof_inv2 WHERE vbeln1 NOT IN ( SELECT vbeln FROM zfform_r ); |
The table ZFFORM_R will grow with time.
Thanks & Regards,
Sanket Shah.