ā2012 Nov 27 11:18 AM
Hi Experts,
Can some one please tell me, how i can make changes to user id, mobile number, office number, fax number using BAPI_USER_CHANGE,
Thanks in advance.
Regards,
Snigdha
ā2012 Nov 27 12:01 PM
Hi,
Use below sample code .
DATA : T_USERNAME LIKE BAPIBNAME-BAPIBNAME ,
BAPIMSG LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
T_ADDTEL LIKE BAPIADTEL OCCURS 0 WITH HEADER LINE.
.
T_USERNAME-BAPIBNAME = 'XXXXXXXXX' . " User Name in User Master Record
LOOP AT T_ADDTEL .
T_ADDTEL-TELEPHONE = 'xxxxxxx' . " pass ur TELEPHONE numner
APPEND: T_ADDTEL .
CLEAR : T_ADDTEL .
ENDLOOP.
CALL FUNCTION 'BAPI_USER_CHANGE'
EXPORTING
USERNAME = T_USERNAME
TABLES
* PARAMETER =
RETURN = BAPIMSG
ADDTEL = T_ADDTEL
.
READ TABLE BAPIMSG WITH KEY TYPE = 'E'.
IF SY-SUBRC EQ '0'.
CONCATENATE BAPIMSG-MESSAGE BAPIMSG-ID BAPIMSG-NUMBER INTO E_ERROR SEPARATED BY SPACE.
ELSE .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
ENDIF.
Regard's
Smruti Ranjan
ā2012 Nov 27 11:24 AM
Use ADDTEL(For Mobile number and standard number) and ADDFAX ( For Fax number ). See the SE37 documentation for FM.
ā2012 Nov 27 11:32 AM
Hi Rudra,
How can i use addtel for both mobile number and standard number?
Will that help me?
I am actually fetching bname(user id ) from an external source outside sap, and i am using an rfc to check whether the the bname exists in sap or not,
If yes, i am trying to fill the above mentioned fields.
So will my exporting parameter, wen i call bapi_user_change in my rfc will be bname.
Please do kindly show me, how i can make use of it,
Do tell me, how to make use of bapiret2, if the bname doesnt exist in sap
Thanks in advacne.
ā2012 Nov 27 11:48 AM
Incase you User name is invalid ( BNAME ) bapi_user_change will throw an error message automatically in the RETURN table which has got structure BAPIRET2, You do not need to call a separate BAPI to validate the user name. Still you want to do it it is up to you.
To answer your second question, yes you pass the User Name to FM importing parameter USERNAME field and pass the telephone number and fax numbers in those internal table. If you are using JCO to call the RFC you have methods available to populate the internal table. To know how the BAPI works, check for the documentation and run the BAPI in SE37 in SAP system.
ā2012 Nov 27 12:01 PM
Thanks Rudra Roy,
That was really helpfull.
Thanks for your time.
ā2012 Nov 27 11:33 AM
Hi,
Provide the following exporting parameters.
Pass the below parameters for the BAPI.
USERNAME
ADDRESS ADDRESS-PERS_NO
ADDRESS-ADDR_NO
ADDRESS-TEL1_NUMBR
ADDRESS-FAX_NUMBER
ADDRESSX ADDRESSX-PERS_NO = 'X'
ADDRESSX-ADDR_NO = 'X'
ADDRESSX-TEL1_NUMBR = 'X'
ADDRESSX-FAX_NUMBER = 'X'.
Then Call the BAPI_TRANSACTION_COMMIT
Thanks & Regards
Bala Krishna
ā2012 Nov 27 12:01 PM
Hi,
Use below sample code .
DATA : T_USERNAME LIKE BAPIBNAME-BAPIBNAME ,
BAPIMSG LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
T_ADDTEL LIKE BAPIADTEL OCCURS 0 WITH HEADER LINE.
.
T_USERNAME-BAPIBNAME = 'XXXXXXXXX' . " User Name in User Master Record
LOOP AT T_ADDTEL .
T_ADDTEL-TELEPHONE = 'xxxxxxx' . " pass ur TELEPHONE numner
APPEND: T_ADDTEL .
CLEAR : T_ADDTEL .
ENDLOOP.
CALL FUNCTION 'BAPI_USER_CHANGE'
EXPORTING
USERNAME = T_USERNAME
TABLES
* PARAMETER =
RETURN = BAPIMSG
ADDTEL = T_ADDTEL
.
READ TABLE BAPIMSG WITH KEY TYPE = 'E'.
IF SY-SUBRC EQ '0'.
CONCATENATE BAPIMSG-MESSAGE BAPIMSG-ID BAPIMSG-NUMBER INTO E_ERROR SEPARATED BY SPACE.
ELSE .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
ENDIF.
Regard's
Smruti Ranjan
ā2012 Nov 27 12:36 PM
ā2012 Nov 27 12:38 PM
ā2012 Nov 27 12:41 PM
Hi venkat,
how do i close the tread?
can u please tell me, how i can do this,
Thanks!!
ā2012 Nov 27 12:53 PM
You can say it as Self Answered or Can give points to others who answered.
ā2015 Feb 07 11:42 PM
Hello,
I am having an issue with BAPI_USER_CHANGE. The client has the users centralized system in 250 and the program i am creating has to change any system password. So, for example, when i try to change system 700 password if i execute the FM it will throw me an error because the password change has to be done in 250, and if I do the password change in 250 it will change the password for 250, not for 700.
Do you know any other BAPI i can use or if i can set the parameters correctly in a different way to use
BAPI_USER_CHANGE. Currently if i execute bia RFC from 700 to 250 it changes 250 password and not 700.
Thanks for any inputs, regards,
Gustavo
ā2015 Feb 08 12:04 AM
Hi Gustavo
This thread is answered already.
First search the SDN forum for a similar issue to yours. If you cannot find the answer you seek, then open a new discussion thread.
Regards
Arden
ā2012 Nov 27 12:41 PM
In case of problem, read Note 1513595 - BAPI: Handling of telephone data is inconsistent.
(Also use search tool before posting to find discussion like change Phone and Mobile number using BAPI_USER_CHANGE, BAPI_USER_CHANGE mobile and telephone or BAPI_USER_CHANGE for mobile number changes. and read the Rules of Engagement.)
Regards,
Raymond