cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to modify Procurement Wizard to display only a subset of Items on Sales Order?

leon_laikan
Participant

Hello,

My company uses 2 different coding systems for our inventories.

(Please see the attached screenshots).

(a) Some items (which are commonly sold) are stocked in the Main Store and are frequently replenished by the Main Store to ensure stock is always available. These items have individual Item Codes.

(b) But most items ordered by our clients are not stocked by us, and must be purchased on demand. As our clients can order practically anything one can imagine, it is impossible to keep individual Item Codes for each of them.

To solve the problem, we create a single Item Code for each Sales Order, and dump everything in it.

These item codes all begin with # to distinguish them from Store Items.

Only Items (b) need the Procurement Wizard. But unfortunately (for us), the Wizard lists all the Items (a) and (b) from Sales Order. And this may confuse our staff.

Is it possible to modify the Procurement Wizard so that it displays only the # Items?

I have thought out some ideas (not tested):

1.Our Staff have to be more careful.

Don’t touch the Procurement Wizard. Let it display both Store and Procurement Items. Our Staff simply have to be vigilant. Alas! Errors do happen, especially when people are under pressure.

2.Sort the Listing in Procurement Wizard.

All Items will still be displayed, but at least, all # Items will be grouped together, and so there is less risk of error.


3.Modify the Procurement Wizard so that it displays only the # Items

This would be ideal. But is it feasible? How? SDK?


4.Do not use Procurement Wizard

Instead, develop an add-on (SDK?) to create Purchase Orders from Sales Order.

It’s going to be hard work!

Do you have any ideas?

Any suggestions most welcome.

Thanks

Leon

Accepted Solutions (1)

Accepted Solutions (1)

ens_
Active Participant

Dear leon.laikan,

Great news for you today 🙂

I have developed what you need. Find the SLD zip file here.

What the addon does is the following;

if (Application.SBO_Application.Forms.ActiveForm.PaneLevel == 4)
                {
                    SAPbouiCOM.Matrix oMatrix;
                    
                    oMatrix = (SAPbouiCOM.Matrix)(Application.SBO_Application.Forms.ActiveForm.Items.Item("540000019").Specific);
                    string mine = oMatrix.SelectionMode.ToString();
                    int rows = oMatrix.RowCount;
           
                    for (int i = 1; i <= rows; i++)
                    {
                        string check = ((SAPbouiCOM.EditText)(oMatrix.GetCellSpecific("540000005", i))).Value.ToString();

                        if(check.Substring(0,1) != "#")
                        {
                            oMatrix.Columns.Item("540000000").Cells.Item(i).Click(SAPbouiCOM.BoCellClickType.ct_Linked);
                         
                        }
                    }
                }

Sincerely,

Varnavas Eleftheriou

leon_laikan
Participant
0 Kudos

Oh! Thank you very much, Varnavas!

I appreciate very much your generosity.

I will work on your idea during the coming days and will let you know how it goes. I must first convert your code to VB.NET as I don't know much about C#.

For my part, I COULD develop an add-on to create a Purchase Order from Sales Order, but I don't want to lose the facilities provided by the Procurement WIzard.

So, here is my latest idea (which I have not yet tested):

I can use one of the unused fields in Sales Order to indicate the way the goods are to be obtained: either "PROCUREMENT" or "IT" (the latter means "INVENTORY TRANSFER")

So, when we go to the Procurement Confirmation Wizard, we can make this field visible using Form Settings.

So, although ALL Item Codes will still be listed, the Wizard will look something like this ( sorry, no images, as I am typing on my home tablet):

PROCUREMENT Oranges

IT Tomatoes

PROCUREMENT Liquid Milk

IT Trolley

Etc ....

It will be very difficult for our Sales Staff to be confused, even if the list is very long (as it is in fact!).

So, this trick could work.

Note that my idea is NOT to input Sales Order details directly in the Sales Order Screen, but to enter them in Excel first, and copy them to SAP. It's easy for excel to insert "PROCUREMENT" or "IT" automatically, and do other validation checks.

But my great dream would be to manipulate the Procurement Wizard directly. I was not sure this COULD be done using SDK.

But you are giving me great hope!

Best Regards,

Leon

from Mauritius.

