Application Development 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: 

FUNCTION 'RS_DD_COPY_OBJ'

Former Member
0 Kudos

Hi,

I had mentioned this problem in a thread. But, then I thought that creating new thread is more logical.

Now, I am calling FUNCTION 'RS_DD_COPY_OBJ' as:

CALL FUNCTION 'RS_DD_COPY_OBJ'  
EXPORTING    
SOURCE_NAME              = SRC_TABL  
TARGET_NAME              = TGT_TABL  
OBJTYPE                  = OBJECT_TYPE  
EXCEPTIONS    
NOT_EXECUTED             = 1    
PERMISSION_FAILURE       = 2    
OTHERS                   = 3.

As you see above there are two parameters that this function gets: SRC_TABL and TGT_TABL. These are table names. Before this function gets these parameters I am getting these table names from user. Although I send these parameters, FUNCTION 'RS_DD_COPY_OBJ' get table names itself from user. So, there may be difference between start of the program that I wanted and while Function wanted.

In this position, I need the table names that function gets.

How can I solve this problem?

1 ACCEPTED SOLUTION

ssimsekler
Active Contributor
0 Kudos

Hi Huseyin

It seems the only way is to copy the function to your namespace (i.e. ZRS_DD_COPY_OBJ) and make it not popping the screen for new names by deleting relevant code part. In fact there are more technical FMs to copy wrt. object types if you inspect the code. But they do not handle CTS (Change and Transport System) and locking. So, they are not feasible.

Kind Regards

*--Serdar

ssimsekler@yahoo.com

11 REPLIES 11

ssimsekler
Active Contributor
0 Kudos

Hi Huseyin

It seems the only way is to copy the function to your namespace (i.e. ZRS_DD_COPY_OBJ) and make it not popping the screen for new names by deleting relevant code part. In fact there are more technical FMs to copy wrt. object types if you inspect the code. But they do not handle CTS (Change and Transport System) and locking. So, they are not feasible.

Kind Regards

*--Serdar

ssimsekler@yahoo.com

0 Kudos

Hi,

To copy 'RS_DD_COPY_OBJ' is too difficult. I could not managed .

But there is one thing about ABAP logical error that I think. As I above mentioned, If function changes the SOURCE and TARGET, why these parameters defined as CHANGING?

0 Kudos

Hi Huseyin

"RS_DD_COPY_OBJ" is an advanced FM which is not for general use. So, it is the developers decision how to handle it. It should be easier to copy and modify it. Anyways, a second alternative: <i>You can write a batch input program for the transaction SE11</i>. For more information on batch-input programming you can refer to standard SAP course BC420.

Kind Regards

*--Serdar

ssimsekler@yahoo.com

0 Kudos

Hello Huseyin,

The solution to your problem is quite simple. You don't need a BDC. And you don't have to bother with copying the FM either.

You only need the name of the <i>target table,</i> so that you can use that for calling the FM RS_DD_ACTIVATE. Is that correct?

Here's the answer:

When the table gets copied, the system sets the parameter-ID for the table with the new table's name. So after calling the FM RS_DD_COPY_OBJ, just use this statement:

GET PARAMETER ID 'DTB' field TGT_TABL.

Then use this TGT_TABL in your next FM call , i.e, for the FM RS_DD_ACTIVATE.

Regards,

Anand Mandalika.

0 Kudos

Hi Anand

The problem is that, it is required that what the name is passed to the FM for the target object, it must not be changed. The mentioned FM pop-ups a new screen which accepts user input. That is; what you pass to the function module serves just as default value for that pop-up. Besides, I agree with you about activation process.

By the way, I feel your breath at my neck. Whooouww...! I will not deliver the flag till my last blood drops ;). Just kidding, you really deserve the first place...:) Who shares more, gets the flag.

Kind Regards...

*--Serdar

ssimsekler@yahoo.com

0 Kudos

Hi Anand,

Thanks, your idea is again useful I only wrote:

GET PARAMETER ID 'DTB' field TGT_TABL.

I did not wrote :

GET PARAMETER ID 'DTB' field SRC_TABL.

But, altough source adress is changed I can see the last value of source. Why this is so?

0 Kudos

Hello Huseyin,

When the user changes both the source table and the target table names in the POP-UP, the system tries to check whether the new source table is existing in the database.

If it is existing , then the system will copy it to the

new target table.

Otherwise,

The system throws an error saying that the source table does not exist.

In any case, the system just needs to create the new table based on the source table. So, the actual operation is happenning only on the new table, so the system sets the parameter-ID to the new table. The source table has just been used as a template and there's no parameter-id associated with it. so you are not able to get the changed value of the source table.

Regards,

Anand Mandalika.

P.S. Please don't forget the points..:-)

Lakshmant1
Active Contributor
0 Kudos

Hi Huseyin,

Instead of FM RS_DD_COPY_OBJ try using RS_DD_COPY FM.

Thanks

Lakshman

Former Member
0 Kudos

Hi Anand,

I apolagize my previous message. Ignore that. If source table changes system don't care it. system cares only the first value of source table. But if target is changed system cares the last value of target.

Is there any way that system cares the last value of source adress?

Thanks.

0 Kudos

Hello Huseyin,

I don't think you have observed it carefully. The system does take into consideration only those values of the source table which are last specified on the pop-up.

I have just checked this out. So please re-verify it once again.

Regards,

Anand Mandalika.

Hint: As a sample, give different source tables in both the screen and the pop-up.

Former Member
0 Kudos

Yes Anand,

You're right.

Problem is solved.