Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
AbdelrahmanZaki
Participant
2,532

 

 

Edit SAP GL Account Centrally (T-code FS00) - Add Custom Fields in a New 'Additional Fields' Tab

In our enhancement, we extended the GL master data screen by adding a custom field, “Custom Long Text,” to overcome the 40-character limit of the standard text field. This new field is displayed in a new tab labeled "Additional Fields," which is available across all related transactions (FS00, FS01, FS02, and FS03) since they share the same layout.

We also developed an upload program for mass changes to the custom long text field: ZFI_GL_TEXT_UPLOAD. This program updates the custom field efficiently.

Key Points:

  • No screen exit or BADI is available to add new fields or tabs in the GL master screen.
  • However, the enhancement can be achieved through layout customization, which allows adding new tabs and fields.

Steps:

1. Add the Custom Field to Table and Structure

  • Append the custom field “ZDESC” (Custom Long Text) to table SKB1.
  • Append the same field to structure GLACCOUNT_CCODE_DATA for data transfer between the screen and the database.

AbdelrahmanZaki_0-1728569599300.png

 

2. Create a New Layout in SPRO

  • Navigate to SPRO:
    Financial Accounting → General Ledger Accounting → G/L Accounts → Master Data → Preparations → Additional Activities → Layouts for Individual Processing → Define Layout
  • Copy an existing layout and create a new layout, ZADD.

AbdelrahmanZaki_1-1728569651192.pngAbdelrahmanZaki_2-1728569666942.pngAbdelrahmanZaki_3-1728569674902.pngAbdelrahmanZaki_4-1728569681895.png

 

3. Update Layout Configuration in Tables

  • Update the following tables with the new layout details:
    • TAMLAY0: Add the new layout, setting application = “GL_MASTER” and layout = “ZADD.”
    • TAMLAY1: Define the new tab page (e.g., Tab 7 - "Additional Fields").
    • TAMLAY2: Set group box configuration for the custom screen (group box = ‘V0100’).

AbdelrahmanZaki_5-1728569697433.png

AbdelrahmanZaki_6-1728569704053.pngAbdelrahmanZaki_7-1728569717588.png

 

4. Create a Custom Function Group and Screen

  • Create a custom function group ZFI_FG in SE80.
  • Develop a new screen (e.g., 0100) for the custom field, “Custom Long Text.”
    • In the PBO module, use the structure GLACCOUNT_CCODE_DATA to transfer data from the database to the screen.
       
      AbdelrahmanZaki_9-1728569746272.pngAbdelrahmanZaki_10-1728569752492.png

       

 

 

 

 

ASSIGN (‘(SAPLGL_ACCOUNT_MASTER_MAINTAIN) ac_new-CCODE_DATA-ZDESC’) TO <fs>. skb1-ZDESC = <fs>.

 

 

 

 

 
  • In the PAI module, transfer the data from the screen back to the structure.
     

 

 

 

 

<fs> = skb1-ZDESC.

 

 

 

Here is the full implementation code of the custom screen.

 

*----------------------------------------------------------------------*
***INCLUDE LZFI_FGO01.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module INITIATE_ADDITIONAL_FIELDS OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE initiate_additional_fields OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.

*PBO

  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)STATUS-ACTIVITY') TO FIELD-SYMBOL(<fs_ctivity>).
  IF <fs_ctivity> IS ASSIGNED.
    LOOP AT SCREEN.
      CASE <fs_ctivity>.
        WHEN c_displaymode.
          screen-input = c_noinput.

        WHEN OTHERS.
          screen-input = c_input.
      ENDCASE.

      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-SAKNR') TO <fs>.
  IF <fs> IS ASSIGNED. saknr = <fs>. ENDIF.
  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-KTOPL') TO <fs>.
  IF <fs> IS ASSIGNED. ktopl = <fs>. ENDIF.
  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-BUKRS') TO <fs>.
  IF <fs> IS ASSIGNED. bukrs = <fs>. ENDIF.

  "Read if saved previously
  IF it_skb1[] IS INITIAL.
    SELECT * FROM skb1 INTO TABLE it_skb1_orig WHERE bukrs = bukrs . "AND saknr = saknr.
    APPEND LINES OF it_skb1_orig TO it_skb1.
  ENDIF.

ENDMODULE.

*&---------------------------------------------------------------------*
*& Module READ_ADDITIONAL_FIELDS OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE read_additional_fields OUTPUT.
  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-SAKNR') TO <fs>.
  IF <fs> IS ASSIGNED. saknr = <fs>. ENDIF.
  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-KTOPL') TO <fs>.
  IF <fs> IS ASSIGNED. ktopl = <fs>. ENDIF.
  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-BUKRS') TO <fs>.
  IF <fs> IS ASSIGNED. bukrs = <fs>. ENDIF.

  "fill skb1 from parent screen first

*  SELECT SINGLE * FROM skb1 INTO skb1 WHERE bukrs = bukrs AND saknr = saknr.

  READ TABLE it_skb1 INTO DATA(ls_skb1) WITH KEY saknr = saknr bukrs = bukrs .

  IF sy-subrc = 0.
