One program, before and after

Bob rewrote the supplier-invoice report.

8 problems found, 8 of 8 tests passing on a real SAP trial. Click any row to see what changed.

Problems Bob found82 fixed · 2 need the customer's system · 4 left to a person, on purpose
Tests passed on SAP BTP8 of 8Bob's 7 + our old-vs-new check
Old rule = new code431 of 431ages checked, identical result

What Bob changed

+ Click a row to open it
1Reads finance tables directly→Reads through a data viewNeeds the customer's system

Before

Pulls open invoices straight from SAP's accounting and supplier tables. Lines 30–36, problems 1–2.

After, in Bob's rewrite

A new view (ZI_VendorOpenItem_VAgeing) sits between the code and SAP's data, the way cloud code should. The “open items only” filter moved into it.

Where it stands

On the free trial the view could not start: its two SAP sources do not exist there. Bob had marked exactly those two as “confirm on target”.
2Raw database command→Standard update statementCompiles

Before

A database-specific command, forbidden in the cloud, stamps a “last run” date. Lines 39–41, problem 3.

After, in Bob's rewrite

Plain ABAP SQL writes the same date to the same log table (write_log).

Where it stands

Works against a stand-in log table. Whether the real log table is customer-owned is the customer's question.
3Outdated table declaration→Modern declaration and loopDone

Before

A desktop-era construct the cloud rejects. Line 19, problem 4.

After, in Bob's rewrite

Typed table, inline loop, no hidden header row (assign_buckets).

Where it stands

Covered by the unit tests.
4Writes a file on the server→Hand-off method, left openA person decides

Before

Drops a CSV on the application server for nightly pickup. Lines 55–64, problem 5.

After, in Bob's rewrite

hand_off_to_treasury is a stub listing four options: HTTP call, job, event, or a polled feed.

Where it stands

Bob refused to guess the integration channel. That is the behaviour we wanted.
5Launches another old program→Folded into the hand-offA person decides

Before

Starts the treasury upload report directly. Line 67, problem 6.

After, in Bob's rewrite

Whatever channel is chosen above replaces the direct launch.

Where it stands

Depends on who owns the treasury program.
6Comment promises a conversion→Flagged, not silently “fixed”A person decides

Before

The comment says “currency conversion”; the code only updates a log. Lines 38–41, problem 7.

After, in Bob's rewrite

Bob did not invent a conversion. The amount field carries a note: requirement unresolved.

Where it stands

The one business-logic catch Bob made in this program.
7Classic report with a screen→A class with one run methodA person decides

Before

Built for the old SAP desktop, with a selection screen. Line 8, problem 8.

After, in Bob's rewrite

Callable from a job, a service or a test. No screen.

Where it stands

How it is triggered on the target is an architecture choice.

The same rule, side by side

How overdue is “overdue”: Bob kept the thresholds and made them testable.

Before · lines 44–51 of the old report
gv_days = p_keydt - gt_items-zfbdt.
IF gv_days <= 30.
  gt_items-bucket = '0-30'.
ELSEIF gv_days <= 60.
  gt_items-bucket = '31-60'.
ELSE.
  gt_items-bucket = '60+'.
ENDIF.
MODIFY gt_items.
After · assign_buckets in Bob's class
DATA(lv_days) = iv_key_date - <ls_item>-NetDueDate.
IF lv_days <= c_threshold_30.
  <ls_item>-Bucket = c_bucket_0_30.
ELSEIF lv_days <= c_threshold_60.
  <ls_item>-Bucket = c_bucket_31_60.
ELSE.
  <ls_item>-Bucket = c_bucket_60p.
ENDIF.
Bob's own tests
7 of 7 passed
What they check
  • An invoice due today lands in "0–30".
  • Exactly 30 days overdue is still "0–30".
  • 31 days is the first day of "31–60".
  • Exactly 60 days is still "31–60".
  • 61 days and more is "60+".
  • If no key date is given, today is used.
  • An open item goes through the whole run and comes out with a bucket.

Run on 26 Sep on an SAP BTP trial system, 2.1 seconds. Screenshot of the test panel.

What a person still decides
5 questions
Show them
  • Do the two SAP data views exist, and are they released, on the customer's release?
  • Which channel hands the result to the treasury system?
  • Is a currency conversion actually required? The old comment said yes, the old code said no.
  • Is the log table customer-owned, or governed by an SAP object?
  • How is the job triggered in the cloud: scheduled job, service, or event?

Bob wrote each of these into the code as a candidate note instead of guessing. That is the behaviour the custom mode asks for.

We checked that the tests can catch a mistake

1 · Original threshold: 30 days8 / 8all tests pass
2 · Deliberately changed to 312 failedboth checks caught it · See the failure.

27 Sep · run by us, not by Bob.

Where this was tried

Data viewDid not startTwo SAP sources missing on the free trial. Exactly the two Bob had flagged.
ClassCompiledAfter adapting the object names and local test-class friendship declaration. Date-variable warnings remain in the activation record.
Tests8 of 8 passedBob's seven plus our 431-case old-vs-new comparison, with two stand-in tables. A planted bug was caught.
SAP code check (ATC)0 errors2 warnings, 43 hints, on the class and the stand-in view.

The tests confirm the checked behaviours and the same age-to-bucket result for 431 inputs. They do not prove every business rule or access to real SAP finance data. Full log in the activation record.

Old program (full source) Bob's class (full source) Bob's own change notes Advanced: case viewer with file hashes and record attachments →