nangnangchuai / sap

0 stars 0 forks source link

选择屏幕自行选择输出为alv或者list #35

Open nangnangchuai opened 5 years ago

nangnangchuai commented 5 years ago
*&---------------------------------------------------------------------*
*& Report  YY_SZDX_TEST001
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  yy_szdx_test001 LINE-SIZE 600.

TABLES: sbook.

DATA:
  gs_fieldcat   TYPE lvc_s_fcat,
  gt_fieldcat   TYPE lvc_t_fcat,
  gs_layout     TYPE lvc_s_layo.

DATA: gv_col    TYPE i.
DATA: zblock    TYPE c.

DATA gt_data    TYPE TABLE OF sbook.
DATA gs_data    TYPE  sbook.

DATA gt_data1   TYPE TABLE OF spfli.
DATA gs_data1   TYPE  spfli.

START-OF-SELECTION.

  SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.       "单选按钮的定义

  PARAMETERS:     p_carrid       TYPE sbook-carrid OBLIGATORY.         "航线代码
  SELECT-OPTIONS: s_connid       FOR  sbook-connid.                    "航班连接代码

  SELECTION-SCREEN END OF BLOCK bk1.

  SELECTION-SCREEN BEGIN OF BLOCK bk2 WITH FRAME TITLE text-002.       "单选按钮的定义

  PARAMETERS:

             p_list TYPE c RADIOBUTTON GROUP rao1,
             p_alv  TYPE c RADIOBUTTON GROUP rao1 DEFAULT 'X'.

  SELECTION-SCREEN END OF BLOCK bk2.

  PERFORM frm_get_data.                                                 "取数

*     TOP-OF-PAGE

*END-OF-PAGE .
*AT SELECTION-SCREEN .

START-OF-SELECTION.                                                    "IF 条件判断

  PERFORM frm_get_data1.

END-OF-SELECTION.

  PERFORM frm_get_data1.
*&---------------------------------------------------------------------*
*&      Form  FRM_GET_DATA1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_get_data1 .

  IF
    p_alv = 'X'.
    PERFORM frm_display_alv.

  ELSE.

    PERFORM frm_init_list.
  ENDIF.

ENDFORM.                    " FRM_GET_DATA1

*&---------------------------------------------------------------------*
*&      Form  FRM_GET_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_get_data .

  SELECT  *
  FROM    sbook
  INTO    TABLE gt_data "CORRESPONDING FIELDS OF
  WHERE   carrid = p_carrid
  AND     connid IN s_connid.

ENDFORM.                    " FRM_GET_DATA

*&---------------------------------------------------------------------*
*&      Form  FRM_DISPLAY_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_display_alv .

  PERFORM frm_init_fieldcat.
  PERFORM frm_init_layout.
  PERFORM frm_init_alv.

ENDFORM.                    " FRM_DISPLAY_ALV

