Skip to Content
author's profile photo Former Member
Former Member

Logic in ABAP HR

Hi folks,

Actually my requirement is, i have some data in an internal table. I have to check the particular record in in that itab is there in infotype 9003 by checking some condtions. if the record is not found in the 9003 i need to display a error message. I am new to ABAP HR. Please help me regarding the logic of comparing ITAB and an infotype in my requirement here.

Thanks,

Ram.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 02:40 AM

    Not sure what exactly are you looking for. But here is a generic code.

    Select * from 9003 where field1 = itab-field1.

    If sy-subrc = 0.

    Perform action.

    else.

    error.

    endif.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 19, 2008 at 06:49 AM

    Hi Ram,

    Why do you think it is so completely different from 'normal' ABAP? There isn't much difference. Infotypes are stored in tables, just like any other data. And all the standard infotypes are in similar tables, they all start with PA and then the number of the infotype. So if infotype 9003 is created similar to standard SAP you can find the data in table PA9003. There are some things you have to take into account, the validity of the infotype for instance. So you will need to do a select considering the beginning date and the end date. Another thing is subtypes, it could be you need to take a subtype into account.

    If you don't want to do a select on a table there is always the FM HR_READ_INFOTYPE to get the data.

    The main differences start when you use a logical database, because then you can use some helpfull macro's.

    Regards,

    Martin

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 11:23 AM

    Create a program

    In program attributes

    Put PNP for the Logical Database field

    Save it

    You will have PNP's standard selection screen

    If you dont want selection screen from PNP,

    In program attributes Choose HR REPORT CATEGORY

    Create one with no fields for selection

    
    tables: pernr
    
    infotypes: 0000, 0001, 0002, 0006, 9003
    
    start-of-selection.
    
    get pernr.
    loop at table p9003.
    endloop.
    

    all values of 9003 will be in internal table p9003

    If you have Personnel number in your internal table itab then the easier code without PNP Logical database is

    loop at itab.
    
      CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
    *     TCLAS                 = 'A'
          pernr                 = itab-pernr
          infty                 = 9003
         BEGDA                 = '18000101'
         ENDDA                 = '99991231'
       IMPORTING
         SUBRC                 = subrc
        tables
          infty_tab             = it9003
       EXCEPTIONS
         INFTY_NOT_FOUND       = 1
         OTHERS                = 2
                .
      IF sy-subrc = 0.
    
    ** Do the processing you want to do
      ENDIF.
    
    endloop.
    

    Reward points if helpful

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.