Ansicht
Dokumentation

EXIT_SAPLFBQ1_001 - User Exit after Segment Processing IDoc

EXIT_SAPLFBQ1_001 - User Exit after Segment Processing IDoc

Vendor Master (General Section)   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

You are using the IHC module. The PAYRQ table is too restrictive to pass remittance data generated in the subsidiary from IHC to the FI system. The table PAYRQT can be used in the FI system for this purpose but because it is not structured, you would rather have your own remittance data table. This customer-specific table must be created in the FI system. In addition to the following three compulsory key fields:

MANDT,,( LIKE MANDT)

KEYNO,,(LIKE PRQ_KEYNO)

TEXTNO,,(LIKE FIBL_COUNT),

the table must also contain the other fields of your choice, for example NAME1, BELNR, XBLNR, BLDAT, PARTN, RWBTR, WAERS, WRBTR, SKNTO, WMWST, and QBSHB.

In IHC the internal table t_payrqt (filled in this user-exit) is used to send the remittance data to the FI system via BAPI(function module 'BAPI_PAYMENTREQUEST_CREATE'). Refer to section 'EXAMPLE' below for possible sample coding.

In the second user-exit in function module 'FI_BL_PRQ_POST' in FI which is called when the PAYRQ is being posted(function module 'BAPI_PAYMENTREQUEST_CREATE'), the internal table t_payrqt is converted into your customer-specific table (see section 'HINTS' below for the corresponding sample coding).

In addition, the customer can also use this user-exit for other purposes by simply appending the customer coding to the existing one for remittance data.

Activate both the function module and its entire project.

Example

In the IHC system you use this user-exit function module initially to build an internal table t_remittance to include the following:

1- the segment's name from the idoc

2- the segment name which must always have the appendix _DATA

3- whether it is a header or an item segment ('H' = header, 'I' = ITEM)

4- the name of the qualifier field

5- the value in the qualifier field

6- the field from which the value will be inserted in your specific table

7- the name of the corresponding field in your specific table, in this example ZPAYRQS.

Here is an example of how to fill the internal table t_remittance. Supposing you want the value from the field NAME1 in segment E1EDKA1 which has the qualifier field PARVW = 'AG' to be inserted into ZPAYRQS-NAME1, then the internal table t_remittance has to be filled as follows:

T_REMITTANCE-SEGnam = 'E1EDKA1'.

T_REMITTANCE-Sdata = 'E1EDKA1_DATA'.

T_REMITTANCE-HD_ITEM = 'H'.

T_REMITTANCE-Q_FIELD = 'PARVW'.

T_REMITTANCE-QUALF = 'AG'.

T_REMITTANCE-FIELD = 'NAME1'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-NAME1'.

APPEND T_REMITTANCE,

This has then to be repeated for the all other values required in your specific table ZPAYRQS.

Whenever an idoc's segment fullfils the requirements in t_remittance, the t_remittance-new_field and its real value from the idoc's segment are packed into the field text in t_payrqt.

Below is sample coding of how to pack NAME1, BELNR, XBLNR, BLDAT, PARTN, RWBTR, WAERS, WRBTR, SKNTO, WMWST, and QBSHB (the fields of ZPAYRQS in the FI system) plus their corresponding values into t_payrqt. See section 'HINTS' on how to unpack them into ZPAYRQS once t_payrqt reaches the FI system.

*----------------------------------------------------------------------*

* FUNCTION EXIT_SAPLFBQ1_001 in FBQ1

*---- --------------- coding for ZXBKKU01 -----------------------------*

* Segmentdata

DATA: E1IDKU1_DATA LIKE E1IDKU1,

E1IDKU2_DATA LIKE E1IDKU2,

E1IDKU3_DATA LIKE E1IDKU3,

E1IDKU4_DATA LIKE E1IDKU4,

E1IDKU5_DATA LIKE E1IDKU5,

E1IDLU5_DATA LIKE E1IDLU5,

E1IDMU5_DATA LIKE E1IDMU5,

E1IDKU6_DATA LIKE E1IDKU6,

E1IDKU7_DATA LIKE E1IDKU7,

