abap 动态生成alv列详解编程语言

ZRP_FI007_A

PERFORM F_INPUT_FIELDCAT USING:
'A' '列1',
'B' '列2',
'C' '列3'.

*如果不等于0就输出列4
sort gt_tab by 列4.
read table gt_tab with key 列4 = 0 BINARY SEARCH. “二分法检索,可查看博客
IF sy-subrc <> 0.
PERFORM F_INPUT_FIELDCAT USING 'D' '列4'.
endif.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = WS_LAYOUT
IT_FIELDCAT_LVC = WS_FIELDCAT
TABLES
T_OUTTAB = GT_TAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.

*&---------------------------------------------------------------------*
*& Form F_INPUT_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->VALUE(P_FIELD) text
* -->VALUE(P_NAME) text
*----------------------------------------------------------------------*
FORM F_INPUT_FIELDCAT USING VALUE(P_FIELD)
VALUE(P_NAME).
DATA: ST_FIELDCAT TYPE LVC_S_FCAT.
ST_FIELDCAT-FIELDNAME = P_FIELD.
ST_FIELDCAT-SCRTEXT_M = P_NAME.
APPEND ST_FIELDCAT TO WS_FIELDCAT.
CLEAR ST_FIELDCAT.
ENDFORM. "F_INPUT_FIELDCAT

 

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/19618.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论