SBX - Search With Button

SBX - Forum Post Title

How to delete a release product with posted the invoice?

Microsoft Dynamics AX Forum

ATMA-Jen asked a question on 14 Sep 2018 12:34 AM
My Badges

Question Status

Suggested Answer

Hello ,

I have a Released Product but no belong to a Product Master with no Configuration.

How to fixed it? or How to delete the Released Product or How to delete the transaction Invoice??

Thanks in advance.

Reply
Suggested Answer

Hi,

A posted invoice cannot be deleted. You can only reverse the transaction and create an offset transaction by recording another invoice with opposite signs.

I your product is not correctly setup I would probably just create and setup a new one. Seems to be the fastest and easiest way.

Best regards,

Ludwig

Reply
ATMA-Jen responded on 17 Sep 2018 3:11 AM
My Badges

Hello,

I try rename the ItemId (ex.: PenA) to PenA-X.

and try to create again the  ItemId: PenA,

but get a warning message: The number has already been assigned to a product.

Specify a new number.

I prefer the ItemId is PenA with product master had configuration.

Is that possible in AX 2012 R2?

Thanks in advance.

Reply

Hi ATMA,

You can try to see if you can also rename the (global) product. If this is not possible from the user interface, a developer would be able to write a script (X++ job) for it.

Reply
ATMA-Jen responded on 18 Sep 2018 1:18 AM
My Badges

Hello,

I rename the Item number (product number) using record info -> rename ,

it changed in release products.

but it still in the products.

When I want to delete it, AX show the warning message: Product has been released to a company and cannot be deleted.

When I want to create new product master, AX show the alarm message: The number has already been assigned to a product.

Specify a new number.

Reply

Hi ATMA-Jen,

I did check the Products. There is no support to rename the products from the user interface. So, a script would be required to rename the product as well.

Reply
ATMA-Jen responded on 20 Sep 2018 8:30 PM
My Badges

How about the script of rename ProductID or ItemID?

Could provider me the script?

Reply
ATMA-Jen responded on 20 Sep 2018 8:39 PM
My Badges

Hello,

Please help confirm below script is could rename the wrong itemid to correct itemid??

============================

static void renamePKInventTable()

{

   #File

   #define.prefixItem('Old')

   InventTable     inventTable;

   container       getCompanyList;

   int             i;

   DataAreaName    id;

   container getCompany()

   {

       dataArea  dataArea;

       // Virtual Companies should not be added.

       while select dataArea

           where dataArea.isVirtual != NoYes::Yes

       {

           getCompanyList += [dataArea.id];

       }

       return getCompanyList;

   }

   ;

   getCompanyList = getCompany();

   for(i = 1; i<= conlen(getCompanyList); i++)

   {

       id = conpeek(getCompanyList, i);

       changeCompany(id)

       {

           inventTable.clear();

           while select inventTable

             where inventTable.RMCItemType == RMCItemType::StopItem

                && inventTable.dataAreaId  == id

                && !(inventTable.ItemId like 'Old*')

           {

               ttsbegin;

               inventTable.ItemId = #prefixItem +

                                    #delimiterSpace +

                                    inventTable.ItemId;

               inventTable.renamePrimaryKey();

               if(inventTable)

               {

                   inventTable.selectForUpdate(boolean::true);

                   inventTable.ItemName  = inventTable.ItemId;

                   inventTable.NameAlias = inventTable.ItemName;

                   inventTable.update();

               }

               ttscommit;

           }

       }

   }

}

Reply
Suggested Answer

Hi,

A posted invoice cannot be deleted. You can only reverse the transaction and create an offset transaction by recording another invoice with opposite signs.

I your product is not correctly setup I would probably just create and setup a new one. Seems to be the fastest and easiest way.

Best regards,

Ludwig

Reply

SBX - Two Col Forum

SBX - Migrated JS