Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Adding code to additional fields in Ad Hoc Query

Former Member
0 Likes
759

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

2 REPLIES 2
Read only

Former Member
0 Likes
477

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

Read only

0 Likes
477

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