*&---------------------------------------------------------------------*
*&      Form  FRM_INIT_FIELDCAT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_init_fieldcat .

  PERFORM frm_set_fieldcat USING 'MANDT'     '集团' .
  PERFORM frm_set_fieldcat USING 'CARRID'    '航线代码' .
  PERFORM frm_set_fieldcat USING 'CONNID'    '航班连接 Id' .
  PERFORM frm_set_fieldcat USING 'FLDATE'    '航班日期 ' .
  PERFORM frm_set_fieldcat USING 'BOOKID'    '工作台培训数据模型 BC_Travel 的登记编号  ' .
  PERFORM frm_set_fieldcat USING 'CUSTOMID'  '工作台培训数据模型 BC_ Travel 的客户数' .
  PERFORM frm_set_fieldcat USING 'CUSTTYPE'  '商业/私人客户' .
  PERFORM frm_set_fieldcat USING 'SMOKER'    '吸烟者 ' .
  PERFORM frm_set_fieldcat USING 'LUGGWEIGHT' '行李重量 ' .
  PERFORM frm_set_fieldcat USING 'WUNIT'     '工作台培训模型 BC_Travel 的重量单位  ' .
  PERFORM frm_set_fieldcat USING 'INVOICE'   '发送 BW 培训数据模型 BC_Travel 的发票 (是/否)' .
  PERFORM frm_set_fieldcat USING 'CLASS'     '航班舱位' .
  PERFORM frm_set_fieldcat USING 'FORCURAM'  '外币帐面价格(取决于地点) ' .
  PERFORM frm_set_fieldcat USING 'FORCURKEY' '工作台培训模型 BC_Travel 的支付货币  ' .
  PERFORM frm_set_fieldcat USING 'LOCCURAM'  '航线的帐面本地货币价格  ' .
  PERFORM frm_set_fieldcat USING 'LOCCURKEY' '航班的本地货币 ' .
  PERFORM frm_set_fieldcat USING 'ORDER_DATE' '工作台培训数据模型 BC_Travel 的登记日期 ' .
  PERFORM frm_set_fieldcat USING 'COUNTER'   'Number of sales office' .
  PERFORM frm_set_fieldcat USING 'AGENCYNUM' 'Travel Agency Number ' .
  PERFORM frm_set_fieldcat USING 'CANCELLED' 'Cancelation flag ' .
  PERFORM frm_set_fieldcat USING 'RESERVED'  'Reservation flag' .
  PERFORM frm_set_fieldcat USING 'PASSNAME'  '乘客姓名' .
  PERFORM frm_set_fieldcat USING 'PASSFORM'  '工作台培训数据模型 BC_Travel 的标题 ' .
  PERFORM frm_set_fieldcat USING 'PASSBIRTH' '乘客出生日期 ' .

ENDFORM.    " FRM_INIT_FIELDCAT

*&---------------------------------------------------------------------*
*&      Form  FRM_INIT_LAYOUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_init_layout .

  gs_layout-zebra = 'X'.       "斑马线
  gs_layout-cwidth_opt = 'X'.  "自动化列宽

ENDFORM.                    " FRM_INIT_LAYOUT

*&---------------------------------------------------------------------*
*&      Form  FRM_INIT_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_init_alv .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program       = sy-repid
      is_layout_lvc            = gs_layout
      it_fieldcat_lvc          = gt_fieldcat
      i_callback_pf_status_set = 'SUB_SET_STATUS'
      i_callback_user_command  = 'FRM_UCOMM'
      i_save                   = 'A'
    TABLES
      t_outtab                 = gt_data
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.

ENDFORM.                    " FRM_INIT_ALV
*&---------------------------------------------------------------------*
*&      Form  FRM_SET_FIELDCAT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0112   text
*      -->P_0113   text
*----------------------------------------------------------------------*
FORM frm_set_fieldcat   USING    p_field p_name .
  gs_fieldcat-col_pos   = gv_col.
  gs_fieldcat-fieldname = p_field.
  gs_fieldcat-coltext = p_name.
  gs_fieldcat-scrtext_l = p_name.
  APPEND gs_fieldcat TO gt_fieldcat.
  gv_col = gv_col + 1.
  CLEAR gs_fieldcat.

