14.01.2020 Views

ABAP_to_the_Future

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Locating Code that Can Be Pushed Down 15.4

30 days after the end of the month in which the invoice date falls. However, some

customers go bankrupt and thus cannot pay the invoice; in SAP terms, the customer

open item must be classified as a bad debt. An accountant (e.g., Igor) has to

clear the open item by writing off the debt from the balance sheet and charging it

to the profit and loss section of the accounts.

To make matters worse for the custome r (as if going bankrupt was not bad

enough), the baron presses a button on his control panel, and the monster delivered

to the customer goes into a frenzy, destroying everything in sight and then

killing and eating the customer. As a result, the Baron has a remarkably low bad

debt ratio.

Nonetheless, customers who have been eaten by monsters are not very good at

paying off their debts afterwards, so there remain a number of cleared open items

in the baron’s SAP system relating to su ch bad debts. Luckily for the baron, the

Transylvanian government has recognized this problem. If the baron sends an

electronic extract of such bad debts to the government each month, then he can

get tax relief for them.

Now imagine there is a program that look s at the cleared open items relating to

bad debts; it runs each month and sends that data to the government in the format

it requires. The most important thing naturally is not to claim the same bad

debt twice, because that would be fr aud—much worse than killing and eating

your customers.

The program identifies which customers are bad debt customers (i.e., did not pay

their bills and thus have been eaten), loops through each such customer, and

reads that customer’s cleared open items. Once this data has been retrieved from

the database, the program loops through each record and applies some business

logic to determine if the record should be sent to the government.

There is a variable called GD_WOFF_DATE that stores the date on which the customer

came to a gruesome end. Because this isthe government the baron’s dealing with,

the rules are quite complicated: any cl eared items with a creation date ( CPUDT)

equal to or later than the date of th e customer’s horrible, horrible death ( GD_

WOFF_DATE) can be claimed as a tax write-off. For open items with a creation date

earlier than the write-off date, on ly items with a clearing date ( AUGDT) greater or

equal to the write-off date can be claimed.

685

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!