ens_
Active Participant
0 Kudos

Dear leon.laikan,

You do not lose the functionality of the Procurement Wizard. All my addon does, it unchecks all items that are not starting with #. Kindly, download the file i linked on the answer, import it in SLD, and run the addon on a demo database to see how it behaves. let me know if its what you wanted.

Sincerely,

Varnavas Eleftheriou

leon_laikan
Participant

Hi, Varnavas

My colleague and I started working on your addon yesterday, but we are having some problems getting it to work.

First, we tried to Register and Install your .ard file in SAP, but it could not be installed. SAP displays ERROR.

Second, we converted your C# code to VB.NET, and built the add-on in Visual Studio. No Build errors.

But when we run the addon (using Debug), it shows there are errors in our VB .NET code.

Here is our VB.NET code (partly obtained by using C# converter, partly modified by us manually)

Sub X
If SBO_Application.Forms.ActiveForm.PaneLevel = 4 Then
Dim oMatrix As SAPbouiCOM.Matrix
oMatrix = CType((SBO_Application.Forms.ActiveForm.Items.Item("540000019").Specific), SAPbouiCOM.Matrix)
Dim mine As String = oMatrix.SelectionMode.ToString()
Dim rows As Integer = oMatrix.RowCount
For i As Integer = 1 To rows
Dim check As String = (CType((oMatrix.GetCellSpecific("540000005", i)), SAPbouiCOM.EditText)).Value.ToString() If check.Substring(0, 1) <> "#" Then
oMatrix.Columns.Item("540000000").Cells.Item(i).Click(SAPbouiCOM.BoCellClickType.ct_Linked)
End If Next
End If
End Sub

I hope you can help us. We have not programmed SDK for quite a while, and we have to refresh our notes. Unfortunately, we could not use your C# code directly, as we know only VB .NET and we are not professional programmers.

Best Regards,

Leon

ens_
Active Participant
0 Kudos

Dear leon.laikan,

The zip i provided, should be imported from the SLD and not from SAP Business One.

https://<SERVERNAME>:40000/ExtensionManager

or

https://<SERVERNAME>:30000/ExtensionManager

As for the code, it is correct, you just have to include it within an Item event. here is the IF section of the ItemEvent.

 if (((pVal.FormType == 540010007 && pVal.ItemUID == "_wiz_next_" && pVal.EventType != SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) & (pVal.Before_Action == true)))
            {
                if (Application.SBO_Application.Forms.ActiveForm.PaneLevel == 4)
                {
                    SAPbouiCOM.Matrix oMatrix;
                    
                    oMatrix = (SAPbouiCOM.Matrix)(Application.SBO_Application.Forms.ActiveForm.Items.Item("540000019").Specific);
                    string mine = oMatrix.SelectionMode.ToString();
                    int rows = oMatrix.RowCount;
           
                    for (int i = 1; i <= rows; i++)
                    {
                        string check = ((SAPbouiCOM.EditText)(oMatrix.GetCellSpecific("540000005", i))).Value.ToString();




                        if(check.Substring(0,1) != "#")
                        {


                            oMatrix.Columns.Item("540000000").Cells.Item(i).Click(SAPbouiCOM.BoCellClickType.ct_Linked);
                           // oMatrix.SelectRow(i, true, false);
                         //   oMatrix.SelectRow(i, false, true);
                        }


                    }


                }
            }<br>

Sincerely,

Varnavas Eleftheriou

leon_laikan
Participant
0 Kudos

Varnavas,

I just received your latest comment.

You said:

>>> The zip i provided, should be imported from the SLD and not from SAP Business One

I don't know what is SLD. Although we have developed a few SAP B1 SDK add-ons, I never heard about SLD.

I searched the SAP Forum, and learn that SDL means System Landscape Directory.

We have never heard of this term also.

Are we on the same wavelength?

Maybe I should have mentioned that we use SAP Business One version 9.2, and we sometimes develop SDK addons to add functionality to SAP.

The only way we know how to develop SDK addons is as follows:

  • (1) Develop the addon in Visual Studio (VB.NET)
  • (2) Use Build and Debug to test the add-on.
  • (3) When add-on is complete and error-free, generate the.ard file
  • (4) Register and Install the add-on in SAP Business One using the Add-on Menu.

Please enlighten me.

Is it possible to retype your code (after translating to VB.NET) in Visual Studio, and develop the addon using the 4 step-process I mentioned above?

Leon


ens_
Active Participant
0 Kudos

Dear leon.laikan,

The SLD is the System Landscape Directory, Correct. You have to login using the B1SiteUser and the password defined during installation. Navigate in your Browser at

https://<SERVERNAME>:40000/ExtensionManager/

or 30000 port instead of 40000.

From there, click on Import button and you select the zip file i attached above. After that you click next next next and click on Configure Company Registration it is a link on the last step of the wizard. There, Select the database you want to register the addon to and click next. On the next screen, set the addon to run Automatic on the top of the wizard window. You have successfully registered an addon in the database.

If you want to replicate the code, you can do it. Just convert it to VB. i haven't worked with VB so i can't really help you on that. All you need, is an Item Event and within the Item Event, paste the code i sent you after you convert it to VB. But really, the addon is ready as i provided it to you. Just import it in the SLD ExtensionManager.

If you need more assistance, let us know.

Sincerely,

Varnavas Eleftheriou

leon_laikan
Participant

Hi Varnavas

Thanks for your latest comment.

I prefer not to touch SLD for the moment. It is unfamiliar ground.

I prefer working on your Visual Studio Code.

I tried your latest code:

VS gives this Error:

pVal is not declared.

It may be inaccessible due to its protection level


When I run (debug) the program, it stops at the 1st line:

if(((pVal.FormType ==540010007&& pVal.ItemUID =="_wiz_next_" && pVal.EventType != SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) & (pVal.Before_Action == true)))

Seems a handler is missing.

Leon


ens_
Active Participant
0 Kudos

Dear leon.laikan ,

The SLD is nothing dangerous to meddle with. You just import the addon packages from there so each client reads from there and connects the addons. Regardless, my zip file is working and it has nothing more than what i sent you already and what i include below.

Yes, i did mention that you need to include an item event. see below the declaration and how the method is (in C#)

Application.SBO_Application.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);



   private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {


            BubbleEvent = true;


//REST OF THE CODE I SENT YOU
        }


Make sure you mark the answer as correct so others can find it if you manage to do what you need.

Sincerely,

Varnavas Eleftheriou

leon_laikan
Participant
0 Kudos

Hi, Varnavas

Thanks again for your comment.

Unfortunately, it still does not work. I've spent a lot of time trying to debug.

And I don't feel it's nice of me to ask you to debug. You have already done a lot for me.

I do not doubt the code will work as it works on your side.

As I have not programmed SDK for quite some time, I need to review my previous codes, and take up the challenge of debugging this code later.

I'll contact you again later to tell how it goes.

Best Regards,

Leon

ens_
Active Participant
0 Kudos

Dear leon.laikan,

Let me know where i can contact you and help you on it. Skype?

Answers (2)

Answers (2)

ens_
Active Participant

Dear leon.laikan,

No, You cannot have additional filters on the procurement wizard. I would suggest to head over to the ideas section of SAP and suggest it as an improvement request. It will take quite a while to be implemented if it is finally selected to be implemented. As of right now, your best option is to create your own addon to tackle this. You will have to actively look for Sale's orders that are marked as 'Y' on PoPrss field from ORDR or PoDropPrss depending on which one applies to your case. From there, you can filter out the orders that do not include any of the '#' itemcodes OR filter them by item group if they are grouped separately and then generate your target Document. It will not be hard to develop it. It seems pretty easy and straightforward.

As a side note, I would like to commend on your question details. Quite hard to find properly documented cases with questions on forums 🙂

Sincerely,

Varnavas Eleftheriou

leon_laikan
Participant
0 Kudos

Hi, Varnavas

Thank you for your reply.

Your idea of writing an add-on to create a Purchase Order is good and I have thought about it.

But I've tried SDK, and I know how difficult it is to develop SDK add-ons. So...

... I will do it only if nothing else works.

I've seen one or two threads (not many!) on the forum where people have tried to manipulate the Procurement Wizard using SDK. I have yet to study these in detail, to see what can or can't be done with SDK.

Best Regards,

Leon