E1IDPU1_DATA LIKE E1IDPU1,

E1IDPU2_DATA LIKE E1IDPU2,

E1IDPU3_DATA LIKE E1IDPU3,

E1IDPU5_DATA LIKE E1IDPU5,

E1IDUU2_DATA LIKE E1IDUU2,

E1IDUU4_DATA LIKE E1IDUU4,

E1IDUU5_DATA LIKE E1IDUU5,

E1EDU03_DATA LIKE E1EDU03,

E1IDBW1_DATA LIKE E1IDBW1,

E1IDB02_DATA LIKE E1IDB02,

E1IDBL2_DATA LIKE E1IDBL2,

E1EDK02_DATA LIKE E1EDK02,

E1EDK12_DATA LIKE E1EDK12,

E1EDK03_DATA LIKE E1EDK03,

E1EDL02_DATA LIKE E1EDL02,

E1EDL03_DATA LIKE E1EDL03,

E1EDM03_DATA LIKE E1EDM03,

E1EDV03_DATA LIKE E1EDV03,

E1EDW03_DATA LIKE E1EDW03,

E1EDP02_DATA LIKE E1EDP02,

E1EDP03_DATA LIKE E1EDP03,

E1IDT01_DATA LIKE E1IDT01,

E1IDT02_DATA LIKE E1IDT02,

E1EDKA1_DATA LIKE E1EDKA1,

E1EDLA1_DATA LIKE E1EDLA1.

DATA: FNAM_POINTD(25), FNAM_POINTQ(21), FNAM_POINTF(21),

L_CONCAT_ALL(25).

FIELD-SYMBOLS: , , <field_pointf>.

DATA: BEGIN OF L_F_CONCAT,

F1(12),

F2(1) value '-',

F3(12).

DATA: END OF L_F_CONCAT.

*----------------------------------------------------------------

* fill only once table t_remittance with the required field

* which go to payrqt.

* The field HD_ITEM = 'I' if Segment = Item

* The field HD_ITEM = 'H' if Segment = Header

*-- This is where the ZPAYRQS fields and their input values from IDOC are entered

*-- so that they fill the ZAPAYRQS later in the FI system.

*------------------------- beginning of customer's field definition ------------------------

if i_counter = 1.

T_REMITTANCE-SEGnam = 'E1EDKA1'.

T_REMITTANCE-Sdata = 'E1EDKA1_DATA'.

T_REMITTANCE-HD_ITEM = 'H'.

T_REMITTANCE-Q_FIELD = 'PARVW'.

T_REMITTANCE-QUALF = 'AG'.

T_REMITTANCE-FIELD = 'NAME1'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-NAME1'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1EDP02'.

T_REMITTANCE-Sdata = 'E1EDP02_DATA'.

T_REMITTANCE-HD_ITEM = 'I'.

T_REMITTANCE-Q_FIELD = 'QUALF'.

T_REMITTANCE-QUALF = '010'.

T_REMITTANCE-FIELD = 'BELNR'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-BELNR'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1EDP02'.

T_REMITTANCE-Sdata = 'E1EDP02_DATA'.

T_REMITTANCE-HD_ITEM = 'I'.

T_REMITTANCE-Q_FIELD = 'QUALF'.

T_REMITTANCE-QUALF = '009'.

T_REMITTANCE-FIELD = 'BELNR'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-XBLNR'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1EDP03'.

T_REMITTANCE-Sdata = 'E1EDP03_DATA'.

T_REMITTANCE-HD_ITEM = 'I'.

T_REMITTANCE-Q_FIELD = 'IDDAT'.

T_REMITTANCE-QUALF = '016'.

T_REMITTANCE-FIELD = 'DATUM'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-BLDAT'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1EDKA1'.

T_REMITTANCE-Sdata = 'E1EDKA1_DATA'.

T_REMITTANCE-HD_ITEM = 'H'.

T_REMITTANCE-Q_FIELD = 'PARVW'.

T_REMITTANCE-QUALF = 'BE'.

T_REMITTANCE-FIELD = 'PARTN'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-PARTN'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1IDKU5'.

T_REMITTANCE-Sdata = 'E1IDKU5_DATA'.

