Chinaunix首页 | 论坛 | 博客
  • 博客访问: 721408
  • 博文数量: 158
  • 博客积分: 6010
  • 博客等级: 准将
  • 技术积分: 1643
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-11 14:37
个人简介

人法地,地法天,天法道,道法自然

文章分类

全部博文(158)

文章存档

2022年(1)

2020年(3)

2016年(1)

2014年(7)

2013年(4)

2010年(5)

2009年(86)

2008年(25)

2007年(26)

我的朋友

分类:

2009-06-03 22:18:37

TC向导设计:

 

 

退出功能码:MYITAB-EXIT

 

Flow logic:

PROCESS BEFORE OUTPUT.
* MODULE STATUS_0140.
*
  MODULE MYITAB_CHANGE_TC_ATTR.

  LOOP AT   ITAB WITH CONTROL MYITAB CURSOR MYITAB-CURRENT_LINE.
    MODULE MYITAB_GET_LINES.
  ENDLOOP.

  MODULE MYITEM_CHANGE_TC_ATTR.

  LOOP AT   ITEM WITH CONTROL MYITEM  CURSOR MYITEM-CURRENT_LINE.
    MODULE MYITEM_GET_LINES.
  ENDLOOP.

PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0140.

 LOOP AT ITAB.
    CHAIN.
      FIELD ITAB-MATNR.
      FIELD ITAB-MTART.
      FIELD ITAB-MATKL.
      FIELD ITAB-MEINS.
      MODULE MYITAB_MODIFY ON CHAIN-REQUEST.
    endchain.
    FIELD ITAB-MARK
      MODULE MYITAB_MARK ON REQUEST.
  ENDLOOP.

  MODULE MYITAB_USER_COMMAND.


 LOOP AT ITEM.
    CHAIN.
      FIELD ITEM-WERKS.
      FIELD ITEM-LGORT.
    endchain.
    FIELD ITEM-MARK
      MODULE MYITEM_MARK ON REQUEST.
  ENDLOOP.
  MODULE MYITEM_USER_COMMAND.

 

Program:

 

*&---------------------------------------------------------------------*
*& Report  ZMYP_TCM
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZMYP_TCM.

tables:mara,t001l.

data:begin of itab occurs 0.
      include structure mara.
      data:mark type char1.
data:end of itab.

data:begin of item occurs 0.
      include structure t001l.
      data:mark type char1.
data:end of item.

DATA:     OK_CODE LIKE SY-UCOMM,
          S_OK_CODE LIKE SY-UCOMM.

select * from mara into corresponding fields of table itab .
select * from t001l into corresponding fields of table item .

call screen 0140.


CONTROLS: MYITAB TYPE TABLEVIEW USING SCREEN 0140.
CONTROLS: MYITEM TYPE TABLEVIEW USING SCREEN 0140.

DATA:     G_MYITAB_LINES  LIKE SY-LOOPC,
          G_MYITEM_LINES  LIKE SY-LOOPC.
*&---------------------------------------------------------------------*
*&      Module  MYITAB_CHANGE_TC_ATTR  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MYITAB_CHANGE_TC_ATTR OUTPUT.
   DESCRIBE TABLE ITAB LINES MYITAB-lines.
ENDMODULE.                 " MYITAB_CHANGE_TC_ATTR  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  MYITAB_GET_LINES  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MYITAB_GET_LINES OUTPUT.
  G_MYITAB_LINES = SY-LOOPC.
ENDMODULE.                 " MYITAB_GET_LINES  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  MYITEM_CHANGE_TC_ATTR  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MYITEM_CHANGE_TC_ATTR OUTPUT.
   DESCRIBE TABLE ITEM LINES MYITEM-lines.
ENDMODULE.                 " MYITEM_CHANGE_TC_ATTR  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  MYITEM_GET_LINES  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MYITEM_GET_LINES OUTPUT.
   G_MYITEM_LINES = SY-LOOPC.
ENDMODULE.                 " MYITEM_GET_LINES  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  MYITAB_MODIFY  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MYITAB_MODIFY INPUT.
   MODIFY ITAB
    INDEX MYITAB-CURRENT_LINE.
ENDMODULE.                 " MYITAB_MODIFY  INPUT
*&---------------------------------------------------------------------*
*&      Module  MYITAB_MARK  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MYITAB_MARK INPUT.
  DATA: g_MYITAB_wa2 like line of ITAB.
    if MYITAB-line_sel_mode = 1
    and ITAB-MARK = 'X'.
     loop at ITAB into g_MYITAB_wa2
       where MARK = 'X'.
       g_MYITAB_wa2-MARK = ''.
       modify ITAB
         from g_MYITAB_wa2
         transporting MARK.
     endloop.
  endif.
  MODIFY ITAB
    INDEX MYITAB-CURRENT_LINE
    TRANSPORTING MARK.
ENDMODULE.                 " MYITAB_MARK  INPUT
*&---------------------------------------------------------------------*
*&      Module  MYITAB_USER_COMMAND  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MYITAB_USER_COMMAND INPUT.
  OK_CODE = SY-UCOMM.
  PERFORM USER_OK_TC USING    'MYITAB'
                              'ITAB'
                              'MARK'
                     CHANGING OK_CODE.
  SY-UCOMM = OK_CODE.
ENDMODULE.                 " MYITAB_USER_COMMAND  INPUT
*&---------------------------------------------------------------------*
*&      Module  MYITEM_MARK  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MYITEM_MARK INPUT.
DATA: g_MYITEM_wa2 like line of ITEM.
    if MYITEM-line_sel_mode = 1
    and ITEM-MARK = 'X'.
     loop at ITEM into g_MYITEM_wa2
       where MARK = 'X'.
       g_MYITEM_wa2-MARK = ''.
       modify ITEM
         from g_MYITEM_wa2
         transporting MARK.
     endloop.
  endif.
  MODIFY ITEM
    INDEX MYITEM-CURRENT_LINE
    TRANSPORTING MARK.
ENDMODULE.                 " MYITEM_MARK  INPUT
*&---------------------------------------------------------------------*
*&      Module  MYITEM_USER_COMMAND  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MYITEM_USER_COMMAND INPUT.

  OK_CODE = SY-UCOMM.
  PERFORM USER_OK_TC USING    'MYITEM'
                              'ITEM'
                              'MARK'
                     CHANGING OK_CODE.
  SY-UCOMM = OK_CODE.

ENDMODULE.                 " MYITEM_USER_COMMAND  INPUT
*&---------------------------------------------------------------------*
*&      Form  USER_OK_TC
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0235   text
*      -->P_0236   text
*      -->P_0237   text
*      <--P_OK_CODE  text
*----------------------------------------------------------------------*
FORM USER_OK_TC  USING    P_TC_NAME TYPE DYNFNAM
                          P_TABLE_NAME
                          P_MARK_NAME
                 CHANGING P_OK      LIKE SY-UCOMM.

DATA: L_OK              TYPE SY-UCOMM,
         L_OFFSET          TYPE I.

SEARCH P_OK FOR P_TC_NAME.
   IF SY-SUBRC <> 0.
     EXIT.
   ENDIF.
   L_OFFSET = STRLEN( P_TC_NAME ) + 1.
   L_OK = P_OK+L_OFFSET.


 CASE L_OK.

   WHEN 'EXIT'.
     LEAVE PROGRAM.


 ENDCASE.
ENDFORM.                    " USER_OK_TC

 

阅读(1226) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~