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

code for hr report to display highest qualification based on sub type?

satish_kumar127
Participant
0 Likes
1,111

Hi experts,

I have a requirement to display highest qualification based on subtypes .

lets say

Z3-Graduation

Z5- Diploma

Z4- PG

Z7-Others

here  PG ( subtype - z4) is the highest qualification for some employee, for some "Graduation (z3) is highest qualification.

could anybody give me some idea to write the logic.

i'm having the data in internal table.

Thanks in Advance.

Regards

satish

1 ACCEPTED SOLUTION
Read only

former_member201275
Active Contributor
0 Likes
1,065

   DATA: qual_for_employee.
LOOP AT itab INTO workarea.
  CASE workarea.
    WHEN 'Z3'.
      qual_for_employee = workarea.
    WHEN 'Z5'.
      IF qual_for_employee = 'Z3'.
      ELSE.
        qual_for_employee = workarea.
      ENDIF.
    WHEN 'Z4'.
      IF qual_for_employee = 'Z3'.
      ELSEIF qual_for_employee = 'Z5'.
      ELSE.
        qual_for_employee = workarea.
      ENDIF.
    WHEN 'Z7'.
      IF qual_for_employee = 'Z3'.
      ELSEIF qual_for_employee = 'Z5'.
      ELSEIF qual_for_employee = 'Z4'.
      ELSE.
        qual_for_employee = workarea.
      ENDIF.
  ENDCASE.
ENDLOOP.

Hi experts,

I have a requirement to display highest qualification based on subtypes .

lets say

Z3-Graduation

Z5- Diploma

Z4- PG

Z7-Others

here  PG ( subtype - z4) is the highest qualification for some employee, for some "Graduation (z3) is highest qualification.

could anybody give me some idea to write the logic.

i'm having the data in internal table.

Thanks in Advance.

Regards

satish

7 REPLIES 7
Read only

Former Member
0 Likes
1,065

Dear Satish,

Best soltion is to have an internal table fill like this:

Employee group  -  Highest qualification    

      A                                        Z3

      B                                        Z3

      C                                        Z4

Then use 2 loops together and  write your condition in 2nd loop in "Where" clause

Read only

VenkatRamesh_V
Active Contributor
0 Likes
1,065

Hi Satish,

store the itab to   temporary itab.

sort temporary itab by descending. and

delete adjacent duplicates.

try this .

Regards,

Venkat.

Read only

0 Likes
1,065

hi ramesh,

thanks for the prompt reply, i guess the logic u have given will not work as subgroups are in random order. if i sort my itab in desc, following is my result set as itab is having 4 records

Z7-Others

Z5- Diploma

Z4- PG

Z3-Graduation

but my requirement is to get highest qualification. here z4 - PG is the highest qualification.

regards

satish

Read only

0 Likes
1,065

Hi satish,

Check this code,

data: BEGIN OF itab OCCURS 0,
       name(30) TYPE c,
       id(02)   TYPE c,
       des(30TYPE c,
       Ini(01TYPE c,
      END OF itab,
      wa LIKE LINE OF itab.


START-OF-SELECTION.

wa-name = 'Ram'.
wa-id   = 'z7'.
wa-des = 'Others'.
APPEND wa to itab. CLEAR wa.



wa-name = 'Ram'.
wa-id   = 'z2'.
wa-des = 'Diploma'.
APPEND wa to itab. CLEAR wa.


wa-name = 'Ram'.
wa-id   = 'z4'.
wa-des = 'PG'.
APPEND wa to itab. CLEAR wa.



wa-name = 'Ram'.
wa-id   = 'z8'.
wa-des = 'Graduation'.
APPEND wa to itab. CLEAR wa.



loop at itab INTO wa.
wa-ini = wa-des(01).
if wa-ini EQ 'O'.
wa-ini = 'A'.
ENDIF.
MODIFY itab FROM wa.
ENDLOOP.

sort itab by name ini DESCENDING.

READ TABLE itab INTO wa INDEX 1.
   write:/ wa-name,
           wa-des.


Regards,

Venkat.

Read only

former_member201275
Active Contributor
0 Likes
1,066

   DATA: qual_for_employee.
LOOP AT itab INTO workarea.
  CASE workarea.
    WHEN 'Z3'.
      qual_for_employee = workarea.
    WHEN 'Z5'.
      IF qual_for_employee = 'Z3'.
      ELSE.
        qual_for_employee = workarea.
      ENDIF.
    WHEN 'Z4'.
      IF qual_for_employee = 'Z3'.
      ELSEIF qual_for_employee = 'Z5'.
      ELSE.
        qual_for_employee = workarea.
      ENDIF.
    WHEN 'Z7'.
      IF qual_for_employee = 'Z3'.
      ELSEIF qual_for_employee = 'Z5'.
      ELSEIF qual_for_employee = 'Z4'.
      ELSE.
        qual_for_employee = workarea.
      ENDIF.
  ENDCASE.
ENDLOOP.

Read only

0 Likes
1,065

Hi Anthony,

Thank you very much for your helpful reply to achieve my requirement. thanks a lot.

regards

satish

Read only

satish_kumar127
Participant
0 Likes
1,065

Thank you all guys for your valuable KT and time.