READ REPORT it_prog-name INTO it_text
该句话的意思是将 it_prog-name 这个程序代码写入 内表it_text中。
你这个问题是什么意思?输出到屏幕?最终结果么?还是中间的 *** 作过程中的子屏幕?
假如是最终结果的话,输出到最终的屏幕上有2种:
1、普通输出方式:WRITE语句
例如:DATA: L_TEXT TYPE C.
L_TEXT = '这是我的第一个abap程序'.
WRITE:/ L_TEXT.
结果如图
2.ALV输出,不过ALV输出一般都用于表的输出展示。这边就不费劲去举例了。
假如是在子屏幕上要显示的话,需要在子屏幕上画一个T的控件,然后给它命名(如:l_txt)在程序中也需要定义一个全局的变量和它同名(如:l_txt),然后在PAI里面把你要展示的值赋给l_txt,这个时候call出来的子屏幕上的名为l_txt的T控件就能显示你想展示的数值了。
就这么多了,因为不知道你问题的具体内容是什么,希望能帮的上忙。
SORT IT_DATA BY BNAME. INCLUDE OLE2INCL. "定义OLE变量DATA: EXCEL TYPE OLE2_OBJECT, SHEET TYPE OLE2_OBJECT, CELL TYPE OLE2_OBJECT, WORKBOOK TYPE OLE2_OBJECT, XLSNAME TYPE STRING VALUE 'C:\sap_usr02.xls', LINE TYPE I VALUE 0. "行号CREATE OBJECT EXCEL 'EXCEL.APPLICATION'."启动ExcelIF SY-SUBRC NE 0. WRITE: / '启动Excel失败。'. STOP.ENDIF.CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOK.SET PROPERTY OF EXCEL 'VISIBLE' = 1. "使excel 可视SET PROPERTY OF EXCEL 'SHEETSINNEWWORKBOOK' = 1. "如果是读取excel文件中的内容 则是直接打开工作簿第一页CALL METHOD OF WORKBOOK 'ADD'. "例如:CALL METHOD OF EXCEL 'WORKSHEETS' = SHEET EXPORTING #1 = 1.LOOP AT IT_DATA INTO MY_DATA. LINE = LINE + 1. "Excel 中行号从1开始 CALL METHOD OF EXCEL 'CELLS' = CELL EXPORTING #1 = LINE #2 = 1. "指定单元格, SET PROPERTY OF CELL 'VALUE' = MY_DATA-MANDT. "写入值 CALL METHOD OF EXCEL 'CELLS' = CELL EXPORTING #1 = LINE #2 = 2. "指定单元格, SET PROPERTY OF CELL 'VALUE' = MY_DATA-BNAME. "写入值 CALL METHOD OF EXCEL 'CELLS' = CELL EXPORTING #1 = LINE #2 = 3. "指定单元格, SET PROPERTY OF CELL 'VALUE' = MY_DATA-ERDAT. "写入值 CALL METHOD OF EXCEL 'CELLS' = CELL EXPORTING #1 = LINE #2 = 4. "指定单元格, SET PROPERTY OF CELL 'VALUE' = MY_DATA-LTIME. "写入值ENDLOOP.GET PROPERTY OF EXCEL 'ACTIVESHEET' = SHEET. "激活工作簿GET PROPERTY OF EXCEL 'ACTIVEWORKBOOK' = WORKBOOK. "激活工作区CALL METHOD OF WORKBOOK 'SAVEAS' EXPORTING #1 = XLSNAME #2 = 1. "将excel文件保存CALL METHOD OF WORKBOOK 'CLOSE'. "关闭工作区CALL METHOD OF EXCEL 'QUIT'. "退出excel*WRITE:/ XLSNAME,'DONE'. "退出成功,输出doneFREE OBJECT SHEET. "释放 *** 作FREE OBJECT WORKBOOK.FREE OBJECT EXCEL.欢迎分享,转载请注明来源:内存溢出
评论列表(0条)