ENDFORM.                    " FRM_SET_FIELDCAT
*&---------------------------------------------------------------------*
*&      Form  FRM_INIT_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_init_list .

  WRITE: /'集团',
       22       '航线代码',
       47       '航班连接 Id',
       77       '航班日期',
       95       '工作台培训数据模型 BC_Travel 的登记编',
       122       '工作台培训数据模型 BC_ Travel 的客户',
       147      '商业/私人客户',
       172       '吸烟者 ',
       197       '行李重量',
       222       '工作台培训模型 BC_Travel 的重量单位 ',
       247       '发送 BW 培训数据模型 BC_Travel 的',
       271       '航班舱位',
       296       '外币帐面价格(取决于地点) ',
       321       '工作台培训模型 BC_Travel 的支付货币 ',
       346       '航线的帐面本地货币价格 ',
       371       '航班的本地货币 ',
       396       '工作台培训数据模型 BC_Travel 的登记日',
       421       'Number of sales office',
       446       'Travel Agency Number',
       471       'Cancelation flag',
       496       'Reservation flag',
       520       '乘客姓名',
       545       '工作台培训数据模型 BC_Travel 的标题 ',
       570       '乘客出生日期'.
  ULINE AT /1(580).

  LOOP AT gt_data INTO gs_data.
    WRITE:
          /            gs_data-mandt,
           22          gs_data-carrid,
           47          gs_data-connid,
           77          gs_data-fldate,
           95          gs_data-bookid,
           122         gs_data-customid,
           147         gs_data-custtype,
           172         gs_data-smoker,
           197         gs_data-luggweight,
           222         gs_data-wunit,
           247         gs_data-invoice,
           271         gs_data-class,
           296         gs_data-forcuram,
           321         gs_data-forcurkey,
           346         gs_data-loccuram,
           371         gs_data-loccurkey,
           396         gs_data-order_date,
           421         gs_data-counter,
           446         gs_data-agencynum,
           471         gs_data-cancelled,
           496         gs_data-reserved,
           520         gs_data-passname,
           545         gs_data-passform,
           570         gs_data-passbirth.

    HIDE : gs_data-connid.

    ULINE AT /1(580).

  ENDLOOP.

ENDFORM.                    " FRM_INIT_LIST

*&---------------------------------------------------------------------*
*&      Form  SUB_SET_STATUS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PT_EXTAB   text
*----------------------------------------------------------------------*
FORM sub_set_status USING pt_extab TYPE slis_t_extab.

*gui status的定义
  SET PF-STATUS 'S_1000' .

ENDFORM.                    "sub_set_status

*&---------------------------------------------------------------------*
*&      Form  FRM_IST_SHUCHU
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_ucomm  USING p_ucomm TYPE sy-ucomm
       p_selfield TYPE slis_selfield.
  CASE p_ucomm .
    WHEN '&IC1'.

    WHEN 'BACK'.
      LEAVE PROGRAM.

  ENDCASE.
  p_selfield = 'X'.
ENDFORM .                    "FRM_UCOMM

AT LINE-SELECTION.

  WRITE: /'集团',
     22       '航线代码',
     47       '航班连接 Id',
     77       '国家键值 ',
     95       '起飞城市',
     122      '起飞机场',
     147      '国家键值 ',
     172      '目标城市 ',
     197      '目标机场',
     222      '航班时间 ',
     247      '启程时间 ',
     271      '到达时间',
     296      '距离 ',
     321      '大距离单位(公里,英里) ',
     346      '航班类型(包机或既定) ',
     371      'Arrival n day(s) later '.
  ULINE AT /1(380).

  SELECT *
    INTO CORRESPONDING FIELDS OF TABLE  gt_data1
    FROM  spfli
    FOR ALL ENTRIES IN gt_data
    WHERE  connid = gt_data-connid
    and    connid = gs_data-connid.

*    SELECT *
*    FROM spfli
*    INTO  TABLE  gt_data1
*    WHERE  connid = gs_data-connid.

  LOOP AT gt_data1 INTO gs_data1.
    WRITE:
          /            gs_data1-mandt,
           22          gs_data1-carrid,
           47          gs_data1-connid,
           77          gs_data1-countryfr,
           95          gs_data1-cityfrom,
           122         gs_data1-airpfrom,
           147         gs_data1-countryto,
           172         gs_data1-cityto,
           197         gs_data1-airpto,
           222         gs_data1-fltime,
           247         gs_data1-deptime,
           271         gs_data1-arrtime,
           296         gs_data1-distance,
           321         gs_data1-distid,
           346         gs_data1-fltype,
           371         gs_data1-period.
    ULINE AT /1(380).
  ENDLOOP. 
