SAP Knowledge Base Article - Public

3462236 - Why the value be cleared after published Journal Entry Item Substitution? - SAP S/4HANA Cloud Public Edition

Symptom

  • Why the value of field, for example, Financial Transaction Type been cleared after entering on the UI in app Clear Outgoing Payments?
  • Why the value of field, for example, Assignment can't be saved in app Manage Journal Entries. The value been cleared after saved.
  • Entry view summarization is active and UNCOMPRESSEDITEMS not used, field for which you expect value appears empty in ledger view. 

Environment

SAP S/4HANA Cloud Public Edition

Reproducing the Issue

  1. Custom logic Journal Entry Item Substitution is created
  2. The value of field Assignment can't be saved in app Manage Journal Entries. The value been cleared after saved.

Cause

Resolution

Always copy the values from input to output first before any substitutions, otherwise, the initial values from the output will be used for substitutions.

For example 

  • MOVE-CORRESPONDING accountingdocitem TO accountingdocitemout.
  • MOVE-CORRESPONDING codingblockitem TO codingblockitemout. 

It is recommended to, Show Sample Code in app Custom Logic for the extension point in question 

For example an Extract for of sample code for badi FIN_ACDOC_SUBSTITUTION  

 " BAdI usage:
    " Substitute accounting document items of the complete journal entry with the possibility
    " to access data from other items.
    " Note that this BAdI is based on the entry view, which might be compressed if entry view
    " summarization is active (SSCUI 106716). Summarization is active by default for new tenants.
    " See https://help.sap.com/docs/SAP_S4HANA_CLOUD/0fa84c9d9c634132b7c4abb9ffdd8f06/3a295f45d9354aa09418530288fc166c.html
    " In that case, UNCOMPRESSEDITEMS contains the data sent to the accounting interface
    " in the form it was before summarization
    "
    " SUBSTITUTIONDONE:
    " -- Please always set this flag when updating any item
    " -- Substitutions take effect only when true (‘X’) is set.
    " ACCOUNTINGDOCITEMSOUT:
    " -- Please always copy values from input to output and keep rowindex
    " -- Existing values might be cleared or wrong items changed otherwise.
    " ----------------------------------------------------------------------------------------------
    DATA ls_itemout TYPE fins_acdoc_out.

    CLEAR accountingdocitemsout.

    " Use Case 1 : Document type 'RE' and vendor item (finanialaccounttype K):
    " substitute documentitemtext with material number found in any G/L account item (type S)
    " This doesn't work if entry view is summarized, material number is cleared by summarization
    " --------------------------------------------------------------------------------------------
    IF accountingdocheader-AccountingDocumentType = 'RE' AND uncompresseditems IS INITIAL.
      DATA lv_material TYPE matnr.
      LOOP AT accountingdocitems REFERENCE INTO DATA(lr_item) WHERE FinancialAccountType = 'S' AND Material IS NOT INITIAL.
        lv_material = lr_item->material.
        EXIT.
      ENDLOOP.
      IF lv_material IS NOT INITIAL.
        LOOP AT accountingdocitems REFERENCE INTO lr_item WHERE FinancialAccountType = 'K'.
          " Notes:
          " 1. Please always copy the values from input to output first before any substitutions,
          "    otherwise, the initial values from the output will be used for substitutions!
          " 2. Always keep 'rowindex' unchanged, otherwise, another item will be substituted accidently!
          MOVE-CORRESPONDING lr_item->* TO ls_itemout.
          ls_itemout-DocumentItemText = lv_material.
          APPEND ls_itemout TO accountingdocitemsout.
          substitutiondone = abap_true.
        ENDLOOP.
      ENDIF.
    ENDIF."

See Also

SAP Help Portal: BAdIs for Substitution for Journal Entries

3715619 - Cost Center is blank in BAdI FIN_ACDOC_ITEM_VALIDATION despite being filled 

2802958 - How to substitute custom fields on cloud systems

Entry View Summarization

Keywords

Journal Entry Substitution, Journal Entry Item Substitution, Journal Entry Header Substitution, Financial Transaction Type, Assignment, BAdI, Custom Logic, FIN_CODING_BLOCK_SUBSTITUTION, Assignment, Profit Center, changed, summarization, UNCOMPRESSEDITEMS  , KBA , FI-SL-VSR-2CL , Validation, Substitution and Rules (Public Cloud) , How To

Product

SAP S/4HANA Cloud Public Edition all versions