Routine to compare a clearing doc number with AC doc number in AR

Advertisement
Hi All,
I need to write a routine to look up the following for new DSO built above  the existing DSO.
Look up on the delta between AR DSO to new  Payment DSO.
-     Filter items with status = c and doc type = zl,rv
-     For each document  number  ,check  that clearing doc = a/c doc no. and doctype = u201CDZu201D
-     Subtract orig invoice amount with residual to get payment(look for discount ).
Please help
Advertisement

Replay

Hi Denise,
Try:
SELECT sales_doc
               date_doc
INTO TABLE t_ods
FROM /BIC/ZODS
FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE sales_doc EQ RESULT_PACKAGE-NAST(10).
IF sy-subrc EQ 0.
    SORT t_ods BY sales_doc.
ENDIF.
LOOP RESULT_PACKAGE ASSIGNING <result_fields>.
     READ t_ods INTO w_ods WITH KEY sales_doc = <result_fields>-nast(10).
     BINARY SEARCH.
     IF sy-subrc EQ 0.
         <result_fields-date> = w_ods-date_doc.
     ENDIF.
ENDLOOP.
Regards.