Variants & Job Scheduling
Selection variants, dynamic date fields, and job scheduling in SM36.
Overview
For the Extractor report to run automatically, you need two things:
Selection variant – stores the selection parameters (which data types, which time period, which company codes)
Background job (SM36) – starts the report periodically using the stored variant
1. Create a Selection Variant
Step by Step
SE38 → Call report
ZFI_BILENDO_EXPORT_V2→ F8 (Execute)Fill in the selection screen:
P_KNA1 = X (customer master)
P_BSID = X (open items)
P_BSAD = X (cleared items)
P_DELTA = X (delta load)
S_BUKRS = desired company codes
Date fields: → dynamic (see next section)
Menu:
Goto → Variants → Save as VariantVariant name: e.g.,
BILENDO_DAILY_DELTADescription: e.g.,
Bilendo Daily Delta ExportSave
Recommended Selection Values
| Parameter | Value | Note |
|---|---|---|
| P_KNA1 | X | Extract customer master |
| P_BSEG | – | Usually not required |
| P_BSID | X | Open items |
| P_BSAD | X | Cleared items |
| P_ALL | – | Only for a one-time full load |
| P_DELTA | X | Default: Delta |
| S_BUKRS | All relevant BUKRS | Restriction to active company codes |
2. Configuring Dynamic Date Fields
Fixed date values in the variant lead to outdated selections. Instead, you must use selection variables that calculate the current date on each run.
Which Fields Should Be Set Dynamically?
| Field | Select option | Recommended variable | Meaning |
|---|---|---|---|
| Entry date | S_CPUDT | D: Current date, offset -7 to 0 | Last 7 days |
| Clearing date | S_AUGDT | D: Current date, offset -7 to 0 | Last 7 days |
| Entry time | S_CPUTM | (fixed, e.g., 00:00:00 to 23:59:59) | Optional: restriction |
Instructions: Storing a Dynamic Date in a Variant
Open the variant in change mode
Click the "Attributes" button (or use the menu:
Goto → Variants → Attributes)In the "Selection Variable" column, place the cursor in the
S_CPUDTfield (low value)Call up the F4 value help
Select a variable:
D = Current date (for the "To" value)
D with offset -7 = Current date minus 7 days (for the "From" value)
Follow the same procedure for
S_AUGDTThe fields are then displayed as not editable (grayed out) – this is correct
Save the variant
Typical Configuration
S_CPUDT (Entry Date):
From: D (current date) - 7 days
To: D (current date)
S_AUGDT (Clearing Date):
From: D (current date) - 7 days
To: D (current date)Recommendation: Use an overlap of at least 7 days. In SAP, postings can be entered retroactively, so time windows that are too narrow lead to data gaps in Bilendo.
3. Selection Logic in Detail
Open Items (BSID)
The class ZCL_FI_BILENDO_ASSIST_V2 (method get_bsid) makes selections as follows:
If the CPU date (S_CPUDT) is filled and covers only 1 day (because of the time of day):
Selection of all documents with
CPUDT IN S_CPUDTAND (if specified:CPUTM IN S_CPUTM)OR
Änderungsdatum (AEDAT) IN S_CPUDT(changes without time of day)
If posting date (S_BUDAT) is filled:
Selection of all documents with
BUDAT IN S_BUDATOR
Änderungsdatum (AEDAT) IN S_BUDAT
Cleared Items (BSAD)
If CPU date (S_CPUDT) is filled:
Selection via
CPUDT IN S_CPUDT(+ optional CPUTM)OR
Änderungsdatum (AEDAT) IN S_CPUDT
If clearing date (S_AUGDT) is filled:
Selection via
AUGDT IN S_AUGDTOR
Änderungsdatum (AEDAT) IN S_AUGDT
If Clearing Document (S_AUGBL) is filled:
Selection across multiple clearing documents is possible (for subsequent selection)
Customer Master (KNA1)
Generally selected by CPU date (S_CUSDT)
Takes the time of day into account during selection → maintain a variant with exactly 1 day
Change history is not explicitly checked (KNA1 has no AEDAT at field level)
4. Scheduling a Job (SM36)
Step by Step
Call transaction SM36
Assign a job name:
BILENDO_EXPORT_DAILYJob class: A (highest priority) or B (normal)
Define the Step
Click the "Steps" button → "ABAP/4 Program"
Enter the following:
Program name:
ZFI_BILENDO_EXPORT_V2Variant:
BILENDO_DAILY_DELTA
"Copy" → The step is created
You can chain multiple steps for different company codes or different reports (e.g., export first, then import) in a single job.
Start Condition
Click the "Start Condition" button → "Date/Time"
Start date: Today's date (or the next desired day)
Start time: e.g.,
03:00:00(before the Bilendo import window)Select the "Periodic" checkbox
Period: "Daily" → "Save"
Release the Job
Back on the main screen: Click the "Save" button
The job appears in SM37 with the status "Released"
Job Monitoring (SM37)
| Status | Meaning | Action |
|---|---|---|
| Scheduled | Job is waiting for start condition | – |
| Active | Job is currently running | – |
| Finished | Completed successfully | Check the log |
| Canceled | An error occurred | Analyze the job log (SM37 → Job Log) |
5. Job Configuration Variants
Variant A: One Job for All Company Codes
Job: BILENDO_EXPORT_DAILY
Step 1: ZFI_BILENDO_EXPORT_V2 / Variant: BILENDO_DAILY_DELTA
(S_BUKRS contains all company codes)
Start condition: Daily 03:00Variant B: Separate Jobs per Company Code
Job: BILENDO_EXPORT_BK1001
Step 1: ZFI_BILENDO_EXPORT_V2 / Variant: BILENDO_DELTA_1001
Start condition: Daily 03:00
Job: BILENDO_EXPORT_BK2001
Step 1: ZFI_BILENDO_EXPORT_V2 / Variant: BILENDO_DELTA_2001
Start condition: Daily 03:15Variant C: Export + Import in One Job
Job: BILENDO_SYNC_DAILY
Step 1: ZFI_BILENDO_EXPORT_V2 / Variant: BILENDO_DAILY_DELTA
Step 2: ZFI_BILENDO_IMPORT_V2 / Variant: BILENDO_IMPORT_DAILY
Start condition: Daily 03:00Note: Variant C only makes sense if the Bilendo-side writeback files are already on the application server when the job runs. Otherwise, the import job should run with a time offset.
6. Variant for Two-Stage Delta (Every 6 Hours)
When using the improved two-stage delta logic (→ 04 - Extractor Report#Improved Delta Logic Two-Stage Selection), the job is scheduled every 6 hours. The delta windows are calculated programmatically in the get_open_delta() and get_cleared_delta() methods, so dynamic date fields in the variant are no longer required.
Variant: BILENDO_DELTA_6H
| Parameter | Value | Note |
|---|---|---|
| P_KNA1 | X | Customer master (optional on each run) |
| P_BSID | X | Open items via get_open_delta() |
| P_BSAD | X | Cleared items via get_cleared_delta() |
| P_DELTA | X | Enables two-stage methods |
| S_BUKRS | All relevant BUKRS | |
| S_CPUDT | empty | Calculated internally (6-hour window) |
| S_AUGDT | empty | Calculated internally (24-hour window) |
SM36 Scheduling (Periodic, Every 6 Hours)
SM36 → Job name:
BILENDO_EXPORT_6HStep:
ZFI_BILENDO_EXPORT_V2/ VariantBILENDO_DELTA_6HStart condition → Date/Time → Start time
00:00:00Select the checkbox "Periodic" → Period: "Hourly" → Hour value: 6
Save
| Run time | BSID window | BSAD window |
|---|---|---|
| 00:00 | BKPF: CPUDT/CPUTM ≥ previous day 18:00 | BSAD: AUGDT ≥ previous day |
| 06:00 | BKPF: CPUDT/CPUTM ≥ 00:00 | BSAD: AUGDT ≥ previous day |
| 12:00 | BKPF: CPUDT/CPUTM ≥ 06:00 | BSAD: AUGDT ≥ previous day |
| 18:00 | BKPF: CPUDT/CPUTM ≥ 12:00 | BSAD: AUGDT ≥ previous day |
The BSAD selection always uses a 24-hour window (AUGDT ≥ yesterday), regardless of the run frequency. This creates a fourfold overlap, which ensures robustness in the event of errors.
7. Variant for Initial/Full Load
A separate variant is required for the initial load or a complete reload:
| Parameter | Value | Note |
|---|---|---|
| P_ALL | X | Full load mode |
| P_DELTA | – | |
| S_CPUDT | empty | No time filter |
| S_AUGDT | empty | No time filter |
| S_BUKRS | All BUKRS |
Variant name: e.g., BILENDO_INITIAL_FULL
⚠️ Caution: Depending on the data volume, a full load can cause significant runtime and system load. Coordinate with SAP Basis before running it in PRD.