# migrations

dir: sysdb
filename: 00001-collections.sqlite.sql
hash: 38352d725ad1c16074fac420b22b4633
sql:
CREATE TABLE collections (
    id TEXT PRIMARY KEY,
    name TEXT NOT NULL,
    topic TEXT NOT NULL,
    UNIQUE (name)
);

CREATE TABLE collection_metadata (
    collection_id TEXT REFERENCES collections(id) ON DELETE CASCADE,
    key TEXT NOT NULL,
    str_value TEXT,
    int_value INTEGER,
    float_value REAL,
    PRIMARY KEY (collection_id, key)
);


dir: sysdb
filename: 00002-segments.sqlite.sql
hash: 2913cb6a503055a95f625448037e8912
sql:
CREATE TABLE segments (
    id TEXT PRIMARY KEY,
    type TEXT NOT NULL,
    scope TEXT NOT NULL,
    topic TEXT,
    collection TEXT REFERENCES collection(id)
);

CREATE TABLE segment_metadata (
    segment_id TEXT  REFERENCES segments(id) ON DELETE CASCADE,
    key TEXT NOT NULL,
    str_value TEXT,
    int_value INTEGER,
    float_value REAL,
    PRIMARY KEY (segment_id, key)
);


dir: sysdb
filename: 00004-tenants-databases.sqlite.sql
hash: 048867ce8fcdefe4023c7110e4433591
sql:
CREATE TABLE IF NOT EXISTS tenants (
    id TEXT PRIMARY KEY,
    UNIQUE (id)
);

CREATE TABLE IF NOT EXISTS databases (
    id TEXT PRIMARY KEY, -- unique globally
    name TEXT NOT NULL, -- unique per tenant
    tenant_id TEXT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
    UNIQUE (tenant_id, name) -- Ensure that a tenant has only one database with a given name
);

CREATE TABLE IF NOT EXISTS collections_tmp (
    id TEXT PRIMARY KEY, -- unique globally
    name TEXT NOT NULL, -- unique per database
    topic TEXT NOT NULL,
    dimension INTEGER,
    database_id TEXT NOT NULL REFERENCES databases(id) ON DELETE CASCADE,
    UNIQUE (name, database_id)
);

-- Create default tenant and database
INSERT OR REPLACE INTO tenants (id) VALUES ('default_tenant'); -- The default tenant id is 'default_tenant' others are UUIDs
INSERT OR REPLACE INTO databases (id, name, tenant_id) VALUES ('00000000-0000-0000-0000-000000000000', 'default_database', 'default_tenant');

INSERT OR REPLACE INTO collections_tmp (id, name, topic, dimension, database_id)
    SELECT id, name, topic, dimension, '00000000-0000-0000-0000-000000000000' FROM collections;
DROP TABLE collections;
ALTER TABLE collections_tmp RENAME TO collections;


dir: sysdb
filename: 00005-remove-topic.sqlite.sql
hash: b1367c826b8fba5f96f27befdc1d42d2
sql:
-- Remove the topic column from the Collections and Segments tables

ALTER TABLE collections DROP COLUMN topic;
ALTER TABLE segments DROP COLUMN topic;


dir: sysdb
filename: 00006-collection-segment-metadata.sqlite.sql
hash: 4eea7468935bf25d4604a0fed2366116
sql:
-- SQLite does not support adding check with alter table, as a result, adding a check
-- involve creating a new table and copying the data over. It is over kill with adding
-- a boolean type column. The application write to the table needs to ensure the data
-- integrity.
ALTER TABLE collection_metadata ADD COLUMN bool_value INTEGER;
ALTER TABLE segment_metadata ADD COLUMN bool_value INTEGER;


dir: sysdb
filename: 00007-collection-config.sqlite.sql
hash: 1c7e63bba346a42a18b6ab7f1c989bed
sql:
-- Stores collection configuration dictionaries.
ALTER TABLE collections ADD COLUMN config_json_str TEXT;


dir: sysdb
filename: 00008-maintenance-log.sqlite.sql
hash: 0a0e7e93111a01789addf64961c6127c
sql:
-- Records when database maintenance operations are performed.
-- At time of creation, this table is only used to record vacuum operations.
CREATE TABLE maintenance_log (
  id INT PRIMARY KEY,
  timestamp INT NOT NULL,
  operation TEXT NOT NULL
);


dir: sysdb
filename: 00009-segment-collection-not-null.sqlite.sql
hash: 054355aef9e63702bf54ea29e61563f1
sql:
-- This makes segments.collection non-nullable.
CREATE TABLE segments_temp (
    id TEXT PRIMARY KEY,
    type TEXT NOT NULL,
    scope TEXT NOT NULL,
    collection TEXT REFERENCES collection(id) NOT NULL
);

INSERT INTO segments_temp SELECT * FROM segments;
DROP TABLE segments;
ALTER TABLE segments_temp RENAME TO segments;


dir: sysdb
filename: 00010-collection-schema.sqlite.sql
hash: 5c3a5ac4b79df76799b4721827ed5e1d
sql:
-- Stores collection schema as stringified json
ALTER TABLE collections ADD COLUMN schema_str TEXT;


dir: metadb
filename: 00001-embedding-metadata.sqlite.sql
hash: 2b4cf52c4bb2676e21d6860a4409f856
sql:
CREATE TABLE embeddings (
    id INTEGER PRIMARY KEY,
    segment_id TEXT NOT NULL,
    embedding_id TEXT NOT NULL,
    seq_id BLOB NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    UNIQUE (segment_id, embedding_id)
);

CREATE TABLE embedding_metadata (
    id INTEGER REFERENCES embeddings(id),
    key TEXT NOT NULL,
    string_value TEXT,
    int_value INTEGER,
    float_value REAL,
    PRIMARY KEY (id, key)
);

CREATE TABLE max_seq_id (
    segment_id TEXT PRIMARY KEY,
    seq_id BLOB NOT NULL
);

CREATE VIRTUAL TABLE embedding_fulltext USING fts5(id, string_value);


dir: metadb
filename: 00002-embedding-metadata.sqlite.sql
hash: 12a570f7121b3a8ce750a2a7c36da20f
sql:
-- SQLite does not support adding check with alter table, as a result, adding a check
-- involve creating a new table and copying the data over. It is over kill with adding
-- a boolean type column. The application write to the table needs to ensure the data
-- integrity.
ALTER TABLE embedding_metadata ADD COLUMN bool_value INTEGER


dir: metadb
filename: 00003-full-text-tokenize.sqlite.sql
hash: f97ad6334aeaa8f419f01110b648b97a
sql:
CREATE VIRTUAL TABLE embedding_fulltext_search USING fts5(string_value, tokenize='trigram');
INSERT INTO embedding_fulltext_search (rowid, string_value) SELECT rowid, string_value FROM embedding_metadata;
DROP TABLE embedding_fulltext;


dir: metadb
filename: 00004-metadata-indices.sqlite.sql
hash: fb36603a45ee2cd0254cef3ef86585e8
sql:
CREATE INDEX IF NOT EXISTS embedding_metadata_int_value ON embedding_metadata (key, int_value) WHERE int_value IS NOT NULL;
CREATE INDEX IF NOT EXISTS embedding_metadata_float_value ON embedding_metadata (key, float_value) WHERE float_value IS NOT NULL;
CREATE INDEX IF NOT EXISTS embedding_metadata_string_value ON embedding_metadata (key, string_value) WHERE string_value IS NOT NULL;


dir: metadb
filename: 00005-max-seq-id-int.sqlite.sql
hash: 0e9de46758761b373ce682925edcc326
sql:
ALTER TABLE max_seq_id ADD COLUMN int_seq_id INTEGER;

-- Convert 8 byte wide big-endian integer as blob to native 64 bit integer.
-- Adapted from https://stackoverflow.com/a/70296198.
UPDATE max_seq_id SET int_seq_id = (
  SELECT (
       (instr('123456789ABCDEF', substr(hex(seq_id), -1 , 1)) <<  0)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -2 , 1)) <<  4)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -3 , 1)) <<  8)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -4 , 1)) << 12)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -5 , 1)) << 16)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -6 , 1)) << 20)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -7 , 1)) << 24)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -8 , 1)) << 28)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -9 , 1)) << 32)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -10, 1)) << 36)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -11, 1)) << 40)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -12, 1)) << 44)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -13, 1)) << 48)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -14, 1)) << 52)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -15, 1)) << 56)
     | (instr('123456789ABCDEF', substr(hex(seq_id), -16, 1)) << 60)
    )
);

ALTER TABLE max_seq_id DROP COLUMN seq_id;
ALTER TABLE max_seq_id RENAME COLUMN int_seq_id TO seq_id;


dir: metadb
filename: 00006-metadata-array-support.sqlite.sql
hash: e026f01ea92c1baa1493f4ad5ca7cfe7
sql:
-- Separate table for exploded array metadata values.
-- Each array element gets its own row, enabling efficient $contains queries.
-- The existing embedding_metadata table (with its PRIMARY KEY (id, key))
-- remains untouched and continues to store scalar metadata values.

CREATE TABLE IF NOT EXISTS embedding_metadata_array (
    id INTEGER NOT NULL REFERENCES embeddings(id),
    key TEXT NOT NULL,
    string_value TEXT,
    int_value INTEGER,
    float_value REAL,
    bool_value INTEGER
);

CREATE INDEX IF NOT EXISTS embedding_metadata_array_id_key
    ON embedding_metadata_array (id, key);
CREATE INDEX IF NOT EXISTS embedding_metadata_array_key_string
    ON embedding_metadata_array (key, string_value) WHERE string_value IS NOT NULL;
CREATE INDEX IF NOT EXISTS embedding_metadata_array_key_int
    ON embedding_metadata_array (key, int_value) WHERE int_value IS NOT NULL;
CREATE INDEX IF NOT EXISTS embedding_metadata_array_key_float
    ON embedding_metadata_array (key, float_value) WHERE float_value IS NOT NULL;


dir: embeddings_queue
filename: 00001-embeddings.sqlite.sql
hash: d3755dfd232be8e8301f4d7fcfb3a486
sql:
CREATE TABLE embeddings_queue (
    seq_id INTEGER PRIMARY KEY,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    operation INTEGER NOT NULL,
    topic TEXT NOT NULL,
    id TEXT NOT NULL,
    vector BLOB,
    encoding TEXT,
    metadata TEXT
);


# collections

