migo的屏幕格式的由来
migo的屏幕格式是根据用户选择的操作,由操作决定参考单据(操作和参考单据有个固定关系,在次关系基础上用户可以配置哪些TCODE可以使用哪些操作,操作参照哪些文档),在根据用输入的操作和参考文档,系统内部决定交易/事件类型,交易/事件类型内部决定操作代码(migo_mode ),有了操作代码就决定了屏幕的格式。具体内容和代码请参见下面的摘抄。
GOACTION: MIGO 事务中执行操作
Goods Receipt收货A01
Return Delivery返回交货A02
Cancellation取消A03
Display显示A04
Release GR blocked stock下达收货冻结库存A05
Subsequent Delivery后续交货A06
Goods Issue发货A07
Transfer Posting转移过帐A08
Remove from Storage出库A09
Place in Storage入库A10
Subsequent Adjustment后续调整A11
REFDOC:MIGO参考凭证
Purchase Order采购订单R01
Material Document物料凭证R02
Delivery Note交货单R03
Inbound Delivery向内发货R04
Outbound Delivery向外交货R05
Transport传送R06
Transport ID Code运输标识代码R07
Order订单R08
Reservation预留R09
Others其他R10
配置:设置业务和参考单据
Path: IMG-物料管理-库存管理和实际库存-Enjoy 事务设置-货物移动设置 (MIGO_CUST_ACTION)
MIGO 事务中屏幕:执行操作和参考文档对应关系参见代码(LMIGOGL2:CLASS lcl_migo_globals IMPLEMENTATION.)
************************************************************************
* Create the internal customozing table.
* It contains the valid combinations of action and refdoc, derived
* a) From an internal default combination scheme
* b) The customizing, which is able to delete entries.
************************************************************************
METHOD customizing_read.
DATA: l_action_list TYPE string,
l_refdoc_list TYPE string,
lt_action TYPE TABLE OF goaction,
lt_refdoc TYPE TABLE OF refdoc,
l_action TYPE goaction,
l_refdoc TYPE refdoc,
ls_cust TYPE ty_s_cust,
ls_cust_action TYPE migo_cust_action,
ls_cust_refdoc TYPE migo_cust_refdoc.
* Create the default entries. These are the superset of all allowed
* combinations. Customizing can only delete entries.
l_action_list = 'A01 A02 A03 A04 A05 A06 A07 A08 A09 A10 A11'.
SPLIT l_action_list AT ' ' INTO TABLE lt_action.
LOOP AT lt_action INTO l_action.
CASE l_action.
WHEN 'A01'. l_refdoc_list = 'R01 R04 R05 R06 R07 R08 R09 R10'.
WHEN 'A02'. l_refdoc_list = 'R02 R03'.
WHEN 'A03'. l_refdoc_list = 'R02'.
WHEN 'A04'. l_refdoc_list = 'R02'.
WHEN 'A05'. l_refdoc_list = 'R02'.
WHEN 'A06'. l_refdoc_list = 'R02 R03'.
WHEN 'A07'. l_refdoc_list = 'R01 R08 R09 R10'.
WHEN 'A08'. l_refdoc_list = 'R09 R10'.
WHEN 'A09'. l_refdoc_list = 'R10'.
WHEN 'A10'. l_refdoc_list = 'R02 R10'.
WHEN 'A11'. l_refdoc_list = 'R01'.
ENDCASE.
SPLIT l_refdoc_list AT ' ' INTO TABLE lt_refdoc.
LOOP AT lt_refdoc INTO l_refdoc.
ls_cust-action = l_action.
ls_cust-refdoc = l_refdoc.
APPEND ls_cust TO t_cust.
ENDLOOP.
ENDLOOP.
* Read the customizing and eliminate found entries which are deselected.
SELECT * FROM migo_cust_action INTO ls_cust_action
WHERE tcode = caller_sytcode.
IF ls_cust_action-active = space.
DELETE t_cust WHERE action = ls_cust_action-action.
ELSE.
SELECT * FROM migo_cust_refdoc INTO ls_cust_refdoc
WHERE tcode = ls_cust_action-tcode
AND action = ls_cust_action-action.
IF ls_cust_refdoc-active = space.
DELETE t_cust WHERE action = ls_cust_refdoc-action
AND refdoc = ls_cust_refdoc-refdoc.
ENDIF.
ENDSELECT.
ENDIF.
ENDSELECT.
ENDMETHOD.
MIGO根据用户选择的操作选择参考文档的代码(LMIGOFL4: lcl_migo_firstline)
************************************************************************
* Fill the values for the REFDOC-listbox according to P_ACTION
* Entries can be deactivated in customizing table MIGO_CUST_REFDOC
************************************************************************
METHOD listbox_refdoc_set.
DATA: ls_ddic_info TYPE dd07v,
lt_ddic_info TYPE TABLE OF dd07v,
ls_refdoc TYPE pty_s_refdoc.
CLEAR pt_refdoc.
* Get all domain texts
CALL FUNCTION 'DDUT_DOMVALUES_GET'
EXPORTING
name = 'REFDOC'
texts_only = x
TABLES
dd07v_tab = lt_ddic_info
EXCEPTIONS
illegal_input = 1
OTHERS = 2.
IF sy-subrc <> 0.
sy-subrc = sy-subrc.
ENDIF.
* Loop over the allowed refdocs
LOOP AT lt_ddic_info INTO ls_ddic_info.
ls_refdoc-refdoc = ls_ddic_info-domvalue_l.
ls_refdoc-value = ls_ddic_info-ddtext.
READ TABLE lcl_migo_globals=>t_cust
WITH KEY action = p_action
refdoc = ls_refdoc-refdoc
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
APPEND ls_refdoc TO pt_refdoc.
ENDIF.
ENDLOOP.
SORT pt_refdoc BY value.
ENDMETHOD. "listbox_refdoc_set
操作和参考单据决定了交易/事件类型(代码参见),再由交易类型来决定操作类型(操作类型又用于决定屏幕格式)(LMIGOKS1)
*_______________________________________________________________________
* INTERNAL DOCUMENTATION:
* How to set migo_mode.
* Possible values: GR (goods receipt [MB01]), GI (goods issue [MB11]),
* GO (goods receipt for production order [MB31]),
* GS (subsequent adjustment).
* Note: The allowed combinations for MIGO are layed out in LMIGOGL2
* (METHOD customizing_read).
* Determines the selected table control.
*
* /REFDOC |
* / |
* / |
* / |
* ACTION / |R01|R02|R03|R04|R05|R06|R07|R08|R09|R10|
*___________________________________________________________
* Goods receipt |GR | - | - |GR |GR |GR |GR |GO |GI |GI |
* Return delivery | - | * | * | - | - | - | - | - | - | - |
* cancellation | - | * | - | - | - | - | - | - | - | - |
* Display | - | * | - | - | - | - | - | - | - | - |
* Release GR bl.st.|GR | * | - |GR |GR |GR |GR | - | - | - |
* Subsequent deliv.| - | * | * | - | - | - | - | - | - | - |
* goods issue |GI | - | - | - | - | - | - |GI |GI |GI |
* transfer | - | - | - | - | - | - | - | - |GT |GT |
* remove from stor.| - | - | - | - | - | - | - | - | - |GT |
* place in stor. | - |GR | - | - | - | - | - | - | - |GR |
* Subsequent adjust|GS | - | - | - | - | - | - | - | - | - |
*___________________________________________________________
* Note: * means: determined by the material document to be read.
* Before reading, a default is set. Will be overwritten
* immedeately by the material document!
* Default today is: GR
*_______________________________________________________________________
************************************************************************
* Set a new kernel mode.
* According the to flags and fields in S_CONTROL, the data in
* S_ACTION are derived.
************************************************************************
METHOD mode_set.
DATA: lt_mvt TYPE TABLE OF bwart,
l_vgart TYPE vgart,
ls_action_old TYPE ty_s_action.
ls_action_old = s_action.
* Nothing to do if old and new mode are identical. Execute always
* if called from within RESET.
IF is_control <> s_control OR i_unconditional = abap_true.
* If either ACTION or REFDOC has changed, clear VGART. It will be
* set later in this routine to a default or set when reading a
* material document.
* Exception: Setting of VGART forced by flag. Needed for predoc,
* as this routing calls MODE_SET once with a complete set of data.
* Result:
* - New ACTION/REFDOC --> Correct combination set.
* - Read material document --> New VGART set.
* - Change another flag (e.g. new positions) --> No modif to VGART.
l_vgart = is_control-vgart.
IF ( s_control-action <> is_control-action OR
s_control-refdoc <> is_control-refdoc ) AND
i_keep_vgart = abap_false.
CLEAR l_vgart.
ENDIF.
s_control = is_control.
s_control-vgart = l_vgart.
* Create S_ACTION
CLEAR s_action.
* Settings for transaction type. If posting with reference to a
* material document, this is set by the material document reading
* routine. (Importing parameter I_VGART). If not given --> cleared.
* In all other cases, it is derived from ACTION/REFDOC.
CASE s_control-action.
WHEN 'A01'.
s_control-vgart = 'WE'.
IF 'R08' CS s_control-refdoc. s_control-vgart = 'WF'. ENDIF.
IF 'R09 R10' CS s_control-refdoc. s_control-vgart = 'WA'. ENDIF.
WHEN 'A05'.
IF 'R02' NS s_control-refdoc. s_control-vgart = 'WE'. ENDIF.
WHEN 'A07'. s_control-vgart = 'WA'.
WHEN 'A08'. s_control-vgart = 'WA'.
WHEN 'A09'. s_control-vgart = 'WA'.
WHEN 'A10'. s_control-vgart = 'WA'."583649
WHEN 'A11'. s_control-vgart = 'WO'.
ENDCASE.
* Goods receipt/issue others: Table control will be ready for input
IF s_control-refdoc = 'R10'.
s_control-new_line_mode = x.
ENDIF.
* Derive the MIGO_MODE.
* Controls the selection of the a table control variant, field
* selection and authority checks.
CASE s_control-vgart.
WHEN 'WE'. s_action-migo_mode = 'GR'.
WHEN 'WA'.
IF s_control-action = 'A08' or s_control-action = 'A09'.
s_action-migo_mode = 'GT'.
ELSE.
s_action-migo_mode = 'GI'.
ENDIF.
WHEN 'WF'. s_action-migo_mode = 'GO'.
WHEN 'WO'. s_action-migo_mode = 'GS'.
WHEN space. s_action-migo_mode = 'GR'.
WHEN OTHERS. s_action-migo_mode = 'GI'.
ENDCASE.
* If a transfer material document was read by materialdocument_get
* MIGO_MODE has to be 'GT' (only method materialdocument_get can set
* parameter i_transfer).
IF i_transfer = abap_true.
s_action-migo_mode = 'GT'.
ENDIF.
* set accounting VGART for accounting assignment block
CASE s_control-vgart. "431091
WHEN 'WE'. s_control-rw_vorgn = 'RMWE'. "431091 交易业务
WHEN 'WA'. s_control-rw_vorgn = 'RMWA'. "431091
WHEN 'WF'. s_control-rw_vorgn = 'RMWF'. "431091
* additional VGARTs for display material document "431091
WHEN 'WI'. s_control-rw_vorgn = 'RMWI'. "431091
WHEN 'WL'. s_control-rw_vorgn = 'RMWL'. "431091
WHEN 'WO'. s_control-rw_vorgn = 'RMWE'. "431091
WHEN 'WQ'. s_control-rw_vorgn = 'RMWQ'. "431091
WHEN 'WR'. s_control-rw_vorgn = 'RMRU'. "431091
WHEN 'WS'. s_control-rw_vorgn = 'RMRU'. "431091
WHEN 'WZ'. s_control-rw_vorgn = 'RMWA'. "431091
WHEN others. s_control-rw_vorgn = 'RMWA'. "431091
ENDCASE. "431091
* Set the small dependent flags in S_ACTION.
CASE s_control-action.
WHEN 'A01'.
s_action-create = abap_true.
IF s_action-migo_mode = 'GI'.
s_action-issue = abap_true.
ELSE.
s_action-receipt = abap_true.
ENDIF.
WHEN 'A02'.
s_action-create = abap_true.
s_action-return = abap_true.
WHEN 'A03'.
s_action-create = abap_true.
s_action-cancel = abap_true.
WHEN 'A04'.
s_action-display = abap_true.
WHEN 'A05'.
s_action-create = abap_true.
s_action-release = abap_true.
WHEN 'A06'.
s_action-create = abap_true.
s_action-subsequent = abap_true.
WHEN 'A07'.
s_action-create = abap_true.
s_action-issue = abap_true.
WHEN 'A08'.
s_action-create = abap_true.
WHEN 'A09'.
s_action-create = abap_true.
when 'A10'.
s_action-create = abap_true.
s_action-place = abap_true.
WHEN 'A11'.
s_action-create = abap_true.
ENDCASE.
* Set the type of reference document for this combination of
* ACTION and REFDOC.
CASE s_control-refdoc. "381404
WHEN 'R01' OR 'R04' OR 'R05' OR 'R06' OR 'R07'. "381404
* Purchase order, Inbound/Outbound delivery, Transport, TraId.
s_action-refdoctype = c_refdoctype_po. "381404
WHEN 'R02' OR 'R03'. "381404
* Material document, delivery note.
s_action-refdoctype = c_refdoctype_matdoc. "381404
WHEN 'R08'. "381404
* Order. Can be MB31 or goods issue for reservation.
CASE s_control-action. "381404
WHEN 'A01'. "381404
s_action-refdoctype = c_refdoctype_order. "381404
WHEN 'A07'. "381404
s_action-refdoctype = c_refdoctype_reservation. "381404
ENDCASE. "381404
WHEN 'R09'. "381404
* Reservation.
s_action-refdoctype = c_refdoctype_reservation. "381404
WHEN 'R10'. "381404
* No reference document.
s_action-refdoctype = c_refdoctype_none. "381404
ENDCASE. "381404
* Set context for the table control
CALL FUNCTION 'SET_TC_KONTEXT'
EXPORTING
programname = 'SAPLMIGO'
controlname = 'TV_GOITEM'
kontext = s_action-migo_mode. "#EC DOM_EQUAL
* The REFRESH ***after*** the context has been set ensures that the
* R/3 kernel creates the new table control structure using the
* correct settings from that context.
* This refresh has nothing to do with a refresh of the context!
REFRESH CONTROL 'TV_GOITEM' FROM SCREEN '0200'. "354686
* The detail toggler has to use different subscreens for transfer
* postings. Therefore it needs to be updated with the correct screens
* when migo_mode changes.
if s_action-migo_mode = 'GT'.
* To display all tabsprips, the control TS_GOITEM has to be cleared
CLEAR ts_goitem.
call method oref_detail_toggler->screen_set exporting
i_active_dyn = '0303'
i_inactive_dyn = '0302'
i_subscreen_dyn = '0305'
i_subscreen = 'G_DETAIL_SUBSCREEN'.
else.
* To display all tabsprips, the control TS_GOITEM has to be cleared
CLEAR ts_goitem.
call method oref_detail_toggler->screen_set exporting
i_active_dyn = '0301'
i_inactive_dyn = '0302'
i_subscreen_dyn = '0300'
i_subscreen = 'G_DETAIL_SUBSCREEN'.
endif.
def_sms 'MIGO_DETAIL_CARRIER_CHANGE' space space.
ENDIF. "S_CONTROL changed...
* Default values for header data
CALL METHOD header_defaults_set.
* BAdI: MODE SET
IF NOT lcl_migo_globals=>if_badi is initial. "552774
CALL METHOD lcl_migo_globals=>if_badi->mode_set
EXPORTING
i_action = s_control-action
i_refdoc = s_control-refdoc.
ENDIF. "552774
* Send message
def_sms 'KERNEL_MODE_CHANGED' ls_action_old-migo_mode
s_action-migo_mode.
* New 'migo_mode'-depending fieldselection
CALL METHOD screen_modify_mode.
* Get allowed movemtent types (from T158B / MIGO_T156)
CALL METHOD lcl_migo_buffer=>allowed_mvt_get
EXPORTING i_migo_mode = s_action-migo_mode
i_migo_action = s_control-action
IMPORTING et_mvt = lt_mvt.
* Export pt_mvt to memory, because F4-Help for BWART needs it.
EXPORT lt_mvt FROM lt_mvt TO MEMORY ID 'MIGO_MVT'.
ENDMETHOD.
MIGO的屏幕格式是如何来的?(代码摘自:LMIGOSM2)
* CLASS lcl_migo_screenmanager IMPLEMENTATION
METHOD lif_migo_frame~message_handler.
* Set the correct bit in the status data
* Mapping: <status> = 'ABC' with A = Header, B = Table, C = Item
CASE i_message_id.
WHEN 'MIGO_HEADER_TOGGLER_STATUS'. p_status+0(1) = is_message-data2.
WHEN 'MIGO_DETAIL_TOGGLER_STATUS'. p_status+2(1) = is_message-data2.
WHEN 'MIGO_DETAIL_CARRIER_CHANGE'. "new carrier screen with 'old'
"p_status
ENDCASE.
p_status+1(1) = x. "Table always visible
* Choose the appropriate subscreen
IF lcl_migo_globals=>kernel->s_action-migo_mode = 'GT'.
* Transfer posting
g_detail_subscreen = '0305'.
CASE p_status.
WHEN 'XX '. g_screenmanager_dynnr = '0006'.
WHEN 'XXX'. g_screenmanager_dynnr = '0007'.
WHEN ' X '. g_screenmanager_dynnr = '0008'.
WHEN ' XX'. g_screenmanager_dynnr = '0009'.
ENDCASE.
ELSE.
* Normal posting (mode: GI/GR/GS/GO)
g_detail_subscreen = '0300'.
CASE p_status.
WHEN 'XX '. g_screenmanager_dynnr = '0002'.
WHEN 'XXX'. g_screenmanager_dynnr = '0003'.
WHEN ' X '. g_screenmanager_dynnr = '0004'.
WHEN ' XX'. g_screenmanager_dynnr = '0005'.
ENDCASE.
endif.
ENDMETHOD.