2012 Jan 13 6:45 AM
HI Experts,
I am into SAP BI. I have done datasource enhancement to get Delivery costs(DMBTR) from EKBZ table to EKPO table structure.
In EKPO having 3 items - data is like this -
EBELN--- EBELLP POQTY
415150901--10 --- 30
415150901---20 --- 40
415150901---30 --- 40
In EKBZ data is like this
EBELN- EBELLPGR qty--Delivery cost(DMBTR)
415150901---10 -- 40--10
415150901--10 -- 40---20
415150901---20 - 205
After writing code in CMOD - code is
WHEN '2LIS_02_ITM'.
DATA :C_T_DATA1 type table of MC02M_0ITM,
WA_MC02M_0ITM LIKE MC02M_0ITM.
LOOP AT C_T_DATA INTO WA_MC02M_0ITM.
IF WA_MC02M_0ITM-ALIEF = '0'.
DELETE C_T_DATA index sy-tabix .
ENDIF.
ENDLOOP.
c_t_data1[] = c_t_data[].
sort C_T_DATA1 by ebeln ebelp.
LOOP AT C_T_DATA1 INTO WA_MC02M_0ITM.
SELECT DMBTR FROM EKBZ INTO WA_MC02M_0ITM-ZZDMBTR
WHERE EBELN = WA_MC02M_0ITM-EBELN
AND EBELP = WA_MC02M_0ITM-EBELP
AND MENGE = WA_MC02M_0ITM-AKTWE.
MODIFY C_T_DATA1 FROM WA_MC02M_0ITM index sy-tabix transporting zzdmbtr .
endselect.
After executing code the result is not coming properly. The result is like this -
EBELN-EBELLPPO qty GR qty- Delivery cost(DMBTR)
415150901---10 -30 40--10
415150901--20 - 40-20---5
415150901---30 -- 40-20-0
I am missing one item document i.e.
415150901---10 -- 40----20
Can any one help on this issue.
Regards,
rvc
2012 Jan 13 7:46 AM
Hi RVC,
Try using
GJAHR
BELNR
BUZEI
Fields in ur selection criteria if possible. Sometimes SAP misses out the records if few fields are duplicate to avoid this we should add as many primary keys as possible in select query .
Thanks,
MN
2012 Jan 13 7:46 AM
Hi RVC,
Try using
GJAHR
BELNR
BUZEI
Fields in ur selection criteria if possible. Sometimes SAP misses out the records if few fields are duplicate to avoid this we should add as many primary keys as possible in select query .
Thanks,
MN
2012 Jan 13 9:42 AM
MN,
I feel it is not possible, because these feilds are not keys in EKPO table.
need some other valuable inputs.
2012 Jan 13 12:17 PM
Hi RVC ,
Better u have to collect the quantity from EKBZ using EBELN & EBELP. like itab2.
Now u r having the the single record in ITAB2.
come to the previous U have internal table with the data's of EKPO. LIKE ITAB1.
now loop through the internal table ITAB1.
read itab2 with ebeln & ebelp.
if sy-subrc = 0.
itab1-quantity = itab2-quantity.
endif.
modify itab1.
endloop.
Above code is working perfect.
Regards,
S.C.K