on 02-09-2011 10:10 AM
Hi
i have wriiten a update rule routine.
in that routine i am fetching comp code ,GL Acct. from SKB1 table and match those records wth Data Package records.
Data Package has both Open and Closed items. so i need to match the Comp Code and GL Account which i have fetched from SKB1 with Data Package Comp Code and GL account which records will be matched they will go to Target ODS otherwise Delete from Data Package.
But data is not coming properly in Target ODS.
i have debug the routine and found , there are 10 records(Comp Code + GL Acct.) has been fetched from SKB1
and Data Package has Total 416 Records. Only 20 Records has been gone to Target ODS while I have seen the 216 Comp Code and GL Account combination has been successfully matched with 10 Records of SKB1
Below is the code in Start routine.
Note: Data Package has Multiple Records for a Combination of Company Code and GL Account which is present in SKB1.
How can i resolve this problem.
********Logic to Fetch Open items GL Account**************
*Fetch data from SKB1*********
SELECT /BIC/ZMCFBUKRS
/BIC/ZMCFSAKNR
FROM /BIC/AZOCFSKB100
INTO TABLE TB_ZOCFSKB1
FOR ALL ENTRIES IN DATA_PACKAGE
WHERE /BIC/ZMCFBUKRS = DATA_PACKAGE-COMP_CODE
AND /BIC/ZMCFSAKNR = DATA_PACKAGE-GL_ACCOUNT
AND /BIC/ZMCFXOPVW = 'X'.
***Fetch records from FI GL Data Package which match with
***internal table TB_ZOCFSKB1
LOOP AT DATA_PACKAGE INTO WA_DATA_PACKAGE.
READ TABLE TB_ZOCFSKB1 INTO WA_TB_ZOCFSKB1 WITH KEY
/BIC/ZMCFBUKRS = WA_DATA_PACKAGE-COMP_CODE
/BIC/ZMCFSAKNR = WA_DATA_PACKAGE-GL_ACCOUNT
binary search.
IF sy-subrc ne 0.
DELETE TABLE DATA_PACKAGE FROM WA_DATA_PACKAGE.
ENDIF.
***Clear Work Area****************
CLEAR WA_TB_ZOCFSKB1.
CLEAR WA_DATA_PACKAGE.
ENDLOOP.
***Refresh internal table*********
REFRESH TB_ZOCFSKB1.
ENDIF.
if abort is not equal zero, the update process will be canceled
ABORT = 0.
Edited by: AtulMohan Mishra on Feb 9, 2011 11:22 AM
Hi,
It is very important that you SORT the internal table before you do a READ with Binary Search.
SORT TB_ZOCFSKB1 BY /BIC/ZMCFBUKRS /BIC/ZMCFSAKNR.
You are sure to miss results unless you do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.