Skip to Content
Technical Articles
Author's profile photo xiaosan yu

How to add custom field in tcode: IDCNAR (AR Ageing)

Introduction

In the community, I found some people asking how to add custom fields to IDCNAR reports. I happened to have done it recently. In this blog, I will introduce how to do it.

 

STEP1. Implement Sap note 3202661

Check if your system needs to implement SAP note 3202661, perhaps you need the help of a basis consultant

STEP2. Add Custom field In structure “IDCN_S_AR_AGING_HEADER” & “IDCN_S_AR_AGING_ITEM”

STEP3. Add Implicit Enhancement

  1. find the Subroutines “ficn_app_oth_fields” in includes “RFIDCN_AR_AGING_SUBROUTINE
  2. Add Implicit Enhancement on the end of “ficn_app_oth_fields“, add your custom field
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form FICN_APP_OTH_FIELDS, End                                                                                                                     A
    *$*$-Start: (1)---------------------------------------------------------------------------------$*$*
    ENHANCEMENT 1  ZENH_IDCN_AR_AGING_FCAT.    "active version
    * add by yu.xiaosan 20230516
     READ TABLE  ct_fieldcat TRANSPORTING NO FIELDS WITH KEY fieldname = 'ZZ01'.
     IF sy-subrc <> 0.
       CLEAR ls_fieldcat.
       ls_fieldcat-fieldname = 'ZZ01'.
       ls_fieldcat-scrtext_l = '管理利润中心'.
       ls_fieldcat-scrtext_m = '管理利润中心'.
       ls_fieldcat-scrtext_s = '管理利润中心'.
       ls_fieldcat-col_pos = 232.
       APPEND ls_fieldcat TO ct_fieldcat.
     ENDIF.
    
     CLEAR ls_fieldcat.
     ls_fieldcat-fieldname = 'ZZ01_TEXT'.
     ls_fieldcat-scrtext_l = '管理利润中心描述'.
     ls_fieldcat-scrtext_m = '管理利润中心描述'.
     ls_fieldcat-scrtext_s = '管理利润中心描述'.
     ls_fieldcat-col_pos = 233.
     APPEND ls_fieldcat TO ct_fieldcat.
    ENDENHANCEMENT.
    *$*$-End:   (1)---------------------------------------------------------------------------------$*$*
  3.  find the Subroutines “split_screen_0101” in includes “RFIDCN_AR_AGING_PBO
  4. Add Implicit Enhancement on the start of “split_screen_0101“, add your logic for achieving values.
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form SPLIT_SCREEN_0101, Start                                                                                                                     A
    *$*$-Start: (1)---------------------------------------------------------------------------------$*$*
    ENHANCEMENT 2  ZENH_IDCN_AR_AGING_FCAT.    "active version
    * add by yu.xiaosan 20230516
     IF gt_mid_output[] IS NOT INITIAL.
       SELECT prctr,
              ltext
         INTO TABLE @DATA(lt_cepct)
         FROM cepct
         FOR ALL ENTRIES IN @gt_mid_output
         WHERE prctr = @gt_mid_output-zz01
           AND spras = @sy-langu.
       SORT lt_cepct BY prctr.
       IF sy-subrc = 0.
         LOOP AT gt_mid_output ASSIGNING FIELD-SYMBOL(<fs_output>).
           READ TABLE lt_cepct INTO DATA(ls_cepct) WITH KEY prctr = <fs_output>-zz01 BINARY SEARCH.
           CHECK sy-subrc = 0.
           <fs_output>-zz01_text = ls_cepct-ltext.
         ENDLOOP.
       ENDIF.
     ENDIF.
    ENDENHANCEMENT.
    *$*$-End:   (1)---------------------------------------------------------------------------------$*$*

STEP4. Implement BADI “IDCN_AR_AGING”

STEP5. Achieve data

 METHOD if_idcn_ar_aging~post_selection_control.
    IF ct_content_header[] IS NOT INITIAL.
      SELECT prctr,
             ltext
        INTO TABLE @DATA(lt_cepct)
        FROM cepct
        FOR ALL ENTRIES IN @ct_content_header
        WHERE prctr = @ct_content_header-zz01
          AND spras = @sy-langu.
      SORT lt_cepct BY prctr.
      IF sy-subrc = 0.
        LOOP AT ct_content_header ASSIGNING FIELD-SYMBOL(<fs_header>).
          READ TABLE lt_cepct INTO DATA(ls_cepct) WITH KEY prctr = <fs_header>-zz01 BINARY SEARCH.
          CHECK sy-subrc = 0.
          <fs_header>-zz01_text = ls_cepct-ltext.
        ENDLOOP.
      ENDIF.
    ENDIF.
  ENDMETHOD.

STEP6. Check result by T-code IDCNAR

 

Summary

I hope to help those in need. If you have any questions, please comment and I will reply as soon as possible.

Thanks for reading!

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.