查询物料的上阶方法有三:
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