‎2007 Apr 17 10:25 AM
Hello,
I have an info set in tra SQ02 and the area is HCM with version ERP2004.
I need to create an additional field to show "Work permit" in ad hoc queries. I know that the infotype 0016 has a standard field P0016-ARBER which contains a date if that person has a work permit. System should select the latest record or the one which is valid during reporting period.
The requirement for this new field is that it should just has X if the field P0016-ARBER contains a date (i.e. that person has a work permit). If the field P0016-ARBER is empty, then the new field "Work permit" is also empty. So, the date itself is not enough.
I am not an abaper. I have tried to create a code for my field but there is always problems with the code. I have tried without the line<i>into</i> but checker says I need to. I have tried different places for statement ENDSELECT but without success. How should I do this?
What I have so far is (TYOLUPA = Work permit) is shown below:
select SINGLE ARBER
into TYOLUPA
from PA0016
where pernr = P0016-pernr
and ENDDA = '31129999'.
clear TYOLUPA.
if ARBER ne ''.
then TYOLUPA = 'X'.
endif.
Thanks for your advice!
Regards,
Pipsa
‎2007 Apr 17 10:40 AM
pia,
In extras tab create column "workpermit" in infoset and add that column to Field groups.
Then under record processing event...
DATA : TYOLUPA like PA0016-ARBER.
Under Record processing event.
select SINGLE ARBER
into TYOLUPA
from PA0016
where pernr = P0016-pernr
and ENDDA = '31129999'.
if TYOLUPA ne ' '.
WORKPERMIT = 'X'.
endif.
Don't forget to reward if useful...
‎2007 Apr 17 11:00 AM
Hi,
Unfortunately your answer is not working. Sceondly, why should I set TYOLUPA like PA0016-ARBER when the latter is a date field (type D) and my new field is not? Did you mean P0016-ARBER? Neither of the options work.
Regards,
Pia
‎2007 Apr 17 10:46 AM
Hello ,
Once u have added the additional field to the infoset
right click on the field and select Fieldcode there u will find the editor .
in the editor u can write the code .
regards,