Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Getting the perner based on the username in portal.

Hai all,

I want to pass the pernr based on the userid of the employee.. am using the below code. is it the rite way... If am wrong pls correct me.

Am new to Webdynpro ABAP.

CALL FUNCTION 'HR_GET_EMPLOYEES_FROM_USER'

EXPORTING

USER = SY-UNAME

BEGDA = '19000101'

ENDDA = '99991231'

IV_WITH_AUTHORITY = 'X'

TABLES

EE_TAB = LV_USER.

IF NOT LV_USER is INITIAL.

READ TABLE LV_USER INTO LS_USER INDEX 1.

IF sy-subrc = 0.

DATA lo_nd_service TYPE REF TO if_wd_context_node.

DATA lo_el_service TYPE REF TO if_wd_context_element.

DATA ls_service TYPE wd_this->Element_service.

DATA lv_pernr TYPE wd_this->Element_service-pernr.

  • navigate from <CONTEXT> to <SERVICE> via lead selection

lo_nd_service = wd_context->get_child_node( name = wd_this->wdctx_service ).

  • @TODO handle non existant child

  • IF lo_nd_service IS INITIAL.

  • ENDIF.

  • get element via lead selection

lo_el_service = lo_nd_service->get_element( ).

  • @TODO handle not set lead selection

IF lo_el_service IS INITIAL.

ENDIF.

  • @TODO fill attribute

  • lv_pernr = 1.

  • set single attribute

lo_el_service->set_attribute(

name = `PERNR`

value = ls_user-pernr ).

Thanks in Advance,

Nalla.B

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question