‎2019 Jun 17 8:52 PM
Hello Experts, I am getting the mentioned error when I am executing AMDP through a transaction.
Types of the internal tables used
ET_BATCH
TYPES: BEGIN OF ty_batch,
matnr TYPE matnr,
werks TYPE werks_d,
LGORT type LGORT_d,
charg TYPE charg_d,
hsdat TYPE hsdat,
verab TYPE verab,
qty TYPE labst,
week TYPE char8,
year TYPE char4,
month TYPE char10,
quater TYPE char7,
price TYPE stprs,
objek TYPE cuobj_bm,
b_unit TYPE meins,
END OF ty_batch,
IT_T_BATCH
TYPES : BEGIN OF ty_t_batch,
matnr TYPE matnr,
werks TYPE werks_d,
charg TYPE charg_d,
qty TYPE menge_d,
hsdat TYPE hsdat,
verab TYPE verab,
b_unit TYPE meins,
END OF ty_t_batch,
Following is the code inside the method
DECLARE lc_qty CONSTANT decimal( 13,3 ) := '0.000';
DECLARE lc_zero CONSTANT char( 1 ) := '0';
DECLARE lc_space CONSTANT char( 8 ) := ' ';
DECLARE lc_date CONSTANT DATE := '00000000';
DECLARE lc_set CONSTANT char( 1 ) := 'X';
*======================================================================*
* Get Week, Month and Year based on Manufaring date-
et_batch = SELECT
matnr,
werks,
lgort,
charg,
hsdat,
verab,
qty,
isoweek (TO_DATE(hsdat, 'YYYYMMDD')) as week,
case when hsdat = 00000000 OR hsdat is NULL or hsdat = lc_space then 00000000
when hsdat is NOT NULL and hsdat != 00000000 then year (TO_DATE(hsdat, 'YYYYMMDD'))
end as year,
monthname (hsdat) as month,
case when hsdat != lc_space and hsdat != 00000000 then
quarter (to_date(hsdat, 'YYYYMMDD')) END as quater,
:lc_zero as price,
cuobj_bm as objek,
b_unit as b_unit
FROM(
* Get manufacturing date from MCH1 and convert batch quantity to User Enterd UOM
SELECT DISTINCT
a.matnr,
b.werks,
b.lgort,
a.charg,
a.hsdat,
a.verab,
case when unts.umrez = 0 or unts.umrez is NULL then 0.000
when unts.umrez is NOT NULL then
* Begin of MOD: MONTAOSP: WO0000000126366: 11.06.2019
* ROUND( ( ( b.CLABS + B.CUMLM + B.CINSM + B.CEINM + B.CSPEM + b.CRETM ) *
ROUND( ( ( b.CLABS + B.CUMLM + B.CINSM + B.CEINM + b.CRETM ) *
* End of MOD: MONTAOSP: WO0000000126366: 11.06.2019
( unts.umren / unts.umrez ) ), 3, ROUND_HALF_EVEN)
end as qty,
a.cuobj_bm,
c.meins as b_unit
from "MCH1" as a
INNER join "MCHB" as b
on b.mandt = a.mandt
AND b.matnr = a.matnr
and b.charg = a.charg
inner join "MARA" as c
on c.matnr = a.matnr
left outer join (
SELECT DISTINCT matnr,
meinh,
umren,
umrez
FROM marm
WHERE mandt = session_context( 'CLIENT' )
AND matnr IN ( SELECT DISTINCT matnr FROM :it_marc )
AND meinh = :iv_unit ) AS unts ON
unts.matnr = a.matnr
where a.mandt = session_context( 'CLIENT' )
and c.mandt = session_context( 'CLIENT' )
and a.matnr in ( select DISTINCT matnr FROM :it_marc )
and b.werks in ( select DISTINCT werks from :it_marc )
and a.hsdat != :lc_space
and a.hsdat != :lc_date
and a.hsdat is NOT NULL
and ( b.CLABS != lc_qty
or B.CUMLM != lc_qty
or B.CINSM != lc_qty
or B.CEINM != lc_qty
or B.CSPEM != lc_qty
or b.CRETM != lc_qty )
UNION ALL
* Add transit batchs along with complete batches
SELECT matnr,
werks,
0 as lgort,
charg,
hsdat,
verab,
qty,
CONCAT( matnr, werks) AS objek,
b_unit
FROM :it_t_batch );
* Fetch Characteristics details, if required!
IF iv_char_flag = :lc_set
THEN
* Get details for selected characteristics!!
li_temp =
SELECT btc.matnr,
btc.werks,
btc.charg,
btc.hsdat,
btc.verab,
btc.qty AS qty,
btc.week,
btc.year,
btc.month,
btc.quater,
chr.atwrt AS ch_val,
btc.qty AS cr_qty
FROM :et_batch as btc
INNER JOIN ausp as chr
ON chr.mandt = SESSION_CONTEXT( 'CLIENT' )
AND chr.objek = btc.objek
WHERE atinn = iv_cr_nm;
* Filter details based on selected Values!!
et_batch_cr = APPLY_FILTER (:li_temp, :iv_values);
END IF;
‎2019 Jun 17 9:28 PM
This is resolved as found that there is data type mismatch at line "0 as LGORT". The lgort field is character and by assigning 0 I was converting it to integer. Changed it to blank and it worked.