'RP_GET_PERNR_FROM_USERID'

DATA:   USRID LIKE PA0105-USRID,
      USRTY LIKE PA0105-USRTY.
USRID = PA0105-USRID.
USRTY = PA0105-USRTY.
*function module to the personnel number
CALL FUNCTION 'RP_GET_PERNR_FROM_USERID'
  EXPORTING
    BEGDA           = sy-datum
    ENDDA           = sy-datum
    USRID           = USRID
    USRTY           = USRTY
IMPORTING
   USR_PERNR       = WA_PERNR
EXCEPTIONS
  RETCD           = 1
  OTHERS          = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WHEN THE CODE IS RUN IT GIVES RUNTIME ERROR AND SAYS RET CODE (RETC) IS.....

hi
i think you have posted the question again,
when you pass dates to the function module , check your date format , the function module should work.
Check the preivous post i have mentioned the date format.
Regards
Sameer.

Similar Messages

  • Issues in 'RP_GET_PERNR_FROM_USERID'

    Hi Experts,
    I got a strange pblm with this FM. If I test it in SE37 its retrieve the pernr. But in my program its not giving the pernr.
    Please chek the below code.
    data : lv_userid type SYSID,
                     lv_begda like P0105-BEGDA value '01011900',
                     lv_endda like P0105-BEGDA value '12319999' ,
                     lv_usrty like P0105-USRTY value '0001'.
              lv_userid = ls_wi_agents-user.
              CALL FUNCTION 'RP_GET_PERNR_FROM_USERID'
                EXPORTING
                  begda     = lv_begda
                  endda     = lv_endda
                  usrid     = lv_userid
                  usrty     = lv_usrty
                IMPORTING
                  usr_pernr = lv_pernr
                EXCEPTIONS
                  retcd     = 1
                  OTHERS    = 2.
    Thanks.

    Hi,
    Check this code.It is working when i test it.
    data : lv_userid type SYSID,
                     lv_begda like P0105-BEGDA value '01.01.1900',
                     lv_endda like P0105-BEGDA value '31.12.9999' ,
                     lv_usrty like P0105-USRTY value '0001',
                     lv_pernr like P0105-PERNR.
              lv_userid = 'ECCGEN'.
              CALL FUNCTION 'RP_GET_PERNR_FROM_USERID'
                EXPORTING
                  begda     = lv_begda
                  endda     = lv_endda
                  usrid     = lv_userid
                  usrty     = lv_usrty
                IMPORTING
                  usr_pernr = lv_pernr
                EXCEPTIONS
                  retcd     = 1
                  OTHERS    = 2.
    write lv_pernr.
    Thanks.
    Ramya.

  • How to create ALV as a POPUP in abap web dynpro?

    I have a requirement to display an ALV report as a popup for ESS application in HR module. Data fetching and binding is done in component controller
    WDINIT method and it is displaying ALV in ESS. Now my requirement is to show this alv as a popup in ESS, I have used the method "Generate_Popup" using wizard however it is showing error that "Instance is already used for window".
    Please let me know how to create POPUP alv where data fetching is done in "Component controller" hence I have only 1 view and 1 window in my web dynpro program.
    Below is the logic for data fetching and data binding in WDINIT method of "Component controller":
    method WDDOINIT .
      DATA: lv_pernr type p0105-PERNR,
            lv_user  TYPE P0105-USRID.
      lv_user = sy-uname.
       CALL FUNCTION 'RP_GET_PERNR_FROM_USERID'
         EXPORTING
           begda           = sy-datum
           endda           = sy-datum
           usrid           = lv_user
           usrty           = '0001'
        IMPORTING
          USR_PERNR        = lv_pernr
        EXCEPTIONS
          RETCD            = 1
          OTHERS           = 2.
    IF sy-subrc = 0.
    TYPES: BEGIN OF ty_pa2001,
                 PERNR TYPE PERSNO,
                 SUBTY TYPE SUBTY,
                 ENDDA TYPE ENDDA,
                 BEGDA TYPE BEGDA,
                 END OF   ty_pa2001.
          DATA: lt_pa2001 TYPE TABLE OF ty_pa2001.
    "Changes by shiromani
          DATA lo_nd_node_pernr TYPE REF TO if_wd_context_node.
          DATA lo_el_node_pernr TYPE REF TO if_wd_context_element.
          DATA ls_node_pernr TYPE wd_this->element_node_pernr.
    *    navigate from <CONTEXT> to <NODE_PERNR> via lead selection
          lo_nd_node_pernr = wd_context->get_child_node( name = wd_this->wdctx_node_pernr ).
    *    get element via lead selection
          lo_el_node_pernr = lo_nd_node_pernr->get_element( ).
    *    @TODO handle not set lead selection
          IF lo_el_node_pernr IS INITIAL.
          ENDIF.
    *    get all declared attributes
          lo_el_node_pernr->get_static_attributes(
            IMPORTING
              static_attributes = ls_node_pernr ).
    SELECT PERNR
            SUBTY
            ENDDA
            BEGDA FROM pa2001
    INTO CORRESPONDING FIELDS OF TABLE lt_pa2001
    WHERE pernr = lv_pernr AND subty = 'ITEL'.
    if sy-subrc = 0.
       DATA lo_nd_node_details TYPE REF TO if_wd_context_node.
       DATA lo_el_node_details TYPE REF TO if_wd_context_element.
       DATA ls_node_details TYPE wd_this->element_node_details.
    * navigate from <CONTEXT> to <NODE_DETAILS> via lead selection
       lo_nd_node_details = wd_context->get_child_node( name = wd_this->wdctx_node_details ).
    * get element via lead selection
       lo_el_node_details = lo_nd_node_details->get_element( ).
       lo_nd_node_details->bind_table( lt_pa2001 ).
    * alternative access  via index
    ENDIF.
    ENDIF.
    endmethod.

    Hi
    You ca use this function to Create a new window..
      CALL METHOD wd_window->create_window
          EXPORTING
            modal             = abap_true
            window_name       = 'MMPUR_CPPR_RFQ_WDW'
            title             = lv_otr_text
            close_button      = abap_true
            button_kind       = 3
            close_in_any_case = abap_true
          RECEIVING
            window            = wd_comp_controller->window.
        wd_comp_controller->window->open( ).
    here you acn impliment buttons, if you want to subcribe window button please use this window subcribe method.
        CALL METHOD wd_comp_controller->window->subscribe_to_button_event
          EXPORTING
            button            = if_wd_window=>co_button_ok
            action_name       = 'RFQ_WT_VENDOR'
            action_view       = l_api
            is_default_button = abap_false
            button_text       = lv_otr_text
            tooltip           = lv_otr_text.
        wd_comp_controller->window->open( ).
    Please let me know if you have any issue. Please reword if its solve your problem.
    Regards
    Satrajit

  • Get PERNR using SY-UNAME

    Hi All,
    How to find personnel number (PERNR )using SAP logon username(SY-UNAME)?
    Please let me know your thoughts....
    Thanks & Regards
    Santhosh

    Hi
    You can use RP_GET_PERNR_FROM_USERID function module to get the pernr.
    Give USRTY parameter = '0001' (SY-UNAME).
    CALL FUNCTION 'RP_GET_PERNR_FROM_USERID'
    EXPORTING
    BEGDA = sy-datum
    ENDDA = sy-datum
    USRID = G_SYUNAME
    USRTY = '0001'
    IMPORTING
    USR_PERNR = G_PERNR
    EXCEPTIONS
    RETCD = 1
    OTHERS = 2
    With Regards
    Nikunj Shah

  • USERID and PERNR

    Hi Experts,
       I need to Get one to one mapping for userid and pernr ....for every users ( userid or bname ) char 12 i need to get his corresponding pernr (numc  8) ...
    I have checked the forum and many threads ...
    i checked USR21, PA0105,ADRP  and function modules RP_GET_PERNR_FROM_USERID also but no vain.
    USR21 contains BNAME which is userid ....
    ADRP contains bname and persno which is char 10 but not pernr and addr no.
    PA0105 contains pernr and the username but this username refers to change of that person
    i have found one table ALM_ME_D997 which has many of the values....but some values are missing ..
    is there any one table which contains all the values.
    But i need pernr of all the users(userids or bname)
    Thanks
    vamsi
    Edited by: vamsi talluri on Oct 8, 2009 6:58 PM

    Hi Shashank ,
         Actually my requirement is to get all the users from r3 and has  to go for  PA0006 and get some information for them....
    But Userid is char 12 and in PA0006 we have key as pernr which is numc 08 .....
    I am in a notation that for each userid there exists one pernr ....
    Most  times userid and pernr are same.... but for the other userids i am thinking i need to get pernr and then transverse to PA0006 to get this information.....
    So i am asking for userid and pernr relation......
    What in PA0105 we will have pernr and the userid who changed this pernr ...which is not needed for my requirement.....
    Can you tell me wheter my notation is correct or not....
    Thanks
    vamsi

  • Error RABAX_STATE while launching HRESS_A_MENU

    Hi,
    When I open the application HRESS_A_MENU in portal or in SE80, I get an error
    500 SAP Internal Server Error
    Error: Type conflict when calling a function module. (termination: RABAX_STATE).
    Below is the ST22 dump analysis.... also check the attachment for full ST22 dump. Am i missing some config?
    Thanks,
    -Ashwani
    If the error occurred in your own ABAP program or in an SAP
        program you modified, try to remove the error.
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "CALL_FUNCTION_CONFLICT_TYPE" "CX_SY_DYN_CALL_ILLEGAL_TYPE"
        "CL_HRASR00_SET_PERNR_MEMID_ESSCP" or "CL_HRASR00_SET_PERNR_MEMID_ESSCM001"
        "IF_EX_HRESS_MENU~MODIFY_APPLICATION_ATTRIBUTES"
        Termination occurred in the ABAP program "CL_HRASR00_SET_PERNR_MEMID_ESSCP" -
        in "IF_EX_HRESS_MENU~MODIFY_APPLICATION_ATTRIBUTES".
        The main program was "SAPMHTTP ".
        In the source code you have the termination point in line 15
        of the (Include) program "CL_HRASR00_SET_PERNR_MEMID_ESSCM001".
        The termination is caused because exception "CX_SY_DYN_CALL_ILLEGAL_TYPE"
        occurred in
        procedure "IF_EX_HRESS_MENU~MODIFY_APPLICATION_ATTRIBUTES" "(METHOD)", but it
        was neither handled locally nor declared
        in the RAISING clause of its signature.
        The procedure is in program "CL_HRASR00_SET_PERNR_MEMID_ESSCP "; its source

    Hi,
    I did a little bit of research and saw in your message in the other thread you showed that the short dump was occurring when the code was going to Function Module RP_GET_PERNR_FROM_USERID.
    While the program should not short dump and there should be error handling, can you confirm if you have your user ID (That you login to test with) set to IT0105 for a particular personnel number that is valid on the date of processing? I dont see why that FM would have an error if you have a personnel number set to your user ID. Here is the screenshot from your other thread showing where it is short dumping
    In further research of this, can you also check and confirm if OSS Note 1893321 is implemented in your system? The description for this fix says "The Exception Handling in the function module RP_GET_PERNR_FROM_USERID was incorrect and does not cover all the scenarios. The code has been adjusted to cover all exception conditions."
    http://service.sap.com/sap/support/notes/1893321
    You can probably go to SE37 directly and see if this code is in the system on line 58. Here is the change that SAP made FYI. They just adjusted one line of code.
    Thanks,
    Imran

  • Username and PERNR

    Hi All,
    I want to get PERNR (Personnel Number) using Sy-Uname.
    Is there any way to get it except below options ?
    1. PA0105
    2. USR21
    3. RP_GET_PERNR_FROM_USERID
    4. BAPI_USER_GET_DETAIL
    Please help.
    In my system HR data is not maintained. It is a gateway server. I am using RFC's of remote system,
    I have to capture the personnel number based on logged in user.

    The first point that you need to check is WHERE your company saves the SAP user in the employee master data (usually in IT0105 but not always).
    If it is in IT105, the easier method is use the FM  HR_GET_USER_FROM_EMPLOYEE. See the example:
       DATA: lv_user TYPE syuname.
       CALL FUNCTION 'HR_GET_USER_FROM_EMPLOYEE'
         EXPORTING
           pernr             = lv_pernr
           begda             = sy-datum
           endda             = sy-datum
           iv_with_authority = 'X'
         IMPORTING
           user              = lv_user.

  • Fetching pernr from workitem

    HI All,
    I am working on workflow for approval /rejection of leave requests. Can someone tell me if there is any BAPI/function module or DB table from where i can fetch the personnel number (pernr) from the workitem id in my function module?
    Regards
    Partha
    Edited by: Partha Kar on Apr 6, 2010 6:03 PM

    Check below code snippet, Actually Iam not clear whose pernr you are trying to get whether the Intiiators or the approvers, if it is intiiators the you can use the below code snippet,
    DATA:
               lv_wiid   TYPE sww_wiid,
               lt_cont   TYPE STANDARD TABLE OF swr_cont,
               ls_cont  TYPE swr_cont,
               lv_pernr  TYPE pernr_d,
               lv_initiator TYPE sysid.
    CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
      EXPORTING
        workitem_id      = lv_wiid
      TABLES
        simple_container = lt_cont.
    READ TABLE lt_cont INTO ls_cont WITH KEY element = '_WF_INITIATOR'.
    IF sy-subrc IS  INITIAL.
      lv_initiator = ls_cont-value.
      CALL FUNCTION 'RP_GET_PERNR_FROM_USERID'
        EXPORTING
          begda     = sy-datum
          endda     = sy-datum
          usrid       = lv_initiator
          usrty       = '0001'
        IMPORTING
          usr_pernr = lv_pernr
        EXCEPTIONS
          retcd     = 1
          OTHERS    = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDIF.
    If at all you are looking for approvers pernr then you need to change read table statement by replacing the key from WIINITIATOR to WIACTUAL_AGENT.

  • Date field in Webdynpro Java

    Hi, I am trying to hardcode date field in a project with date say "21.11.2007", the rfc takes only date in java.sql form. can you please help me how can I do so. Plz help me out.
    Regards
    Umang

    I have used the following code for importing the date value to a rfc the I have checked that the code for date is fine but still I am not getting any output. I think that its the issue of the date format. Because while testing the RFC, it is not accepting date in   dd-mm-yyyy format but is only accepting in the format dd.mm.yyyy or ddmmyyyy.
    So I believe that it is the issue of date format. or might be possible that there would be some error in the way I am executing the RFC.
    Even after setting the debugger in RFC, the the RFC is not coming into picture i.e, the project is not hitting the RFC  might be because of the wrong format of date .
    Could you please refer to the code and suggest something.
    Rp_Get_Pernr_From_Userid is the name of RFC.
         try
                Rp_Get_Pernr_From_Userid_Input inp = new Rp_Get_Pernr_From_Userid_Input();
                wdContext.nodeRp_Get_Pernr_From_Userid_Input().bind(inp);     
    wdContext.currentRp_Get_Pernr_From_Userid_InputElement().setBegda(new java.sql.Date((new java.util.Date()).getTime()));
    wdContext.currentRp_Get_Pernr_From_Userid_InputElement().setUsrid(wdContext.currentContextElement().getUserid());
    String dateInput = "9999.12.31";
           SimpleDateFormat sdf = new SimpleDateFormat( "yyyy.MM.dd" ) ;
                java.sql.Date dt = null;
                try {
                    dt = new java.sql.Date( sdf.parse(dateInput).getTime()) ;
                catch(Exception io)
                 io.printStackTrace();
              wdContext.currentRp_Get_Pernr_From_Userid_InputElement().setEndda(dt);
    wdContext.currentRp_Get_Pernr_From_Userid_InputElement().modelObject().execute();
    catch (Exception e)
                                             wdContext.currentContextElement().setTest(e.toString());

Maybe you are looking for