*    zskb1-zdesc = skb1-zdesc.
    zskb1-zdesc = ls_skb1-zdesc.
  ELSE.
    CLEAR zskb1-zdesc.
  ENDIF.

  CLEAR ls_skb1.

*  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)ac_new-CCODE_DATA-ZDESC') TO <fs>.
*from database to screen
*  skb1-zdesc = <fs>.


ENDMODULE.

*&---------------------------------------------------------------------*
*&      Module  UPDATE_ADDITIONAL_FIELDS  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE update_additional_fields INPUT.
  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-SAKNR') TO <fs>.
  IF <fs> IS ASSIGNED. saknr = <fs>. ENDIF.
  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-KTOPL') TO <fs>.
  IF <fs> IS ASSIGNED. ktopl = <fs>. ENDIF.
  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-BUKRS') TO <fs>.
  IF <fs> IS ASSIGNED. bukrs = <fs>. ENDIF.
  "update zdesc from input field


**  break azaki.
*  CLEAR ls_skb1.
*  READ TABLE it_skb1 INTO ls_skb1 WITH KEY saknr = saknr bukrs = bukrs .
*
*  "MOVE-CORRESPONDING skb1 to ls_skb1.
*  ls_skb1-zdesc = zskb1-zdesc.
**  ls_skb1-saknr = saknr.
**  "ls_skb1-KTOPL = KTOPL.
**  ls_skb1-bukrs = bukrs.
*
*  MODIFY TABLE it_skb1 FROM ls_skb1." TRANSPORTING zdesc.
*  "skb1-zdesc = zskb1-zdesc.

  CLEAR ls_skb1.

  LOOP AT it_skb1 INTO ls_skb1 WHERE saknr = saknr AND bukrs = bukrs.
    ls_skb1-zdesc = zskb1-zdesc.
    MODIFY it_skb1 FROM ls_skb1 TRANSPORTING zdesc.
    CLEAR ls_skb1.
  ENDLOOP.
  CLEAR ls_skb1.

*"to update field in standard table
*  skb1-zdesc = zskb1-zdesc.
*  MODIFY table skb1 from zskb1 TRANSPORTING zdesc.

*  ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)SKB1-ZDESC') TO <fs>.
*  IF <fs> IS ASSIGNED. <fs> = zskb1-zdesc . ENDIF.
ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  CASE sy-ucomm.

    WHEN 'SAVE'. "standard called this user_command_0100 also

      ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-SAKNR') TO <fs>.
      IF <fs> IS ASSIGNED. saknr = <fs>. ENDIF.
      ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-KTOPL') TO <fs>.
      IF <fs> IS ASSIGNED. ktopl = <fs>. ENDIF.
      ASSIGN ('(SAPLGL_ACCOUNT_MASTER_MAINTAIN)GLACCOUNT_SCREEN_KEY-BUKRS') TO <fs>.
      IF <fs> IS ASSIGNED. bukrs = <fs>. ENDIF.

      CLEAR ls_skb1.
      READ TABLE it_skb1 INTO ls_skb1 WITH KEY bukrs = bukrs saknr = saknr.
      IF sy-subrc = 0.
        MODIFY skb1 FROM ls_skb1 .
        COMMIT WORK.
      ENDIF.
  ENDCASE.
ENDMODULE.

 

5. Register the Custom Function Group

  • Add a new entry to table TAMLAYA, linking the new function group (ZFI_FG) to the GL master application.

AbdelrahmanZaki_8-1728569731241.png

 

6. Assign the Layout to a Chart of Accounts

  • In SPRO, assign the newly created layout to a specific chart of accounts: Financial Accounting → General Ledger Accounting → G/L Accounts → Master Data → Preparations → Additional Activities → Assign Layout to Chart of Accounts.

AbdelrahmanZaki_11-1728569770538.pngAbdelrahmanZaki_12-1728569777158.pngAbdelrahmanZaki_13-1728569782289.png

 

Final Result

After completing these steps, the GL master data screen (T-code FS00) will display a new tab labeled "Additional Fields" with the custom field “Custom Long Text.” This enhancement allows the input of long text exceeding the standard character limit.

AbdelrahmanZaki_14-1728569798570.png

Congratulations! You've successfully extended the G/L account to store descriptions up to 100 characters.

In the future, we'll explore the upload program for bulk updating the custom long text description of G/L accounts, allowing you to maintain multiple accounts efficiently at once.

I’ll also share how I enabled displaying and saving this custom field in the FIORI RAP Application "Manage G/L Account Master Data" through a FIORI Extension App.

AbdelrahmanZaki_1-1728571395801.png

AbdelrahmanZaki_0-1728571389995.png

Best Regards,
Abdelrahman Zaki

1 Comment
Sandra_Rossi
Active Contributor
0 Kudos

For information, the solution discussed in this blog post was already existing here: Enhancement of GL master (Addition of new fields i... - SAP Community.

Labels in this area