nangnangchuai commented 5 years ago

alv中根据单选按钮控制某个按钮的显示和隐藏

*&---------------------------------------------------------------------*
*& Report  ZTEST_LTT_TEST1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZTEST_LTT_TEST1.
TABLES: sbook.
DATA:
  gs_fieldcat   TYPE lvc_s_fcat,
  gt_fieldcat   TYPE lvc_t_fcat,
  gs_layout     TYPE lvc_s_layo.

DATA: gv_col    TYPE i.
DATA: zblock    TYPE c.

DATA gt_data    TYPE TABLE OF sbook.
DATA gs_data    TYPE  sbook.

DATA gt_data1   TYPE TABLE OF spfli.
DATA gs_data1   TYPE  spfli.

TYPES :BEGIN OF GTS_EXCLUDE ,
       UCOMM LIKE SY-UCOMM,
      END OF GTS_EXCLUDE.

DATA:GDT_EXCLUDE TYPE TABLE OF GTS_EXCLUDE,
     GDS_EXCLUDE TYPE  GTS_EXCLUDE.

START-OF-SELECTION.

  SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.       "单选按钮的定义

  PARAMETERS:     p_carrid       TYPE sbook-carrid OBLIGATORY.         "航线代码
  SELECT-OPTIONS: s_connid       FOR  sbook-connid.                    "航班连接代码

  SELECTION-SCREEN END OF BLOCK bk1.

  SELECTION-SCREEN BEGIN OF BLOCK bk2 WITH FRAME TITLE text-002.

  PARAMETERS:

             p_list TYPE c RADIOBUTTON GROUP rao1,
             p_alv  TYPE c RADIOBUTTON GROUP rao1 DEFAULT 'X'.

  SELECTION-SCREEN END OF BLOCK bk2.

  SELECTION-SCREEN BEGIN OF BLOCK bk3 WITH FRAME TITLE text-003.       "单选按钮的定义

  PARAMETERS:

             p_dispy TYPE c RADIOBUTTON GROUP rao2 DEFAULT 'X',
             p_hide    TYPE c RADIOBUTTON GROUP rao2 .

  SELECTION-SCREEN END OF BLOCK bk3.

  PERFORM frm_get_data.                                                 "取数

*     TOP-OF-PAGE

*END-OF-PAGE .
*AT SELECTION-SCREEN .

START-OF-SELECTION.                                                    "IF 条件判断

  PERFORM frm_get_data1.

END-OF-SELECTION.

  PERFORM frm_get_data1.
*&---------------------------------------------------------------------*
*&      Form  FRM_GET_DATA1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_get_data1 .

  IF
    p_alv = 'X'.
    PERFORM frm_display_alv.

  ELSE.

    PERFORM frm_init_list.
  ENDIF.

ENDFORM.                    " FRM_GET_DATA1

*&---------------------------------------------------------------------*
*&      Form  FRM_GET_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_get_data .

  SELECT  *
  FROM    sbook
  INTO    TABLE gt_data "CORRESPONDING FIELDS OF
  WHERE   carrid = p_carrid
  AND     connid IN s_connid.

ENDFORM.                    " FRM_GET_DATA

*&---------------------------------------------------------------------*
*&      Form  FRM_DISPLAY_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_display_alv .

  PERFORM frm_init_fieldcat.
  PERFORM frm_init_layout.
  PERFORM frm_init_alv.

ENDFORM.                    " FRM_DISPLAY_ALV