id: f3e327e3-e8c8-4a37-9788-969e4be749a9
name: abap_rag
database_id: 00000000-0000-0000-0000-000000000000
config_json_str: {}
schema_str:
{"defaults":{"string":{"fts_index":{"enabled":false,"config":{}},"string_inverted_index":{"enabled":true,"config":{}}},"float_list":{"vector_index":{"enabled":false,"config":{"space":"l2","embedding_function":{"type":"known","name":"default","config":{}},"hnsw":{"ef_construction":100,"max_neighbors":16,"ef_search":100,"num_threads":14,"batch_size":100,"sync_threshold":1000,"resize_factor":1.2}}}},"sparse_vector":{"sparse_vector_index":{"enabled":false,"config":{"embedding_function":{"type":"unknown"},"bm25":false}}},"int":{"int_inverted_index":{"enabled":true,"config":{}}},"float":{"float_inverted_index":{"enabled":true,"config":{}}},"bool":{"bool_inverted_index":{"enabled":true,"config":{}}}},"keys":{"filename":{"string":{"fts_index":{"enabled":false,"config":{}},"string_inverted_index":{"enabled":true,"config":{}}}},"source":{"string":{"fts_index":{"enabled":false,"config":{}},"string_inverted_index":{"enabled":true,"config":{}}}},"#embedding":{"float_list":{"vector_index":{"enabled":true,"config":{"space":"l2","embedding_function":{"type":"known","name":"default","config":{}},"source_key":"#document","hnsw":{"ef_construction":100,"max_neighbors":16,"ef_search":100,"num_threads":14,"batch_size":100,"sync_threshold":1000,"resize_factor":1.2}}}}},"#document":{"string":{"fts_index":{"enabled":true,"config":{}},"string_inverted_index":{"enabled":false,"config":{}}}}}}


# embedding_metadata

key: chroma:document
string_value:
*---------------------------------------------------------------------*
*    view related FORM routines
*---------------------------------------------------------------------*

* base table related FORM-routines.............
INCLUDE LSVIMFTX .


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpaymentrules.fugr.lzfgpaymentrulesf00.abap


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpaymentrules.fugr.lzfgpaymentrulesi00.abap


key: chroma:document
string_value:
*---------------------------------------------------------------------*
*    view related PAI modules
*---------------------------------------------------------------------*

INCLUDE LSVIMITX . "base table related PAI modules


key: chroma:document
string_value:
*---------------------------------------------------------------------*
*    view related data declarations
*---------------------------------------------------------------------*
*...processing: ZPAYMENTRULES...................................*
DATA:  BEGIN OF STATUS_ZPAYMENTRULES                 .   "state vector
         INCLUDE STRUCTURE VIMSTATUS.
DATA:  END OF STATUS_ZPAYMENTRULES                 .
CONTROLS: TCTRL_ZPAYMENTRULES
            TYPE TABLEVIEW USING SCREEN '0001'.
*.........table declarations:.................................*
TABLES: *ZPAYMENTRULES                 .
TABLES: ZPAYMENTRULES                  .

* general table data declarations..............
  INCLUDE LSVIMTDT                                .


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpaymentrules.fugr.lzfgpaymentrulest00.abap


key: chroma:document
string_value:
FUNCTION-POOL ZFGPAYMENTRULES            MESSAGE-ID SV.

* INCLUDE LZFGPAYMENTRULESD...               " Local class definition
  INCLUDE LSVIMDAT                                . "general data decl.
  INCLUDE LZFGPAYMENTRULEST00                     . "view rel. data dcl.


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpaymentrules.fugr.lzfgpaymentrulestop.abap


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpaymentrules.fugr.saplzfgpaymentrules.abap


key: chroma:document
string_value:
*******************************************************************
*   System-defined Include-files.                                 *
*******************************************************************
  INCLUDE LZFGPAYMENTRULESTOP.               " Global Declarations
  INCLUDE LZFGPAYMENTRULESUXX.               " Function Modules

*******************************************************************
*   User-defined Include-files (if necessary).                    *
*******************************************************************
* INCLUDE LZFGPAYMENTRULESF...               " Subroutines
* INCLUDE LZFGPAYMENTRULESO...               " PBO-Modules
* INCLUDE LZFGPAYMENTRULESI...               " PAI-Modules
* INCLUDE LZFGPAYMENTRULESE...               " Events
* INCLUDE LZFGPAYMENTRULESP...               " Local class implement.
* INCLUDE LZFGPAYMENTRULEST99.               " ABAP Unit tests
  INCLUDE LZFGPAYMENTRULESF00                     . " subprograms
  INCLUDE LZFGPAYMENTRULESI00                     . " PAI modules
  INCLUDE LSVIMFXX                                . " subprograms
  INCLUDE LSVIMOXX                                . " PBO modules
  INCLUDE LSVIMIXX                                . " PAI modules


key: chroma:document
string_value:
PROCESS BEFORE OUTPUT.
 MODULE LISTE_INITIALISIEREN.
 LOOP AT EXTRACT WITH CONTROL
  TCTRL_ZPAYMENTRULES CURSOR NEXTLINE.
   MODULE LISTE_SHOW_LISTE.
 ENDLOOP.
*
PROCESS AFTER INPUT.
 MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
 MODULE LISTE_BEFORE_LOOP.
 LOOP AT EXTRACT.
   MODULE LISTE_INIT_WORKAREA.
   CHAIN.
    FIELD ZPAYMENTRULES-LIFNR .
    FIELD ZPAYMENTRULES-VENDORNAME .
    FIELD ZPAYMENTRULES-DAYSLATE .
    FIELD ZPAYMENTRULES-COMMENTS .
    MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
   ENDCHAIN.
   FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
   CHAIN.
    FIELD ZPAYMENTRULES-LIFNR .
    MODULE LISTE_UPDATE_LISTE.
   ENDCHAIN.
 ENDLOOP.
 MODULE LISTE_AFTER_LOOP.


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpaymentrules.fugr.screen_0001.abap


key: chroma:document
string_value:
FUNCTION TABLEFRAME_ZFGPAYMENTRULES    .

  PERFORM TABLEFRAME TABLES X_HEADER X_NAMTAB DBA_SELLIST DPL_SELLIST
                            EXCL_CUA_FUNCT
                     USING  CORR_NUMBER VIEW_ACTION VIEW_NAME.

ENDFUNCTION.


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpaymentrules.fugr.tableframe_zfgpaymentrules.abap


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpaymentrules.fugr.tableproc_zfgpaymentrules.abap


key: chroma:document
string_value:
FUNCTION-POOL ZFGPAYMENTS.                  "MESSAGE-ID ..

* INCLUDE LZFGPAYMENTSD...                   " Local class definition


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpayments.fugr.lzfgpaymentstop.abap


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpayments.fugr.saplzfgpayments.abap


key: chroma:document
string_value:
*******************************************************************
*   System-defined Include-files.                                 *
*******************************************************************
  INCLUDE LZFGPAYMENTSTOP.                   " Global Declarations
  INCLUDE LZFGPAYMENTSUXX.                   " Function Modules

*******************************************************************
*   User-defined Include-files (if necessary).                    *
*******************************************************************
* INCLUDE LZFGPAYMENTSF...                   " Subroutines
* INCLUDE LZFGPAYMENTSO...                   " PBO-Modules
* INCLUDE LZFGPAYMENTSI...                   " PAI-Modules
* INCLUDE LZFGPAYMENTSE...                   " Events
* INCLUDE LZFGPAYMENTSP...                   " Local class implement.
* INCLUDE LZFGPAYMENTST99.                   " ABAP Unit tests


key: chroma:document
string_value:
FUNCTION ZBDC_VENDOR_PAYMENTS_CLOUD.
*"--------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(CTU) LIKE  APQI-PUTACTIVE DEFAULT 'X'
*"     VALUE(MODE) LIKE  APQI-PUTACTIVE DEFAULT 'N'
*"     VALUE(UPDATE) LIKE  APQI-PUTACTIVE DEFAULT 'L'
*"     VALUE(GROUP) LIKE  APQI-GROUPID OPTIONAL
*"     VALUE(USER) LIKE  APQI-USERID OPTIONAL
*"     VALUE(KEEP) LIKE  APQI-QERASE OPTIONAL
*"     VALUE(HOLDDATE) LIKE  APQI-STARTDATE OPTIONAL
*"     VALUE(NODATA) LIKE  APQI-PUTACTIVE DEFAULT '/'
*"     VALUE(BLDAT_001) LIKE  BDCDATA-FVAL DEFAULT '04/17/2017'
*"     VALUE(BLART_002) LIKE  BDCDATA-FVAL DEFAULT 'KZ'
*"     VALUE(BUKRS_003) LIKE  BDCDATA-FVAL DEFAULT '1710'
*"     VALUE(BUDAT_004) LIKE  BDCDATA-FVAL DEFAULT '04/21/2017'
*"     VALUE(MONAT_005) LIKE  BDCDATA-FVAL DEFAULT '4'
*"     VALUE(WAERS_006) LIKE  BDCDATA-FVAL DEFAULT 'USD'
*"     VALUE(KONTO_007) LIKE  BDCDATA-FVAL DEFAULT '11001000'
*"     VALUE(WRBTR_008) LIKE  BDCDATA-FVAL DEFAULT '204182.87'
*"     VALUE(VALUT_009) LIKE  BDCDATA-FVAL DEFAULT '04/17/2017'
*"     VALUE(AGKON_010) LIKE  BDCDATA-FVAL DEFAULT 'USSU_V8001'
*"     VALUE(AGKOA_011) LIKE  BDCDATA-FVAL DEFAULT 'K'
*"     VALUE(XNOPS_012) LIKE  BDCDATA-FVAL DEFAULT 'X'
*"     VALUE(XPOS1_01_013) LIKE  BDCDATA-FVAL DEFAULT ''
*"     VALUE(XPOS1_03_014) LIKE  BDCDATA-FVAL DEFAULT 'X'
*"     VALUE(SEL01_01_015) LIKE  BDCDATA-FVAL DEFAULT '5100002254'
*"     VALUE(ABPOS_016) LIKE  BDCDATA-FVAL DEFAULT '1'
*"     VALUE(WRBTR_017) LIKE  BDCDATA-FVAL DEFAULT '204,182.87'
*"     VALUE(VALUT_018) LIKE  BDCDATA-FVAL DEFAULT '04/17/2017'
*"     VALUE(FMORE_019) LIKE  BDCDATA-FVAL DEFAULT 'X'
*"     VALUE(HBKID_020) LIKE  BDCDATA-FVAL DEFAULT 'USBK1'
*"     VALUE(HKTID_021) LIKE  BDCDATA-FVAL DEFAULT 'USAC1'
*"     VALUE(HBKID_022) LIKE  BDCDATA-FVAL DEFAULT 'USBK1'
*"     VALUE(HKTID_023) LIKE  BDCDATA-FVAL DEFAULT 'USAC1'
*"     VALUE(HBKID_024) LIKE  BDCDATA-FVAL DEFAULT 'USBK1'
*"     VALUE(HKTID_025) LIKE  BDCDATA-FVAL DEFAULT 'USAC1'
*"  EXPORTING
*"     VALUE(SUBRC) LIKE  SYST-SUBRC
*"  TABLES
*"      MESSTAB STRUCTURE  BDCMSGCOLL OPTIONAL
*"--------------------------------------------------------------------

