ABAP prog with Call Transaction  to SU01 will not add roles in a CUA client

I am modifying a current ABAP program that works in a non-CUA client to hopefully execute in a CUA client.  This program performs a Call Transaction to tcode SU01 and adds roles to an existing user.  I used tcode SHDB to identify the new BDC commands needed for CUA when using tcode SU01.  When executing the program in the CUA client  it does not save the roles to the user.  There is no error message or abnormal termination.
When I assign the role to the same user that's referenced in my program directly with tcode SU01 it works fine.  Its just when I run the ABAP program the role assigment is not retained.  I opened a Customer Message with SAP and they referenced OSS Note 93802 and said this was a consulting question.  My program is not abending as referenced in Note 93802, it just does not add the role.
Has anyone been able to get this to work in a CUA client?

Hi,
it should be fairly simple to create a new ABAP using the BAPI's related to business object USER. Call BAPI_USER_CREATE1 to create the users, and BAPI_USER_LOCACTGROUPS_ASSIGN to assign roles in a CUA environment. It should go something like this:
[read file with user data into internal table wt_users]
[read file with role assignments into internal table wt_roles]
Loop at wt_users into wa_user.
  [create LOGINDATA, ADDRESS and other structures for user in BAPI below, based on the data in wa_user]
  call 'BAPI_USER_CREATE1'
  exporting
    username                      = [the user name from input file]
  NAME_IN                       =
    logondata                     = [structure for logondata]
    password                      = [initial password value]
  DEFAULTS                      =
    address                       = [address structure created above]
    [etc.]
  if sy-subrc eq 0.
Assign roles for the user
clear wt_activitygroups. refresh wt_activitygroups.
loop at wt_roles into wa_roles where username = wa_user-username.
    [build an internal table, wt_activitygroups, for system/role assignments for the user]
endloop.
    call BAPI_USER_LOCACTGROUPS_ASSIGN
      exporting
        username                      = [the users name]
      tables
        activitygroups           = wt_activitygroups
        return                       = wt_return.
Endloop.
Ideally, you would have two input files: one with the user data (one record per user), and another one containing the data for the BAPI_USER_LOCACTGROUPS_ASSIGN (on the format USERNAME, SYSTEM, ROLENAME); one entry per line. You'd loop at the first table, containing the user data, then create the user, then loop at all entries in the system/role assignment file for the same username, building an internal table of role assignemnts; then call the second BAPI (provided there were any role assignments to assign for that user!)
Hope this makes sense. It's not rocket science really; you can omit most of the parameters of BAPI_USER_CREATE1, and the second BAPI is even simpler. You could consider validating the input data by checking entries in table USRSYSACT, which contains all valid system/role assignments as seen from the CUA system (this table gets updated every time you do a "text compare" from within SU01.
Regards,
Trond

