Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Mass role change using excel file without using PFCG.

Former Member
0 Likes
5,506

Hello everyone,

I have a requirement where I want to upload the role changes from excel file. Hence the role should should get updated from the values in Excel file.

Following will be the format of excel file.

Role Name

Role Text

Object

Authorization

Field

Low

High

Action (Insert/Delete/Change)

I understand that I need to use the following function modules in sync to update the role.

PRGN_1250_READ_AUTH_DATA

PRGN_1250_SAVE_AUTH_DATA

PRGN_1251_READ_FIELD_VALUES

PRGN_1251_SAVE_FIELD_VALUES

PRGN_1252_READ_ORG_LEVELS

PRGN_1252_SAVE_ORG_LEVELS

PRGN_UPDATE_DATABASE

But in spite of these function modules there is a lot more going on inside the code when I try to debug the profile generation in PFCG. I am watching function pool 'SAPLSUPRN' ad it seems there are endless number of function modules and includes in there. Can anyone help me out how to use the SAP built in functionality of profile generation to my advantage?

Best Regards,

Jagraj Singh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,482

Hi,

The f.m to generate the authorization profile is 'SUPRN_PROFILE_BATCH'. I have successfully generated the profile also. Will update this thread with proper steps when I finish my development.

Best Regards,

Jagraj Singh.

Hello everyone,

I have a requirement where I want to upload the role changes from excel file. Hence the role should should get updated from the values in Excel file.

Following will be the format of excel file.

Role Name

Role Text

Object

Authorization

Field

Low

High

Action (Insert/Delete/Change)

I understand that I need to use the following function modules in sync to update the role.

PRGN_1250_READ_AUTH_DATA

PRGN_1250_SAVE_AUTH_DATA

PRGN_1251_READ_FIELD_VALUES

PRGN_1251_SAVE_FIELD_VALUES

PRGN_1252_READ_ORG_LEVELS

PRGN_1252_SAVE_ORG_LEVELS

PRGN_UPDATE_DATABASE

But in spite of these function modules there is a lot more going on inside the code when I try to debug the profile generation in PFCG. I am watching function pool 'SAPLSUPRN' ad it seems there are endless number of function modules and includes in there. Can anyone help me out how to use the SAP built in functionality of profile generation to my advantage?

Best Regards,

Jagraj Singh.

11 REPLIES 11
Read only

FredericGirod
Active Contributor
0 Likes
3,482

Hi Jagraj,

look inside the PFCG trans. you could export / import the role/profil. If you go in detail it works like a direct input. You just have to understand the structure of the file.

Search a little bit in the forum and if you don't find I will give you the function (I remember I already gives this functions here)

regards

Fred

Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,482

So look PRGN_EXECUTE_UPLOAD ( or  PRGN_UPLOAD_AGR and PRGN_DOWNLOAD_AGR for more infiormations )

Also read  's anwers in create a program to mass change ACTVT to '03' in sap roles.

.

Regards,

Raymond

Read only

Former Member
0 Likes
3,482

Thank you Frederic and Raymond. I wasn't aware of these F.Ms. However I need this specific layout of the excel sheet due to client's requirement. I am able to update the database using the above function modules. Can anyone tell me which Function module is used to generate the Authorization Profile?

Using f.m PRGN_UPDATE_DATABASE only updates the database and authorization profile. But the profile is not generated.

Please help.

Best Regards,

Jagraj Singh.

Read only

0 Likes
3,482

Hi Jagraj,

to generate :


  CALL FUNCTION 'PRGN_AUTO_GENERATE_PROFILE_NEW'

    EXPORTING

      activity_group              = lv_agr_name

      profile_name                = lv_profil

      profile_text                = lv_profilt

      no_dialog                   = 'X'

      rebuild_auth_data           = ' '

      org_levels_with_star        = ' '

      fill_empty_fields_with_star = ' '

*     TEMPLATE                    = ' '

      check_profgen_tables        = ' '

      generate_profile            = 'X'

      authority_check_pfcg        = 'X'

    EXCEPTIONS

      OTHERS                      = 14.

to get a profile :


* ASK SAP for a Profile.

  CALL FUNCTION 'PRGN_PROFILE_NAME_GET'

    EXPORTING

      act_objid        = lv_agr_name

*     text             = lv_agr_title

    IMPORTING

      act_profile_name = lv_profil

      act_prof_text    = lv_profilt.

  CHECK sy-subrc EQ space.

*



regards

Fred

Read only

0 Likes
3,482

Hello Frederic,

The F.M 'PRGN_PROFILE_NAME_GET' is used to propose/generate a Profile name. How about reading the existing profile name and text? Is there any f.m for that too?

Best Regards,

Jagraj Singh.

Read only

0 Likes
3,482

I think PRGN_PROFILE_NAME_GET will give you the profile corresponding to the role, and generate you a profile if there is not

but I'm not sure, that was a long time I used these functions

regards

fred

Read only

JimRadiantExplorer
Product and Topic Expert
Product and Topic Expert
0 Likes
3,482

Hello,

You can use transaction SUPC for mass generation.

You can also check the program of the transaction to see how it is written.

something like:

EXPORT g_data TO DATABASE indx(pr) ID 'SAPPROFG_NEW'.

      COMMIT WORK.

      SUBMIT sapprofg_new AND RETURN.

Thanks.

Jim

Read only

Former Member
0 Likes
3,483

Hi,

The f.m to generate the authorization profile is 'SUPRN_PROFILE_BATCH'. I have successfully generated the profile also. Will update this thread with proper steps when I finish my development.

Best Regards,

Jagraj Singh.

Read only

0 Likes
3,482

Hi Jagraj,

Do you have the steps to create a role from flat file/excel ?

I am basically looking for creating a role if I have Authorization Object, Field, Low and High values available.

Thank you.

regards,

Sanjyot

Read only

0 Likes
3,482

Hello,

Following are the function modules which work in conjunction to generate a new role or change the fields/org levels of the existing roles.


PRGN_1016_READ_PROFILE_NAME - Read Profile Data  - i.e. data from agr_1016.


PRGN_1250_READ_AUTH_DATA - Read Authorization Data - i.e. data from agr_1250.


PRGN_1251_READ_FIELD_VALUES - Read Field Values - i.e. data from agr_1251.


PRGN_1252_READ_ORG_LEVELS - Read Org Levels - i.e. data from agr_1252.

Then you need to modify the field values of all the tables which you want to.


PRGN_1250_SAVE_AUTH_DATA - Save Authorization Data - i.e. save data to internal table similar to agr_1250 after modification.


PRGN_1251_SAVE_FIELD_VALUES - Save field values - i.e. save data to the internal table similar to agr_1251after modification.


PRGN_1252_SAVE_ORG_LEVELS - Save org values - i.e. save data to the internal table similar to agr_1251after modification.


PRGN_UPDATE_DATABASE - update database tables i.e. agr_1250, agr_1251, agr_1252, agr_1016.


PRGN_CLEAR_BUFFER - Release all the changes to the internal tables.


Please note that thefunction modules PRGN_UPDATE_DATABASE and PRGN_CLEAR_BUFFER will only update the database tables. This is like a commit-work statement. But  it will not generate the role.


SUPRN_PROFILE_BATCH - This function module is used to generate the Authorization Profile.

For detailed analysis you can debug the code when you generate the role.


Best Regards,

Jagraj Singh

Read only

Former Member
0 Likes
3,482

Hello Jagraj,

I am working on a similar task at the moment but got stuck at the following point:

How to add completely new authorizations into profile/role?


I can read and change the values in agr_1250 and agr_1251.
But when i want to add another authorization object - which has not been in the profile before - it is not working. Anyone got a solution for this?

Kind regards

Kevin