Getting data into work area from function module export parameter
I am working on the SAPUI5 to create an app to display employee lookup. Now what i want to get manager name of the employee by submitting employee ID method. There is function module available in my system to get manager info by entering EMPLOYEE ID. The FM is working good, now further i want to use this FM into the Application Class method to display manager name on the screen,
The FM is Z_ORGCHART_ANG, with importing parameter as EMPLOYEE ID and the EXPORTING parameter is defined as table,
Now in the method i have declared the variables as,
it_emp TYPE STANDARD TABLE OF ztab_orgchart_ang,
wa_emp LIKE LINE OF it_emp,
CALL METHOD get_employee_number( ).
CALL FUNCTION 'Z_ORGCHART_ANG'
i_pernr = gv_pernr
e_tab_employees = it_emp.
READ TABLE it_emp INTO wa_emp INDEX 1.
CHECK sy-subrc EQ 0.
Now when i try to select particular field from wa_emp suppose wa_emp-managerid, then the status message is getting displayed as WA_EMP is table without header line thus not having component as MANAGERID. I think the problem arising is due to EXPORT parameter in method it should be DECLARED as TABLE. Is there any solution available for this problem please share it with me? Or is there any other method to get MANAGER data using employee ID.
Raymond Giuseppi replied
Now double click on the Line Type associated to the internal table, which kind of ddic object do you identify ?
DATA: it_emp TYPE ztab_orgchart_ang,
wa_emp LIKE LINE OF it_emp. " or use line type,
If this is a structure, that should perform well, else you may have to read thru another internal table or even a deep structure.