subrc = 0.

perform bdc_nodata      using NODATA.

perform open_group      using GROUP USER KEEP HOLDDATE CTU.

perform bdc_dynpro      using 'SAPMF05A' '0103'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-XPOS1(03)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=PA'.
perform bdc_field       using 'BKPF-BLDAT'
                              BLDAT_001.
perform bdc_field       using 'BKPF-BLART'
                              BLART_002.
perform bdc_field       using 'BKPF-BUKRS'
                              BUKRS_003.
perform bdc_field       using 'BKPF-BUDAT'
                              BUDAT_004.
perform bdc_field       using 'BKPF-MONAT'
                              MONAT_005.
perform bdc_field       using 'BKPF-WAERS'
                              WAERS_006.
perform bdc_field       using 'RF05A-KONTO'
                              KONTO_007.
perform bdc_field       using 'BSEG-WRBTR'
                              WRBTR_008.
perform bdc_field       using 'BSEG-VALUT'
                              VALUT_009.
perform bdc_field       using 'RF05A-AGKON'
                              AGKON_010.
perform bdc_field       using 'RF05A-AGKOA'
                              AGKOA_011.
perform bdc_field       using 'RF05A-XNOPS'
                              XNOPS_012.
perform bdc_field       using 'RF05A-XPOS1(01)'
                              XPOS1_01_013.
perform bdc_field       using 'RF05A-XPOS1(03)'
                              XPOS1_03_014.
