cancel
Showing results for 
Search instead for 
Did you mean: 

look up in an ODS and update in a characteristic routine (BI 7.0)

Former Member
0 Kudos

Hi ,

My requirement is : I have data coming from both legacy as well as SAP Systems. The user wants both legacy as well as SAP fields data in their reports.

I have a Standard DSO ( say DSO1) with all the legacy fields with direct mappings from Legacy sytem along with couple of SAP fields which are not mapped as of now.

I have few more DSO's which have just the legacy field and corresponding SAP field data.

like DSO 2 with ZCOMPCODE and 0COMPCODE data.

All i have to do is write a Routine for unmapped 0COMPCODE field in DSO1 that pulls up corrersponding 0COMPCODE values for ZCOMPCODE from DSO 2 .

Could someone please help me with the Coding part of the Routine.

Greatly appreciate your help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

try the below

you need to give some fields information such as <field>

data: li_tab_ds2 type standard table /bic/adso2,

lwa_tab_ds2 type /bic/adso2.

select ZCOMPCODE into li_tab_ds2 from /bic/adso2 for all entries in source_package where <condition for selecting data from /bic/adso2 = Source_package-<field>.

( this will get all the records from the DSO in the internal table)

sort tab_ds2 by <field>.

//in the field routine

read table li_tab_ds2 into lwa_tab_ds2 with key <field> = source_fields-<field>

if sy-subrc = 0

result = lwa_tab_ds2-ZCOMPCODE.

else.

result = space.

endif.

Answers (2)

Answers (2)

Former Member
0 Kudos

I am getting couple of errors :

i was getting the error that 0COMP_CODE is not declared kinds...so i wrote the below under declaration before METHODS Part.

types:

BEGIN OF tys_tg_1_full,

0COMP_CODE TYPE /BI0/OICOMP_CODE.

END OF tys_tg_1_full.

-


and wrote the below under insert your code under CLASS lcl_transform IMPLEMENTATION part :

data: li_tab_ds2 type standard table /BIC/ADSO2.

lwa_tab_ds2 type /BIC/ADSO2.

select 0COMP_CODE from /BIC/ADSO2 into li_tab_ds2 for all entries

in source_package

where Source_package-ZCOMPCODE ne 0.

*<condition for selecting data from /bic/adso2 = Source_package-<field>.

*( this will get all the records from the DSO in the internal table)

sort li_tab_ds2 by <0COMP_CODE>.

*//in the field routine

read table li_tab_ds2 into lwa_tab_ds2 with key <0COMP_CODE> =

source_fields-0COMP_CODE.

if sy-subrc = 0

result = lwa_tab_ds2-0COMP_CODE.

else.

result = ' '.

endif.

I get the error message :

E:Names may only consist of the characters "A-Z", "0-9" and "_".

In addition, they must not begin with a number. number.

Please help !!

Former Member
0 Kudos

Hi Shilpi,

For standard fields you are not supposed to give the 0 prefix. In your code remove the zero from company code object i.e make 0COMP_CODE as COMP_CODE.

Hope it helps!

Regards,

Pavan

Former Member
0 Kudos

Thanks Shailesh for a prompt reply.

I still have few questions. I want to retrieve corresponding values of 0COMPCODE values for all ZCOMPCODE enties.

But not ZCOMPCODE values.

So should i substitute ZCOMPCODE with 00COMPCODE in the code you provided ???

Also all i can think about the condition is get all records when ZCOMPCODE ne 0.

so can i write the condition like Source_package-<ZCOMPCODE> ne 0 ???

will the below code work for me ?? Please help. Points will be asssigned.

data: li_tab_ds2 type standard table /BIC/ADSO2.

lwa_tab_ds2 type /BIC/ADSO2.

select 0COMP_CODE into li_tab_ds2 from /BIC/ADSO2 for all entries

in source_package

where Source_package-<ZCOMPCODE> ne 0.

*<condition for selecting data from /bic/adso2 = Source_package-<field>.

*( this will get all the records from the DSO in the internal table)

sort lwa_tab_ds2 by <0COMP_CODE>.

*//in the field routine

read table li_tab_ds2 into lwa_tab_ds2 with key <0COMP_CODE> =

source_fields-<0COMP_CODE>.

if sy-subrc = 0

result = lwa_tab_ds2-0COMP_CODE.

else.

result = space.

endif.