*&---------------------------------------------------------------------*
*&      Form  FRM_INIT_FIELDCAT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_init_fieldcat .

  PERFORM frm_set_fieldcat USING 'MANDT'     '集团' .
  PERFORM frm_set_fieldcat USING 'CARRID'    '航线代码' .
  PERFORM frm_set_fieldcat USING 'CONNID'    '航班连接 Id' .
  PERFORM frm_set_fieldcat USING 'FLDATE'    '航班日期 ' .
  PERFORM frm_set_fieldcat USING 'BOOKID'    '工作台培训数据模型 BC_Travel 的登记编号  ' .
  PERFORM frm_set_fieldcat USING 'CUSTOMID'  '工作台培训数据模型 BC_ Travel 的客户数' .
  PERFORM frm_set_fieldcat USING 'CUSTTYPE'  '商业/私人客户' .
  PERFORM frm_set_fieldcat USING 'SMOKER'    '吸烟者 ' .
  PERFORM frm_set_fieldcat USING 'LUGGWEIGHT' '行李重量 ' .
  PERFORM frm_set_fieldcat USING 'WUNIT'     '工作台培训模型 BC_Travel 的重量单位  ' .
  PERFORM frm_set_fieldcat USING 'INVOICE'   '发送 BW 培训数据模型 BC_Travel 的发票 (是/否)' .
  PERFORM frm_set_fieldcat USING 'CLASS'     '航班舱位' .
  PERFORM frm_set_fieldcat USING 'FORCURAM'  '外币帐面价格(取决于地点) ' .
  PERFORM frm_set_fieldcat USING 'FORCURKEY' '工作台培训模型 BC_Travel 的支付货币  ' .
  PERFORM frm_set_fieldcat USING 'LOCCURAM'  '航线的帐面本地货币价格  ' .
  PERFORM frm_set_fieldcat USING 'LOCCURKEY' '航班的本地货币 ' .
  PERFORM frm_set_fieldcat USING 'ORDER_DATE' '工作台培训数据模型 BC_Travel 的登记日期 ' .
  PERFORM frm_set_fieldcat USING 'COUNTER'   'Number of sales office' .
  PERFORM frm_set_fieldcat USING 'AGENCYNUM' 'Travel Agency Number ' .
  PERFORM frm_set_fieldcat USING 'CANCELLED' 'Cancelation flag ' .
  PERFORM frm_set_fieldcat USING 'RESERVED'  'Reservation flag' .
  PERFORM frm_set_fieldcat USING 'PASSNAME'  '乘客姓名' .
  PERFORM frm_set_fieldcat USING 'PASSFORM'  '工作台培训数据模型 BC_Travel 的标题 ' .
  PERFORM frm_set_fieldcat USING 'PASSBIRTH' '乘客出生日期 ' .

ENDFORM.    " FRM_INIT_FIELDCAT

*&---------------------------------------------------------------------*
*&      Form  FRM_INIT_LAYOUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_init_layout .

  gs_layout-zebra = 'X'.       "斑马线
  gs_layout-cwidth_opt = 'X'.  "自动化列宽

ENDFORM.                    " FRM_INIT_LAYOUT

*&---------------------------------------------------------------------*
*&      Form  FRM_INIT_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_init_alv .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program       = sy-repid
      is_layout_lvc            = gs_layout
      it_fieldcat_lvc          = gt_fieldcat
      i_callback_pf_status_set = 'SUB_SET_STATUS'
      i_callback_user_command  = 'FRM_UCOMM'
      i_save                   = 'A'
    TABLES
      t_outtab                 = gt_data
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.

ENDFORM.                    " FRM_INIT_ALV
*&---------------------------------------------------------------------*
*&      Form  FRM_SET_FIELDCAT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0112   text
*      -->P_0113   text
*----------------------------------------------------------------------*
FORM frm_set_fieldcat   USING    p_field p_name .
  gs_fieldcat-col_pos   = gv_col.
  gs_fieldcat-fieldname = p_field.
  gs_fieldcat-coltext = p_name.
  gs_fieldcat-scrtext_l = p_name.
  APPEND gs_fieldcat TO gt_fieldcat.
  gv_col = gv_col + 1.
  CLEAR gs_fieldcat.

