分类:
2008-11-13 11:27:10
近日做QM项目时遇到一个需求,根据工厂,生产订单和BOM展开号查询出相应的质量通知单,再分别把质量通知单号传入事务QM10,QM11,QM12,QM13,QM14,QM15,QM16,QM17中相应的select-options中.
使用SUBMIT和BDC方式都是可以的,但是开发需求特别推荐使用SUBMIT,不是用BDC.现在的问题是使用SUBMIT后,传入的REPORT的title会发生变化.例如QM10单独运行时titlebar显示:更改质量通知列表:通知单选择;如果用SUBMIT后变成了:XXXXXXX:通知单选择.我跟踪了一下QM10对应的report程序RQMELL10,发现有个subroutine init_selection_screen_f16会根据DY_TCODE来调整TITLE的显示.但是又发现DY_TCODE(选择屏幕上的parameter,不显示)的值是TITLE被赋值后才有值的,这个时候说啥也晚了啊.
下面是简单的代码,看看各位有啥好的办法吗?
REPORT ZQMR005.
TABLES:AFPO,QMEL,SSCRFIELDS.
DATA: BEGIN OF IT_TAB OCCURS 0,
QMNUM TYPE QMEL-QMNUM,
END OF IT_TAB.
DATA: BEGIN OF L_TAB OCCURS 0,
AUFNR TYPE AFPO-AUFNR,
END OF L_TAB.
DATA: SELTAB TYPE TABLE OF RSPARAMS,
SELTAB_WA LIKE LINE OF SELTAB.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:S_DWERK FOR AFPO-DWERK NO-EXTENSION DEFAULT '1000' NO INTERVALS,
S_SERNR FOR AFPO-SERNR NO-EXTENSION,
S_AUFNR FOR AFPO-AUFNR NO-EXTENSION.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN PUSHBUTTON 10(10) BUT1 USER-COMMAND QM10.
SELECTION-SCREEN PUSHBUTTON 30(10) BUT2 USER-COMMAND QM12.
SELECTION-SCREEN PUSHBUTTON 50(10) BUT3 USER-COMMAND QM14.
SELECTION-SCREEN PUSHBUTTON 70(10) BUT4 USER-COMMAND QM16.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN PUSHBUTTON 10(10) BUT5 USER-COMMAND QM11.
SELECTION-SCREEN PUSHBUTTON 30(10) BUT6 USER-COMMAND QM13.
SELECTION-SCREEN PUSHBUTTON 50(10) BUT7 USER-COMMAND QM15.
SELECTION-SCREEN PUSHBUTTON 70(10) BUT8 USER-COMMAND QM17.
SELECTION-SCREEN END OF BLOCK B2.
INITIALIZATION.
BUT1 = 'QM10'.
BUT2 = 'QM12'.
BUT3 = 'QM14'.
BUT4 = 'QM16'.
BUT5 = 'QM11'.
BUT6 = 'QM13'.
BUT7 = 'QM15'.
BUT8 = 'QM17'.
AT SELECTION-SCREEN.
PERFORM GET_DATA.
PERFORM SET_SUBMIT.
CASE SSCRFIELDS.
WHEN 'QM10' OR 'QM11'.
SUBMIT RQMELL10 WITH SELECTION-TABLE SELTAB
WITH DY_OFN EQ 'X'
WITH DY_IAR EQ 'X'
VIA SELECTION-SCREEN
AND RETURN.
WHEN 'QM12' OR 'QM13'.
SUBMIT RQMELL20 WITH SELECTION-TABLE SELTAB
WITH DY_OFN EQ 'X'
WITH DY_IAR EQ 'X'
VIA SELECTION-SCREEN
AND RETURN.
WHEN 'QM14' OR 'QM15'.
SUBMIT RQMELL30 WITH SELECTION-TABLE SELTAB
WITH DY_OFN EQ 'X'
WITH DY_IAR EQ 'X'
VIA SELECTION-SCREEN
AND RETURN.
WHEN 'QM16' OR 'QM17'.
SUBMIT RQMELL40 WITH SELECTION-TABLE SELTAB
WITH DY_OFN EQ 'X'
WITH DY_IAR EQ 'X'
VIA SELECTION-SCREEN
AND RETURN.
ENDCASE.
*&---------------------------------------------------------------------*
*& Form SET_SUBMIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM SET_SUBMIT.
SELTAB_WA-SELNAME = 'QMNUM'.
SELTAB_WA-SIGN = 'I'.
SELTAB_WA-OPTION = 'EQ'.
LOOP AT IT_TAB.
SELTAB_WA-LOW = IT_TAB-QMNUM.
APPEND SELTAB_WA TO SELTAB.
ENDLOOP.
ENDFORM. "SET_SUBMIT
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM GET_DATA.
SELECT AUFNR INTO CORRESPONDING FIELDS OF TABLE L_TAB FROM AFPO
WHERE DWERK IN S_DWERK
AND SERNR IN S_SERNR
AND AUFNR IN S_AUFNR.
SELECT QMNUM INTO CORRESPONDING FIELDS OF TABLE IT_TAB FROM QMEL
FOR ALL ENTRIES IN L_TAB
WHERE FERTAUFNR = L_TAB-AUFNR.
SORT IT_TAB ASCENDING BY QMNUM.
ENDFORM. "GET_DATA
qdbarry2008-11-14 22:25:08
两个方法: 1、改用BDC Call Transaction的方法 2、如果坚持使用Submit,则你这个程序设置为Tcode(比如ZQM10)来运行,并且随时更新Tcode的描述。如: DATA: ttext LIKE tstct-ttext. SELECT SINGLE ttext INTO ttext FROM tstct WHERE tcode = sscrfields AND sprsl = sy-langu . IF sy-subrc = 0 . UPDATE tstct SET ttext = ttext WHERE tcode = 'ZQM10' AND sprsl = sy-langu. ENDIF. CASE sscrfields. WHEN 'QM10' OR 'QM11'. .............