反查BOM, 找出它的上阶
Posted rainysblog
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了反查BOM, 找出它的上阶相关的知识,希望对你有一定的参考价值。
转自:https://blog.csdn.net/zhongguomao/article/details/80172441
查询物料的上阶方法有三:
1. CS15 可直接查出物料的上阶直至顶阶物料.
2. CALL FUNCTION. 只能查上上阶, 要想得到顶阶, 需要递归查询.
CS_WHERE_USED_MAT Bills of material; where-used list
CS_WHERE_USED_MAT_ANY Bills of material; where-used list as material or class item
3. 根据表 STAS 和 STPO.
REPORT z_af_023.
DATA: BEGIN OF iwultb OCCURS 0.
INCLUDE STRUCTURE stpov. " BOM Item
DATA: END OF iwultb.
DATA: BEGIN OF iequicat OCCURS 0.
INCLUDE STRUCTURE cscequi. " BOM Explosion: Equipments
DATA: END OF iequicat.
*
DATA: BEGIN OF ikndcat OCCURS 0.
INCLUDE STRUCTURE cscknd. " BOM Explosion: Sales Order
DATA: END OF ikndcat.
*
DATA: BEGIN OF imatcat OCCURS 0.
INCLUDE STRUCTURE cscmat. " BOM Explosion: Materials
DATA: END OF imatcat.
*
DATA: BEGIN OF istdcat OCCURS 0.
INCLUDE STRUCTURE cscstd. " BOM Explosion: Standard Object
DATA: END OF istdcat.
*
DATA: BEGIN OF itplcat OCCURS 0.
INCLUDE STRUCTURE csctpl. " BOM Explosion: Equipments
DATA: END OF itplcat.
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME.
PARAMETERS: i_werks LIKE marc-werks.
PARAMETERS: i_matnr LIKE marc-matnr.
SELECTION-SCREEN END OF BLOCK bk1.
START-OF-SELECTION.
DATA: datub LIKE rc29l-datub,
datuv LIKE rc29l-datuv.
CALL FUNCTION ‘CS_WHERE_USED_MAT‘
EXPORTING
datub = datub
datuv = datuv
matnr
DATA: BEGIN OF iwultb OCCURS 0.
INCLUDE STRUCTURE stpov. " BOM Item
DATA: END OF iwultb.
DATA: BEGIN OF iequicat OCCURS 0.
INCLUDE STRUCTURE cscequi. " BOM Explosion: Equipments
DATA: END OF iequicat.
*
DATA: BEGIN OF ikndcat OCCURS 0.
INCLUDE STRUCTURE cscknd. " BOM Explosion: Sales Order
DATA: END OF ikndcat.
*
DATA: BEGIN OF imatcat OCCURS 0.
INCLUDE STRUCTURE cscmat. " BOM Explosion: Materials
DATA: END OF imatcat.
*
DATA: BEGIN OF istdcat OCCURS 0.
INCLUDE STRUCTURE cscstd. " BOM Explosion: Standard Object
DATA: END OF istdcat.
*
DATA: BEGIN OF itplcat OCCURS 0.
INCLUDE STRUCTURE csctpl. " BOM Explosion: Equipments
DATA: END OF itplcat.
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME.
PARAMETERS: i_werks LIKE marc-werks.
PARAMETERS: i_matnr LIKE marc-matnr.
SELECTION-SCREEN END OF BLOCK bk1.
START-OF-SELECTION.
DATA: datub LIKE rc29l-datub,
datuv LIKE rc29l-datuv.
CALL FUNCTION ‘CS_WHERE_USED_MAT‘
EXPORTING
datub = datub
datuv = datuv
matnr
以上是关于反查BOM, 找出它的上阶的主要内容,如果未能解决你的问题,请参考以下文章