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

How to duplicate package structure and objets ? (without datas)

Former Member
0 Likes
8,562

Hello,

My name is David and I'm a student in IT engineering school in Paris.

I have to work on a scrambling project to prevent private datas on SAP to be accessed and reused by unautorised people.

First of all, I have to develop an application (in PHP) to access all tables, datas and relations, private and foreign keys and copy them in a local database in order to scramble those datas. This done, scrambling applied, next step is to put those scrambled datas back in SAP and test if everything works fine.

So, I have a question: Is it possible to duplicate all package objects in a new 'Z'package and then populate new tables with scrambled datas using connector like SAPRFC ? Is there any transaction that would help me to recreate the package structure and objets I'm woking on ?

I'm working on SAPBC_DATAMODEL package.

Help would be highly appreciated.

Thank you in advance

David

Hello,

My name is David and I'm a student in IT engineering school in Paris.

I have to work on a scrambling project to prevent private datas on SAP to be accessed and reused by unautorised people.

First of all, I have to develop an application (in PHP) to access all tables, datas and relations, private and foreign keys and copy them in a local database in order to scramble those datas. This done, scrambling applied, next step is to put those scrambled datas back in SAP and test if everything works fine.

So, I have a question: Is it possible to duplicate all package objects in a new 'Z'package and then populate new tables with scrambled datas using connector like SAPRFC ? Is there any transaction that would help me to recreate the package structure and objets I'm woking on ?

I'm working on SAPBC_DATAMODEL package.

Help would be highly appreciated.

Thank you in advance

David

14 REPLIES 14
Read only

former_member184158
Active Contributor
0 Likes
8,509

Hi 'David,

you can copy any structure or package but with different name, they must not be identc, otherwise you will get Dump.

Regards

Ebrahim

Read only

0 Likes
8,509

Thank you Ebrahim.

In fact, it appears that it doesn't seem possible to deeply/recursively copy a package with all its objects.

src ->

So i'm looking for a way to do it by myself,  using a PHP app with SAP connector.

Is there any Module Fonction I can use to get a list of all objects from SAPBC_DATAMODEL package ?

Regards

David

Read only

0 Likes
8,509

Hi David,

you can use this Function module "TADIR_GET"

    CALL FUNCTION 'TADIR_GET'
     
EXPORTING
        devclass
= 'SAPBC_DATAMODEL'
     
TABLES
        iadir   
= lt_iadir.





If you face any problem, just let us to know,

good luck

Regards

Ebrahim

Read only

0 Likes
8,509

Hi Ebrahim and thanks again. 🙂

I'm facing a SAP error from my PHP app, due to security policy:

"RFC_ERROR_SYSTEM_FAILURE Status : Message : The function module "TADIR_GET" cannot be used for 'remote' calls"

I think I'll have to consider another solution : a new SAP instance with SAPBC_DATAMODEL package installed, deleting all datas and then populating database with scrambled datas.

Thank you for all.

David

Read only

0 Likes
8,508

Hi David,

you are right, it is not RFC-Function,

Remote enabled module , but you can copy it to z_FM_TADIR_GET , but there are many sub routine, and it is not easy to copy them., any how what could I advise you, just create a new FM as RFC and just select the data from TADIR, If you can not do  it, just write us, and we will help you to write a function modulde RFC with select statments,

Function module RFC

  1. For more information
  2. Create FM as RFC

https://www.sapnuts.com/courses/SAP-Cross-Applications/rfc-development/creating-rfc-function.html

PHP calls SAP RFC

  1. http://rdeshapriya.com/connecting-sap-and-php/
  2. PHP Call SAP RFC Function Module - YouTube

I hope it could help you.

Regards

Ebrahim

Read only

0 Likes
8,508

You do not need to copy the subroutines. Just create an RFC function module with the same parameters as TADIR_GET which calls TADIR_GET.

This function just will function as a wrapper to be able to call TADIR_GET as an RFC.

Read only

0 Likes
8,508

Hi Peter,

you mean he has to create his own FRC function module, then he has to just select from Table TADIR as I have mentioned above.

Regards

Ebrahim

Read only

0 Likes
8,507

No I mean exactly what I said. You can create a RFC function module e.g. Z_TADIR_GET with exactly the same paremeters as TADIR GET

Read only

0 Likes
8,507

Hi Peter,

you are right,  I have forgotten it

Regards

Ebrahim

Read only

0 Likes
8,507

Hi and thank you all for thoses ideas and advices.

I juste have last question:

Is it possible to disable/enable constraints like foreign keys ?

I mean, I need to populate new SAP Z_package with scrambled data. If I populate SAP database table by table, foreign keys constraints will forbid me to do this. The idea is to disable those constraints like Oracle SQL command "ALTER TABLE table_name DISABLE CONSTRAINT constraint_name;".

Is there a way to do this on SAP ? Aren't thoses keys stored in DFIES_TAB table ?

Read only

0 Likes
8,507

Hi David,

Foreign key checks on the tables are not executed when you update the data from a program; only when user is entering data on a screen.  So I don't think they'll be a problem for you.

Jim

Read only

0 Likes
8,506

Hi David,

"I juste have last question"

it is not problem you post many questions as you wish, we are here

Is it possible to disable/enable constraints like foreign keys ?

1-  it is possible to remove the foreign keys  if have copied SAP-Table to your Z-Table

2- so if you want to enter data directly to SAP-System, it is better to use FM  ( FM does everything for you ) you need to just pass the values to FM, and the FM from SAP will insert into the SAP-table without any problem, ( but if you do it directly, it cause a problem and it is not advisable to change sap-tables directly, although, they have created FMs)

3. Your Z-Tables which is copied from SAP table, it is ok, there is no problem,

an Example SAP-Table:  SFLIGHT,

copy to your custom table ---> Z_any_name,

Disable them in your table Z_name

I hope I could good explain and help you as you whish.

Regards

Ebrahim

Read only

0 Likes
8,506

Hi,

look to this screen shot, may it help you how you can disable the checks in your copied table

Read only

0 Likes
8,506

Thank you all.

I think my technical approach will be a mix of thoses different possibilities.

Best regards,

David