cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP BTE 1120: Document Header Information Processing and Customization

Kaba_Abdullah
Explorer
0 Kudos
1,528

In SAP ERP and S/4HANA systems, different extension options are offered to make business processes flexible according to customer needs. One of these extension tools is the Business Transaction Events (BTE) structure.

BTE 1120 allows user-defined changes on the document header and items during FI document posting. With this structure, some fields of the document can be updated, changed, or replaced with a fixed value automatically depending on conditions.

BTE 1120 makes it possible to change some fields in BKPF (document header) and BSEG (document items) tables before the document is posted. SAP provides the example function module SAMPLE_INTERFACE_00001120 as a basis for this development.

With this structure, many scenarios can be done, for example:
📌Assigning a fixed text to the document header reference text field (BKPF_SUBST-BKTXT)
📌Updating the value date of a document item (BSEG_SUBST-VALUT) depending on a condition
📌Changing the line item text (BSEG_SUBST-SGTXT) for the customer
📌Assigning a payment block key (BSEG_SUBST-ZLSPR) to a document item
📌Changing fields like cost center or activity type according to business rules

Thanks to this exit, when customer documents are posted (for example FB70, F-28, F-32 etc.), you can change values, assign new ones, or manipulate indirect data line by line.

ssssssssssssss_0-1757057313238.png

During document posting, the fields XBLNR1 and/or BKTXT in the document header can be replaced with a new field or changed with a fixed value. This allows you to make changes at the time of posting.

ssssssssssssss_1-1757057497636.png

During document posting, the fields ZLSPR and/or VALUT in the document item can be replaced with a new field or changed with a fixed value. This makes it possible to modify them at the time of posting.

ssssssssssssss_2-1757057522505.png

Application on a Live Scenario:
The user asked us the following:
In personnel expense postings, in the automatically created FI documents, the item text from the personnel line should also appear in all other lines. Also, when posting, the personnel customer code should be added at the beginning of this text. This process should not be done manually, it should work automatically.

This requirement can be done by writing code with BTE 1120. Below, I will explain how to do this.

ssssssssssssss_3-1757057572146.png

  DATA: lv_sgtxt   TYPE bseg-sgtxt,
        lv_lıfnr   TYPE bseg-lıfnr,
        lv_found   TYPE abap_bool,
        ls_bseg    TYPE bseg,
        ls_bsegsub TYPE bseg_subst.
  DATA lv_tabix TYPE sy-tabix.

    READ TABLE t_bkpf INTO DATA(ls_bkpf) INDEX 1.
  IF sy-subrc <> 0 OR ls_bkpf-blart <> 'PG'.
    RETURN. " PG değilse çık
  ENDIF.

  LOOP AT t_bseg INTO ls_bseg.
    IF ls_bseg-umskz = '1' AND ls_bseg-sgtxt IS NOT INITIAL.
      lv_sgtxt = ls_bseg-sgtxt.
      lv_lıfnr = ls_bseg-lıfnr.
      lv_found = abap_true.
      EXIT.
    ENDIF.
  ENDLOOP.
  
  IF lv_found = abap_true.
    LOOP AT t_bseg INTO ls_bseg.
      lv_tabix = sy-tabix.

      READ TABLE t_bsegsub INTO ls_bsegsub INDEX lv_tabix.
      IF sy-subrc = 0.
        CONCATENATE lv_lıfnr lv_sgtxt INTO ls_bsegsub-sgtxt SEPARATED BY space.
        MODIFY t_bsegsub FROM ls_bsegsub INDEX lv_tabix.
      ENDIF.
    ENDLOOP.
  ENDIF.

After the 1120 development was completed, a unit test was done with the transaction code F-02 by entering a document. Before the posting was finished, the explanations entered in the text field were as follows.

Abdullah_kabaa_0-1757070615504.png

Revision of the text field according to the customer’s request after posting.

Abdullah_kabaa_1-1757070661968.png

In conclusion, BTE 1120 is a strong SAP enhancement point that allows field-level changes during the document creation process. It is especially used when field values in automatically created FI documents need to be replaced according to non-standard rules. Its ability to provide direct solutions for real-life requirements and remove manual intervention makes 1120 a frequently used method in SAP projects.

I hope my writing will be helpful to you.

Best Regards,

Abdullah Kaba

SAP S/4HANA Finance #

View Entire Topic
NooruBohra
Active Participant
0 Kudos

Very well written. But it seems I'm missing the question here. 🤔