我还处于SAP ABAP的学习阶段,所以请耐心等待。所以我试图创建一个将从vbak表中检索数据的报告,但是有一些条件: 1)启用和禁用单选按钮。 2)使用" AT SELECTION-SCREEN ON"声明。 3)复选框'组织' (以可显示的方式打印数据) 4)复选框'下载为文本文件'将数据下载为文本文件。
我的代码:
REPORT z_testingdemo.
TABLES: vbak.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME NO INTERVALS.
PARAMETERS: rb_on RADIOBUTTON GROUP g1.
PARAMETERS: rb_off RADIOBUTTON GROUP g1.
PARAMETERS: p_name TYPE char15.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
PARAMETERS: c_check AS CHECKBOX DEFAULT 'X'.
PARAMETERS: c_check2 AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON RADIOBUTTON GROUP g1.
IF rb_on IS INITIAL.
MESSAGE 'Please Press ENABLE to ENABLE the FIELDS' TYPE 'E'.
ENDIF.
"--------I don't really know why this part didn't work -----------
* IF rb_off = 'X'.
* screen-active = 0.
* modify screen.
* ELSE.
* screen-active = 1.
* modify screen.
* ENDIF.
"------------------------------------------------------------------
TYPES: BEGIN OF itab,
vbeln TYPE vbak-vbeln,
vkorg TYPE vbak-vkorg,
vtweg TYPE vbak-vtweg,
spart TYPE vbak-spart,
END OF itab.
DATA: wa_ma TYPE itab,
it_ma TYPE STANDARD TABLE OF itab.
SELECT vbeln vkorg vtweg spart
FROM vbak
INTO TABLE it_ma
WHERE vbeln IN s_vbeln.
IF sy-subrc = 0 AND c_check = '' AND c_check2 = ''.
LOOP AT it_ma INTO wa_ma.
WRITE : / wa_ma-vbeln, wa_ma-vkorg , wa_ma-vtweg, wa_ma-spart.
ENDLOOP.
ELSEIF sy-subrc = 0 AND c_check = 'X' AND c_check2 = ''.
LOOP AT it_ma INTO wa_ma.
WRITE : / wa_ma-vbeln, 17 wa_ma-vkorg , 37 wa_ma-vtweg, 51 wa_ma-spart.
ENDLOOP.
ELSEIF sy-subrc = 0 AND c_check2 = 'X'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:/REPORT4.TXT'
write_field_separator = ','
TABLES
data_tab = it_ma.
ELSEIF sy-subrc = 0 AND c_check = '' AND c_check2 = 'X'.
ENDIF.
TOP-OF-PAGE .
PERFORM display_heading .
FORM display_heading.
WRITE : / sy-uline .
WRITE: / 'REPORT 4'.
IF c_check = 'X'.
WRITE: / .
WRITE : /'For Mr./Mrs.: ', p_name.
WRITE : /'SALES DOCUMENT', 17 'SALES ORGANIZATION', 37 'DISTRIBUTION', 51 'CHANN. DIVISION'.
WRITE : / sy-uline .
ENDIF.
ENDFORM.
我的意思是,如果没有AT SELECTION-SCREEN ON声明,它大部分都有效。但AT SELECTION-SCREEN ON是其中一个条件。非常感谢。
答案 0 :(得分:0)
如果要更改字段的设置,则需要在AT SELECTION-SCREEN OUTPUT
中执行此操作,并且需要使用LOOP AT SCREEN
语句来遍历字段。
答案 1 :(得分:0)
您在没有'./configure' '--with-zlib' '--enable-soap' '--enable-exif' '--with-config-file-path=/usr/local/php' '--with-config-file-scan-dir=/usr/local/php/php.d' '--enable-phar' '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-iconv' '--with-mysql' '--with-mysqli' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-mcrypt' '--with-gettext' '--with-xmlrpc' '--with-pdo-mysql=mysqlnd' '--enable-posix' '--enable-ftp' '--with-openssl' '--enable-mbstring' '**--enable-mailparse**' '--with-kerberos' '--with-xsl' '--with-bz2' '--enable-sockets' '--enable-zip' '--with-gd' '--with-pcre-regex' '--libdir=/usr/lib' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-imap' '--with-imap-ssl'
的情况下启动代码。
默认情况下,您的报告以事件START-OF_SELECTION
开头,但START-OF_SELECTION
您定义了另一个事件,而您的代码不会从AT SELECTION-SCREEN
开始。
所以你有两个解决方案:
START-OF_SELECTION
移至主代码下方。AT SELECTION-SCREEN
。正如vwegert已经提到的,要更改选择屏幕上的设置,您需要START-OF_SELECTION
。