on 2016 May 24 10:52 AM
Hello All,
i have a requirement like below. After developing logik am getting empty values to that key figure in DSO. Wrote logik between DSO to DSO.
Requirement : Need to add a keyfigure : 0NETVAL_INV based on some conditions between DSo to DSo transformation. for this i used look up.Below is the code.
TYPES: BEGIN OF ty_zbt8,
bill_num TYPE /bi0/oibill_num,
bill_item TYPE /bi0/oibill_item,
netval_inv TYPE /bi0/oinetval_inv,
bill_type TYPE /bi0/oibill_type,
doc_number TYPE /bi0/oidoc_number,
s_ord_item TYPE /bi0/ois_ord_item,
END OF ty_zbt8.
////Here zbt8 is lookup DSO. Our keyfigure hav to populate from this DSO only.
DATA: lit_zbt8 TYPE STANDARD TABLE OF ty_zbt8,
lwa_zbt8 TYPE ty_zbt8.
DATA : r_billtype TYPE RANGE OF /bic/azbt800-bill_type,
r_btyp_wa LIKE LINE OF r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZBV'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZF2'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZF2C'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZG2'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZGS'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZIG'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZIV'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZL2'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZLFS'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZLFT'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZRE'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZS1'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZS2'.
APPEND r_btyp_wa TO r_billtype.
r_btyp_wa-sign = 'I'.
r_btyp_wa-option = 'EQ'.
r_btyp_wa-low = 'ZVS'.
APPEND r_btyp_wa TO r_billtype.
SELECT bill_num
bill_item
SUM( netval_inv ) AS netval_inv
bill_type
doc_number
s_ord_item
* SUM( NETVAL_INV ) AS NETVAL_INV
INTO TABLE lit_zbt8
FROM /bic/azbt800
WHERE bill_type IN r_billtype
GROUP BY bill_num bill_item netval_inv bill_type doc_number
s_ord_item.
IF sy-subrc = 0.
DELETE ADJACENT DUPLICATES FROM lit_zbt8 COMPARING
netval_inv.
SORT lit_zbt8 BY netval_inv.
ENDIF.
ENDIF.
Pls tell me what went wrong in this code? Do the keys for both DSos ( lookup one also) should be same?
Regards,
Raki
Hi Rai,
You have not a loop endloop statement?
Regards,
Gorka.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Gorka,
Actually i need to populate a keyfigure 0netval_inv using a lookup in start routine. i have included the same field in target DSO.
requirement is :
Transformation to ZBT4 (target DSO ) to populate 0NETVAL_INV is SUM(ZBT8-NETVAL_INV) where S_ORD_ITEM = ZBT4-S_ORD_ITEM and DOC_NUMBER = ZBT4-DOC_NUMBER and BILL_TYPE is one of the following :
ZBV Cash sale invoice
ZF2 Sales invoice
ZF2C Sales invoice
ZG2 Credit memo
ZGS Cancel ICM
ZIG Internal credit memo
ZIV Intercompany invoice
ZL2 Debit memo
ZLFS Cancellation invoice
ZLFT LFT Posting Invoice
Here zbt8 is souc dso (lookup0 and zbt4 is target DSO.
If I am not wrong... you are reading 13_vditm (zbt8 dso). Target is Consolidation DSO for sales order item which has billing done. Source is Sales order item
SELECT bill_num
bill_item
SUM( netval_inv ) AS netval_inv
bill_type
doc_number
s_ord_item
* SUM( NETVAL_INV ) AS NETVAL_INV
INTO TABLE lit_zbt8
FROM /bic/azbt800
for all entries in Source_package
WHERE bill_type IN r_billtype
doc_number = source_package-doc_number
s_ord_item = source_package-s_ord_item
GROUP BY bill_num bill_item bill_type doc_number
s_ord_item.
IF sy-subrc = 0.
DELETE ADJACENT DUPLICATES FROM lit_zbt8 COMPARING
bill_num bill_item.
SORT lit_zbt8 BY doc_number s_ord_item.
ENDIF.
ENDIF.
Loop at source_package assiging <sp>
read table lit_zbt8 into wa_zbt8 with key doc_number = <sp>-doc_number s_ord_item = <sp>-s_ord_item binary search.
if sy-subrc eq 0.
<sp>-netval_inv = wa_zbt8-net_inv
endif.
endloop.
User | Count |
---|---|
83 | |
12 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.