01-13-2015 10:35 AM
Hi there,
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,
DATA:
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'
EXPORTING
i_pernr = gv_pernr
IMPORTING
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.
Thanks
Avadhut
01-13-2015 12:17 PM
Double-click on "ztab_orgchart_ang" in your source, is it a structure or an internal table definition. In the second case, suggested by the FM signture which uses it as an export parameter and not an obsolete table parameter, replace
it_emp TYPE STANDARD TABLE OF ztab_orgchart_ang,
with
it_emp TYPE ztab_orgchart_ang,
Regards,
Raymond
01-13-2015 11:04 AM
Peace be upon you,
you should define your work area as
wa_emp type it_emp,
hope you find this helpful
01-13-2015 11:12 AM
Hi Marwan Al-Tawansy,
I have tried out with it but didn't work out. The export parameter is defined with internal table type now i didn't understand how to retrieve data from it.
Thanks,
Avadhut
01-13-2015 11:25 AM
Hi Avadhut,
try using the statement
READ TABLE it_emp INDEX <> INTO wa_emp.
better use the KEY if you know the exact record to be fetched by using the known field.
hope it works...
01-13-2015 11:33 AM
Hi Vishnu,
Thanks for the reply it is working but when i try to access any field from wa_emp suppose "wa_emp-managerid" getting status message as
We cannot define table with header line in class.
Thanks,
Avadhut
01-13-2015 11:30 AM
Hi,
use your original wa_emp declaration and replace line
READ TABLE it_emp INTO wa_emp INDEX 1.
with
READ TABLE it_emp INDEX 1 INTO wa_emp.
Regards,
Klaus
01-13-2015 12:12 PM
01-13-2015 12:17 PM
Double-click on "ztab_orgchart_ang" in your source, is it a structure or an internal table definition. In the second case, suggested by the FM signture which uses it as an export parameter and not an obsolete table parameter, replace
it_emp TYPE STANDARD TABLE OF ztab_orgchart_ang,
with
it_emp TYPE ztab_orgchart_ang,
Regards,
Raymond
01-13-2015 12:21 PM
Hi Raymond,
It is Table Type defined in SE11. I have tried out using
it_emp TYPE ztab_orgchart_ang.
but when i create a work are for it and try to access the field from work area like wa_emp-managerid then getting error message.
Thanks,
Avadhut
01-13-2015 12:27 PM
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.
Regards,
Raymond