cancel
Showing results for 
Search instead for 
Did you mean: 

Routine to filter on account for ODS to ODS data load

Former Member
0 Kudos

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 -

*

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Srini,

The load (which is using my start routine) is failing to add 148 of the 3934669 transferred records. Is something missing from my code that could cause this?

Regards,

Tom

0 Kudos

hi Tom,

not sure understand your question correctly.

we are going to get data with GL_account '158110'

and '2158110' only ? how many records with the same gl account in the other infoprovider ? they should match.

hope this helps.

Former Member
0 Kudos

Hi Tommy,

Can you please paste your new code...??

Srini

Former Member
0 Kudos

A.H.P.

I found the problem. My code had a second delete INFO_PACKAGE. I removed it and the load matches now.

Thank you for your help.

Highest regards,

Tom

Former Member
0 Kudos

Srini,

Found problem. My code contained a second delete

INFO_PACKAGE. I removed it and load matches.

Thank you for your help.

Tom

0 Kudos

hi Tom,

great

Answers (1)

Answers (1)

Former Member
0 Kudos

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