使用函数 CS_BOM_EXPL_KND_V1
FORM FRM_ZJBZFJ_ZK TABLES LT_006 STRUCTURE ZSDT0006
USING P_VLN LIKE GT_VLN .
DATA U_VBAP TYPE VBAP.
DATA LT_STB TYPE TABLE OF STPOX WITH HEADER LINE .
DATA LV_MATNR TYPE MATNR .
DATA LV_FLAG(1) .
CLEAR U_VBAP .
SELECT SINGLE *
INTO U_VBAP
FROM VBAP
WHERE VBELN = P_VLN-VGBEL
AND POSNR = P_VLN-VGPOS .
LV_MATNR = U_VBAP-MATNR+0(4) && 'CTO_FJ' .
* 如果ALV-产品组为10-60,并且订单项目类别为VBAP-PSTYV=ZTC1\ZTC3时,根据成品物料号生成选配附件并插入到附件表中:
IF U_VBAP-PSTYV <> 'ZTC1' AND U_VBAP <> 'ZTC3' .
LV_FLAG = 'X' .
ENDIF.
CHECK LV_FLAG IS INITIAL .
CALL FUNCTION 'CS_BOM_EXPL_KND_V1'
EXPORTING
CAPID = 'PP01'
* CHLST = ' '
* COSPR = ' '
CUOBJ = U_VBAP-CUOBJ
* CUOVS = 0
* CUOLS = ' '
DATUV = SY-DATUM
MEHRS = 'X'
MTNRV = LV_MATNR
WERKS = U_VBAP-WERKS
VBELN = U_VBAP-VBELN
VBPOS = U_VBAP-POSNR
TABLES
STB = LT_STB[]
* MATCAT =
EXCEPTIONS
ALT_NOT_FOUND = 1
CALL_INVALID = 2
MATERIAL_NOT_FOUND = 3
MISSING_AUTHORIZATION = 4
NO_BOM_FOUND = 5
NO_PLANT_DATA = 6
NO_SUITABLE_BOM_FOUND = 7
CONVERSION_ERROR = 8
OTHERS = 9.
* 删除标准附件本身 和 115
DATA LV_S4(4) .
LOOP AT LT_STB WHERE IDNRK <> LV_MATNR .
CLEAR LV_S4 .
LV_S4 = LT_STB-IDNRK+0(4) .
IF LV_S4 <> '115-' .
CLEAR LT_006 .
LT_006-INSNR = P_VLN-VBELN .
LT_006-INSPO = P_VLN-POSNR .
LT_006-VGBEL = P_VLN-VGBEL .
LT_006-VGPOS = P_VLN-VGPOS .
LT_006-MATNR = LT_STB-IDNRK .
LT_006-LFIMG = LT_STB-MENGE .
LT_006-VRKME = LT_STB-MEINS .
LT_006-ZEFJBS = '选配附件' .
COLLECT LT_006 .
ENDIF.
ENDLOOP .
ENDFORM.
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于