Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
miko2
Explorer
0 Kudos
311

*Logic:

*

* One customer in order to be ready from standardsap

* to be cleared via the transaction f-32 must have

* one from 2 cases:

*

*

*   1) dont have any open item ... so zero balance

*   2) have a small amount that can be tolerated form fi customizing

*

*   so...

*   if the differece of the amount from the credit debit

*   is smaller-equal from the BETRS-H we set in the system

*   and the diffrence / big amount is smaller than PROZS-H

*   in table T043T

For that reason i made this function:

TABLES: T043T.

   DATA:

         AMOUNT_DIFF TYPE BAPI3007_2-AMT_DOCCUR,

         AMOUNT_PERC TYPE BAPI3007_2-AMT_DOCCUR,

         LV_BETR_IND    TYPE T043T-BETRS,

         LV_PROZ_IND    TYPE T043T-PROZS.

   CLEAR:

         AMOUNT_DIFF, AMOUNT_PERC, LV_BETR_IND, LV_PROZ_IND.

   CLEAR:

         SUCCESS_INDICATO, T043T.

   IF PBUKRS IS INITIAL.

     RAISE BUKRS_NOT_FOUND.

   ENDIF.

   CALL FUNCTION 'COMPANY_CODE_READ'

     EXPORTING

       I_BUKRS           = PBUKRS

     IMPORTING

       E_T043T           = T043T

     EXCEPTIONS

       COUNTRY_NOT_FOUND = 1

       NO_SUCH_CODE      = 2

       SPACE_INPUT       = 3

       WRONG_KKBER       = 4

       OTHERS            = 5.

   IF SY-SUBRC <> 0.

     RAISE BUKRS_NOT_FOUND.

   ENDIF.

   CASE CRED_DEB.

     WHEN 'H'.

       LV_BETR_IND = T043T-BETRH.

       LV_PROZ_IND = T043T-PROZH.

     WHEN 'S'.

       LV_BETR_IND = T043T-BETRS.

       LV_PROZ_IND = T043T-PROZS.

     WHEN OTHERS.

       RAISE CRED_DEB_WRONG_VALUE.

   ENDCASE.

   AMOUNT_DIFF = BIG_AMOUNT - SMALL_AMOUNT.

   AMOUNT_PERC = AMOUNT_DIFF / BIG_AMOUNT.

   AMOUNT_PERC = AMOUNT_PERC * 100.

   IF AMOUNT_DIFF <= LV_BETR_IND.

     IF AMOUNT_PERC < LV_PROZ_IND.

       SUCCESS_INDICATO = 'X'.

     ELSE.

       SUCCESS_INDICATO = SPACE.

     ENDIF.

   ELSE.

     SUCCESS_INDICATO = SPACE.

   ENDIF.

if SUCCESS_INDICATO is 'X' then the customer's open items can be cleared.


Labels in this area