<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ABAP Program to Upload Users Throwing Errors - Help Optimize Please! in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759740#M2022425</link>
    <description>&lt;P&gt;Hi Guys&lt;/P&gt;&lt;P&gt;Thanks for the answers.... and questions....I am trying to upload a list of users from a text file and create them en masse in SAP. Kindly if you could rewrite the above code to optimize it for me, I would highly appreciate.&lt;/P&gt;&lt;P&gt;Thanks very much.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jun 2023 07:36:01 GMT</pubDate>
    <dc:creator>ravin_jugdav3</dc:creator>
    <dc:date>2023-06-23T07:36:01Z</dc:date>
    <item>
      <title>ABAP Program to Upload Users Throwing Errors - Help Optimize Please!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759737#M2022422</link>
      <description>&lt;P&gt;Hi, I am creating a program to upload users from a text file into SAP. The code is throwing up errors, and probably needs a little optimization. Your help appreciated. Here is the code, followed by the errors:&lt;/P&gt;
  &lt;P&gt;REPORT Z_USER_CREATE.&lt;/P&gt;
  &lt;P&gt;DATA: lv_filename TYPE string,&lt;/P&gt;
  &lt;P&gt; lv_file_content TYPE string,&lt;/P&gt;
  &lt;P&gt; lt_users TYPE TABLE OF sy-uname.&lt;/P&gt;
  &lt;P&gt;PARAMETERS: p_file TYPE rlgrap-filename.&lt;/P&gt;
  &lt;P&gt;START-OF-SELECTION.&lt;/P&gt;
  &lt;P&gt; CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;
  &lt;P&gt; EXPORTING&lt;/P&gt;
  &lt;P&gt; filename = p_file&lt;/P&gt;
  &lt;P&gt; filetype = 'ASC'&lt;/P&gt;
  &lt;P&gt; CHANGING&lt;/P&gt;
  &lt;P&gt; data_tab = lt_users&lt;/P&gt;
  &lt;P&gt; EXCEPTIONS&lt;/P&gt;
  &lt;P&gt; file_open_error = 1&lt;/P&gt;
  &lt;P&gt; file_read_error = 2&lt;/P&gt;
  &lt;P&gt; no_batch = 3&lt;/P&gt;
  &lt;P&gt; gui_refuse_filetransfer = 4&lt;/P&gt;
  &lt;P&gt; invalid_type = 5&lt;/P&gt;
  &lt;P&gt; no_authority = 6&lt;/P&gt;
  &lt;P&gt; unknown_error = 7&lt;/P&gt;
  &lt;P&gt; bad_data_format = 8&lt;/P&gt;
  &lt;P&gt; header_not_allowed = 9&lt;/P&gt;
  &lt;P&gt; separator_not_allowed = 10&lt;/P&gt;
  &lt;P&gt; header_too_long = 11&lt;/P&gt;
  &lt;P&gt; unknown_dp_error = 12&lt;/P&gt;
  &lt;P&gt; access_denied = 13&lt;/P&gt;
  &lt;P&gt; dp_out_of_memory = 14&lt;/P&gt;
  &lt;P&gt; disk_full = 15&lt;/P&gt;
  &lt;P&gt; dp_timeout = 16&lt;/P&gt;
  &lt;P&gt; OTHERS = 17.&lt;/P&gt;
  &lt;P&gt; IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;
  &lt;P&gt; MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;
  &lt;P&gt; WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;
  &lt;P&gt; ENDIF.&lt;/P&gt;
  &lt;P&gt; LOOP AT lt_users INTO DATA(ls_user).&lt;/P&gt;
  &lt;P&gt; CREATE OBJECT ls_user TYPE bapiuser.&lt;/P&gt;
  &lt;P&gt; ls_user-username = ls_user.&lt;/P&gt;
  &lt;P&gt; " Set additional user data if required&lt;/P&gt;
  &lt;P&gt; APPEND ls_user TO lt_users.&lt;/P&gt;
  &lt;P&gt; ENDLOOP.&lt;/P&gt;
  &lt;P&gt; CALL FUNCTION 'BAPI_USER_CREATE1'&lt;/P&gt;
  &lt;P&gt; EXPORTING&lt;/P&gt;
  &lt;P&gt; user_tab = lt_users&lt;/P&gt;
  &lt;P&gt; EXCEPTIONS&lt;/P&gt;
  &lt;P&gt; user_name_exist = 1&lt;/P&gt;
  &lt;P&gt; user_lock = 2&lt;/P&gt;
  &lt;P&gt; password_generation_failed = 3&lt;/P&gt;
  &lt;P&gt; profile_creation_failed = 4&lt;/P&gt;
  &lt;P&gt; parameter_error = 5&lt;/P&gt;
  &lt;P&gt; OTHERS = 6.&lt;/P&gt;
  &lt;P&gt; IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;
  &lt;P&gt; MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;
  &lt;P&gt; WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;
  &lt;P&gt; ELSE.&lt;/P&gt;
  &lt;P&gt; COMMIT WORK.&lt;/P&gt;
  &lt;P&gt; WRITE: 'Users uploaded successfully.'.&lt;/P&gt;
  &lt;P&gt; ENDIF.&lt;/P&gt;
  &lt;P&gt;Errors:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2179723-image.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 10:44:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759737#M2022422</guid>
      <dc:creator>ravin_jugdav3</dc:creator>
      <dc:date>2023-06-22T10:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Program to Upload Users Throwing Errors - Help Optimize Please!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759738#M2022423</link>
      <description>&lt;P&gt;Hi, why are you doing this?&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2178810-image.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 17:47:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759738#M2022423</guid>
      <dc:creator>Eduardo-CE</dc:creator>
      <dc:date>2023-06-22T17:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Program to Upload Users Throwing Errors - Help Optimize Please!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759739#M2022424</link>
      <description>&lt;P&gt;not sure what version is your sap, but some weird thing you have done&lt;/P&gt;&lt;P&gt;1. BAPI_USER_CREATE1 does not have the importing user_tab parameter, are you using the right FM?&lt;BR /&gt;2. code below is really weird, &lt;BR /&gt;- you have created the ls_user with the same type as lt_users, but you wanted to change the workarea into another type, then you wanted to append workarea into itab with different structure, why?&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT lt_users INTO DATA(ls_user).&lt;BR /&gt;CREATE OBJECT ls_user TYPE bapiuser.&lt;BR /&gt;ls_user-username = ls_user.&lt;BR /&gt;APPEND ls_user TO lt_users.&lt;BR /&gt;ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Jun 2023 03:35:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759739#M2022424</guid>
      <dc:creator>xiswanto</dc:creator>
      <dc:date>2023-06-23T03:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Program to Upload Users Throwing Errors - Help Optimize Please!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759740#M2022425</link>
      <description>&lt;P&gt;Hi Guys&lt;/P&gt;&lt;P&gt;Thanks for the answers.... and questions....I am trying to upload a list of users from a text file and create them en masse in SAP. Kindly if you could rewrite the above code to optimize it for me, I would highly appreciate.&lt;/P&gt;&lt;P&gt;Thanks very much.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 07:36:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759740#M2022425</guid>
      <dc:creator>ravin_jugdav3</dc:creator>
      <dc:date>2023-06-23T07:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Program to Upload Users Throwing Errors - Help Optimize Please!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759741#M2022426</link>
      <description>&lt;P&gt;Some steps&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Dig out your Abap course materials&lt;/LI&gt;&lt;LI&gt;Read the BAPI documentation to identify the minimal data required to create a user (Try with SE37)&lt;/LI&gt;&lt;LI&gt;Rewrite your code with a correct code of the BAPI (use the pattern option in SE38/SE80)&lt;/LI&gt;&lt;LI&gt;Third, after call of BAPI, look for error in RETURN parameter, if none call BAPI_TRANSACTION_COMMIT else BAPI_TRANSACTION_ROLLBACK&lt;/LI&gt;&lt;LI&gt;Write some log and/or display an execution report&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 23 Jun 2023 11:42:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759741#M2022426</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2023-06-23T11:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Program to Upload Users Throwing Errors - Help Optimize Please!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759742#M2022427</link>
      <description>&lt;P&gt;Any other suggestions? Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 07:13:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-program-to-upload-users-throwing-errors-help-optimize-please/m-p/12759742#M2022427</guid>
      <dc:creator>ravin_jugdav3</dc:creator>
      <dc:date>2023-06-26T07:13:01Z</dc:date>
    </item>
  </channel>
</rss>

