简体   繁体   English

有没有办法在 SAP 中批量创建角色和配置文件?

[英]Is there any way to create roles and profiles in mass in SAP?

I need to create a lot of SAP roles and profiles with a little difference between them.我需要创建很多 SAP 角色和配置文件,它们之间有一点区别。

Is there any way to do this using ABAP, or any the tamplate for the file to be uploaded using the PFCG transaction?有没有办法使用 ABAP 或使用 PFCG 事务上传文件的任何模板来做到这一点?

I'm pretty new in SAP, so if you have any document about that, please send me.我是 SAP 的新手,所以如果你有任何关于这方面的文件,请发给我。

Thanks in advance.提前致谢。

quite often you can use the Legacy Systems Migration Workbench (transaction 'lsmw').您经常可以使用 Legacy Systems Migration Workbench(事务“lsmw”)。 The workbench works like a sort of macro recorder.工作台就像一种宏记录器。 In it you can record the steps in a transaction and replay that record any number of times, replacing the values you used in your recorded transaction with new ones, for instance read from a text file.在其中,您可以记录事务中的步骤并重放记录的任意次数,用新的值替换您在记录的事务中使用的值,例如从文本文件中读取的值。 There are a few limitations though:但是有一些限制:

  • handling table controls is quite tricky处理表格控件非常棘手
  • the steps for all iterations have to be the same.所有迭代的步骤必须相同。 You can't just omit some part of your recording because you only need it for some of the records.您不能只是省略录音的某些部分,因为您只需要某些记录。

A lot more complex would be creating your own batch input (that is the technology used to replay recorded transactions) using some ABAP coding you need to create yourself.使用一些您需要自己创建的 ABAP 编码来创建您自己的批处理输入(即用于重放记录的事务的技术)要复杂得多。 There you would be more flexible, for instance adding different numbers of privileges to different roles.在那里你会更灵活,例如为不同的角色添加不同数量的权限。 That batch input would then be executed by using the "call transaction using " statement (see here ).然后将使用“调用事务使用”语句(请参阅此处)执行该批输入。

If you can manage to restrict the differences to organizational hierarchy fields, you can use the built-in function to derive roles .如果您可以设法将差异限制到组织层次结构字段,则可以使用内置函数来派生角色 This way, you can create a master role and a number of derived roles that only differ in specific values.这样,您可以创建一个主角色和多个仅在特定值上有所不同的派生角色。 You should be able to use the LSMW mentioned by Dirk Trilsbeek to create the derived roles, if necessary.如有必要,您应该能够使用 Dirk Trilsbeek 提到的 LSMW 创建派生角色。

If this is not possible, you could try to create the role once, download it and check the contents of the file - it's basically a line-based fixed-width format with the first field of each line describing the line type, IIRC - just compare the contents of each line to the structures named.如果这是不可能的,您可以尝试创建一次角色,下载它并检查文件的内容 - 它基本上是一种基于行的固定宽度格式,每行的第一个字段描述了线型,IIRC - 只是将每一行的内容与命名的结构进行比较。 If you are familiar with any programming environment that is able to handle text output, it's not too hard to generate files containing the new roles with any toolkit you're comfortable with.如果您熟悉任何能够处理文本输出的编程环境,那么使用您熟悉的任何工具包生成包含新角色的文件并不太难。 I've successfully used XText / XPand for this, but it doesn't really matter.我已经成功地使用了 XText / XPand,但这并不重要。 You can then upload the roles from the generated text files.然后,您可以从生成的文本文件上传角色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM