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

Delete Multiple Sub Assets ASSET_MASTERRECORD_MAINTENANCE

Former Member
0 Likes
2,946

Hi All,

I have a requirement wherein I need to delete asset and sub assets which are selected. I have used "ASSET_MASTERRECORD_MAINTENANCE" and this works fine if I have to delete one single asset or sub asset but in case I select multiple assets following dump is generated that too in update task.

Please help in figuring out a way to achieve this functionality.

Note: I have executed BAPI in case of multiple assets in a Loop and the dump is generated on Commit Work.

Thanks in advance.

Regards,

Chandni Sharma.

* ----------------- Dump Generated ----------------*

Runtime Errors         ASSERTION_FAILED

Date and Time          14.01.2014 16:19:34

Short Text

     The ASSERT condition was violated.

What happened?

     In the running application program, the ASSERT statement recognized a

     situation that should not have occurred.

     The runtime error was triggered for one of these reasons:

     - For the checkpoint group specified with the ASSERT statement, the

       activation mode is set to "abort".

     - Via a system variant, the activation mode is globally set to "abort"

       for checkpoint groups in this system.

     - The activation mode is set to "abort" on program level.

     - The ASSERT statement is not assigned to any checkpoint group.

Error analysis

    The following checkpoint group was used: "No checkpoint group specified"

    If in the ASSERT statement the addition FIELDS was used, you can find

    the content of the first 8 specified fields in the following overview:

    " (not used) "

    " (not used) "

    " (not used) "

    " (not used) "

    " (not used) "

    " (not used) "

    " (not used) "

    " (not used) "

How to correct the error

    Probably the only way to eliminate the error is to correct the program.

    -

    If the error occurs in a non-modified SAP program, you may be able to

    find an interim solution in an SAP Note.

    If you have access to SAP Notes, carry out a search with the following

    keywords:

    "ASSERTION_FAILED" " "

    "CL_FAA_STORABLE===============CP" or "CL_FAA_STORABLE===============CM004"

    "ALL_STORE_WRITE"

1 ACCEPTED SOLUTION
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
2,306

Hi Chandni

Are you using BAPI_TRANSACTION_COMMIT in a loop or outside a loop..If outside try it after each run?Did you try using BAPI_FIXEDASSET_CHANGE for the same?

Please share your sample code as attachment

Nabheet

9 REPLIES 9
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
2,307

Hi Chandni

Are you using BAPI_TRANSACTION_COMMIT in a loop or outside a loop..If outside try it after each run?Did you try using BAPI_FIXEDASSET_CHANGE for the same?

Please share your sample code as attachment

Nabheet

Read only

0 Likes
2,306

Hello Nabheet,

I have used multiple BAPI's to achieve multiple functionalities. This complete process is a new application we have designed for our customer. After everything has been done and checked, then only once, BAPI_TRANSACTION_COMMIT has been used. I did try using BAPI_FIXEDASSET_CHANGE but was not able to successfully delete even one asset alone.

Regards,

Chandni Sharma

Read only

0 Likes
2,306

Chandni

Can you do one thing after each iteration do a commit and see if it works. What i feel is the data remains in buffer and resulting in issues

Nabheet

Read only

0 Likes
2,306

Nabheet, I cannot do that since:

1. It is not recommended as best practice and will be rejected by my ABAP Lead as a solution.

2. And Since if at any step we encounter any error we rollback everything, so that the user can rectify all errors and execute the application again. So if I commit in loop, then I would not be able to rollback later if any error occurs.

This is sure, that this problem is due to non-initialisation of buffer, I checked by debugging too. But somehow I need to achieve this functionality.

Regards,

Chandni Sharma.

Read only

0 Likes
2,306

Hi Chandni

I do understand your point of view which is a valid one. Even i try to avoid this most of the times. But sometimes situation demands it.

Lets say you have 10 assets and sub assets you can have a commit if logically the group of thing fit together you can use a commit. Are those set of 10 assets belongs together?

In addition to this if you do a where used list of this FM SAP standard report RA_CREATE_ASSET_FM uses it. Inside it has a suboutine

FORM delete_asset_subno_im for deletion which is called in a loop. If you look closely SAP is also doing a commit after every deletion.

Nabheet

Read only

0 Likes
2,306

You can show the same type of processing how SAP standard does to your reviewer also

Nabheet

Read only

0 Likes
2,306

Hi Nabheet,

True, even SAP does , but still this will create further problems, as, if in case an error occurs at later stage, I won't be able to rollback already committed deletion of assets. How to manage that then?

Regards,

Chandni Sharma.

Read only

0 Likes
2,306

Hi Chandni

Are those all linked somehow..? Can you do one thing when you last call is running please check what are the contents of global data of this function module might be you have some duplicate entries. For the time being try by deleting two assets togethers and check what is global data hold in debugging XANLA tables etc. Are you only deleting the records not inserting it also..? It may happen the same record which you want to insert is also getting deleted things like these.

OtherwiseYou can show a processing log which all objects got deleted sucessfully and which failed.

Nabheet

Read only

0 Likes
2,306

Hello Nabheet,

Thanks for all the help. I guess this is the only solution left. I got the requirement modified because of a loophole I found in the requirement.

So this question still needs another solution, but my problem is solved.

Regards,

Chandni Sharma.