Display a production order Production orders are an essential part of planning and management. Since not every product is always in stock, a new customer order may initiate a production order. The following example makes this information available for the CIS mobile user by way of an add-on. Production order details unfolded |
|||
Step 1: Display placeholders for add-ons Go to the CIS mobile settings and activate the test output for add-ons. Then navigate to the position in CIS mobile where you want to have the additional information displayed, in this example the detailed view of a customer order. The orange placeholders will be replaced immediately, the yellow ones will show more information when the user clicks on a (+) button. A production order won't always exist for a product so we will only show a (+) button if one does exist. To do so we have to implement a method "BuildOrderPositionButtons2" in the add-on project "s10cisaddon.sln". Activate placeholders for add-ons Positions for potential add-ons |
|||
Step 2: Keys for the request Click on one of the colored placeholders to display a list of all keys and their values that are available in this position. In order to request data from the SAP system we need the order number (VBELN), the item number (POSNR) and of course the customer number (KUNNR). All keys displayed here are available in a dictionary object in VB.net. Keys required for a production order |
|||
Step 3: Implement in VB.net The name of the method in VB.net consist of "Build" + the name of the placeholder. The signature looks like this:
VB.net
' Position to Order Addon Public Function BuildOrderPositionButtons2(ByVal keys As _ Dictionary(Of String, String), _ ByRef buttons As String) As String The parameter "keys" refers to a dictionary object containing the required key-value pairs. A textstring "buttons" is used to define another (+) button to unfold more details about the production order e.g. the components and processes. |
|||
Step 3.1: Is a production order available? We read table "AUFK" to check whether or not there is a production order. To do so we first have to create a new class "aufk" in the S10 repository. Click on "create from SAP table" to let the repository generate the class for you. Please change the assembly name to "s10addon" and add "database='sap' " to the signature of the class. Then include the generated .vb file into the vb.net addonproject "s10addon.sln". Display tables and views with SE11 Generate classes with the s10 repository Configure the class for the add-on project Define object of class "aufk" in the repository We use the S10 repository to create the objects. This can also be done within the VB.net coding. We use folder (array) and count the number of elements after requesting the data from the SAP system to determine whether there is any production order.
VB.net
|
|||
Recommended: Index for table aufk
In order to speed up data-access you can create an index for table aufk in SE11 using only those fields which are needed for the add-on. Creating a new index for table AUFK |
|||
Result of step 3.1 The (+) button to display details of a production order is now only available for item 20 and not for item 10. In the following step we will request the data appropriate to the a selected production order. The new add-on is highlighted in yellow |
|||
Step 4: Production order details In step 3.1 we have made it possible for the user to unfold some additional information about a production order:
VB.net
'Define (+)Button buttons = "ProductionOrder|" & buttonText _ & "|" & processingMessage Now we have to implement the method "BuildProductionOrder" that requests the information about the production order from the SAP system and returns it as a HTML5 formatted text string. Please see the example code in the add-on project. The procedure is almost the same as in step 3.1 except that some of the data is read via the SAP GUI scripting interface:
VB.net
' read some values with sapgui-scripting Dim dic As New Dictionary(Of String, String) ReadWithSapGui_ProductionOrder(productionorder.aufnr, dic) We will have a look at this in the following step. |
|||
Step 4.1: SAP GUI Scripting interface We assume that the SAP GUI Scripting interface is already configured and ready to use. Please see the installation manual if this is not the case. Using the interface is quite simple: After logging on to the SAP system (lines 7 to 10) you can start transactions and read values from inputfields or even a whole table. Hint: In many cases the required data is placed on several tabs. They can be activated by using the corresponding transaction code. You can use the recorder of GuiXT for input scripts to determine those TCodes. NB: Requesting data with this interface is usually far slower than using RFC calls or BAPIs. Please see the documentation for more details and a comparison of the possible access points.
VB.net
|
|||
Step 5: Displaying a diagram This add-on not only displays details about the production order but also shows the relevant list of operations and components. We define two (+) buttons to make this information available to the user:
VB.net
NB: In line 7 two buttons are defined in one string, seperated by a comma. In addition to this information we want to offer the user a Gantt chart. To do so we define another button referring to a method that will create an image file with the diagram using the ChartDirector tool (or any other image creating tool).
VB.net
|
|||
Result of step 5 No buffers in this production order! |