cancel
Showing results for 
Search instead for 
Did you mean: 

Performance issues in select from table HRV1222A

RicardoRomero_1
Active Contributor
0 Kudos

Hi all,

We have a custom FM with this select in the code:


SELECT otype objid

         FROM hrv1222a

         INTO TABLE lt_hrv1222a

         WHERE plvar EQ '01'

           AND begda LE sy-datum

           AND endda GE sy-datum

           AND istat EQ '1'

           AND attrib EQ lv_attrib

AND low EQ lv_value.

We use this FM a lot of times and we're having a lot of performance problems due this select.

Do you know how can I improve this code?
Is there any FM to get the data we want without doing a select to this table? Actually it is a view of two tables.

May be we need to create secondary indexes to the tables of the view...


Thanks in advance,

Regards,
Ricardo.

Accepted Solutions (0)

Answers (2)

Answers (2)

konstantin_anikeev
Active Contributor
0 Kudos

Hi Ricardo,

I'm afraid, you'll not be able to make a super fast solution for that.

Reason is the design by SAP. Think about inheritance of attributes and possibilities to exclude the attribute on some level. The logic would be too complex and may even worse, that by SAP.

How many users do you have in the System?

Is the buffering via Z-Table (via nightly job) is an option for you?

Do you use generic attribute or some kind of the constantly defined?

Regards

konstantin

RicardoRomero_1
Active Contributor
0 Kudos

Hi Konstastin,

In the end we have created indexes for the tables HRP1222 and HRT1222. And the performance has been greatly improved.

Regards,

Ricardo.

konstantin_anikeev
Active Contributor
0 Kudos

Glad to hear, it helped.

But as I said, we had some troubles in case of excluded attributes.

Regards

Konstantin

YayatiEkbote
Contributor
0 Kudos

Hello Ricardo,

I can see that you need to read the value of the attribute "lv_attrib".

But the query says that you are trying to fetch value of particular attributes for all the organizational units at once.

Instead if you want to read the attribute values for a particular organizational unit, you should use FM BBP_READ_ATTRIBUTES. (Depending on scenario)

You can pass user name as sy-uname (considering that SU01 users are mapped to organizational units).

Please see the below code snippet -

CALL FUNCTION 'BBP_READ_ATTRIBUTES'
    EXPORTING
      iv_user                 = sy-uname
      iv_scenario             = 'BBP'
      it_attr_list            = lt_attr_list[]
    IMPORTING
      et_attr                 = lt_attributes
    EXCEPTIONS
      object_id_not_found       = 1
      no_attributes_requested = 2
      attributes_read_error      = 3
      OTHERS                       = 4.

Regards,

Yayati

RicardoRomero_1
Active Contributor
0 Kudos

Hi Yayati; Thanks for answer.


I know the FM BBP_READ_ATTRIBUTES, but I can't use it because what I want is exactly what you said, get the attributes that have a particular value in all the units. http://scn.sap.com/thread/2126667

All of this came from this thread:

I made a FM to get all the users that have an attribute with a especific value.
May be I have to limit the SELECT by organization unit or something... becose the performance of my FM is very bad.

Regards,

Ricardo.

YayatiEkbote
Contributor
0 Kudos

Hello Ricardo,

Then i guess it will be better if you first collect all the required organizational units in one internal table by using some FM like RH_STRUC_GET and then using BBP_READ_ATTRIBUTES in loop. Or you can segregate the org units based on some criteria like company code, purchasing org, purchasing group etc.. and then you can query the view in batches.

HRV1222A itself is a view and has joins, hence querying it for large data it will always affect the performance.

Regards,

Yayati