cancel
Showing results for 
Search instead for 
Did you mean: 

Length of services in Ad hoc query

Former Member
0 Kudos

Dear Expert,

I have difficulty to query length of services from the ad hoc query.

Below is the details:

Date specification (IT0041)

subtype 01 (date start working within the country)

subtype 50 (date join current company)

Ad hoc query selection and filter:

EE ID : display

Entry date : display

leaving date : display

Length of service (years) : display

Length of service (months) : display

Length of service (days) : display

data display for length of services is according Enter date.

If I filter date type (subtype 50), it's still display the length of services according the entry date.

May i know how to filter the date type to make the length of services is according date type 50?

Appreciate your advice.

Thanks,

Mel

Accepted Solutions (1)

Accepted Solutions (1)

JonathanM
Contributor
0 Kudos

Hi Melissa,

In standard, the following fields are not available:

Length of service (years) : display

Length of service (months) : display

Length of service (days) : display

So I think those have been added specifically on your infoset.

You should check the code behind those fields from your infoset definition (transaction SQ02).

Right-click on the additionnal field --> field code.

It seems that you're using the date in the DAR01 field to get the Year, Month, Day information in place of the selected subtype which is variable in the infotype structure DARXX.

Best regards,

Jonathan

Former Member
0 Kudos

Dear Jonathan,

Thanks for the prompt reply.

I am trying to explore on the guide given as above, the field code is blank.

Do you mind to explain further for this

'It seems that you're using the date in the DAR01 field to get the Year, Month, Day information in place of the selected subtype which is variable in the infotype structure DARXX.'

Thanks again,

Mel

JonathanM
Contributor
0 Kudos

Hi Melissa,

In fact the infotype 0041 doesn't really have subtypes because all "his subtypes" are stored on the same record. If you see the record through SE16 or the table definition via SE11. You'll that the subtypes are stored like:

  • DAR01 the first subtype and DAT01 for the date related to it
  • DAR02 the second subtype and DAT02 for the date related to it
  • ...

So witin the adhoc query, the system if checking for your subtype 50 through the different "colomns" and find it (for example) in the 5th position so your data would be DAR05 (subtype) and DAT05 (date). But the code is retrieving the year, month, day on the corresponding record, it should also take the corresponding subtype... And sometimes it just take the first DAR01/DAT01 in place of the corresponding DAR05/DAT05 that the adhoc query found a match.

Best regards,

Jonathan

Former Member
0 Kudos

Hi Jonathan,

It's really a valuable information for me, appreciate it.

May i ask again, how to configure to read other DARxx rather than DAR01?

Thanks,

Mel

JonathanM
Contributor
0 Kudos

Hi Melissa,

Here is the field code I set up to retrieve the year value behind the additional field:

*SYHR_EXT_PERNR_SEL_CONDS[]
*syhr_P0041_itab_wa
*syhr_P0041_itab
field-SYMBOLS: <DATE_Y_tab> TYPE ANY TABLE.
field-SYMBOLS: <DATE_Y> TYPE ANY.
DATA: FIELD_Y TYPE STRING.
MOVE 'SYHR_P0041_ITAB' TO FIELD_Y.
ASSIGN (FIELD_Y) TO <DATE_Y_tab>.
MOVE 'SYHR_P0041_ITAB_WA' TO FIELD_Y.
ASSIGN (FIELD_Y) TO <DATE_Y>.
field-SYMBOLS: <DATE_Y_date> TYPE D.
DATA: DATE_Y TYPE D.
LOOP AT <DATE_Y_tab> INTO <DATE_Y>.
  
MOVE 'SYHR_P0041_ITAB_WA-P0041-DAT01' TO FIELD_Y.
  
ASSIGN (FIELD_Y) TO <DATE_Y_date>.
  
MOVE <DATE_Y_date> TO DATE_Y.
   ZZ_P0041_AF_DAT01_Y
= DATE_Y+0(4).
  
EXIT.
ENDLOOP.

You can easily set a break-point to check what/how the system does.

Within this part, the system moves the date types all the DARXX/DATXX are passing through the DAT01/DAR01.

Best regards,

Jonathan

Answers (1)

Answers (1)

former_member801505
Discoverer
0 Kudos

Please see feauture ENTRY and field DATYP. It should resolve your problem