T_REMITTANCE-HD_ITEM = 'H'.

T_REMITTANCE-Q_FIELD = 'MOAQUAL'.

T_REMITTANCE-QUALF = '002'.

T_REMITTANCE-FIELD = 'MOABETR'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-RWBTR'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1IDKU5'.

T_REMITTANCE-Sdata = 'E1IDKU5_DATA'.

T_REMITTANCE-HD_ITEM = 'H'.

T_REMITTANCE-Q_FIELD = 'MOAQUAL'.

T_REMITTANCE-QUALF = '002'.

T_REMITTANCE-FIELD = 'CUXWAERZ'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-WAERS'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1IDPU5'.

T_REMITTANCE-Sdata = 'E1IDPU5_DATA'.

T_REMITTANCE-HD_ITEM = 'I'.

T_REMITTANCE-Q_FIELD = 'MOAQUAL'.

T_REMITTANCE-QUALF = '004'.

T_REMITTANCE-FIELD = 'MOABETR'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-WRBTR'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1IDPU5'.

T_REMITTANCE-Sdata = 'E1IDPU5_DATA'.

T_REMITTANCE-HD_ITEM = 'I'.

T_REMITTANCE-Q_FIELD = 'MOAQUAL'.

T_REMITTANCE-QUALF = '003'.

T_REMITTANCE-FIELD = 'MOABETR'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-SKNTO'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1IDPU5'.

T_REMITTANCE-Sdata = 'E1IDPU5_DATA'.

T_REMITTANCE-HD_ITEM = 'I'.

T_REMITTANCE-Q_FIELD = 'MOAQUAL'.

T_REMITTANCE-QUALF = '005'.

T_REMITTANCE-FIELD = 'MOABETR'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-WMWST'.

APPEND T_REMITTANCE.

T_REMITTANCE-SEGnam = 'E1IDPU5'.

T_REMITTANCE-Sdata = 'E1IDPU5_DATA'.

T_REMITTANCE-HD_ITEM = 'I'.

T_REMITTANCE-Q_FIELD = 'MOAQUAL'.

T_REMITTANCE-QUALF = '030'.

T_REMITTANCE-FIELD = 'MOABETR'.

T_REMITTANCE-NEW_FIELD = 'ZPAYRQS-QBSHB'.

APPEND T_REMITTANCE.

endif.

*-- end of filling of t_remittance

*-------------------------- end of customer's field definition ------------------------

*-- use keyno to distinguish the items from Headers, items start at 1001 in FI,

*-- This keyno won't be used in FI as a new keyno will be found

if I_IDOC_DATA-segnam = 'E1IDPU1'.

add 1 to t_payrqt-keyno.

endif.

*-- fill payrqt with the right segment data

loop at t_remittance where segnam = I_IDOC_DATA-segnam.

MOVE t_remittance-sdata TO FNAM_pointd.

ASSIGN (FNAM_POINTD) TO .

= I_IDOC_DATA-SDATA.

CLEAR: L_F_CONCAT-f1, L_F_CONCAT-f3.

L_F_CONCAT-F1 = T_REMITTANCE-sdata .

L_F_CONCAT-F3 = T_REMITTANCE-q_field.

MOVE L_F_CONCAT TO L_CONCAT_ALL.

CONDENSE L_CONCAT_ALL NO-GAPS.

MOVE L_CONCAT_ALL TO FNAM_pointq.

ASSIGN (FNAM_pointq) TO .

if = T_REMITTANCE-qualf.

CLEAR: L_F_CONCAT-f1, L_F_CONCAT-f3.

L_F_CONCAT-F1 = T_REMITTANCE-sdata .

L_F_CONCAT-F3 = T_REMITTANCE-field.

MOVE L_F_CONCAT TO L_CONCAT_ALL.

CONDENSE L_CONCAT_ALL NO-GAPS.

MOVE L_CONCAT_ALL TO FNAM_pointf.

ASSIGN (FNAM_pointf) TO .

t_payrqt-textno = 1 + t_payrqt-textno.

t_payrqt-atype = t_remittance-HD_ITEM.

