SAP 下钻功能大全
阅读原文时间:2023年07月15日阅读:2

FORM ALV_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM "作为reuse_alv_grid_display的事件i_callback_user_command
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
" 获取当前ALV所在行数据
READ TABLE IT_DATA INTO WA_DATA INDEX RS_SELFIELD-TABINDEX.
CASE RS_SELFIELD-SEL_TAB_FIELD.
WHEN 'IT_DATA-BELNR'.
SET PARAMETER ID: 'BLN' FIELD WA_DATA-BELNR.
SET PARAMETER ID: 'BUK' FIELD P_BUKRS.
SET PARAMETER ID: 'GJR' FIELD WA_DATA-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN. "凭证的下钻
WHEN 'IT_DATA-EBELN'.
CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT' “采购订单的下钻”
EXPORTING
I_EBELN = WA_DATA-EBELN
EXCEPTIONS
NOT_FOUND =
NO_AUTHORITY =
INVALID_CALL =
PREVIEW_NOT_POSSIBLE =
OTHERS = .
IF SY-SUBRC <> .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM.

附常用的下钻方法:

采购订单:
1. CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'
EXPORTING
i_ebeln = itab-ebeln
EXCEPTIONS
not_found = 1
no_authority = 2
invalid_call = 3
preview_not_possible = 4
OTHERS = 5.

2. SET PARAMETER ID 'BES' FIELD itab-ebeln.
CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'
EXPORTING
i_ebeln = itab-ebeln
i_ebelp = itab-ebelp
i_enjoy = 'X'
* IMPORTING
* E_EKKO =
EXCEPTIONS
not_found = 1
no_authority = 2
invalid_call = 3
OTHERS = 4 .

物料凭证:
SET PARAMETER ID 'MBN' FIELD itab-belnr.
SET PARAMETER ID 'MJA' FIELD itab-gjahr.
SET PARAMETER ID 'BUK' FIELD itab-bukrs.

CALL FUNCTION 'MIGO_DIALOG'
EXPORTING
i_action = 'A04'
i_refdoc = 'R02'
i_notree = 'X'
i_skip_first_screen = 'X'
i_okcode = 'OK_GO'
i_mblnr = itab-belnr
i_mjahr = itab-gjahr
EXCEPTIONS
illegal_combination = 1
OTHERS = 2.

销售订单:
SET PARAMETER ID 'AUN' FIELD it_itab-vgbel .
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN .

交货单:
SET PARAMETER ID 'VL' FIELD it_itab-vbeln .
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN .

PO的物料:
CALL FUNCTION 'MMPUR_MATERIAL_DISPLAY'
EXPORTING
im_matnr = itab-matnr.

物料:
SET PARAMETER ID 'MXX' FIELD 'E'. "Table T132,决定显示哪个视图
SET PARAMETER ID 'MAT' FIELD itab-matnr.
SET PARAMETER ID 'WRK' FIELD itab-werks.
SET PARAMETER ID 'LIF' FIELD itab-lifnr.
* Set parameter id 'KAR' field '001'.
* SET PARAMETER ID 'LAG' FIELD im_lgort.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

MXX的选择看表T132 (同时看表MOFF)
A 工作计划
B 会计
C 分类
D 物料需求计划
E 采购
F 生产资源/工具
G 成本核算
K 基本数据
L 存储
P 预测
Q 质量管理
S 仓库管理
V 销售
X X 工厂库存
Z X 存储位置库存

供应商:
CALL FUNCTION 'MMPUR_VENDOR_DISPLAY'
EXPORTING
im_lifnr = itab-lifnr
im_ekorg = 'B000'.

信息记录:
CALL FUNCTION 'MMPUR_INFO_RECORD_DISPLAY'
EXPORTING
im_infnr = itab-infnr
im_ekorg = 'B000'
im_werks = itab-werks.
工厂:
DATA: ls_vt001w TYPE v_t001w.
ls_vt001w-mandt = sy-mandt.
ls_vt001w-werks = itab-werks.
CALL FUNCTION 'VIEW_MAINTENANCE_SINGLE_ENTRY'
EXPORTING
action = 'SHOW'
view_name = 'V_T001W'
CHANGING
entry = ls_vt001w.

注:一般维护视图的界面可以用这个方法

*几个关于"Display"的Function Group:CK50,EDI5,MEEXT等

会计凭证:

SET PARAMETER ID 'BLN' FIELD '90000046' .
SET PARAMETER ID 'BUK' FIELD '1000'.
SET PARAMETER ID 'GJR' FIELD '2008'.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN .

程序或者函数:

CALL FUNCTION 'EDITOR_PROGRAM'
EXPORTING
display = 'X'
program = it_tfdir-incname
EXCEPTIONS
OTHERS = 1.

函数组:

CALL FUNCTION 'RS_FUNCTION_POOL_CHANGE'
EXPORTING
aktion = 'SHOW'
function_pool = it_tfdir-fgname
EXCEPTIONS
OTHERS = 9.

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章