Skip to Content

Performance issues in select from table HRV1222A

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 14, 2014 at 02:55 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 06, 2014 at 06:26 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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