cancel
Showing results for 
Search instead for 
Did you mean: 

Restriction of data selection in update rule start routine.

Former Member
0 Kudos

The requirement is to load the data from ODS1 to IC1. When loading the data the restriction

needs to be based on selection criteria of Account, Company Code, Ref Key of ODS1

with the data in the table of ODS2(/bic/aODS200), for which a key figure value in ODS2

table is <> 0.

In other words, push the records from ODS1 to IC1 only when

Account, Company Code and Ref key of ODS1 matches with ODS2 table values and Key figure in

ODS2 is <> 0. Please note that ODS2 is just a look up table.

I understand that, a start routine needs to be developed for this. Please advise the ABAP code for this...

Thanks,

RR

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thank You for all of your inputs.

AHP:

Here is the code that i had done based on AHP pseudocode... But ran into an error "E:Field "[/BIC/AZOLAMTOT00-COMPANY]" unknown."

*

$$ begin of routine - insert your code only below this line -

  • fill the internal tables "MONITOR" and/or "MONITOR_RECNO",

  • to make monitor entries

TABLES: /bic/ods200.

DATA : lt_ods2 like /bic/ods200 occurs 0 with header line.

SELECT * from /bic/ods200 into table lt_ods2

for all entries in data_package

where [/bic/ods200-company] = data_package-[company]

and [/bic/ods200-chrt_accts] = data_package-[chrt_accts]

and [/bic/ods200-gl_account] = data_package-[gl_account]

and [/bic/ods200-ref_key3] = data_package-[ref_key3]

AND [/bic/ods200-ztotal] <> 0

ENDSELECT.

  • sort lt_zolamtot by [company] [chrt_accts][gl_account] [ref_key3] .

*DELETE ADJACENT DUPLICATES FROM lt_zolamtot comparing [company] [chrt_accts] *[gl_account] [ref_key3].

loop at data_package.

read table lt_zolamtot with key [company]=data_package-[company] [chrt_accts]=data_package-[chrt_accts] [gl_account]=data_package-[gl_account] [ref_key3]=data_package-[ref_key3].

data_package-ztotal = ztotal

data_package-loc_currcy = loc_currcy

if sy-subrc ne 0.

delete data_package.

endif.

endloop.

  • if abort is not equal zero, the update process will be canceled

ABORT = 0.

The requirement is to populate the ZTOTAL field and LOC_CURRCY into the Infocube, hence i have included the same.

Manfred: Please advise me on Binary search and how to code it.

$$ end of routine - insert your code only before this line -

Thank Again.

Regards,

RR

0 Kudos

hi,

the field name should be /BIC/AZOLAMTOT00-/bi0/COMPANY for business content infoobject 0customer or /BIC/AZOLAMTOT00-/bic/zCOMPANY for customize infoobject zcompany.

hope this helps.

  • reward helpful answers is welcome

Former Member
0 Kudos

AHP:

I still get the same error. I am not sure, what I am missing. Any help will be appreciated.

Thanks,

RR

0 Kudos

dear RR,

what's your infoobject name for company, ods name etc actually ?

you should not use [] , it means you should replace it with the real field name.

i see you didn't change the ods table name.

assume your ods name is zolamtot ?

binary search mentioned by Manfred used with read table.

it would helpful if you have abap guy there to help.

  • i think it's more than pseudo code, it's very near to your real code already, you just need to replace [] with real objects' name.

*

$$ begin of routine - insert your code only below this line -

  • fill the internal tables "MONITOR" and/or "MONITOR_RECNO",

  • to make monitor entries

TABLES: /bic/AZOLAMTOT00.

DATA : lt_ZOLAMTOT like /bic/aZOLAMTOT00 occurs 0 with header line.

SELECT * from /bic/aZOLAMTOT00 into table lt_ZOLAMTOT

for all entries in data_package

where /bic/aZOLAMTOT00-/bi0/company = data_package-/bi0/company

and /bic/aZOLAMTOT00-/bi0/chrt_accts = data_package-/bi0/chrt_accts

and /bic/aZOLAMTOT00-/bi0/gl_account = data_package-/bi0/gl_account