perform bdc_dynpro      using 'SAPMF05A' '0731'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-SEL01(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RF05A-SEL01(01)'
                              SEL01_01_015.
perform bdc_dynpro      using 'SAPMF05A' '0731'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-SEL01(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=PA'.
perform bdc_dynpro      using 'SAPDF05X' '3100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=AB'.
perform bdc_field       using 'BDC_CURSOR'
                              'DF05B-PSSKT(01)'.
perform bdc_field       using 'RF05A-ABPOS'
                              ABPOS_016.
perform bdc_dynpro      using 'SAPMF05A' '0700'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-AZEI1(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=PI'.
perform bdc_dynpro      using 'SAPMF05A' '0300'.
perform bdc_field       using 'BDC_CURSOR'
                              'BSEG-WRBTR'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ZK'.
perform bdc_field       using 'BSEG-WRBTR'
                              WRBTR_017.
perform bdc_field       using 'BSEG-VALUT'
                              VALUT_018.
perform bdc_field       using 'DKACB-FMORE'
                              FMORE_019.
perform bdc_dynpro      using 'SAPLKACB' '0002'.
perform bdc_field       using 'BDC_CURSOR'
                              'COBL-KOSTL'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTE'.
perform bdc_dynpro      using 'SAPMF05A' '0330'.
perform bdc_field       using 'BDC_CURSOR'
                              'BSEG-HBKID'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'BSEG-HBKID'
                              HBKID_020.
perform bdc_field       using 'BSEG-HKTID'
                              HKTID_021.
perform bdc_dynpro      using 'SAPMF05A' '0330'.
perform bdc_field       using 'BDC_CURSOR'
                              'BSEG-CCBTC'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'BSEG-HBKID'
                              HBKID_022.
perform bdc_field       using 'BSEG-HKTID'
                              HKTID_023.
perform bdc_dynpro      using 'SAPMF05A' '0330'.
perform bdc_field       using 'BDC_CURSOR'
                              'BSEG-CCBTC'.
perform bdc_field       using 'BDC_OKCODE'
                              '=RW'.
perform bdc_field       using 'BSEG-HBKID'
                              HBKID_024.
perform bdc_field       using 'BSEG-HKTID'
                              HKTID_025.
perform bdc_dynpro      using 'SAPMF05A' '0700'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-NEWBS'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BS'.
perform bdc_dynpro      using 'SAPMF05A' '0700'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05A-NEWBS'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BU'.
perform bdc_transaction tables messtab
using                         'F-53'
                              CTU
                              MODE
                              UPDATE.
if sy-subrc <> 0.
  subrc = sy-subrc.
  exit.
endif.

perform close_group using     CTU.

ENDFUNCTION.


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpayments.fugr.zbdc_vendor_payments_cloud.abap


key: chroma:document
string_value:
FUNCTION zfi_out_payment_post_clear.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(IM_BUKRS) TYPE  BUKRS
*"     VALUE(IM_GJAHR) TYPE  GJAHR
*"     VALUE(IM_BELNR) TYPE  BELNR_D
*"     VALUE(IM_KONKO) TYPE  KONKO
*"     VALUE(IM_WAERS) TYPE  WAERS
*"     VALUE(IM_CLR_TR) TYPE  AUGLV DEFAULT 'AUSGZAHL'
*"     VALUE(IM_HKONT) TYPE  HKONT
*"     VALUE(IM_KURSF) TYPE  KURSF OPTIONAL
*"     VALUE(IM_WRBTR) TYPE  WRBTR
*"     VALUE(IM_VALUT) TYPE  VALUT
*"     VALUE(IM_HBKID) TYPE  HBKID OPTIONAL
*"     VALUE(IM_HKTID) TYPE  HKTID OPTIONAL
*"  EXPORTING
*"     VALUE(EX_BELNR) TYPE  BELNR_D
*"     VALUE(EX_BUKRS) TYPE  BUKRS
*"     VALUE(EX_GJAHR) TYPE  GJAHR
*"  EXCEPTIONS
*"      ERROR_MESSAGE
*"----------------------------------------------------------------------
  DATA:lt_selection_tab TYPE selection_tab_t,
       ls_selection_tab TYPE selection_tab,
       lv_date          TYPE datum,
       lt_open_item_tab TYPE postab_tab,
       ls_open_item_tab TYPE rfops,
       ls_acchd         TYPE acchd,
       ls_accit         TYPE accit,
       ls_acccr         TYPE acccr,
       lt_acchd         TYPE acchd_t,
       lt_accit         TYPE accit_tab,
       lt_acccr         TYPE acccr_tab.

  CONSTANTS: lv_koart TYPE koart VALUE 'K',     "Vendors
             lv_bschl TYPE bschl VALUE '50',    "Credit Entry
             lv_blart TYPE blart VALUE 'KZ'.    "Vendor Payment

  lv_date = sy-datum.

* build up ranges for open item selection
  ls_selection_tab-fieldname = 'BELNR'.
  ls_selection_tab-fieldtype = 'C'.
  ls_selection_tab-fromvalue = im_belnr.
  ls_selection_tab-tovalue = im_belnr.
  APPEND ls_selection_tab TO lt_selection_tab.
  CLEAR ls_selection_tab.

* open item selection
  CALL FUNCTION 'FI_OPEN_ITEMS_SELECT'
    EXPORTING
      i_clr_trans              = im_clr_tr
      i_bukrs                  = im_bukrs
      i_koart                  = lv_koart
      i_konko                  = im_konko
      i_agums                  = ' '
      i_xnops                  = 'X'
      i_waers                  = im_waers
      i_blart                  = lv_blart
      i_wwert                  = lv_date
      i_kursf                  = im_kursf
      i_bldat                  = lv_date
      i_budat                  = lv_date
      it_selection_tab         = lt_selection_tab
    IMPORTING
      et_open_item_tab         = lt_open_item_tab
    EXCEPTIONS
      company_code_missing     = 1
      account_type_missing     = 2
      account_missing          = 3
      currency_key_missing     = 4
      translation_date_missing = 5
      OTHERS                   = 6.

  IF lt_open_item_tab[] IS NOT INITIAL.
    DELETE lt_open_item_tab WHERE belnr NE im_belnr.
*   Condition check for Open Items
    READ TABLE lt_open_item_tab             "Only one record will be in Int tab
          INTO ls_open_item_tab
         INDEX 1.
    IF ls_open_item_tab-blart EQ 'KR' OR
       ls_open_item_tab-blart EQ 'RE'.

* build up (bank) G/L line item
      ls_acchd-awtyp = 'BKPFF'.
      ls_acchd-glvor = 'RFBU'.
      APPEND ls_acchd TO lt_acchd.

      MOVE-CORRESPONDING ls_acchd TO ls_accit.

      ls_accit-posnr = '0000000001'.
      ls_accit-blart = lv_blart.
      ls_accit-bldat = im_valut.    "lv_date.
      ls_accit-budat = im_valut.    "lv_date.
      ls_accit-valut = im_valut.
      ls_accit-bukrs = im_bukrs.
*      ls_accit-wwert = im_valut.    "lv_date.

      ls_accit-bschl = lv_bschl.
      ls_accit-hkont = im_hkont.

      IF im_hbkid IS NOT INITIAL AND im_hktid IS NOT INITIAL.
        ls_accit-hbkid = im_hbkid.
        ls_accit-hktid = im_hktid.
      ENDIF.


* determine account type and debit/credit indicator
      CALL FUNCTION 'FI_POSTING_KEY_DATA'
        EXPORTING
          i_bschl = ls_accit-bschl
        IMPORTING
          e_koart = ls_accit-koart
          e_shkzg = ls_accit-shkzg.

      APPEND ls_accit TO lt_accit.
      MOVE-CORRESPONDING ls_accit TO ls_acccr.

      ls_acccr-curtp = '00'.
      ls_acccr-waers = im_waers.
      ls_acccr-wrbtr = im_wrbtr.
      IF ls_accit-shkzg = 'H'.
        ls_acccr-wrbtr = - ls_acccr-wrbtr.
      ENDIF.
      ls_acccr-kursf = im_kursf.

      APPEND ls_acccr TO lt_acccr.

* (bank) G/L line item check and enrichment
      CALL FUNCTION 'FI_LINE_ITEM_CHECK'
        TABLES
          t_acchd = lt_acchd
          t_accit = lt_accit
          t_acccr = lt_acccr.

* post payment/clearing document
      CALL FUNCTION 'FI_DOCUMENT_GENERATE_AND_CLEAR'
        EXPORTING
          i_clr_trans      = im_clr_tr
          it_open_item_tab = lt_open_item_tab
        IMPORTING
          e_belnr          = ex_belnr
          e_bukrs          = ex_bukrs
          e_gjahr          = ex_gjahr
        CHANGING
          ct_acchd         = lt_acchd
          ct_accit         = lt_accit
          ct_acccr         = lt_acccr.
      IF ex_belnr IS NOT INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = abap_true.
      ENDIF.
    ENDIF.
  ENDIF.


ENDFUNCTION.


key: source
string_value:
C:\Users\SamuelLAMBERT\Downloads\ZDPR_PAYMENTS_20260519_094657\src\zfgpayments.fugr.zfi_out_payment_post_clear.abap


key: chroma:document
string_value:
FORM send_mail.
NEW-LINE.
WRITE : 'End time' ,sy-uzeit.
****************************************  End of main prgm

FORM send_mail.
*  ********send a mail about activity start***********
*** Header
  DATA : wa_header TYPE sodocchgi1.

*** Contents Data
  DATA : it_content   TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0,
         wa_content   TYPE solisti1,
*** Receivers Data
         it_receivers TYPE STANDARD TABLE OF somlreci1 INITIAL SIZE 0,
         wa_receivers TYPE somlreci1,
         it_para      TYPE STANDARD TABLE OF soparai1 INITIAL SIZE 0,
         wa_para      TYPE soparai1,
         lv_date      TYPE c LENGTH 10.
  WRITE for_date TO lv_date .

  CONCATENATE 'Vendor Payments process for ' lv_date ''  INTO wa_header-obj_descr SEPARATED BY space.
*  WRITE: wa_header-obj_descr.

  IF no_data = 'X' AND sy-batch NE 'X'.
    MESSAGE 'No records to process for the given dates' TYPE 'I'.
*    EXIT.
  ELSEIF no_data NE 'X' AND sy-batch NE 'X'.
    WRITE: wa_header-obj_descr.
  ENDIF.

  WRITE : lv_count TO lv_count_char.
  WRITE : openitem_count TO openitem_count_char.
  WRITE : success_rec_count TO success_rec_count_char.
  WRITE : failed_rec_count TO failed_rec_count_char.

  wa_header-obj_prio = 1.
  wa_header-priority = 1.
  wa_header-obj_langu = sy-langu.

  APPEND 'Hello Team,' TO it_content.
  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.
  CONCATENATE: 'This email serves to notify that' 'Venddor Payments process was executed for  ' lv_date '.' INTO wa_content SEPARATED BY space.
  APPEND wa_content TO it_content.
  WRITE: wa_content.

  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.
  CONCATENATE:  lv_count_char 'openitems found.' openitem_count_char 'open items to be processed today ' lv_date INTO wa_content SEPARATED BY space.
  APPEND wa_content TO it_content.
  WRITE: wa_content.

  DATA : succ_doc_count       TYPE i,
         succ_doc_count_char  TYPE c LENGTH 5 VALUE IS INITIAL,
         error_doc_count      TYPE i,
         error_doc_count_char TYPE c LENGTH 5 VALUE IS INITIAL.

  CLEAR : ls_paymentslog,lt_paymentslog_temp.

**** check errorful records.
  MOVE-CORRESPONDING lt_paymentslog TO lt_paymentslog_temp.
  DELETE lt_paymentslog_temp WHERE status NE 'E'.
  LOOP AT lt_paymentslog_temp INTO ls_paymentslog.
    APPEND '<br>' TO it_content.
    CONCATENATE ls_paymentslog-status_desc '' INTO wa_content SEPARATED BY space.
    APPEND wa_content TO it_content.
    IF sy-batch NE 'X'.
      NEW-LINE.
      WRITE ls_paymentslog-status_desc.
    ENDIF.
    error_doc_count = error_doc_count + 1.  " this loop itself is only on Success docs as no
  ENDLOOP.

****check success records.
  CLEAR : ls_paymentslog.
  DELETE lt_paymentslog WHERE status NE 'S'.
  SORT lt_paymentslog BY documentno.
  DELETE ADJACENT DUPLICATES FROM lt_paymentslog COMPARING documentno.
  LOOP AT lt_paymentslog INTO ls_paymentslog.
    APPEND '<br>' TO it_content.
    CONCATENATE ls_paymentslog-status_desc '' INTO wa_content SEPARATED BY space.
    APPEND wa_content TO it_content.
    IF sy-batch NE 'X'.
      NEW-LINE.
      WRITE ls_paymentslog-status_desc.
    ENDIF.
    succ_doc_count = succ_doc_count + 1.  " this loop itself is only on Success docs as no
  ENDLOOP.

  WRITE :error_doc_count TO error_doc_count_char.
  WRITE : succ_doc_count TO succ_doc_count_char.

  APPEND '<br>' TO it_content.
  CONCATENATE:  success_rec_count_char 'open items cleared in ' succ_doc_count_char 'accounting documents that are generated above.'  INTO wa_content SEPARATED BY space.
  APPEND wa_content TO it_content.
  IF sy-batch NE 'X'.
    WRITE : wa_content.
  ENDIF.
  APPEND '<br>' TO it_content.

  IF failed_rec_count NE 0.
    APPEND '<br>' TO it_content.
    CONCATENATE:  failed_rec_count_char 'were not processed from ' openitem_count_char 'openitems.'  INTO wa_content SEPARATED BY space.
    APPEND wa_content TO it_content.
    IF sy-batch NE 'X'.
      WRITE : wa_content.
    ENDIF.
    APPEND '<br>' TO it_content.
  ENDIF.

  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.

*CONCATENATE: 'Execution Start time' c_starttime INTO wa_content SEPARATED BY space.
*APPEND wa_content TO it_content.
*APPEND '<br>' TO it_content.
*APPEND '<br>' TO it_content.

  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.

  APPEND 'Regards,' TO it_content.
  APPEND '<br>' TO it_content.
  APPEND 'Workflow System.' TO it_content.
  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.

*  wa_receivers-receiver = 'h.a@sap.com'.
*  wa_receivers-rec_type = 'U'.
*  wa_receivers-com_type = 'INT'.
*  APPEND wa_receivers TO it_receivers.
*  CLEAR: wa_receivers.

  wa_receivers-receiver = sy-uname.
  wa_receivers-rec_type = 'B'.
*  wa_receivers-com_type = 'INT'. '' = sap pffice internal
  APPEND wa_receivers TO it_receivers.
  CLEAR: wa_receivers.

  IF no_data = 'X'.
    DELETE it_receivers WHERE receiver NE '_SAPI065658' AND receiver NE '_SAPS4MODEL' AND receiver NE 'h.a@sap.com'.
  ENDIF.
  IF it_receivers[] IS NOT INITIAL AND no_data NE 'X'.
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
      EXPORTING
        document_data  = wa_header
        document_type  = 'HTM'
        commit_work    = 'X'
      TABLES
        object_content = it_content
        object_para    = it_para
        receivers      = it_receivers.
  ENDIF.
**********************End of mail sending************
ENDFORM.


key: chroma:document
string_value:
FORM send_mail.
NEW-LINE.
WRITE : 'End time' ,sy-uzeit.
****************************************  End of main prgm

FORM send_mail.
*  ********send a mail about activity start***********
*** Header
  DATA : wa_header TYPE sodocchgi1.

*** Contents Data
  DATA : it_content   TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0,
         wa_content   TYPE solisti1,
*** Receivers Data
         it_receivers TYPE STANDARD TABLE OF somlreci1 INITIAL SIZE 0,
         wa_receivers TYPE somlreci1,
         it_para      TYPE STANDARD TABLE OF soparai1 INITIAL SIZE 0,
         wa_para      TYPE soparai1,
         lv_date      TYPE c LENGTH 10.
  WRITE for_date TO lv_date .

  CONCATENATE 'Vendor Payments process for ' lv_date ''  INTO wa_header-obj_descr SEPARATED BY space.
*  WRITE: wa_header-obj_descr.

  IF no_data = 'X' AND sy-batch NE 'X'.
    MESSAGE 'No records to process for the given dates' TYPE 'I'.
*    EXIT.
  ELSEIF no_data NE 'X' AND sy-batch NE 'X'.
    WRITE: wa_header-obj_descr.
  ENDIF.


  WRITE : lv_count TO lv_count_char.
  WRITE : openitem_count TO openitem_count_char.
  WRITE : success_rec_count TO success_rec_count_char.
  WRITE : failed_rec_count TO failed_rec_count_char.

  wa_header-obj_prio = 1.
  wa_header-priority = 1.
  wa_header-obj_langu = sy-langu.


  APPEND 'Hello Team,' TO it_content.

  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.
  CONCATENATE: 'This email serves to notify that' 'Venddor Payments process was executed for  ' lv_date '.' INTO wa_content SEPARATED BY space.
  APPEND wa_content TO it_content.
  WRITE: wa_content.

  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.
  CONCATENATE:  lv_count_char 'openitems found.' openitem_count_char 'open items to be processed today ' lv_date INTO wa_content SEPARATED BY space.
  APPEND wa_content TO it_content.
  WRITE: wa_content.

  DATA : succ_doc_count       TYPE i,
         succ_doc_count_char  TYPE c LENGTH 5 VALUE IS INITIAL,
         error_doc_count      TYPE i,
         error_doc_count_char TYPE c LENGTH 5 VALUE IS INITIAL.

  CLEAR : ls_paymentslog,lt_paymentslog_temp.

**** check errorful records.
  MOVE-CORRESPONDING lt_paymentslog TO lt_paymentslog_temp.
  DELETE lt_paymentslog_temp WHERE status NE 'E'.
  LOOP AT lt_paymentslog_temp INTO ls_paymentslog.
    APPEND '<br>' TO it_content.
    CONCATENATE ls_paymentslog-status_desc '' INTO wa_content SEPARATED BY space.
    APPEND wa_content TO it_content.
    IF sy-batch NE 'X'.
      NEW-LINE.
      WRITE ls_paymentslog-status_desc.
    ENDIF.
    error_doc_count = error_doc_count + 1.  " this loop itself is only on Success docs as no
  ENDLOOP.

****check success records.
  CLEAR : ls_paymentslog.
  DELETE lt_paymentslog WHERE status NE 'S'.
  SORT lt_paymentslog BY documentno.
  DELETE ADJACENT DUPLICATES FROM lt_paymentslog COMPARING documentno.
  LOOP AT lt_paymentslog INTO ls_paymentslog.
    APPEND '<br>' TO it_content.
    CONCATENATE ls_paymentslog-status_desc '' INTO wa_content SEPARATED BY space.
    APPEND wa_content TO it_content.
    IF sy-batch NE 'X'.
      NEW-LINE.
      WRITE ls_paymentslog-status_desc.
    ENDIF.
    succ_doc_count = succ_doc_count + 1.  " this loop itself is only on Success docs as no
  ENDLOOP.

  WRITE :error_doc_count TO error_doc_count_char.
  WRITE : succ_doc_count TO succ_doc_count_char.

  APPEND '<br>' TO it_content.
  CONCATENATE:  success_rec_count_char 'open items cleared in ' succ_doc_count_char 'accounting documents that are generated above.'  INTO wa_content SEPARATED BY space.
  APPEND wa_content TO it_content.
  IF sy-batch NE 'X'.
    WRITE : wa_content.
  ENDIF.
  APPEND '<br>' TO it_content.

  IF failed_rec_count NE 0.
    APPEND '<br>' TO it_content.
    CONCATENATE:  failed_rec_count_char 'were not processed from ' openitem_count_char 'openitems.'  INTO wa_content SEPARATED BY space.
    APPEND wa_content TO it_content.
    IF sy-batch NE 'X'.
      WRITE : wa_content.
    ENDIF.
    APPEND '<br>' TO it_content.
  ENDIF.

  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.

*CONCATENATE: 'Execution Start time' c_starttime INTO wa_content SEPARATED BY space.
*APPEND wa_content TO it_content.
*APPEND '<br>' TO it_content.
*APPEND '<br>' TO it_content.

  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.

  APPEND 'Regards,' TO it_content.
  APPEND '<br>' TO it_content.
  APPEND 'Workflow System.' TO it_content.
  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.
  APPEND '<br>' TO it_content.


*  wa_receivers-receiver = 'h.a@sap.com'. "'COMM_MAN@mail.cl1.sap.biz'.
*  wa_receivers-rec_type = 'U'.
*  wa_receivers-com_type = 'INT'.
*  APPEND wa_receivers TO it_receivers.
*  CLEAR: wa_receivers.

  wa_receivers-receiver = sy-uname.
  wa_receivers-rec_type = 'B'.
*  wa_receivers-com_type = 'INT'. '' = sap pffice internal
  APPEND wa_receivers TO it_receivers.
  CLEAR: wa_receivers.

  IF no_data = 'X'.
    DELETE it_receivers WHERE receiver NE '_SAPI065658' AND receiver NE '_SAPS4MODEL' AND receiver NE 'h.a@sap.com'.
  ENDIF.

*  sy-uname  = 'S4MODEL'."'WF-BATCH' .


  IF it_receivers[] IS NOT INITIAL AND no_data NE 'X'.
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
      EXPORTING
        document_data  = wa_header
        document_type  = 'HTM'
        commit_work    = 'X'
      TABLES
        object_content = it_content
        object_para    = it_para
        receivers      = it_receivers.
  ENDIF.
**********************End of mail sending************
ENDFORM.


# embeddings_queue

created_at: 2026-06-23 12:08:48
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 5c62fc65-7230-483d-88a8-46b827e12961
encoding: FLOAT32
metadata:
{"source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpaymentrules.fugr.lzfgpaymentrulesf00.abap","chroma:document":"*---------------------------------------------------------------------*\n*    view related FORM routines\n*---------------------------------------------------------------------*\n\n* base table related FORM-routines.............\nINCLUDE LSVIMFTX .\n","filename":"zfgpaymentrules.fugr.lzfgpaymentrulesf00.abap"}


created_at: 2026-06-23 12:08:48
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 50bc4462-6081-4aad-862c-73032b876027
encoding: FLOAT32
metadata:
{"filename":"zfgpaymentrules.fugr.lzfgpaymentrulesi00.abap","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpaymentrules.fugr.lzfgpaymentrulesi00.abap","chroma:document":"*---------------------------------------------------------------------*\n*    view related PAI modules\n*---------------------------------------------------------------------*\n\nINCLUDE LSVIMITX . \"base table related PAI modules\n"}


created_at: 2026-06-23 12:08:48
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 2ca46dd8-6e9f-4975-b63f-1d3322fda5a3
encoding: FLOAT32
metadata:
{"source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpaymentrules.fugr.lzfgpaymentrulest00.abap","chroma:document":"*---------------------------------------------------------------------*\n*    view related data declarations\n*---------------------------------------------------------------------*\n*...processing: ZPAYMENTRULES...................................*\nDATA:  BEGIN OF STATUS_ZPAYMENTRULES                 .   \"state vector\n         INCLUDE STRUCTURE VIMSTATUS.\nDATA:  END OF STATUS_ZPAYMENTRULES                 .\nCONTROLS: TCTRL_ZPAYMENTRULES\n            TYPE TABLEVIEW USING SCREEN '0001'.\n*.........table declarations:.................................*\nTABLES: *ZPAYMENTRULES                 .\nTABLES: ZPAYMENTRULES                  .\n\n* general table data declarations..............\n  INCLUDE LSVIMTDT                                .\n","filename":"zfgpaymentrules.fugr.lzfgpaymentrulest00.abap"}


created_at: 2026-06-23 12:08:48
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: ef0240f2-2479-47ba-a243-ef59a336cf99
encoding: FLOAT32
metadata:
{"chroma:document":"FUNCTION-POOL ZFGPAYMENTRULES            MESSAGE-ID SV.\n\n* INCLUDE LZFGPAYMENTRULESD...               \" Local class definition\n  INCLUDE LSVIMDAT                                . \"general data decl.\n  INCLUDE LZFGPAYMENTRULEST00                     . \"view rel. data dcl.\n","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpaymentrules.fugr.lzfgpaymentrulestop.abap","filename":"zfgpaymentrules.fugr.lzfgpaymentrulestop.abap"}


created_at: 2026-06-23 12:08:48
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 3de65b8b-9fe4-4671-8b30-c209b848fb08
encoding: FLOAT32
metadata:
{"chroma:document":"*******************************************************************\n*   System-defined Include-files.                                 *\n*******************************************************************\n  INCLUDE LZFGPAYMENTRULESTOP.               \" Global Declarations\n  INCLUDE LZFGPAYMENTRULESUXX.               \" Function Modules\n\n*******************************************************************\n*   User-defined Include-files (if necessary).                    *\n*******************************************************************\n* INCLUDE LZFGPAYMENTRULESF...               \" Subroutines\n* INCLUDE LZFGPAYMENTRULESO...               \" PBO-Modules\n* INCLUDE LZFGPAYMENTRULESI...               \" PAI-Modules\n* INCLUDE LZFGPAYMENTRULESE...               \" Events\n* INCLUDE LZFGPAYMENTRULESP...               \" Local class implement.\n* INCLUDE LZFGPAYMENTRULEST99.               \" ABAP Unit tests\n  INCLUDE LZFGPAYMENTRULESF00                     . \" subprograms\n  INCLUDE LZFGPAYMENTRULESI00                     . \" PAI modules\n  INCLUDE LSVIMFXX                                . \" subprograms\n  INCLUDE LSVIMOXX                                . \" PBO modules\n  INCLUDE LSVIMIXX                                . \" PAI modules\n","filename":"zfgpaymentrules.fugr.saplzfgpaymentrules.abap","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpaymentrules.fugr.saplzfgpaymentrules.abap"}


created_at: 2026-06-23 12:08:49
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: b8cbe0e8-ea40-4a3c-b154-8575957a766a
encoding: FLOAT32
metadata:
{"chroma:document":"PROCESS BEFORE OUTPUT.\n MODULE LISTE_INITIALISIEREN.\n LOOP AT EXTRACT WITH CONTROL\n  TCTRL_ZPAYMENTRULES CURSOR NEXTLINE.\n   MODULE LISTE_SHOW_LISTE.\n ENDLOOP.\n*\nPROCESS AFTER INPUT.\n MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.\n MODULE LISTE_BEFORE_LOOP.\n LOOP AT EXTRACT.\n   MODULE LISTE_INIT_WORKAREA.\n   CHAIN.\n    FIELD ZPAYMENTRULES-LIFNR .\n    FIELD ZPAYMENTRULES-VENDORNAME .\n    FIELD ZPAYMENTRULES-DAYSLATE .\n    FIELD ZPAYMENTRULES-COMMENTS .\n    MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.\n   ENDCHAIN.\n   FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.\n   CHAIN.\n    FIELD ZPAYMENTRULES-LIFNR .\n    MODULE LISTE_UPDATE_LISTE.\n   ENDCHAIN.\n ENDLOOP.\n MODULE LISTE_AFTER_LOOP.\n","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpaymentrules.fugr.screen_0001.abap","filename":"zfgpaymentrules.fugr.screen_0001.abap"}


created_at: 2026-06-23 12:08:49
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: b887510c-0755-487b-954b-ae4d5da12301
encoding: FLOAT32
metadata:
{"filename":"zfgpaymentrules.fugr.tableframe_zfgpaymentrules.abap","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpaymentrules.fugr.tableframe_zfgpaymentrules.abap","chroma:document":"FUNCTION TABLEFRAME_ZFGPAYMENTRULES    .\n\n  PERFORM TABLEFRAME TABLES X_HEADER X_NAMTAB DBA_SELLIST DPL_SELLIST\n                            EXCL_CUA_FUNCT\n                     USING  CORR_NUMBER VIEW_ACTION VIEW_NAME.\n\nENDFUNCTION."}


created_at: 2026-06-23 12:08:49
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 282ff36d-48af-408e-b731-e0d09c465512
encoding: FLOAT32
metadata:
{"filename":"zfgpaymentrules.fugr.tableproc_zfgpaymentrules.abap","chroma:document":"FUNCTION TABLEPROC_ZFGPAYMENTRULES     .\n\n  PERFORM TABLEPROC.\n\nENDFUNCTION.","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpaymentrules.fugr.tableproc_zfgpaymentrules.abap"}


created_at: 2026-06-23 12:08:49
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 51d1cca4-53c3-4cba-826e-07d4090ef8e9
encoding: FLOAT32
metadata:
{"chroma:document":"FUNCTION-POOL ZFGPAYMENTS.                  \"MESSAGE-ID ..\n\n* INCLUDE LZFGPAYMENTSD...                   \" Local class definition\n","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpayments.fugr.lzfgpaymentstop.abap","filename":"zfgpayments.fugr.lzfgpaymentstop.abap"}


created_at: 2026-06-23 12:08:49
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 1e98bb35-af1a-4ee2-8d5b-b30a92bf7a24
encoding: FLOAT32
metadata:
{"filename":"zfgpayments.fugr.saplzfgpayments.abap","chroma:document":"*******************************************************************\n*   System-defined Include-files.                                 *\n*******************************************************************\n  INCLUDE LZFGPAYMENTSTOP.                   \" Global Declarations\n  INCLUDE LZFGPAYMENTSUXX.                   \" Function Modules\n\n*******************************************************************\n*   User-defined Include-files (if necessary).                    *\n*******************************************************************\n* INCLUDE LZFGPAYMENTSF...                   \" Subroutines\n* INCLUDE LZFGPAYMENTSO...                   \" PBO-Modules\n* INCLUDE LZFGPAYMENTSI...                   \" PAI-Modules\n* INCLUDE LZFGPAYMENTSE...                   \" Events\n* INCLUDE LZFGPAYMENTSP...                   \" Local class implement.\n* INCLUDE LZFGPAYMENTST99.                   \" ABAP Unit tests\n","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpayments.fugr.saplzfgpayments.abap"}


created_at: 2026-06-23 12:08:49
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 223e2001-583c-49e4-a20b-7bfd2a98fa26
encoding: FLOAT32
metadata:
{"source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpayments.fugr.zbdc_vendor_payments_cloud.abap","filename":"zfgpayments.fugr.zbdc_vendor_payments_cloud.abap","chroma:document":"FUNCTION ZBDC_VENDOR_PAYMENTS_CLOUD.\n*\"--------------------------------------------------------------------\n*\"*\"Local Interface:\n*\"  IMPORTING\n*\"     VALUE(CTU) LIKE  APQI-PUTACTIVE DEFAULT 'X'\n*\"     VALUE(MODE) LIKE  APQI-PUTACTIVE DEFAULT 'N'\n*\"     VALUE(UPDATE) LIKE  APQI-PUTACTIVE DEFAULT 'L'\n*\"     VALUE(GROUP) LIKE  APQI-GROUPID OPTIONAL\n*\"     VALUE(USER) LIKE  APQI-USERID OPTIONAL\n*\"     VALUE(KEEP) LIKE  APQI-QERASE OPTIONAL\n*\"     VALUE(HOLDDATE) LIKE  APQI-STARTDATE OPTIONAL\n*\"     VALUE(NODATA) LIKE  APQI-PUTACTIVE DEFAULT '/'\n*\"     VALUE(BLDAT_001) LIKE  BDCDATA-FVAL DEFAULT '04/17/2017'\n*\"     VALUE(BLART_002) LIKE  BDCDATA-FVAL DEFAULT 'KZ'\n*\"     VALUE(BUKRS_003) LIKE  BDCDATA-FVAL DEFAULT '1710'\n*\"     VALUE(BUDAT_004) LIKE  BDCDATA-FVAL DEFAULT '04/21/2017'\n*\"     VALUE(MONAT_005) LIKE  BDCDATA-FVAL DEFAULT '4'\n*\"     VALUE(WAERS_006) LIKE  BDCDATA-FVAL DEFAULT 'USD'\n*\"     VALUE(KONTO_007) LIKE  BDCDATA-FVAL DEFAULT '11001000'\n*\"     VALUE(WRBTR_008) LIKE  BDCDATA-FVAL DEFAULT '204182.87'\n*\"     VALUE(VALUT_009) LIKE  BDCDATA-FVAL DEFAULT '04/17/2017'\n*\"     VALUE(AGKON_010) LIKE  BDCDATA-FVAL DEFAULT 'USSU_V8001'\n*\"     VALUE(AGKOA_011) LIKE  BDCDATA-FVAL DEFAULT 'K'\n*\"     VALUE(XNOPS_012) LIKE  BDCDATA-FVAL DEFAULT 'X'\n*\"     VALUE(XPOS1_01_013) LIKE  BDCDATA-FVAL DEFAULT ''\n*\"     VALUE(XPOS1_03_014) LIKE  BDCDATA-FVAL DEFAULT 'X'\n*\"     VALUE(SEL01_01_015) LIKE  BDCDATA-FVAL DEFAULT '5100002254'\n*\"     VALUE(ABPOS_016) LIKE  BDCDATA-FVAL DEFAULT '1'\n*\"     VALUE(WRBTR_017) LIKE  BDCDATA-FVAL DEFAULT '204,182.87'\n*\"     VALUE(VALUT_018) LIKE  BDCDATA-FVAL DEFAULT '04/17/2017'\n*\"     VALUE(FMORE_019) LIKE  BDCDATA-FVAL DEFAULT 'X'\n*\"     VALUE(HBKID_020) LIKE  BDCDATA-FVAL DEFAULT 'USBK1'\n*\"     VALUE(HKTID_021) LIKE  BDCDATA-FVAL DEFAULT 'USAC1'\n*\"     VALUE(HBKID_022) LIKE  BDCDATA-FVAL DEFAULT 'USBK1'\n*\"     VALUE(HKTID_023) LIKE  BDCDATA-FVAL DEFAULT 'USAC1'\n*\"     VALUE(HBKID_024) LIKE  BDCDATA-FVAL DEFAULT 'USBK1'\n*\"     VALUE(HKTID_025) LIKE  BDCDATA-FVAL DEFAULT 'USAC1'\n*\"  EXPORTING\n*\"     VALUE(SUBRC) LIKE  SYST-SUBRC\n*\"  TABLES\n*\"      MESSTAB STRUCTURE  BDCMSGCOLL OPTIONAL\n*\"--------------------------------------------------------------------\n\nsubrc = 0.\n\nperform bdc_nodata      using NODATA.\n\nperform open_group      using GROUP USER KEEP HOLDDATE CTU.\n\nperform bdc_dynpro      using 'SAPMF05A' '0103'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'RF05A-XPOS1(03)'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '=PA'.\nperform bdc_field       using 'BKPF-BLDAT'\n                              BLDAT_001.\nperform bdc_field       using 'BKPF-BLART'\n                              BLART_002.\nperform bdc_field       using 'BKPF-BUKRS'\n                              BUKRS_003.\nperform bdc_field       using 'BKPF-BUDAT'\n                              BUDAT_004.\nperform bdc_field       using 'BKPF-MONAT'\n                              MONAT_005.\nperform bdc_field       using 'BKPF-WAERS'\n                              WAERS_006.\nperform bdc_field       using 'RF05A-KONTO'\n                              KONTO_007.\nperform bdc_field       using 'BSEG-WRBTR'\n                              WRBTR_008.\nperform bdc_field       using 'BSEG-VALUT'\n                              VALUT_009.\nperform bdc_field       using 'RF05A-AGKON'\n                              AGKON_010.\nperform bdc_field       using 'RF05A-AGKOA'\n                              AGKOA_011.\nperform bdc_field       using 'RF05A-XNOPS'\n                              XNOPS_012.\nperform bdc_field       using 'RF05A-XPOS1(01)'\n                              XPOS1_01_013.\nperform bdc_field       using 'RF05A-XPOS1(03)'\n                              XPOS1_03_014.\nperform bdc_dynpro      using 'SAPMF05A' '0731'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'RF05A-SEL01(01)'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '/00'.\nperform bdc_field       using 'RF05A-SEL01(01)'\n                              SEL01_01_015.\nperform bdc_dynpro      using 'SAPMF05A' '0731'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'RF05A-SEL01(01)'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '=PA'.\nperform bdc_dynpro      using 'SAPDF05X' '3100'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '=AB'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'DF05B-PSSKT(01)'.\nperform bdc_field       using 'RF05A-ABPOS'\n                              ABPOS_016.\nperform bdc_dynpro      using 'SAPMF05A' '0700'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'RF05A-AZEI1(01)'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '=PI'.\nperform bdc_dynpro      using 'SAPMF05A' '0300'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'BSEG-WRBTR'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '=ZK'.\nperform bdc_field       using 'BSEG-WRBTR'\n                              WRBTR_017.\nperform bdc_field       using 'BSEG-VALUT'\n                              VALUT_018.\nperform bdc_field       using 'DKACB-FMORE'\n                              FMORE_019.\nperform bdc_dynpro      using 'SAPLKACB' '0002'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'COBL-KOSTL'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '=ENTE'.\nperform bdc_dynpro      using 'SAPMF05A' '0330'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'BSEG-HBKID'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '/00'.\nperform bdc_field       using 'BSEG-HBKID'\n                              HBKID_020.\nperform bdc_field       using 'BSEG-HKTID'\n                              HKTID_021.\nperform bdc_dynpro      using 'SAPMF05A' '0330'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'BSEG-CCBTC'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '/00'.\nperform bdc_field       using 'BSEG-HBKID'\n                              HBKID_022.\nperform bdc_field       using 'BSEG-HKTID'\n                              HKTID_023.\nperform bdc_dynpro      using 'SAPMF05A' '0330'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'BSEG-CCBTC'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '=RW'.\nperform bdc_field       using 'BSEG-HBKID'\n                              HBKID_024.\nperform bdc_field       using 'BSEG-HKTID'\n                              HKTID_025.\nperform bdc_dynpro      using 'SAPMF05A' '0700'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'RF05A-NEWBS'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '=BS'.\nperform bdc_dynpro      using 'SAPMF05A' '0700'.\nperform bdc_field       using 'BDC_CURSOR'\n                              'RF05A-NEWBS'.\nperform bdc_field       using 'BDC_OKCODE'\n                              '=BU'.\nperform bdc_transaction tables messtab\nusing                         'F-53'\n                              CTU\n                              MODE\n                              UPDATE.\nif sy-subrc <> 0.\n  subrc = sy-subrc.\n  exit.\nendif.\n\nperform close_group using     CTU.\n\nENDFUNCTION."}


created_at: 2026-06-23 12:08:49
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 57e9ad55-ee7b-46cb-830a-3f543e13d2d4
encoding: FLOAT32
metadata:
{"chroma:document":"FUNCTION zfi_out_payment_post_clear.\n*\"----------------------------------------------------------------------\n*\"*\"Local Interface:\n*\"  IMPORTING\n*\"     VALUE(IM_BUKRS) TYPE  BUKRS\n*\"     VALUE(IM_GJAHR) TYPE  GJAHR\n*\"     VALUE(IM_BELNR) TYPE  BELNR_D\n*\"     VALUE(IM_KONKO) TYPE  KONKO\n*\"     VALUE(IM_WAERS) TYPE  WAERS\n*\"     VALUE(IM_CLR_TR) TYPE  AUGLV DEFAULT 'AUSGZAHL'\n*\"     VALUE(IM_HKONT) TYPE  HKONT\n*\"     VALUE(IM_KURSF) TYPE  KURSF OPTIONAL\n*\"     VALUE(IM_WRBTR) TYPE  WRBTR\n*\"     VALUE(IM_VALUT) TYPE  VALUT\n*\"     VALUE(IM_HBKID) TYPE  HBKID OPTIONAL\n*\"     VALUE(IM_HKTID) TYPE  HKTID OPTIONAL\n*\"  EXPORTING\n*\"     VALUE(EX_BELNR) TYPE  BELNR_D\n*\"     VALUE(EX_BUKRS) TYPE  BUKRS\n*\"     VALUE(EX_GJAHR) TYPE  GJAHR\n*\"  EXCEPTIONS\n*\"      ERROR_MESSAGE\n*\"----------------------------------------------------------------------\n  DATA:lt_selection_tab TYPE selection_tab_t,\n       ls_selection_tab TYPE selection_tab,\n       lv_date          TYPE datum,\n       lt_open_item_tab TYPE postab_tab,\n       ls_open_item_tab TYPE rfops,\n       ls_acchd         TYPE acchd,\n       ls_accit         TYPE accit,\n       ls_acccr         TYPE acccr,\n       lt_acchd         TYPE acchd_t,\n       lt_accit         TYPE accit_tab,\n       lt_acccr         TYPE acccr_tab.\n\n  CONSTANTS: lv_koart TYPE koart VALUE 'K',     \"Vendors\n             lv_bschl TYPE bschl VALUE '50',    \"Credit Entry\n             lv_blart TYPE blart VALUE 'KZ'.    \"Vendor Payment\n\n  lv_date = sy-datum.\n\n* build up ranges for open item selection\n  ls_selection_tab-fieldname = 'BELNR'.\n  ls_selection_tab-fieldtype = 'C'.\n  ls_selection_tab-fromvalue = im_belnr.\n  ls_selection_tab-tovalue = im_belnr.\n  APPEND ls_selection_tab TO lt_selection_tab.\n  CLEAR ls_selection_tab.\n\n* open item selection\n  CALL FUNCTION 'FI_OPEN_ITEMS_SELECT'\n    EXPORTING\n      i_clr_trans              = im_clr_tr\n      i_bukrs                  = im_bukrs\n      i_koart                  = lv_koart\n      i_konko                  = im_konko\n      i_agums                  = ' '\n      i_xnops                  = 'X'\n      i_waers                  = im_waers\n      i_blart                  = lv_blart\n      i_wwert                  = lv_date\n      i_kursf                  = im_kursf\n      i_bldat                  = lv_date\n      i_budat                  = lv_date\n      it_selection_tab         = lt_selection_tab\n    IMPORTING\n      et_open_item_tab         = lt_open_item_tab\n    EXCEPTIONS\n      company_code_missing     = 1\n      account_type_missing     = 2\n      account_missing          = 3\n      currency_key_missing     = 4\n      translation_date_missing = 5\n      OTHERS                   = 6.\n\n  IF lt_open_item_tab[] IS NOT INITIAL.\n    DELETE lt_open_item_tab WHERE belnr NE im_belnr.\n*   Condition check for Open Items\n    READ TABLE lt_open_item_tab             \"Only one record will be in Int tab\n          INTO ls_open_item_tab\n         INDEX 1.\n    IF ls_open_item_tab-blart EQ 'KR' OR\n       ls_open_item_tab-blart EQ 'RE'.\n\n* build up (bank) G/L line item\n      ls_acchd-awtyp = 'BKPFF'.\n      ls_acchd-glvor = 'RFBU'.\n      APPEND ls_acchd TO lt_acchd.\n\n      MOVE-CORRESPONDING ls_acchd TO ls_accit.\n\n      ls_accit-posnr = '0000000001'.\n      ls_accit-blart = lv_blart.\n      ls_accit-bldat = im_valut.    \"lv_date.\n      ls_accit-budat = im_valut.    \"lv_date.\n      ls_accit-valut = im_valut.\n      ls_accit-bukrs = im_bukrs.\n*      ls_accit-wwert = im_valut.    \"lv_date.\n\n      ls_accit-bschl = lv_bschl.\n      ls_accit-hkont = im_hkont.\n\n      IF im_hbkid IS NOT INITIAL AND im_hktid IS NOT INITIAL.\n        ls_accit-hbkid = im_hbkid.\n        ls_accit-hktid = im_hktid.\n      ENDIF.\n\n\n* determine account type and debit/credit indicator\n      CALL FUNCTION 'FI_POSTING_KEY_DATA'\n        EXPORTING\n          i_bschl = ls_accit-bschl\n        IMPORTING\n          e_koart = ls_accit-koart\n          e_shkzg = ls_accit-shkzg.\n\n      APPEND ls_accit TO lt_accit.\n      MOVE-CORRESPONDING ls_accit TO ls_acccr.\n\n      ls_acccr-curtp = '00'.\n      ls_acccr-waers = im_waers.\n      ls_acccr-wrbtr = im_wrbtr.\n      IF ls_accit-shkzg = 'H'.\n        ls_acccr-wrbtr = - ls_acccr-wrbtr.\n      ENDIF.\n      ls_acccr-kursf = im_kursf.\n\n      APPEND ls_acccr TO lt_acccr.\n\n* (bank) G/L line item check and enrichment\n      CALL FUNCTION 'FI_LINE_ITEM_CHECK'\n        TABLES\n          t_acchd = lt_acchd\n          t_accit = lt_accit\n          t_acccr = lt_acccr.\n\n* post payment/clearing document\n      CALL FUNCTION 'FI_DOCUMENT_GENERATE_AND_CLEAR'\n        EXPORTING\n          i_clr_trans      = im_clr_tr\n          it_open_item_tab = lt_open_item_tab\n        IMPORTING\n          e_belnr          = ex_belnr\n          e_bukrs          = ex_bukrs\n          e_gjahr          = ex_gjahr\n        CHANGING\n          ct_acchd         = lt_acchd\n          ct_accit         = lt_accit\n          ct_acccr         = lt_acccr.\n      IF ex_belnr IS NOT INITIAL.\n        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'\n          EXPORTING\n            wait = abap_true.\n      ENDIF.\n    ENDIF.\n  ENDIF.\n\n\nENDFUNCTION.","filename":"zfgpayments.fugr.zfi_out_payment_post_clear.abap","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zfgpayments.fugr.zfi_out_payment_post_clear.abap"}


created_at: 2026-06-23 12:08:49
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 6062e277-72bd-49f5-af3f-a0e02d548aed
encoding: FLOAT32
metadata:
{"chroma:document":"FORM send_mail.\nNEW-LINE.\nWRITE : 'End time' ,sy-uzeit.\n****************************************  End of main prgm\n\nFORM send_mail.\n*  ********send a mail about activity start***********\n*** Header\n  DATA : wa_header TYPE sodocchgi1.\n\n*** Contents Data\n  DATA : it_content   TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0,\n         wa_content   TYPE solisti1,\n*** Receivers Data\n         it_receivers TYPE STANDARD TABLE OF somlreci1 INITIAL SIZE 0,\n         wa_receivers TYPE somlreci1,\n         it_para      TYPE STANDARD TABLE OF soparai1 INITIAL SIZE 0,\n         wa_para      TYPE soparai1,\n         lv_date      TYPE c LENGTH 10.\n  WRITE for_date TO lv_date .\n\n  CONCATENATE 'Vendor Payments process for ' lv_date ''  INTO wa_header-obj_descr SEPARATED BY space.\n*  WRITE: wa_header-obj_descr.\n\n  IF no_data = 'X' AND sy-batch NE 'X'.\n    MESSAGE 'No records to process for the given dates' TYPE 'I'.\n*    EXIT.\n  ELSEIF no_data NE 'X' AND sy-batch NE 'X'.\n    WRITE: wa_header-obj_descr.\n  ENDIF.\n\n  WRITE : lv_count TO lv_count_char.\n  WRITE : openitem_count TO openitem_count_char.\n  WRITE : success_rec_count TO success_rec_count_char.\n  WRITE : failed_rec_count TO failed_rec_count_char.\n\n  wa_header-obj_prio = 1.\n  wa_header-priority = 1.\n  wa_header-obj_langu = sy-langu.\n\n  APPEND 'Hello Team,' TO it_content.\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n  CONCATENATE: 'This email serves to notify that' 'Venddor Payments process was executed for  ' lv_date '.' INTO wa_content SEPARATED BY space.\n  APPEND wa_content TO it_content.\n  WRITE: wa_content.\n\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n  CONCATENATE:  lv_count_char 'openitems found.' openitem_count_char 'open items to be processed today ' lv_date INTO wa_content SEPARATED BY space.\n  APPEND wa_content TO it_content.\n  WRITE: wa_content.\n\n  DATA : succ_doc_count       TYPE i,\n         succ_doc_count_char  TYPE c LENGTH 5 VALUE IS INITIAL,\n         error_doc_count      TYPE i,\n         error_doc_count_char TYPE c LENGTH 5 VALUE IS INITIAL.\n\n  CLEAR : ls_paymentslog,lt_paymentslog_temp.\n\n**** check errorful records.\n  MOVE-CORRESPONDING lt_paymentslog TO lt_paymentslog_temp.\n  DELETE lt_paymentslog_temp WHERE status NE 'E'.\n  LOOP AT lt_paymentslog_temp INTO ls_paymentslog.\n    APPEND '<br>' TO it_content.\n    CONCATENATE ls_paymentslog-status_desc '' INTO wa_content SEPARATED BY space.\n    APPEND wa_content TO it_content.\n    IF sy-batch NE 'X'.\n      NEW-LINE.\n      WRITE ls_paymentslog-status_desc.\n    ENDIF.\n    error_doc_count = error_doc_count + 1.  \" this loop itself is only on Success docs as no\n  ENDLOOP.\n\n****check success records.\n  CLEAR : ls_paymentslog.\n  DELETE lt_paymentslog WHERE status NE 'S'.\n  SORT lt_paymentslog BY documentno.\n  DELETE ADJACENT DUPLICATES FROM lt_paymentslog COMPARING documentno.\n  LOOP AT lt_paymentslog INTO ls_paymentslog.\n    APPEND '<br>' TO it_content.\n    CONCATENATE ls_paymentslog-status_desc '' INTO wa_content SEPARATED BY space.\n    APPEND wa_content TO it_content.\n    IF sy-batch NE 'X'.\n      NEW-LINE.\n      WRITE ls_paymentslog-status_desc.\n    ENDIF.\n    succ_doc_count = succ_doc_count + 1.  \" this loop itself is only on Success docs as no\n  ENDLOOP.\n\n  WRITE :error_doc_count TO error_doc_count_char.\n  WRITE : succ_doc_count TO succ_doc_count_char.\n\n  APPEND '<br>' TO it_content.\n  CONCATENATE:  success_rec_count_char 'open items cleared in ' succ_doc_count_char 'accounting documents that are generated above.'  INTO wa_content SEPARATED BY space.\n  APPEND wa_content TO it_content.\n  IF sy-batch NE 'X'.\n    WRITE : wa_content.\n  ENDIF.\n  APPEND '<br>' TO it_content.\n\n  IF failed_rec_count NE 0.\n    APPEND '<br>' TO it_content.\n    CONCATENATE:  failed_rec_count_char 'were not processed from ' openitem_count_char 'openitems.'  INTO wa_content SEPARATED BY space.\n    APPEND wa_content TO it_content.\n    IF sy-batch NE 'X'.\n      WRITE : wa_content.\n    ENDIF.\n    APPEND '<br>' TO it_content.\n  ENDIF.\n\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n\n*CONCATENATE: 'Execution Start time' c_starttime INTO wa_content SEPARATED BY space.\n*APPEND wa_content TO it_content.\n*APPEND '<br>' TO it_content.\n*APPEND '<br>' TO it_content.\n\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n\n  APPEND 'Regards,' TO it_content.\n  APPEND '<br>' TO it_content.\n  APPEND 'Workflow System.' TO it_content.\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n\n*  wa_receivers-receiver = 'h.a@sap.com'.\n*  wa_receivers-rec_type = 'U'.\n*  wa_receivers-com_type = 'INT'.\n*  APPEND wa_receivers TO it_receivers.\n*  CLEAR: wa_receivers.\n\n  wa_receivers-receiver = sy-uname.\n  wa_receivers-rec_type = 'B'.\n*  wa_receivers-com_type = 'INT'. '' = sap pffice internal\n  APPEND wa_receivers TO it_receivers.\n  CLEAR: wa_receivers.\n\n  IF no_data = 'X'.\n    DELETE it_receivers WHERE receiver NE '_SAPI065658' AND receiver NE '_SAPS4MODEL' AND receiver NE 'h.a@sap.com'.\n  ENDIF.\n  IF it_receivers[] IS NOT INITIAL AND no_data NE 'X'.\n    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'\n      EXPORTING\n        document_data  = wa_header\n        document_type  = 'HTM'\n        commit_work    = 'X'\n      TABLES\n        object_content = it_content\n        object_para    = it_para\n        receivers      = it_receivers.\n  ENDIF.\n**********************End of mail sending************\nENDFORM.","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zpayments.prog.abap","filename":"zpayments.prog.abap"}


created_at: 2026-06-23 12:08:49
topic: persistent://default/default/f3e327e3-e8c8-4a37-9788-969e4be749a9
id: 06a886e7-12e5-49f5-bd0f-e7692644be83
encoding: FLOAT32
metadata:
{"chroma:document":"FORM send_mail.\nNEW-LINE.\nWRITE : 'End time' ,sy-uzeit.\n****************************************  End of main prgm\n\nFORM send_mail.\n*  ********send a mail about activity start***********\n*** Header\n  DATA : wa_header TYPE sodocchgi1.\n\n*** Contents Data\n  DATA : it_content   TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0,\n         wa_content   TYPE solisti1,\n*** Receivers Data\n         it_receivers TYPE STANDARD TABLE OF somlreci1 INITIAL SIZE 0,\n         wa_receivers TYPE somlreci1,\n         it_para      TYPE STANDARD TABLE OF soparai1 INITIAL SIZE 0,\n         wa_para      TYPE soparai1,\n         lv_date      TYPE c LENGTH 10.\n  WRITE for_date TO lv_date .\n\n  CONCATENATE 'Vendor Payments process for ' lv_date ''  INTO wa_header-obj_descr SEPARATED BY space.\n*  WRITE: wa_header-obj_descr.\n\n  IF no_data = 'X' AND sy-batch NE 'X'.\n    MESSAGE 'No records to process for the given dates' TYPE 'I'.\n*    EXIT.\n  ELSEIF no_data NE 'X' AND sy-batch NE 'X'.\n    WRITE: wa_header-obj_descr.\n  ENDIF.\n\n\n  WRITE : lv_count TO lv_count_char.\n  WRITE : openitem_count TO openitem_count_char.\n  WRITE : success_rec_count TO success_rec_count_char.\n  WRITE : failed_rec_count TO failed_rec_count_char.\n\n  wa_header-obj_prio = 1.\n  wa_header-priority = 1.\n  wa_header-obj_langu = sy-langu.\n\n\n  APPEND 'Hello Team,' TO it_content.\n\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n  CONCATENATE: 'This email serves to notify that' 'Venddor Payments process was executed for  ' lv_date '.' INTO wa_content SEPARATED BY space.\n  APPEND wa_content TO it_content.\n  WRITE: wa_content.\n\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n  CONCATENATE:  lv_count_char 'openitems found.' openitem_count_char 'open items to be processed today ' lv_date INTO wa_content SEPARATED BY space.\n  APPEND wa_content TO it_content.\n  WRITE: wa_content.\n\n  DATA : succ_doc_count       TYPE i,\n         succ_doc_count_char  TYPE c LENGTH 5 VALUE IS INITIAL,\n         error_doc_count      TYPE i,\n         error_doc_count_char TYPE c LENGTH 5 VALUE IS INITIAL.\n\n  CLEAR : ls_paymentslog,lt_paymentslog_temp.\n\n**** check errorful records.\n  MOVE-CORRESPONDING lt_paymentslog TO lt_paymentslog_temp.\n  DELETE lt_paymentslog_temp WHERE status NE 'E'.\n  LOOP AT lt_paymentslog_temp INTO ls_paymentslog.\n    APPEND '<br>' TO it_content.\n    CONCATENATE ls_paymentslog-status_desc '' INTO wa_content SEPARATED BY space.\n    APPEND wa_content TO it_content.\n    IF sy-batch NE 'X'.\n      NEW-LINE.\n      WRITE ls_paymentslog-status_desc.\n    ENDIF.\n    error_doc_count = error_doc_count + 1.  \" this loop itself is only on Success docs as no\n  ENDLOOP.\n\n****check success records.\n  CLEAR : ls_paymentslog.\n  DELETE lt_paymentslog WHERE status NE 'S'.\n  SORT lt_paymentslog BY documentno.\n  DELETE ADJACENT DUPLICATES FROM lt_paymentslog COMPARING documentno.\n  LOOP AT lt_paymentslog INTO ls_paymentslog.\n    APPEND '<br>' TO it_content.\n    CONCATENATE ls_paymentslog-status_desc '' INTO wa_content SEPARATED BY space.\n    APPEND wa_content TO it_content.\n    IF sy-batch NE 'X'.\n      NEW-LINE.\n      WRITE ls_paymentslog-status_desc.\n    ENDIF.\n    succ_doc_count = succ_doc_count + 1.  \" this loop itself is only on Success docs as no\n  ENDLOOP.\n\n  WRITE :error_doc_count TO error_doc_count_char.\n  WRITE : succ_doc_count TO succ_doc_count_char.\n\n  APPEND '<br>' TO it_content.\n  CONCATENATE:  success_rec_count_char 'open items cleared in ' succ_doc_count_char 'accounting documents that are generated above.'  INTO wa_content SEPARATED BY space.\n  APPEND wa_content TO it_content.\n  IF sy-batch NE 'X'.\n    WRITE : wa_content.\n  ENDIF.\n  APPEND '<br>' TO it_content.\n\n  IF failed_rec_count NE 0.\n    APPEND '<br>' TO it_content.\n    CONCATENATE:  failed_rec_count_char 'were not processed from ' openitem_count_char 'openitems.'  INTO wa_content SEPARATED BY space.\n    APPEND wa_content TO it_content.\n    IF sy-batch NE 'X'.\n      WRITE : wa_content.\n    ENDIF.\n    APPEND '<br>' TO it_content.\n  ENDIF.\n\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n\n*CONCATENATE: 'Execution Start time' c_starttime INTO wa_content SEPARATED BY space.\n*APPEND wa_content TO it_content.\n*APPEND '<br>' TO it_content.\n*APPEND '<br>' TO it_content.\n\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n\n  APPEND 'Regards,' TO it_content.\n  APPEND '<br>' TO it_content.\n  APPEND 'Workflow System.' TO it_content.\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n  APPEND '<br>' TO it_content.\n\n\n*  wa_receivers-receiver = 'h.a@sap.com'. \"'COMM_MAN@mail.cl1.sap.biz'.\n*  wa_receivers-rec_type = 'U'.\n*  wa_receivers-com_type = 'INT'.\n*  APPEND wa_receivers TO it_receivers.\n*  CLEAR: wa_receivers.\n\n  wa_receivers-receiver = sy-uname.\n  wa_receivers-rec_type = 'B'.\n*  wa_receivers-com_type = 'INT'. '' = sap pffice internal\n  APPEND wa_receivers TO it_receivers.\n  CLEAR: wa_receivers.\n\n  IF no_data = 'X'.\n    DELETE it_receivers WHERE receiver NE '_SAPI065658' AND receiver NE '_SAPS4MODEL' AND receiver NE 'h.a@sap.com'.\n  ENDIF.\n\n*  sy-uname  = 'S4MODEL'.\"'WF-BATCH' .\n\n\n  IF it_receivers[] IS NOT INITIAL AND no_data NE 'X'.\n    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'\n      EXPORTING\n        document_data  = wa_header\n        document_type  = 'HTM'\n        commit_work    = 'X'\n      TABLES\n        object_content = it_content\n        object_para    = it_para\n        receivers      = it_receivers.\n  ENDIF.\n**********************End of mail sending************\nENDFORM.","source":"C:\\Users\\SamuelLAMBERT\\Downloads\\ZDPR_PAYMENTS_20260519_094657\\src\\zpayments_old.prog.abap","filename":"zpayments_old.prog.abap"}