t_payrqt-cmt = 'ST'. "=CMT_STRUCT_TABLE in top include

t_payrqt-text(10) = t_payrqt-keyno.

t_payrqt-text+10(20) = T_REMITTANCE-NEW_FIELD.

t_payrqt-text+30 = .

append t_payrqt.

endif.

endloop.

Notes

IHC calls function module 'BAPI_PAYMENTREQUEST_CREATE' per RFC to post the PAYRQ, and PAYRQT which contains, among other things, the remittance data information. The t_payrqt records that carry the remittance data fill ZPAYRQS but are deleted after that, since condensed information is now available in ZPAYRQS. There is one record per invoice in ZPAYRQS and all the invoices corresponding to one payment are identified with the payment request key number.

The corresponding coding to read t_payrqt (filled in the IHC section) and populate ZPAYRQS is as follows:

*------------------------------------------------------------------------------------------------

*-------------- EXIT_SAPL2021_002 in FI_BL_PRQ_POST ------------------*

*------------------- coding for ZXBKKU01 ---------------------------------------------*

*------------------------------------------------------------------------------------------------

* version of when zpayrqs fields were sent in payrqt from IHC

* recreate zpayrqs from REFERENCE_TEXT(which is payrqt) with

* FORMAT_COL='ST'(standing for structured table)

*------------------------------------------------------------------------------------------------

data: zpayrqs like zpayrqs occurs 0 with header line,

l_f_zpayrqs like zpayrqs.

data: l_text like payrqt-text,

l_text_name(20) type c,

l_text_value(112) type c, "112=132-20

FNAM_POINTS(25),

new_number like payrq-keyno,

old_number like payrq-keyno,

l_TEXTNO like payrq-keyno.

FIELD-SYMBOLS: .

*-----------------------------------------------------------------------

describe table REFERENCE_TEXT lines sy-tfill.

check sy-tfill <> 0.

*-- The header segments

loop at REFERENCE_TEXT where ref_type = 'H'.

clear: l_text_name, l_text_value.

l_text_name = REFERENCE_TEXT-ref_text+10(20).

l_text_value = REFERENCE_TEXT-ref_text+30.

MOVE l_text_name TO FNAM_POINTS.

ASSIGN (FNAM_POINTS) TO .

= l_text_value.

endloop.

zpayrqs-keyno = REQUESTID.

zpayrqs-mandt = sy-mandt.

l_f_zpayrqs = zpayrqs.

*-- the item segments: first one starts with ref_text(10) = 1001.

read table reference_text with key ref_type = 'I'.

check sy-subrc = 0.

old_number = reference_text-ref_text(10).

l_TEXTNO = 1.

zpayrqs-TEXTNO = l_TEXTNO.

loop at REFERENCE_TEXT where ref_type = 'I'.

new_number = REFERENCE_TEXT-ref_text(10).

if new_number ne old_number.

append zpayrqs.

old_number = new_number.

clear zpayrqs.

add 1 to l_TEXTNO.

move-corresponding l_f_zpayrqs to zpayrqs.

zpayrqs-TEXTNO = l_TEXTNO.

endif.

clear: l_text_name, l_text_value.

l_text_name = REFERENCE_TEXT-ref_text+10(20).

l_text_value = REFERENCE_TEXT-ref_text+30.

MOVE l_text_name TO FNAM_POINTS.

ASSIGN (FNAM_POINTS) TO .

= l_text_value.

endloop.

append zpayrqs.

describe table zpayrqs lines sy-tfill.

check sy-tfill <> 0.

insert zpayrqs from table zpayrqs.

loop at t_payrqt where cmt = 'ST'.

delete t_payrqt.

endloop.

*----------------------------------END of USER-EXIT -------------------------------------------

Further information





Parameters

C_BKKPOHD
C_BKKPOIT_SND
C_PAYRQ
I_COUNTER
I_IDOC_DATA
T_BKKPOIT_RCV
T_BKKPONT
T_PAYRQT
T_REMITTANCE

Exceptions

ERROR

Function Group

XBKK

SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 17555 Date: 20240523 Time: 073525     sap01-206 ( 162 ms )