Similar Messages

  • 2 issues with call transaction to LS24

    Hello All,
    There are 2 issues with call transaction to LS24.
    <b>1) It doesn't take batch value and displays stock for all batches.
    2) When you go back, it doesn't go back to the calling program.</b>
    Any thoughts ?
    <u>Here is my code:</u>
    PARAMETERS: p_lgnum TYPE lgnum,
                p_matnr TYPE matnr,
                p_werks TYPE werks_d,
                p_lgort TYPE lgort_d,
                p_charg TYPE charg_d.
    START-OF-SELECTION.
    END-OF-SELECTION.
      PERFORM display_stock_per_batch.
    *&      Form  DISPLAY_STOCK_PER_BATCH
    FORM display_stock_per_batch .
      SET PARAMETER ID 'LGN' FIELD p_lgnum.
      SET PARAMETER ID 'MAT' FIELD p_matnr.
      SET PARAMETER ID 'WRK' FIELD p_werks.
      SET PARAMETER ID 'LAG' FIELD p_lgort.
      SET PARAMETER ID 'CHA' FIELD p_charg.
      CALL TRANSACTION 'LS24' AND SKIP FIRST SCREEN.
    ENDFORM.                    " DISPLAY_STOCK_PER_BATCH

    hello
    use this code
    perform bdc_dynpro      using 'SAPML01S' '0209'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RL01S-CHARG'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RL01S-LGNUM'
                                  p_lgnum.
    perform bdc_field       using 'RL01S-MATNR'
                                  p_matnr.
    perform bdc_field       using 'RL01S-WERKS'
                                  p_werks.
    perform bdc_field       using 'RL01S-LGORT'
                                  p_lgort.
    perform bdc_field       using 'RL01S-BESTQ'
    perform bdc_field       using 'RL01S-SOBKZ'
    perform bdc_field       using 'RL01S-CHARG'
                                  p_charg.
    perform bdc_dynpro      using 'SAPML01S' '0209'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RL01S-LGNUM'.
    perform bdc_transaction using 'LS24'.
    may be it will help u

  • How to replace 'CALL DIALOG' with 'CALL TRANSACTION'

    IF NOT bkpf-bukrs IS INITIAL.
        CLEAR   buztab.
        REFRESH buztab.
        buztab-zeile = bseg-buzei.
        buztab-bukrs = bkpf-bukrs.
        buztab-belnr = bkpf-belnr.
        buztab-gjahr = bkpf-gjahr.
        buztab-buzei = bseg-buzei.
        APPEND buztab.
        buztab-zeile = bseg-buzei.
        x_nochange = 'X'.
        CALL DIALOG 'RF_ZEILEN_ANZEIGE'
             EXPORTING
                  buztab
                  buztab-zeile
                  tcode        FROM 'FB03'
                  x_nochange
             IMPORTING
                  buztab
                  x_commit.
      ENDIF.
      CLEAR bkpf.
      CLEAR bseg.
    The above given is the part of a code. I need to replace the CALL DIALOG part with CALL TRANSACTION. Can any one plz suggest me how to go ahead with it?

    Javascript. window.open();

  • Problems executing batch input with call transaction

    When I execute BI with Call transaction the fields disabled are enabled and I do not know why. How to resolve it? I do not want them to be enabled

    Can you provide us the BI Program name and Transaction Code???
    Regards
    Eswar

  • I am having a issue installing Adobe Acrobat XI.  I am running Windows 8.1. When  go to install it gets an error.  The error is with transform in registry and will not install product. I am looking at how I can fix this registry problem.

    I am having a issue installing Adobe Acrobat XI.  I am running Windows 8.1. When  go to install it gets an error.  The error is with transform in registry and will not install product. I am looking at how I can fix this registry problem.
    I have tried to uninstall all Abode Acrobat installations but one file remains and refuses to be uninstalled. It gives me this error : Error applying Transforms . Verify that specified paths are valid. It was installed on Sept 18 2014.  I have downloaded a Transform update but it tells I do not have a Adobe Acrobat product installed. 

    Hi all,
    Sylonious, did you manage to sort this problem out? I have been experiencing similar problems. I think my problem was because I had many different versions of JDKs. I have done a complete re-install. I would be really grateful to you (and anyone else) for help with this problem.
    I have re-installed JSDK1.4.2_03, set the "path" variable to "C:\JSDK1.4.2_03".
    When I compile using "javac" I get an error saying "javac" is not recognised.
    When I compile using "C:\j2sdk1.4.2_03\bin\javac Freq.java" no error is thrown.
    Every time I try to run a java file, I always get the NoClassDefFound error. When run with the -verbose option, files are loaded from C:\Program Files\Java\j2re1.4.2_03\bin - is this correct?
    I have removed all previous references to java in the registry editor.
    Please help !
    Regards,
    Vipul

  • I attempted to update my iphone5 to 7.1.1  There was an error and now my phone is erased.  I have attempted to restore from the cloud and it propogates the apple id with an old one, and will not allow me to restore from a the cloud

    I attempted to update my iphone5 to 7.1.1  There was an error and now my phone is erased.  I have attempted to restore from the cloud and it propogates the apple id with an old one, and will not allow me to restore from a the cloud

    Try:                                               
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable       
    - Try on another computer                            
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
      Apple Retail Store - Genius Bar                              
    Also, do you remember what the error message said?

  • My iPhone six with iOS 8.1.1 will not allow me to upload credit card data to Apple pay

    My iPhone six with iOS 8.1.1 will not allow me to add credit card data to Apple pay. It does not recognize my credit card in iTunes. I have I have set location to the United States, and restarted. Still nothing. When I enter the passbook app, hit the plus button, select set up Apple pay, select add new credit card,I get no response when trying to add credit card number expiration date etc., nor does the camera feature work. Bottom line is to date, I cannot add any credit card data at all.

    jimpeg10000 wrote:
    I have I have set location to the United States, and restarted.
    I am guessing there is something about your situation that occurred outside the U.S.  Perhaps you purchased your iPhone outside the U.S., or live outside the U.S., ...
    At the moment, Apple Pay only works in the U.S.

  • Just got an Ipad and am working on setting it up.  the one issue I am having with it is my screen will not rotate no matter what I do to the settings, I can't figure out if the settings are wrong or if there really is something wrong with my Ipad.

    just got an Ipad and am working on setting it up.  the one issue I am having with it is my screen will not rotate no matter what I do to the settings, I can't figure out if I have a setting wrong or if there really is something wrong with my Ipad.  any help would be greatly appreciated.

    Double click the home button (square)  and all the things you did are there.keep sliding the bar that will come up on the bottom to the left till it cant go anymore there should be a icon looking like this.press that and it should work
    Good luck hope it works.

  • My new iPhone 4s paired with my iMac but it will not connect to transfer files by bluetooth. It says the iMac is not supported!

    My iPhone 4s will pair sucessfully with my iMac, but it will not connect so that I can transfer files via bluetooth. It says "bluetooth network not available" or "iMac not supported". Just insane. What to do now??

    I can't pair my iphone 4s with my imac.  It is very frustrating.  I can walk by anything resembling a  bluetooth and my iphone with pair...but not with my mac.  Any assistance would be appreciated.

  • I am having trouble getting a numbers spreadsheet to hold different formats in the same column.  A column with a date formatted heading will not convert to $ for the cells below.   Any suggestions would help.

    I am having trouble getting a numbers spreadsheet to hold different formats in the same column.  A column with a date formatted heading will not convert to $ for the cells below.   Any suggestions would help.

    Hi Wayne,
    Thank you for this response.  I have tried this but when I start enterring $ amounts some, such as $6.00, go in OK others such as $4.00 appear as a date ie 4 Oct 12.  
    Kind regards
    Paul

  • I have a problem with FP 13 in that a Council website with a regional map viewer will not now open.

    I have a problem with FP 13 in that a Council website with a regional map viewer will not now open.  The site was designed around FP 10 and the link they have to download FP 10 nowalso directs to FP 13.  I followed the "How to revert to FP 11.7 (Chris Campbell Oct 2013)  along with the uninstall instructions link and now have both zip FP 10.3 and zip 11.7 in my downloads.  I attempted to run FP 11.7, the "winax" file for IE after unzipping it but I am blocked bya window that says I cannot do this and must install FP 13.  The only choice in this window, other than downloading is QUIT.  What is the best approach now.  The website is Auckland Council and the window concerned is "GIS Viewer".   neither Chrome or IE will open it.

    Hi 34wiki,
    There is only one uninstaller for Windows that will uninstall both 32- and 64-bit versions of the Flash Player. At one point there were two separate installers (one for 32-bit OS and another for 64-bit OS), but that has not been the case for a long time. Based on the error, it's possible you may using an older version of the uninstaller (to find out the version of the uninstaller, right-click on the file, select properties, then the 'details' tab).  The latest version is always posted to this link, and will work on both 32- and 64-bit operating systems.  If you get the same error using this uninstaller, please post the contents at the end of the FlashInstall.log file, that show the uninstall attempt.  Since you have a 64-bit OS, there will be two files at the following locations:
    32-bit: C:\Windows\System32\Macromed\Flash
    64-bit: C:\Windows\SysWOW64\Macromed\Flash
    Maria

  • Can I get Quick time video on iPad 2? Specifically, when I receive an email with quicktime on it, it will not play on the iPad.

    Can I get Quick time video on iPad 2? Specifically, when I receive an email with quicktime on it, it will not play on the iPad.

    Hello.  I have AV player hd.  When I touch and hold the Quicktime icon that is in a received mail message, a prompt comes up "Open in AVPlayerHD".  I click on that and a black screen opens up with the following on it:
    1--A red line at the top with a short white slider button on the right hand side.  There is a time listed at each end of the red line that says 00:00
    2--On the left hand side of the screen, near the middle, there are 4 icons, a colored 'x', a dialogue icon, a circular arrow and an 'i' in a circle.
    3--On the right hand side there is a + and a - sign with '1.00x' in the middle of the two.
    4--At the bottom of the black screen is a play icon plus forward and fast forward icons.
    When I press the play icon it changes to a stop icon.
    So, even though I have AV player I cannot play this Quicktime slideshow.
    Any help would be appreciated.  Thanks.

  • TS3423 Mac book pro stops responding after Maverick OS restart. Currently have a circle with a line through it after 20+ hours. Tried to shut it down and use the Time Machine to restore but no response. How can I restore with Time Machine if it will not s

    Mac book pro stops responding after Maverick OS restart. Currently have a circle with a line through it after 20+ hours. Tried to shut it down and use the Time Machine to restore but no response. How can I restore with Time Machine if it will not start?

    sonjadg,
    you can purchase a replacement pair of grey installation DVDs for your MacBook Pro from either Apple or iFixit. If Startup Manager is only showing an OS X Installer volume, then it sounds like the Mavericks installer had a problem midway through its installation process. To fix this, you’re going to need to erase your internal disk and reïnstall your original version of OS X from the grey Mac OS X Install DVD, use Software Update  to get it back to 10.6.8 (presuming that your MacBook Pro originally came with Snow Leopard), and then restore from Time Machine.

  • My mid 2011 mac with OSX 10.7.5 will not mirror with my apple tv. No icon at top of page or in system preferences - advice?

    My mid 2011 mac with OSX 10.7.5 will not mirror with my apple tv. No icon at top of page or in system preferences - advice?

    You need to upgrade the OS, go to the Mac App Store to download Mavericks

  • I purchased photoshop CS5 for my windows vista operating system. I purchased a canon 7 D some yrs ago no problem. I purchased canon 7D mk 11 in december 2014. The supplied software will not work with vista. Photoshop CS5 will not accept canon7D mk11. Can

    I purchased Photoshop CS5 for my windows vista operating system. I purchased a canon 7 D some yrs ago no problem. I purchased canon 7D mk 11 in December 2014. The supplied software will not work with vista. Photoshop CS5 will not accept canon7D mk11. Can someone please tell me how i process canon 7D mk11 photos ?????. (is it possible to bypass camera raw and open the photo straight into CS5 without using camera raw first. if so how do i do that. if not how do i process pictures).
    Thank you.
    Brian in the UK.

    Photoshop by itself cannot process raw image data. That is why the Camera Raw plug-in was developed. You could try the DNG converter and convert your images to the DNG format and then the Camera Raw that you have would be able to open them. I can't recommend Lightroom because you are using Vista, and Lightroom 5 cannot be used with that operating system. It may be time for you to get a new computer and upgrade your software.

