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

Adding code to additional fields in Ad Hoc Query

Hello,

I am trying to add code to existing additional fields available in IT0001 - Field SYHR_A_P0001_AF_PL_CTRY.

I have added code in the field code section, but the field does not get populated.

I also tried to add code to Start of selection / Record processing sections, but the values are not populated.

What am I doing wrong?

Thanks,

Vaishali

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 23, 2011 at 10:17 AM

    Hi Vaishali,,

    Your question is not clear, no probs. you plz check this code !!

    FUNCTION zhrintf_om_pernr_info_adhocqry .

    *"----


    ""Local Interface:

    *" IMPORTING

    *" VALUE(FI_PERNR) TYPE PA0001-PERNR

    *" VALUE(FI_BEGDA) TYPE PA0001-BEGDA

    *" EXPORTING

    *" VALUE(L_MC_STEXT) TYPE HRP1000-MC_STEXT

    *"----


    DATA: dep_text(40) TYPE c,

    l_plans TYPE pa0001-plans,

    l_sobid TYPE hrp1001-sobid,

    l_mc_short TYPE hrp1000-mc_short.

    • Get Employee Position ID

    SELECT SINGLE plans

    FROM pa0001

    INTO l_plans

    WHERE pernr = fi_pernr

    AND begda LE fi_begda

    AND endda GE fi_begda.

    l_sobid = l_plans.

    • Check if OU is Department

    IF ( l_sobid NE '00000000' ) AND ( l_sobid NE '99999999' ). " Terminated Employee

    WHILE NOT ( ( l_mc_short(1) EQ '2' ) OR ( l_mc_short(1) EQ '1' ) OR ( l_mc_short(1) EQ 'X' ) ).

    SELECT SINGLE sobid FROM hrp1001

    INTO l_sobid

    WHERE objid = l_sobid

    AND rsign = 'A'

    AND sclas = 'O'

    AND begda LE fi_begda

    AND endda GE fi_begda.

    SELECT SINGLE mc_short mc_stext FROM hrp1000

    INTO (l_mc_short, l_mc_stext)

    WHERE otype = 'O'

    AND objid = l_sobid

    AND begda LE fi_begda

    AND endda GE fi_begda.

    • Empty l_mc_stext if OU is not Department

    IF NOT ( ( l_mc_short(1) EQ '2' ) OR ( l_mc_short(1) EQ 'X' ) ).

    l_mc_stext = ''.

    ENDIF.

    ENDWHILE.

    ENDIF.

    ENDFUNCTION.

    Regards

    Zulfikhar Ali

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Zulfikar,

      Let me try to explain. There are additional fields available to use in AD HOC query which are visible in infosets under the folder additional field.

      I am trying to use the additional field in IT0001 which displays country - which is called as Field SYHR_A_P0001_AF_PL_CTRY.

      Currently, this field does not get any data.

      Hence in the section where I can add field code, I have added a code that reads country information from T-tables.

      There is no error in the code, but when the query is executed, it does not fetch any data.

      Firstly - should any code be added to these additional fields?

      If not, why is it not fetching any country data ?

      Hope this helps.

      The code that you have supplied fetches data from HRP tables - unfortunately, this is not what I am looking for.

      Vaishali

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.