04-02-2014 9:17 AM
Hi ,
I am going to get meins and tbtwr from esll based on belnr,gjahr and buzei from ekbe.
In process , i will go thru to table rseg ( Document Item: Incoming Invoice ) to get the packno and introw
in order to link to esll table based belnr,gjahr and buzei from ekbe.
However, the packno and introw return empty value sometimes which make this logic is not 100% reliable.
Beside this table, rseg, do i have other option in order to link the ekbe table to esll table ?
And, how to match the line item in ekbe to the service line item in esll ?
Any ideas ?
Thanks
04-02-2014 10:39 AM
Hi,
select * from ml_esll into table xml_esll
where ...
loop at xml_esll into ml_esll.
select * from srv_mdrv where ebeln = ml_esll-ebeln
and ebelp = ml_esll-ebelp .....
move-corresponding srv_mdrv to l_ekko.
move-corresponding srv_mdrv to l_ekpo.
call function 'ZPO_HISTORY'
exporting
ebeln = l_ekko-ebeln
ebelp = l_ekpo-ebelp
webre = l_ekpo-webre
importing
history = xdata-history
budat = xdata-budat.
endloop.
function zpo_history.
*"----------------------------------------------------------------------
*"*"Локальный интерфейс:
*" IMPORTING
*" REFERENCE(EBELN) TYPE EBELN
*" REFERENCE(EBELP) TYPE EBELP
*" REFERENCE(WEBRE) TYPE WEBRE
*" EXPORTING
*" REFERENCE(HISTORY) TYPE FLAG
*" REFERENCE(BUDAT) TYPE BUDAT
*"----------------------------------------------------------------------
*------- BET ( Tabelle der Bestellentwicklungssaetze ) ----------------*
data: begin of bet occurs 50.
include structure ekbe.
data: end of bet.
data wrbtr like rseg-wrbtr .
clear wrbtr .
call function 'ME_READ_HISTORY'
exporting
ebeln = ebeln
ebelp = ebelp
webre = webre
i_refresh_buffer = 'X'
tables
xekbe = bet.
loop at bet .
case bet-shkzg .
when 'S' . wrbtr = wrbtr + bet-wrbtr .
when 'H' . wrbtr = wrbtr - bet-wrbtr .
endcase .
endloop .
if not wrbtr is initial .
history = 'X' .
else .
clear history .
endif .
clear budat .
if history = 'X' .
sort bet by budat descending .
clear bet .
read table bet index 1 .
budat = bet-budat .
endif .
endfunction.