on 03-02-2011 11:28 PM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 !!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
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.