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

Getting data from FM

Former Member
0 Likes
707

Hello experts,

I am working on UI5 mobile application development, i have developed the app for Employee Lookup. Now i want to display Manager name by passing personal number of employee. I have use the FM which is defined in our system. I have rectified all other issues from the code, But still there is one issue still exists its regarding Manager name. It’s like getting same manager name for all employees. I have done coding as below,

SELECT pernr

          from pa0105

          into table it_per_no

          where usrty eq '0001'

            and usrid eq sy-uname

            and endda ge sy-datum

            and begda le sy-datum.

   LOOP AT it_per_no INTO wa_per_no.

    MOVE wa_per_no TO gv_pernr.

   ENDLOOP.

   CALL FUNCTION 'Z_ORGCHART_ANG'

     EXPORTING

       i_pernr         = gv_pernr

     IMPORTING

       e_tab_employees = it_emp.


Here it_emp returns list with EMPLOYEE ID, EMPLOYEE NAME, MANAGER ID, MANAGER NAME etc. further this manager name should appear under corresponding employee to achieve this i have done coding as below


LOOP AT it_emp INTO wa_emp.


    MOVE wa_emp-managerid   TO wa_employee_list-pernr.

    MOVE wa_emp-managername TO wa_employee_list-ename.

    MOVE wa_emp-title       TO wa_employee_list-job_text.

    MOVE wa_emp-city        TO wa_employee_list-org_text.

  

*   Get Employee Image

     CALL METHOD get_data_image( ).

*   Get Employee Communication

     CALL METHOD get_data_comm( ).

*   Get Employee Address

     CALL METHOD get_data_address( ).

     APPEND wa_employee_list TO it_employee_mang.

     CLEAR  wa_employee_list.

   ENDLOOP.



but here what happens I am getting manager list in wa_employee_list. With MANAGER ID, MANAGER NAME but how it will identify to display certain manager for entered employee, I just didn't understand logic behind this. If anybody have idea regarding this issue please share it with me.



Thanks,

Avadhut

Message was edited by: Thea Hillenbrand: I deselected the category ABAP Trials and Developer Editions. This category should be used for ABAP Systems in the Cloud Appliance Library related contributions. Kind regards, Thea

2 REPLIES 2
Read only

Former Member
0 Likes
636

Hi Avadhut

An Employee is typically assigned to the Manager via the Organisational Model. You can take a look at transaction PPOMA in order to get a view of the structure.

Using Tables HRP1000, HRP1001, you should be able to locate the relationship from the Manager to the Employee...on these tables it is basically hierarchical.

Hope this helps

Regards

Arden

Read only

0 Likes
636

Hi Arden,

Thanks for the reply, I have used FM " Z_ORGCHART_ANG" to get MANAGER for employee this is returning correct data. This FM is defined in the system. Now next wht i want to do is when we click in the APP on EMPLOYEE then it should display all the data of the employee as well as MANAGER NAME.  As per the code mentioned above I am getting list of EMPLOYEE and corresponding MANAGER. I just want to display the MANAGER name for corresponding employee.

LOOP AT it_employee INTO wa_employee.

   MOVE wa_emp-managerid   TO wa_employee_list-pernr.

    MOVE wa_emp-managername TO wa_employee_list-ename.

    MOVE wa_emp-title       TO wa_employee_list-job_text.

    MOVE wa_emp-city        TO wa_employee_list-org_text.

*   Get Employee Image

     CALL METHOD get_data_image( ).

*   Get Employee Communication

     CALL METHOD get_data_comm( ).

*   Get Employee Address

     CALL METHOD get_data_address( ).

     APPEND wa_employee_list TO it_employee_mang.

     CLEAR  wa_employee_list.

   ENDLOOP.


Here need to make some changes, I didn't understand how to acheive this.


Thanks,

Avadhut