获取物料批次的生产日期和有效期
*->获取生产日期和有效期:原因:某些原料的生产日期是手工改的,未按照系统计算,所以必须要取
LV_MATNR = LS_I_TABLE-MATERIALCODE.
LV_CHARG = <FS_BDBATCH>-CHARG.
CLEAR: LT_ALLOCVALUESNUM,LT_ALLOCVALUESCHAR,LT_ALLOCVALUESCURR,LT_RETURN.
CALL FUNCTION 'VB_BATCH_2_CLASS_OBJECT'
EXPORTING
I_MATNR = LV_MATNR
I_CHARG = LV_CHARG
I_WERKS = '8000'
IMPORTING
E_OBJEK = E_OBJEK
E_OBTAB = E_OBTAB
E_KLART = E_KLART
E_CLASS = E_CLASS.
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
OBJECTKEY = E_OBJEK
OBJECTTABLE = E_OBTAB
CLASSNUM = E_CLASS
CLASSTYPE = E_KLART
TABLES
ALLOCVALUESNUM = LT_ALLOCVALUESNUM
ALLOCVALUESCHAR = LT_ALLOCVALUESCHAR
ALLOCVALUESCURR = LT_ALLOCVALUESCURR
RETURN = LT_RETURN.
LOOP AT LT_ALLOCVALUESNUM INTO LS_ALLOCVALUESNUM WHERE CHARACT = 'ZFIFO_HSDAT' OR CHARACT = 'ZFIFO_VFDAT' .
*-->日期格转换
CALL FUNCTION 'QSS0_FLTP_TO_CHAR_CONVERSION'
EXPORTING
I_NUMBER_OF_DIGITS = 0
I_FLTP_VALUE = LS_ALLOCVALUESNUM-VALUE_FROM
IMPORTING
E_CHAR_FIELD = LV_FIELD.
CONDENSE LV_FIELD.
CASE LS_ALLOCVALUESNUM-CHARACT.
WHEN 'ZFIFO_HSDAT'."生产日期
LS_GOODSMVT_ITEM-PROD_DATE = LV_FIELD.
WHEN 'ZFIFO_VFDAT'."有效期
LS_GOODSMVT_ITEM-EXPIRYDATE = LV_FIELD.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
ENDIF.