MM--MIGO的螢幕格式由來學習
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow
也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!
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.