cancel
Showing results for 
Search instead for 
Did you mean: 

Abap Query

Former Member
0 Kudos

Hello, i have a question about abap. i am doing a look up to another dso from this one dso.  the dso i am looking up to has about 10 fields that i want in my dso as well. so this is what i wrote in my start routine but the system won't let me do SELECT SINGLE *. It works for SELECT * but i don't want to do SELECT * as it takes too long. can some one tell me how to do SELECT SINGLE * so it will take less time loading please?    
Thanks.


    DATA: it_1 TYPE STANDARD TABLE OF /BIC/AZD_vb00 INITIAL SIZE 0.
    DATA: wa_1 TYPE /BIC/AZD_vb00.


    SELECT * INTO TABLE it_1 FROM /BIC/AZD_vb00

    FOR ALL ENTRIES IN SOURCE_PACKAGE

    WHERE DOC_NUMBER = SOURCE_PACKAGE-DOC_NUMBER AND

    S_ORD_ITEM = SOURCE_PACKAGE-S_ORD_ITEM.

then at the field level i am doing a read statements.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Venkat,

if you  are looking up for 10 fields from another DSO then do lookup in end routine instead of reading the internal table 10times in field routines. some of the tips to improve:

try to define a sorted or hashed internal table instead of standard, also you can remove 'intial size 0' addition.

How many fields does zd_vb00 has? try to include only the fields you require in the internal table- it_1.

also, while reading using a field symbol instead of work area.

Former Member
0 Kudos

Ok, thanks I need all the fields there are in the DSO that i am looking up from. I dont have 7.3 system. it is 7.0 so i can not use DSO lookup function.

anshu_lilhori
Active Contributor
0 Kudos

Hi,

Best way to improve the performance and to avoid select * is to define an internal with the fields you need to fetch from other dso.

After that write in select (name of all the fields).

Make use of field symbols.

Sample code for your reference

TYPES: BEGIN OF ST_DBM,

           DOC_NUMBER  TYPE /BI0/OIDOC_NUMBER,

           /BIC/A_MGUID TYPE /BIC/OIA_MGUID,

           END OF ST_DBM.

    DATA:IT_DBM TYPE STANDARD TABLE OF ST_DBM,

              WA_DBM TYPE ST_DBM.

BREAK-POINT.

    SELECT DOC_NUMBER /BIC/A_MGUID FROM /bic/azdbm_o0100 INTO TABLE

    IT_DBM  FOR ALL ENTRIES IN RESULT_PACKAGE

    WHERE DOC_NUMBER = RESULT_PACKAGE-DOC_NUMBER .

       

LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS> .

      READ TABLE IT_DBM INTO WA_DBM WITH KEY

      DOC_NUMBER = <RESULT_FIELDS>-DOC_NUMBER.

      <RESULT_FIELDS>-/BIC/A_MGUID = WA_DBM-/BIC/A_MGUID.

    ENDLOOP.

Hope this helps.

Regards,

AL

Answers (2)

Answers (2)

former_member213275
Contributor
0 Kudos

Hi Venkat,

Do you want to execute select single in loop at source packae.. endloop.?.If yes then its not advisable to use select statement inside loops.

As suggested  by Martin, you can go with using standard "Read from DSO" function to do a look up to a dso without any abap routine.

If you still want to achieve with start routine then  declare an internal table of type sorted table with non-unique key as DOC_NUMBER and S_ORD_ITEM and structure same as source package and move the contents of source package to internal table and delete adjacent duplicates comparing doc_num and s_ord_item. and select what fields you require from lookup dso and then use read statement in loop.

Hope this helps you.

Srikanth.

MGrob
Active Contributor
0 Kudos

Hi

Instead * you can just mention the fields you want to transfer. Since BI7 you can also use the standard function "read from dso" to do a lookup in the transformation without an abap routine.

See http://scn.sap.com/community/data-warehousing/blog/2012/05/10/usage-of-bw73-transformation-rule-type...

Hope it helps

Martin