and /bic/aZOLAMTOT00-/bi0/ref_key3 = data_package-/bi0/ref_key3

AND /bic/aZOLAMTOT00-ztotal <> 0.

  • ENDSELECT.

<b>* no endselect here</b>

sort lt_zolamtot by /bi0/company /bi0/chrt_accts /bi0/gl_account /bi0/ref_key3.

DELETE ADJACENT DUPLICATES FROM lt_zolamtot comparing /bi0/company /bi0/chrt_accts /bi0/gl_account /bi0/ref_key3.

loop at data_package.

read table lt_zolamtot with key /bi0/company =data_package-/bi0/company /bi0/chrt_accts=data_package-/bi0/chrt_accts /bi0/gl_account=data_package-/bi0/gl_account /bi0/ref_key3=data_package-/bi0/ref_key3

BINARY SEARCH.

if sy-subrc ne 0.

delete data_package.

else.

data_package-/bic/ztotal = lt_zolamtot-/bic/ztotal.

data_package-/bi0/loc_currcy = lt_zolamtot-/bi0/loc_currcy.

endif.

endloop.

  • if abort is not equal zero, the update process will be canceled

ABORT = 0.

Former Member
0 Kudos

Dear AHP:

I appreciate your effort in helping me out on this. I have coded exactly, the way you have suggested. But, I still get the same error.

E:Field "/BIC/AZOLAMTOT00-/BI0/COMPANY" unknown.

Am I missing something here?

I do not have ABAP programmer in my team to take help.

It would be great help,if you can assist me in fixing this.

To me it looks fine, but I know, I am missing something over here.

Following are the data elements on table /BIC/AZOLAMTOT00.

/BI0/OICOMPANY

/BI0/OICHRT_ACCTS

/BI0/OIGL_ACCOUNT

/BI0/OIREF_KEY3

RODMUPDMOD

/BIC/OIZTOTAL

/BI0/OILOC_CURRCY

If you need more information, please let me know.

Thanks,

RR

0 Kudos

dear R R,

should be /BIC/AZOLAMTOT00-COMPANY, without /BI0/.

please remove /BI0/ from others /BIC/AZOLAMTOT00- and data_package.

hope this helps.

0 Kudos

hi RR,

try ...

tables : bic/aODS200.

data : lt_ods2 like /bic/aODS200 occurs 0 with header line.

select * from bic/aODS200 into table lt_ods2

for all entries in data_package

where [account] = data_package-[account]

and [company] = data_package-[company]

and [ref] = data_package-[ref]

and [keyfigure] <> 0.

  • cross check again if the record not exist in other ods

  • here we have list for records with kf <> 0.

sort lt_ods2 by [account] [company] [ref] .

DELETE ADJACENT DUPLICATES FROM lt_ods2 comparing [account] [company] [ref].

loop at data_package.

read table lt_ods2 with key [account]=data_package-[account] [company]=data_package-[company] [ref]=data_package-[ref].

if sy-subrc ne 0.

delete data_package.

endif.

endloop.

  • performance need to be tested.

Former Member
0 Kudos

Hi,

performance could be endhanced with the good coding from A.H.P while adding BINARY SEARCH at the end of read table command.

/manfred

Former Member
0 Kudos

May be better if we declare internal table without using 'occurs 0 with header line'.You can declare a work area by saying '<wa name> like line of <internal table name>.Then while reading,read into the work area.

Also..i think u only need to select the 3-4 required fields from the ODS2 table.

Remove 'select *' and select only required fields.

regards,

Vishu

Former Member
0 Kudos

Hello there Edwin

You wrote this code for RR and it worked very well for me.I thank you very much.You are a wizard for us. I wish i could assign you points but its someone elses post.

Former Member
0 Kudos

Hi RR,

Yes you need to write a start routine for this thing... hope the following code will give some idea ...

Start routine on ODS1

select account, com.code, refkey from ods2

where ods1/account = ods2/account

ods1/com.code = ods2/com.code

ods1/refkey = ods2/refkey.

If ods2/keyfig <> 0 .

delete package.

endif.

Regards,

PRK