cancel
Showing results for 
Search instead for 
Did you mean: 

After duplication, updating new MA's unique name with old MA's unique name

Former Member
0 Kudos

Hi Experts,

After duplication of one existing MA, the new MA will get a unique name. But I would like to update the new MA's unique name with old MA's unique name in addition to that some text.

It looks like...

Old MA : MA-123

New MA : MA-456

After update the New MA is : MA-123-old

For this I have created one extension field to display old MA name, that is "ParentMA".

I am able to update same at DB level, but if I apply the same in scripting it is not updating.

The code snippet is :

DBhandle.executeQuery("  UPDATE TABLE FCI_CONTRACT SET UNIQUE_DOC_NAME =" doc.getExtensionField(ParentMA) " WHERE OBJECTID = " doc.getObjectReference().getObjectID() " ");

Can you please share your ideas.

Thanks

Krish

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Krish,

As pointed by Uday it is not recommended to write update query.

The duplicated MA is ideally not the child doc of the original MA also.

In scripting context, doc is referred to the current duplicated doc and otherDoc is the variable used to refer the original doc.

So, if you have created an extension field on your own, you might want to try this way:

doc.getExtensionField("Your created field name").set(otherDoc.getAppExtensionField("unique doc name"));

If the getAppExtensionField() function doesn's work for you, then you can retrieve the value through query and set it in the extension field.

Let me know if this works.

Regards,

Lopita

Former Member
0 Kudos

Hi Lopita,

After duplication the new MA will get one unique ID. I would like to update that duplicated MA's unique ID with the old MA's unique ID.

For that I have created an extension field and it is showing the old MA's unique ID, No problem with this.

The Unique ID of the new MA is out of the box field, it is not an extension and I did not find any method to update this field in IAPI.

Can you share your thoughts..

Thanks

Krish

Former Member
0 Kudos

Hi Krish,

You will not find any API or function nor SAP would come in future.

Your old MA ID will be available in Document Links section of projects header page , which signifies from which project it was created.Instead of IDs , you can look for renaming display names of projects if it helps you in any way.

Thanks

Uday

Former Member
0 Kudos

Hi Uday,

Thank You for your reply.

Already I am displaying the Old MA ID in the new extension field, in the same way as you told from document link section.After that I did not find any clue to update, then I approached the community.

So we can not update the MAID.

I have a question..

1. I am displaying the Old MA ID from Document link section in the new extension field through DB handle query. No problem with this.

But in the IAPI, I found two methods  getDocLinkId() and getDocLinkClassId(). I have used these methods in the script, but I am getting "un identified exception" in the logs. I tried these methods in different ways to print but no use. Could you please tell me how to use these methods to print.

And

2. We can get current MA's unique doc name using DB handle query in script.Is there any method in IAPI to get it, instead of using DB handle..

Thanks

Krish

Former Member
0 Kudos

Hi Krish ,

This is strongly not recommended by SAP to write update query . DB handle shall be used only for select queries. By directly updating DB , you may miss some alerts . noftications , etc and system might behave abruptly on long run .

I think you may need to re think on how to handle the clients requirement .

Thanks

Uday chand teli

Former Member
0 Kudos

Hi UdayChand,

Thanks for your reply.

Since the MAID is out of the box field, there no method available for update in IAPI. Hence I tried in this way.

Can you please share your idea, how to handle this.

Thanks

Krish