cancel
Showing results for 
Search instead for 
Did you mean: 

Help in Start Routine Code.

former_member184624
Participant
0 Kudos

Hi All,

I have ODS 1, ODS 2, ODS 3 and ODS 4.

I want to load the data from ODS 1 to ODS 4 where indicator = "x". I need to write this code in Start Routine. Can you please help in the ABAP Code.

Thanks & Regards,

Allwin.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

For this you need to have atleast one common key field in DSO1 and DSO4..

You can write select statement to pick the required firleds from DSo1..

sample code

select XXXX YYYY from /BIC/PXXXX into table it_tab

for all entries in SOURCE_ACKAGE

where xxxx = source_package-XXXX.

replace XXXX in where clause with the key field and xxxx YYYY in the select statement with the fields you require...

former_member184624
Participant
0 Kudos

Thanks for your quick reply. Do i need to include this staements in the Loop ? Pls reply

Former Member
0 Kudos

no the select statement will pick all the data from DSO1 and put in the internal table acording to the condition specified in where clause.....

when you will be appending this data to the DSo4 then you need to do loop at this internal table(it_tab) and append the whole data to result_package in end routine..

former_member184624
Participant
0 Kudos

Can you please provide me that code also. I dont know where i should write append code. Pls help.

ravi_chandra3
Active Contributor
0 Kudos

Hi

During the transformation at the top u will find the start routine button click on it , and at the write the above code .

DELETE SOURCE_PACKAGE WHERE INDICATOR <> 'X'.

Regards,
RaviChandra

Former Member
0 Kudos

if you want to select some fields from DSO1 where indicator is X and put those fields in DSo4 then you can go for DTP filter....create a transformation between DSO4 and DSO1...there in DTP filter give indicatior as X and map only required fields of DSO1 to DSO4 along with keyfields.....

also refer to sample code

   LOOP AT RESULT_PACKAGE into wa_package.
            LOOP AT it_tab INTO wa_tab WHERE /bic/XXX =
           wa_package-/bic/XXX

wa_package = wa_tab-YYYY.

wa_package = wa_tab-ZZZZ.

modify result_package from wa_package transproting (required felds)

refresh wa_package

endloop.

endloop.

modify the code according to your requirement.

ravi_chandra3
Active Contributor
0 Kudos

Hi anshul,

The RESULT_PACKAGE will be present at the end routine not at the start routine and i think no need to write all those unnecassary step just to filter.

Hope u got it,
Regards,

RaviChandra

Former Member
0 Kudos

Hi RaviChandra,

I know result_package is used in end routine...i mentioned this in my earlier response(2nd) that append will needs to be done in end routine..

it depends whether Allwin wants to go for transformation between DSO1 and DSO4....if he wants transformation then only filter will be required...

Answers (4)

Answers (4)

ravi_chandra3
Active Contributor
0 Kudos

Hi Alwin,

Plz follow the step as suggested by me. No need to write any select statement or read statement because no lookup is involved in ur scenario.

Hope u got it,

Regards,

RaviChandra

former_member202684
Contributor
0 Kudos

Hi Allwin,

Could you explain your requirement a bit clearly.

The part we understood here is that you have to load data from DSO1 to DSO4 where indicator is 'X'. This can be done by just setting a filter in the DTP.

In the information specified by you, there seems to be no lookup involved.

If not, do let us know which field do you need to lookup and from which DSO.

Example: DSO4 contains key: document no and material. and Data fields: price, quantity, weight.

Here lets say you are loading this data to DSO4 from DSO1 and weight is not available in DSO1 so you need to lookup the value from DSO3 and stamp it in DSO4. In this case we can write a lookup in the transformation from DSO1 to DSO4.

Hope this helps

Regards, Joe

Former Member
0 Kudos

Hi Alwin,

If DSO1 is simply transferring records to DSO4 where indicator is X then i would suggest you not to go for any kind of routine because there is no need of code in general.Its just filtering and loading desired data.Routines are used in case we have lookup or more than one fields need to decide value of some other field.

In your case its just selective load .Either in DTP set filter in indicator field as 'X' or as Ravi suggested in start routine delete all records where indicator is not 'X'.

Map rest of the fields directly .

Regards,

Jaya

ravi_chandra3
Active Contributor
0 Kudos

Hi

U can filter the data at the DTP LEVEL also , At the DTP level , EXTRACTION tab----->filter---->select routine for the corresponding fields ----> give some name--->and then write the following code.

L_T_RANGE-FIELDNAME = 'INDICATOR'.

L_T_RANGE-SIGN = 'I'.

L_T_RANGE-OPTION = 'EQ'.

L_T_RANGE-LOW = 'X'.

APPEND L_T_RANGE.

save the routine---> activate the DTP and execute the DTP.

Thanx & Regards,

RaviChandra