其他分享
首页 > 其他分享> > QA32增强

QA32增强

作者:互联网

一、QA32报表新增字段

二、QA32报表程序RQEEAL10

结构增加字段,该结构就是报表展示字段列的结构

表新增字段

 

找到报表展示的子例程

 找到程序RQEEAL10,子例程中新增隐式增强

 隐式增强参考代码

ENHANCEMENT 1  Z101.    "active version

DATA:LS_TAB LIKE LINE OF OBJECT_TAB.
DATA:TMP_NAME TYPE THEAD-TDNAME.
DATA:LT_LINE TYPE STANDARD TABLE OF TLINE,
     LS_LINE TYPE TLINE.
LOOP AT P_OBJECT_TAB INTO LS_TAB.
      IF SY-TCODE = 'QA32' OR SY-TCODE = 'QA33'.
        SELECT SINGLE
          MARA~MATKL

          T023T~WGBEZ
        FROM MARA
        LEFT JOIN T023T ON MARA~MATKL = T023T~MATKL AND T023T~SPRAS = SY-LANGU
        INTO CORRESPONDING FIELDS OF LS_TAB
        WHERE MARA~MATNR = LS_TAB-MATNR.

        SELECT SINGLE
          NAME1
        FROM LFA1
        INTO CORRESPONDING FIELDS OF LS_TAB
        WHERE LIFNR = LS_TAB-LIFNR.
      ENDIF.
    MODIFY P_OBJECT_TAB FROM LS_TAB." TRANSPORTING EBELN_TEXT ZJGH ZLPH ZZBSH ZCLPH ZCJH ZVENDOR ZSCCJ ZGDH.
    CLEAR LS_TAB.
ENDLOOP.
ENDENHANCEMENT.

需要将新增的栏位设置到布局中并保存,下次进入显示默认布局带出新增字段

如果未保存布局,查询出报表之后,再显示新增字段,发现字段没有值

如果想在ALV展示之后,再放开字段并保证有值,就要找到更改布局时,调用的子例程

 在子例程的最后,加上查询逻辑

ENHANCEMENT 2  ZNHMME00101.    "active version
*                     \PR:RQEEAL10\FO:CALL_LISTVIEWER_F14\SE:
DATA:h_fieldcat_wa TYPE slis_fieldcat_alv.

DATA:LS_TAB LIKE LINE OF OBJECT_TAB.
DATA:TMP_NAME TYPE THEAD-TDNAME.
DATA:LT_LINE TYPE STANDARD TABLE OF TLINE,
     LS_LINE TYPE TLINE.
LOOP AT object_tab INTO LS_TAB.
      IF SY-TCODE = 'QA32' OR SY-TCODE = 'QA33'.
        SELECT SINGLE
          MARA~MATKL

          T023T~WGBEZ
        FROM MARA
        LEFT JOIN T023T ON MARA~MATKL = T023T~MATKL AND T023T~SPRAS = SY-LANGU
        INTO CORRESPONDING FIELDS OF LS_TAB
        WHERE MARA~MATNR = LS_TAB-MATNR.

        SELECT SINGLE
          NAME1
        FROM LFA1
        INTO CORRESPONDING FIELDS OF LS_TAB
        WHERE LIFNR = LS_TAB-LIFNR.
      ENDIF.
    MODIFY object_tab FROM LS_TAB." TRANSPORTING EBELN_TEXT ZJGH ZLPH ZZBSH ZCLPH ZCJH ZVENDOR ZSCCJ ZGDH.
    CLEAR LS_TAB.
ENDLOOP.
ENDENHANCEMENT.

这样,即使进入时没有该字段,更改布局后,还是可以将字段值带出

 

标签:增强,MARA,DATA,T023T,LS,TAB,QA32,TYPE
来源: https://www.cnblogs.com/BinGeneral/p/15469326.html