4

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

 10 months ago
source link: https://blogs.sap.com/2023/06/29/how-to-add-custom-field-in-tcode-idcnar-ar-ageing/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
June 29, 2023 2 minute read

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

QQ20230629-133258@2x.png

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

QQ20230629-135952@2x-1.png
QQ20230629-140008@2x.png

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”

QQ20230629-135529@2x.png

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

QQ20230629-132542@2x.png
QQ20230629-132605@2x.png

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!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK