Monday 24 April 2023

Company code Determination for FI-EDI incoming payment advice

Recently got one request to check why the payment advice showing incorrect company code details for the new company code. Not familiar with this process before, so write this down as a tips and hope can help someone who faces the same issues.

SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Jobs, SAP ABAP Prep

For this case, the payment advice generation processing is following below steps:

◉ First run payment run in F110 (Parameters for Automatic Payment);
◉ Then run a specific variant in the program RFFOEDI1 which generates IDOC with message type DIRDEB (basic type: PEXR2002)
◉ Finally, run WE14 to process the generated IDOC PAYEXT.

The whole DME process is a big topic, here only focusing on company code details at E1EDKA1 with partner function ‘BE’ for message type DIRDEB.

SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Jobs, SAP ABAP Prep

There’s one SAP note which explains the source for Segments E1EDKA1 when Partner function = ‘BE’ (Payee). But seems not related to this case, just FYI.

1. Notes 63485 (FI-EDI incoming payment advice: determine CCode)


Segments E1EDKA1 and E1IDB02 are evaluated to determine the company code, customer or vendor. The address is contained in segment E1EDKA1, and the bank details of the customer/vendor resp. of our company (our company code) is contained in segment E1IDB02.

Segment E1EDKA1 (‘Partner information of sender and receiver’) is evaluated first to determine the company code, customer or vendor for a received payment advice note. This segment should be contained twice in the IDOC.
The following values are supported as qualifiers for the partner function of this segment:
AG – Payer
BE – Payee
PA – Partner
Segments with other partner functions are ignored completely.

2. Partner function = ‘BE’, ‘PA’

2.a Element ‘PARTN’ – our number at the vendor or customer or
element ‘NAME1’ – name of the vendor
Table T076B (‘ Assign name <-> Company code’) is read to determine the current company code. You can store the actual company code for a business partner (partner category, partner number) and their company code ID in the table.
Caution: If the ‘PARTN’ field is filled, table T076B is read with this value. Only if the ‘PARTN’ field is empty, the field contents of ‘NAME1’ is used for reading.
Important: Only the first 20 characters of the company name are output with the error message. However, the complete name (up to 35 characters) must be specified in table T076B. Please refer to the ‘NAME1’ field of the segment ‘E1EDKA1’ for the complete name.
Example:
Our vendor ‘KAISER’ sends us payment advice notes, where we are identified as the receiver with the name ‘SAP DEUTSCHLAND’. To assign all payment advice notes of this type to our company code ‘DE01’, maintain the following entry in table T076B:
Key: ‘LI’ ‘KAISER’ ‘SAP DEUTSCHLAND’
Attribute : ‘DE01’

2. EDI processing at RFFOEDI1


SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Jobs, SAP ABAP Prep

There are majorly three function modules to deal with 3 events. Looks like FI_EDI_PAYEXT_PEXR2001_OUT will be used to deal with message type DIRDEB (Event: OUT).

◉ FM ‘FI_EDI_PAYEXT_PEXR2001_NEW’ for ‘NEW’
◉ FM ‘FI_EDI_PAYEXT_PEXR2001_OUT’ for ‘OUT’ 
◉ FM ‘FI_EDI_PAYEXT_PEXR2001_END’ for ‘END’

The system already provides user exit for those 3 events.

SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Jobs, SAP ABAP Prep

Inside routine ‘user_exit’, there’re three options provided.

SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Jobs, SAP ABAP Prep

As we’re checking Event OUT, so double click ‘902’ will lead us to function module: EXIT_SAPLIEDP_902.

SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Jobs, SAP ABAP Prep

Include program ZXF08U06 is where customized company code information comes from. Below is the example to update the segments ‘E1EDKA1’ content of IDOC.

* Insert new segment 
 loop at edidd_table where segnam = 'E1IDKU3'.
    if reguh_data-zland eq 'ES'.
    else.
      l_e1idt01         = edidd_table-sdata.
      l_e1idt01-txtvw   = l_payment_reason.

      concatenate l_city l_slash
                  l_fiscal_code_nr l_slash into l_e1idt01-txt01.
      edidd_table-sdata  = l_e1idt01.
      edidd_table-segnam = 'E1IDT01'.
      insert edidd_table.
    endif.
  endloop.

* Modify existed segment
  loop at edidd_table where segnam = 'E1EDKA1'.

    if edidd_table-sdata+0(2) eq 'BE' and reguh_data-zland eq 'IT'.
      edidd_table-sdata+37(35) = 'Company name'.
      edidd_table-sdata+177(35) = 'company address'.
      edidd_table-sdata+282(35) = 'city'.
      edidd_table-sdata+326(9) = 'postal code'.
      modify edidd_table.
    endif.
  endloop.

No comments:

Post a Comment