Skip to Content
0
Aug 17, 2005 at 02:01 AM

BAPI_USER_CHANGE - cannot initialise communication fields

81 Views

Hi friends,

I am using BAPI_USER_CHANGE to synchronise SAP User data with our Exchange Server. Included in these changes are the user's telephone and mobile number. Now say for example if I want to change these numbers there is no problem, but if a user no longer has a (desk) telephone number because they are now splitting their time evenly over several sites or no longer has a mobile number I want to the appropriate fields to be empty in SAP.

Here is a segment of my code:


* Structure to hold Communication 'X' structure
DATA: BEGIN OF st_commx.
        INCLUDE STRUCTURE bapiadcomx.
DATA: END OF st_commx.

* Internal Table to hold Telephone / Mobile Numbers
DATA: BEGIN OF tbl_comm OCCURS 0.
        INCLUDE STRUCTURE bapiadtel.
DATA: END OF tbl_comm.
  
  CLEAR tbl_comm.
  ADD 1 TO l_counter.
  tbl_comm-std_no     = 'X'.
  tbl_comm-telephone  = st_user_change-mob_number.
  tbl_comm-std_recip  = 'X'.  "SMS Compatible?
  tbl_comm-r_3_user   = '3'.  "Mobile?
  tbl_comm-home_flag  = 'X'.
  tbl_comm-consnumber = l_counter.

  st_commx-adtel = 'X'.

....

  CALL FUNCTION 'BAPI_USER_CHANGE'
    EXPORTING
      username = st_user_change-username
      address  = st_addr
      addressx = st_addrx
      addcomx  = st_commx
    TABLES
      return   = tbl_return
      addsmtp  = tbl_email
      addtel   = tbl_comm.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

So, if st_user_change-mob_number is empty, I would assume that the BAPI would overwrite the existing number with blanks, but this is not happening - the old number is still there.

Any assistance will be rewarded accordingly.

Cheers,

Pat.