ENDFORM.                    " FRM_SET_FIELDCAT
*&---------------------------------------------------------------------*
*&      Form  FRM_INIT_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_init_list .

  WRITE: /'集团',
       22       '航线代码',
       47       '航班连接 Id',
       77       '航班日期',
       95       '工作台培训数据模型 BC_Travel 的登记编',
       122       '工作台培训数据模型 BC_ Travel 的客户',
       147      '商业/私人客户',
       172       '吸烟者 ',
       197       '行李重量',
       222       '工作台培训模型 BC_Travel 的重量单位 ',
       247       '发送 BW 培训数据模型 BC_Travel 的',
       271       '航班舱位',
       296       '外币帐面价格(取决于地点) ',
       321       '工作台培训模型 BC_Travel 的支付货币 ',
       346       '航线的帐面本地货币价格 ',
       371       '航班的本地货币 ',
       396       '工作台培训数据模型 BC_Travel 的登记日',
       421       'Number of sales office',
       446       'Travel Agency Number',
       471       'Cancelation flag',
       496       'Reservation flag',
       520       '乘客姓名',
       545       '工作台培训数据模型 BC_Travel 的标题 ',
       570       '乘客出生日期'.
  ULINE AT /1(580).

  LOOP AT gt_data INTO gs_data.
    WRITE:
          /            gs_data-mandt,
           22          gs_data-carrid,
           47          gs_data-connid,
           77          gs_data-fldate,
           95          gs_data-bookid,
           122         gs_data-customid,
           147         gs_data-custtype,
           172         gs_data-smoker,
           197         gs_data-luggweight,
           222         gs_data-wunit,
           247         gs_data-invoice,
           271         gs_data-class,
           296         gs_data-forcuram,
           321         gs_data-forcurkey,
           346         gs_data-loccuram,
           371         gs_data-loccurkey,
           396         gs_data-order_date,
           421         gs_data-counter,
           446         gs_data-agencynum,
           471         gs_data-cancelled,
           496         gs_data-reserved,
           520         gs_data-passname,
           545         gs_data-passform,
           570         gs_data-passbirth.

    HIDE : gs_data-connid.

    ULINE AT /1(580).

  ENDLOOP.

ENDFORM.                    " FRM_INIT_LIST

*&---------------------------------------------------------------------*
*&      Form  SUB_SET_STATUS
*&---------------------------------------------------------------------*
*       alv中根据对单选框的选择控制gui中的某个按钮的显示与否
*----------------------------------------------------------------------*
*      -->PT_EXTAB   text
*----------------------------------------------------------------------*
FORM sub_set_status USING pt_extab TYPE slis_t_extab.
  GDS_EXCLUDE-UCOMM = 'BUTTON'.
  APPEND GDS_EXCLUDE TO GDT_EXCLUDE.
*gui status的定义
  IF  p_hide = 'X'.
  SET PF-STATUS 'STATUS' EXCLUDING GDT_EXCLUDE.
  SET TITLEBAR 'TITLE001' WITH '传入参数1'.
  ELSE.
  SET PF-STATUS 'STATUS'.
  SET TITLEBAR 'TITLE001' WITH '传入参数2'.
  ENDIF.

ENDFORM.                    "sub_set_status

*&---------------------------------------------------------------------*
*&      Form  FRM_IST_SHUCHU
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_ucomm  USING p_ucomm TYPE sy-ucomm
       p_selfield TYPE slis_selfield.
  CASE p_ucomm .
    WHEN '&IC1'.
    WHEN 'BACK'.
      LEAVE PROGRAM.

  ENDCASE.
  p_selfield = 'X'.
ENDFORM .                    "FRM_UCOMM
nangnangchuai commented 5 years ago

alv 开发使用list或者grid

主要功能:需要掌握

  • 上传
  • 展示
  • 下载
  • 全局的变量,每个程序都需要用,
  • form不使用,要求method的方法。class
  • ose24查看全局 类