Maybe you are looking for

  • .m4v file icons have become solid white in Finder under iTunes 10.6.3

    Hi there, I just discovered this little annoyance... I thought I'd seen the last of it under a prior version of iTunes, but it may have come back. iTunes video files (.m4v container files) have suddenly defaulted to a plain white icon in the Finder -

  • Can't import from home share with same account

    Hi all, I have this really annoying problem that some of the content of my iTunes library on one computer cannot be imported to the other one, because "this computer is not authorized". That is, of course, bollocks. The scenario: MacMini Server = mac

  • HP Photosmart 3310 - Scanner not working over Bonjour since 2.1 update

    My HP3310 is connected to my Time Capsule via Ethernet to allow it to be used by my iMac and a Macbook. After I updated to OSX 10.6 I had a few problems but eventually I was able to get my 3310 working as a printer and a scanner with both Macs connec

  • How can I import Safari bookmarks to my iPhone 6

    I simply want to export Safari bookmarks from my Mac to iPhone 6. I do not want to use cloud. ITunes lets me sync contacts and calendars (along with music, movies and all the other crap I do not want to sync) but does not offer me the option  of sync

  • Memory allocation error with disk image

    I'm having recurring problems with a large encrypted sparseimage that I mount at /Users (an arrangement I prefer to FileVault.) The file contains one journaled HFS+ partition. Every so often, open files on the volume vanish or become unwritable. At t