-
Notifications
You must be signed in to change notification settings - Fork 0
/
zcl_wcb_tr_invoice_vbpa_1b.clas.abap
66 lines (51 loc) · 1.56 KB
/
zcl_wcb_tr_invoice_vbpa_1b.clas.abap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
class zcl_wcb_tr_invoice_vbpa_1b definition
public
final
create public .
public section.
interfaces if_wlf_tr_source_value_class .
protected section.
private section.
class-data ss_proc_var_b type wcb_c_proc_var_b .
endclass.
class zcl_wcb_tr_invoice_vbpa_1b implementation.
method if_wlf_tr_source_value_class~get_source_value.
* local data
field-symbols <komlfp> type komlfp.
read table it_source_copy_data assigning field-symbol(<it_source_copy_data>)
with key structure = 'KOMLFP'.
if sy-subrc = 0.
assign <it_source_copy_data>-reference->* to <komlfp>.
endif.
check <komlfp> is assigned.
create data rr_source_value type hiezu01.
assign rr_source_value->* to field-symbol(<rr_source_value>).
* read data
try.
select * into table @data(lt_vbpa)
from vbpa
where vbeln = @<komlfp>-wbelnv.
read table lt_vbpa into data(ls_vbpa)
with key posnr = <komlfp>-posnrv
parvw = '1B'.
if sy-subrc <> 0.
read table lt_vbpa into ls_vbpa
with key posnr = '000000'
parvw = '1B'.
if sy-subrc = 0.
<rr_source_value> = ls_vbpa-kunnr.
else.
read table lt_vbpa into ls_vbpa
with key posnr = '000010'
parvw = '1B'.
if sy-subrc = 0.
<rr_source_value> = ls_vbpa-kunnr.
endif.
endif.
else.
<rr_source_value> = ls_vbpa-kunnr.
endif.
catch cx_wb2_rebates.
endtry.
endmethod.
endclass.