on 05-04-2006 7:03 PM
Hi gurus,
I am not an ABAP programmer, so I need your help writing a routine to filter an ODS1 to ODS2 data load. I just need to select and load records containing two specified GL accounts.
I thought it best to code a "start routine" in the target ODS2. Is this the place for the code? The editor is complaining that it cannot find the account, so this looks like a problem. (I am not sure COMM_STRUCTURE can be used in a start routine and if so, how should I handle this?) There may be other problems, so please take a look and send your recommendations.
Best regards,
Tom
PROGRAM UPDATE_ROUTINE.
$$ begin of global - insert your declaration only below this line -
TABLES:/BIC/AZD_SCHF00, /BIC/AZD_BAKGL00.
DATA: n type i.
DATA: l_tabix like sy-tabix.
DATA: account like COMM_STRUCTURE-0GL_ACCOUNT.
$$ end of global - insert your declaration only before this line -
The follow definition is new in the BW3.x
TYPES:
BEGIN OF DATA_PACKAGE_STRUCTURE.
INCLUDE STRUCTURE /BIC/CS8ZD_BAKGL.
TYPES:
RECNO LIKE sy-tabix,
END OF DATA_PACKAGE_STRUCTURE.
DATA:
DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
WITH HEADER LINE
WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
FORM startup
TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring
MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
DATA_PACKAGE STRUCTURE DATA_PACKAGE
USING RECORD_ALL LIKE SY-TABIX
SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
*
$$ begin of routine - insert your code only below this line -
Loop AT DATA_PACKAGE.
l_tabix = sy-tabix.
select * from /BIC/AZD_BAKGL00.
If COMM_STRUCTURE-account = "0000158110".
If COMM_STRUCTURE-account = "00002158110".
select DATA_PACKAGE index l_tabix.
if sy-subrc NE 0.
delete DATA_PACKAGE index l_tabix.
else.
continue.
endif.
Endloop.
fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
to make monitor entries
if abort is not equal zero, the update process will be canceled
ABORT = 0.
$$ end of routine - insert your code only before this line -
*
hi Tom,
try
$$ begin of routine - insert your code only below this line -
delete DATA_PACKAGE where account <> '0000158110'
and account <> '00002158110'.
seems you put the wrong number for 00002158110 ? it's 11 digit, should be 10 digits ?
assume account is your infoobject 0account, for customize infoobject, use /bic/z...
fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
to make monitor entries
hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A.H.P.
Thank you for the suggestion. I coded as you described, but code is ignored by load. Please help.
Loop AT DATA_PACKAGE.
l_tabix = sy-tabix.
delete DATA_PACKAGE where GL_ACCOUNT <> '158110'
and GL_account <> '2158110'.
sy-subrc = 0.
delete DATA_PACKAGE index l_tabix.
continue.
Endloop.
fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
to make monitor entries
if abort is not equal zero, the update process will be canceled
ABORT = 0.
Kindest regards, Tom
hi Tom,
you just need and put a break-point.
break-point.
delete DATA_PACKAGE where GL_ACCOUNT <> '158110'
and GL_account <> '2158110'.
and try simulate from monitor, tab 'details', last node 'datapackage', click one data package and 'simulate update' and mark 'update routine'.
no need loop endloop.
hope this helps.
Hi Tommy,
If you want to load only two GL Accounts, You can write the code this way.
delete DATA_PACKAGE where GL_ACCOUNT <> '158110'
<b>or</b> GL_account <> '2158110'.
in start routine. No need of looping.
<b>Or</b>
Why cant you restrict in infopackage...??
Load only for GL_Accounts : 158110 and 2158110.
Hope it helps
Srini
Thanks Srini,
The code you suggested works in the start routine. Thanks for that. It works without the looping.
Restricting the info package only works for FULL loads, not inits or delta loads. SAP does not allow restricting info packages on ODS to ODS loads for INIT or delta. Mine is for inits and deltas.
Best regards,
Tom
A.H.P.
My INIT load (using the start routine) now updates records with the two selected GL_accounts. OK, But the updated record count is slightly short and the amounts too large as compared to my earlier FULL load which was restricted from an info package and did not use the start routine. (Note the earlier FULL load does match a LISTCUBE run from the source.) Is my start routine missing a "clear statement" or something that could fix this?
Regards,
Tom
Hi dear and welcome on board!
Maybe you want to use DATA_PACKAGE in your IF-clauses...COMM_STRUCTURE doesn't exist on start routine...
Anyway, what do you want to do?
Since in my opinion it's better to explain to us in words and not with code (at least, THIS code...)
Hope it helps!
Bye,
Roberto
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.