Kanban Development Example - automotive EDI integration, Mascidon
Transcript of Kanban Development Example - automotive EDI integration, Mascidon
Kanban Processing Page 1
Using ‘Right Click’
Add-on for
Development with
SAP B1
Kanban Management
System Example
Mascidon, LLC
October 2012
Dr. Don Maes
248-568-0418
Kanban Processing Page 2
Table of Contents Using ‘Right Click’ Add-on for Development with SAP B1 ........................................................................... 1
Kanban Management System Example ........................................................................................................ 1
Using Right-Click for Development ............................................................................................................... 4
Design of the Kanban System ................................................................................................................... 4
SAP Business One File Structures .............................................................................................................. 4
SAP Business One Kanban Screens ........................................................................................................... 5
Figure 1.1 Kanban Maintenance ............................................................................................................... 5
Figure 1.2 Kanban Transaction History ..................................................................................................... 6
Figure 1.3 Using a Formatted Search to Display an Item Description ...................................................... 7
Figure 1.4 Retrieving the Employee Name via Formatted Search ............................................................ 8
Using Right Click to Enhance the Use of the Kanban System ....................................................................... 8
Form ID of the Kanban Screen .................................................................................................................. 8
Figure 1.5 Finding the Form ID .................................................................................................................. 8
Query Identification .................................................................................................................................. 9
Set up the Right Click Screen .................................................................................................................... 9
Figure 1.6 Kanban Maintenance Form Setup for Right Click .................................................................... 9
Figure 1.7 Associating the query with the Form ..................................................................................... 10
Using the Right Click Function ................................................................................................................ 10
Figure 1.8 Right Click Usage .................................................................................................................... 10
Figure 1.9 Kanban Purge Addition to the Right Click Menu Definition ................................................... 11
Figure 1.10 Kanban Purge Access via Right Click .................................................................................... 11
Figure 1.11 Purged Transaction Message ............................................................................................... 11
Figure 1.12 Adding the Kanban Import Functionality ............................................................................. 12
Figure 1.13 Importing Kanbans from a CSV File ...................................................................................... 12
Figure 1.14 Kanban Labels Report (Crystal) ............................................................................................ 13
Figure 1.15 Getting the Menuid of a Crystal Report ............................................................................... 14
Figure 1.16 Assigning a Menuid to a Crystal Report ............................................................................... 15
Figure 1.17 Accessing the Kanban Labels Crystal Report ....................................................................... 15
Figure 1.18 Kanban Label ........................................................................................................................ 16
Figure 1.19 Accessing the PO from the Kanban Screen .......................................................................... 16
Appendix A – Queries for Kanban Functionality ......................................................................................... 17
Kanban Review Query ............................................................................................................................. 17
Kanban Purge Query ............................................................................................................................... 17
Kanban Import CSV File ........................................................................................................................... 18
Kanban Processing Page 3
Kanban Processing Page 4
Using Right-Click for Development This document shows how Mascidon developed a simple Kanban add-on using standard SAP Business
One tools AND our ‘Right Click’ add-on. This document illustrates the ease with which new functionality
can be developed without using SDK work and still staying within the framework laid out by SAP for
maintaining data integrity. The Kanban system has actually been implemented using hand held units,
but that is inconsequential to the process – other than showing how development can be further
extended.
This document will lead you through the design and implementation of the Kanban system. The first
step in any design is to determine the characteristics of the Kanban system. First we need to visualize
what we are trying to accomplish. The plant has Kanban cards in two areas – a spare parts warehouse
and on the production floor. In the spare parts warehouse, a Kanban card is pulled for an item when the
last container of parts has been opened. The user pulling the stock grabs the Kanban card and turns it in
to their supervisor (if hand held units were utilized, the user would simply scan the Kanban card). In the
production warehouse, a similar process is used when sub-assemblies are depleted to the point where a
Kanban card is pulled.
The objective of pulling the Kanban is to alert either purchasing or production that stock is low and
action needs to be taken.
Design of the Kanban System At this stage, the design of the Kanban system began with the objective of using the Kanban cards to
alert personnel to perform purchasing or production functions. A person would enter the Kanban card
ids every day. The system would automatically send alerts to the purchasing and production personnel.
My design included the following:
• A master file to maintain all of the active Kanbans in the system
• A transaction file to keep track of Kanban activities
• A Kanban review query
• A purge program to delete old Kanban activities
• Import of Kanbans from an Excel table – for startup
• A Crystal Report to print Kanban cards
• An alert to send periodic shortage reports to purchasing and production based on Kanbans (not
included in this document)
SAP Business One File Structures The Kanban file is a user defined file and must be added to SAP. The file created, DCMKANBAN, was set
as an object type = ‘Master’. The fields in this file are:
• Code = key to the file – this is the Kanban number
• U_ItemCode – the inventory item to be reviewed when this Kanban is pulled
• U_ItemName – the description of the item is saved
• U_Bin – the bin where this item is located on the floor (information only – does not imply that
bin control is required)
• U_Quantity – this is the Kanban quantity. For instance, if this Kanban is pulled you should
purchase or make this quantity.
Kanban Processing Page 5
• U_WhsCode – this is the warehouse where the Kanban is located
• U_Status – the Kanban can be active or inactive
• U_PO – if automating the PO creation, this flag could be set (only available if the SDK add-on to
create PO drafts is provided).
• U_PDO – if automating the PDO creation, this flag could be set (only available if the SDK add-on
to create planned PDOs is provided).
Whenever a user pulls a Kanban and records this via a program (soon to be shown), a transaction will be
created. This Kanban activity is associated with a specific Kanban, so the file DCMKANBANTRX has been
defined as a user table ‘Master Rows’ type. The fields in this table (linked via the ‘Code’ field = Kanban)
are:
• U_Badge - employee badge id – this is a user defined field in the employee master. We could
have used the employee id provided by SAP, but that is not usually the existing badge number.
• U_Employee – the name of the employee is save in the transaction
• U_Date – this is the date and time the transaction was entered.
• U_Type – there are several Kanban transactions and this defines which type
• U_Status – a Kanban transaction that has not been acted upon has a different status than one
that has been processed.
• U_Comment – a transaction comment can be entered
SAP Business One Kanban Screens With these two user defined tables defined, we need to define the SAP screen so we can view the data
and maintain the Kanbans. This is done in SAP using the Objects Registration Wizard. (Tools �
Customization Tools � Objects Registration Wizard. If we assume that you know how to utilize this
wizard, the object that is created would be similar to the screen shown in Figure 1.1. If you are not
familiar with this wizard, use SAP’s on-line help and the training DVD to become familiar. It is really a
simple function. The first field ‘Kanban’ is the ‘Code’ field renamed and bolded (use Ctrl click on the
‘Code’ label to change the name of the label – standard SAP functionality).
Figure 1.1 Kanban Maintenance
To see the detail transactions associated with a Kanban, the user can click on a Kanban code or name
field and then click the ‘Kanban transactions’ button. The transaction screen is shown in Figure 1.2.
Kanban Processing Page 6
Figure 1.2 Kanban Transaction History
Okay – so we have the data file maintenance in place. We can add some amenities to the screens. For
instance, if a user is defining a new Kanban and needs to enter the item, it would be beneficial to have
the item code correct. If we use a query with a formatted search, this lookup can be accomplished. First
we define an item lookup query as:
/*
Lookup item (shop floor)
Created 09/17/12 dcm
*/
SELECT itemcode, itemname from oitm
where invntitem = 'Y'
order by 1 for browse
This query returns a list of all items in the inventory file that are flagged as stocked items.
To attach the query to the Kanban item field, click on the item field and then click ‘Alt – Right Shift – F2’
keys simultaneously. Then associate the query ‘Lookup Item’ to the formatted search. Now we have a
lookup of the item code. The next step would be to have the item description displayed on the Kanban
screen. To do this, we define a second query:
/*
Lookup item description (shop floor)
Created 09/17/12 dcm
*/
SELECT itemname from oitm
where itemcode = $[@DCMKANBAN.U_ItemCode]
If you don’t know where to get the field [@DCMKANBAN.U_ItemCode], the process is simple. From the
SAP ‘View’ menu option at the top of the screen, click on the ‘System Information’. Then on the Kanban
screen, hover the mouse over the ‘item’ field. In the bottom left corner of the SAP screen you will see
the name of the field = [@DCMKANBAN.U_ItemCode].
Kanban Processing Page 7
With this defined, we need a formatted search to be triggered each time the item code is changed so
that the item description is automatically displayed. Figure 1.3 shows how to attach the formatted
search query to the field ‘description’ so that it displays properly each time an item is changed.
Figure 1.3 Using a Formatted Search to Display an Item Description
In the Kanban transactions screen we should verify that the employee badge is correct and display the
employee’s name. This is accomplished using queries and the associated formatted searches. The
query to look up the employee badge is:
/*
Lookup employee (shop floor)
Created 09/17/12 dcm
*/
SELECT U_DCMEmployee, lastname + ', ' + firstname, empid
from OHEM
where ISNULL(u_dcmemployee,'') <> '' and ISNULL(manager,0) <> 0
for browse
I am going to use the employee’s manager to determine to whom the alert should be sent, so I do
something clever and require that the employee has a manager – as set up in the employee master file.
The field ‘U_DCMEmployee’ is a user defined field = the employee’s badge number.
The query to lookup the employee name is:
/*
Lookup employee name (shop floor)
Created 09/17/12 dcm
*/
SELECT lastname + ', ' + firstname, empid
from OHEM
where u_dcmemployee = $[@DCMKANBANTRX.U_Badge]
for browse
This query is attached to the employee name in the transaction screen as shown in Figure 1.4.
Kanban Processing Page 8
Figure 1.4 Retrieving the Employee Name via Formatted Search
Using Right Click to Enhance the Use of the Kanban System
At this point we have the basics of the Kanban system. Now we want to have a query that shows all of
the transactions for a Kanban, and we want to access this from the Kanban maintenance screen. The
first step is to define the query. Since this is a longer, more complex query it is attached in Appendix A.
The name of the query is ‘Kanban Review’. Now before we can use the ‘Right Click’ function we need to
know this information:
• The form id of the Kanban screen.
• The internal SAP number for the query, and it’s category.
Form ID of the Kanban Screen To get the form id of the Kanban screen, make certain the ‘System Information’ button is flagged as
checked. Then, with the Kanban screen open, click on any field and note the Form id in the bottom left
hand corner of the screen as shown in Figure 1.5. The form id is shown as ‘Kanbans’.
Figure 1.5 Finding the Form ID
Kanban Processing Page 9
Query Identification Every query in SAP has an two part ‘Key’ – the internal SAP query number and the category with which
the query is associated. To find this information, use this query to get the query information for the
query named ‘Kanban Review’. The queries are listed in alphabetical order – find the ‘Kanban Review’ in
the list. In my system it is 601 for the internal SAP key, and 23 for the category.
select IntrnalKey as 'SAP Key', QCategory as 'Category', QName as 'Query Name'
from OUQR
order by 3
Set up the Right Click Screen At this point, we are ready to set up the Right Click screen to access the Kanban Review query from the
Kanban screen. Figure 1.6 shows the ‘Form’ setup for the Right Click function.
Figure 1.6 Kanban Maintenance Form Setup for Right Click
To set up the right click form ‘Kanbans’, enter the code field as a unique number and enter the Form ID
in the correct column. In this instance, Kanbans has been identified as the form id. You can see other
forms, including the Right Click form itself have been defined and set up. The comment is not required
but is a good practice to use.
The next step is to highlight the Form ID ‘Kanbans’ and then click the ‘Right click menu definition’
button. This brings up the Figure 1.7 screen. I have entered the data we obtained about the query – the
601 and 23 codes. The field ‘Description’ is the description of the query to be accessed via the Right
Click function. It can be different than the name of the query.
Kanban Processing Page 10
Figure 1.7 Associating the query with the Form
Using the Right Click Function Okay, the Right Click Function has been defined – now just go to the Kanban maintenance screen and
Right Click anywhere. Figure 1.8 shows the result.
Figure 1.8 Right Click Usage
In the example, there is one right click query that is accessible – ‘Kanban review’. The other functions –
Copy, Remove, and Kanban transactions are all standard SAP functions behind the Right Click. The
Kanban transactions option is the ‘button’ shown on the kanban screen.
Note: at this point, we have shown how to setup and use the right click function. The remainder of the
document delves into more details regarding the Kanban system. It also shows how to use Right Click to
access the PO screen directly from the Kanban screen and how to access Crystal Reports from the
Kanban screen. You have the basics at this point. Keep reading if you are hungry for knowledge, have
nothing else to do, or want to use Right Click in more depth.
Adding a Purge Function
The next step is to add a purge function to the Kanban processing. This again will be a query. The query
to be used is shown in Appendix A. This query was determined to have an internal id of 602 and a query
category of 23. This information was added to the Right Click menu for the Kanban form, as shown in
Figure 1.9.
Kanban Processing Page 11
Figure 1.9 Kanban Purge Addition to the Right Click Menu Definition
If we now access the Kanban system and utilize the Right Click function, Figure 1.10 shows the results.
This query will ask for a date and then purge transactions from the file DCMKANBANTRX. Figure 1.11
shows the message resulting from the purge.
Figure 1.10 Kanban Purge Access via Right Click
Figure 1.11 Purged Transaction Message
Kanban Processing Page 12
We’re starting to look like a real application – we can maintain Kanbans, post transactions to the Kanban
transaction file by manually entering transactions, and we can purge transactions. The initial creation of
hundreds of Kanbans in the Kanban table would be a cumbersome process however. Let’s add a
function to import the data from a CSV (Excel) file. The first step is to create a query that allows us to
import data to a user defined table – specifically the DCMKANBAN file. This query is shown in Appendix
A. Its query id is 602, and the category is 23. Figure 1.12 shows how adding this to the Right Click menu
provides another menu option – you should be getting the idea of how this works at this point.
Figure 1.12 Adding the Kanban Import Functionality
The query itself asks the question shown in Figure 1.13.
Figure 1.13 Importing Kanbans from a CSV File
If you are really looking at the queries in depth, you will see a couple of important things in the import
query. First of all, the directory where the import file is stored is a variable stored in the user table
DCMSetup. This table is used throughout all Mascidon add-ons for setup functions. The second item
you should note is that the prompt ‘File Name’ comes from the table DMAKRCPROMPTS. The file
structure for this table is: Code
Name
U_A1_1 Alpha 1
U_A1_2 Alpha 1
U_A1_3 Alpha 1
U_A1_4 Alpha 1
U_A1_5 Alpha 1
U_A1_6 Alpha 1
U_A1_7 Alpha 1
U_A1_8 Alpha 1
U_A1_9 Alpha 1
Kanban Processing Page 13
U_A1_10 Alpha 1
U_A50_1 Alpha 50
U_A50_2 Alpha 50
U_A50_3 Alpha 50
U_A50_4 Alpha 50
U_Int_1 Integer
U_Int_2 Integer
U_Int_3 Integer
U_Int_4 Integer
U_Date_1 Date
U_Date_2 Date
U_Date_3 Date
U_Date_4 Date
The field names given to these variables are used to obtain the prompt field names. For instance, in the
query the field U_A50_1 is accessed to get the variable @file name. When looking at the actual prompt,
we see the word ‘File Name’ – the name for the field U_A50_1. This technique can be used to obtain
field names used for prompts AND if the option to define values for the field is used, the drop down list
of possible values (and a default) can be defined. This is a powerful technique for getting meaningful
query prompts.
Okay – so now we have a review screen, a purge screen and an import screen. We really should have a
Crystal report that prints the Kanban labels to complete the application. I have created a Crystal Report
‘Kanban Labels’. The Report and Layout manager function in SAP can be used to import this Crystal
report. To do this, click on Administration � Setup � General � Report and Layout Manager. Then
click on the ‘Import’ button. Follow the wizard prompts to import a ‘Report’ (not a form). The end
result is that I have saved the report in the Inventory Reports sub-menu as shown in Figure 1.14.
Figure 1.14 Kanban Labels Report (Crystal)
If you are paying attention, you realize that so far we have simply been adding queries to the Right Click
menu option on the Kanban screen. Now we want to include the report ‘Kanban Labels’. It will not have
a query id or query category – it’s not a query. If you refer back to Figure 1.9, the column ‘Menuid’ has
been left empty. The Kanban Labels Crystal report has a ‘menuid’. To determine the menuid of any
Kanban Processing Page 14
form (other than a query), make certain the View has the System Information turned on. Then access
the report as shown in Figure 1.15.
Figure 1.15 Getting the Menuid of a Crystal Report
In this case the menuid is very long (32 characters). Write down this menuid and access the Right Click
Menu form as shown in Figure 1.16, and add it in as shown.
Kanban Processing Page 15
Figure 1.16 Assigning a Menuid to a Crystal Report
The option to use the Right Click from the Kanban screen is shown in Figure 1.17.
Figure 1.17 Accessing the Kanban Labels Crystal Report
The report itself is a 5 x 8 index card printout of the Kanban. This is shown in Figure 1.18.
Kanban Processing Page 16
Figure 1.18 Kanban Label
The application is just about complete. Let’s assume we want to add the option to access the Purchase
Order screen directly from the Kanban screen. The user has entered the transaction, and we want to
simply add a PO. The PO screen has the menuid 2305. We add this menuid to the Kanban screen and
get the result shown in Figure 1.19.
Figure 1.19 Accessing the PO from the Kanban Screen
Clicking on this selection immediately accesses the Purchasing Screen.
Kanban Processing Page 17
Appendix A – Queries for Kanban Functionality
Kanban Review Query /*
Lookup kanban transactions
Created 09/20/12 dcm
Fields to get from user:
Warehouse code to use – blank = All
Display open / closed (defaults to open if left empty)
*/
declare @whs varchar(8), @sortseq varchar(1), @type varchar(1), @kanban varchar(8),
@selectcode varchar(8000), @where varchar(200), @order varchar(200)
/*SELECT T0.[WhsCode] FROM [dbo].[OWHS] T0 */
/* WHERE */
set @whs = /* T0.[WhsCode] */ (N'[%0]' ) /* AND */
/*SELECT T1.[U_Status] FROM [dbo].[@DCMKANBANTRX] T1 */
/* WHERE */
set @type = /* T1.[U_Status] */ (N'[%1]' )
/*SELECT T2.[Code] FROM [dbo].[@DCMKANBAN] T2 */
/* WHERE */
set @kanban = /* T2.[Code] */ (N'[%2]' )
select k.code as Kanban
, k.u_itemcode as Item
, i.ItemName as Description
, k.u_whscode as Whs
, k.u_bin as Bin
, k.u_quantity as Quantity
, convert(varchar(10),d.u_date,101) as Date
, CONVERT(varchar(5),d.u_date,108) as Time
, d.u_badge as Badge
, d.u_employee as Name
, isnull(d.u_comment,'') as Comment
, d.u_type as Type
, d.u_status as Status
from [@dcmkanban] k
inner join OITM i on i.ItemCode = k.u_itemcode
inner join [@dcmkanbantrx] d on d.code = k.code
where (isnull(@kanban,'') = '' or k.code = @kanban) and (@type = d.u_status or
@type = '') and @whs = k.u_whscode
order by 1,7,8
Kanban Purge Query /*
Created 09/21/12 dcm
*/
declare @purgedate datetime
Kanban Processing Page 18
/*SELECT T1.[U_Date] FROM [dbo].[@DCMKANBANTRX] T1 */
/* WHERE */
set @purgedate = /* T1.[U_Date] */ (N'[%0]' )
delete [@DCMKanbantrx] with (rowlock)
where u_date < @purgedate
select @purgedate as 'Purge prior to date', 'Older kanban transactions have been
purged' as 'Message'
Kanban Import CSV File /*
Import kanban csv file
Data to import:
Kanban, item, whs, bin, quantity, po, pdo
Created
09/21/12 dcm
*/
DECLARE @xmlDoc XML, @idoc int, @error int, @msg varchar(1), @FileDir varchar(2000),
@filename varchar(200), @dir varchar(200)
, @task varchar(2000), @sql varchar(8000), @docentry int, @time
varchar(5), @timeint int, @autokey int
, @item varchar(20), @kanban varchar(8), @whs varchar(8), @bin
varchar(30), @qty int, @po varchar(1), @pdo varchar(1)
select @msg = 'N'
create table #kanbans (Kanban varchar(8), item varchar(20), whs varchar(8), bin
varchar(30), quantity int, po varchar(1), pdo varchar(1))
select top 1 @FileDir = u_xmlimport from [@dcmsetup]
if ISNULL(@FileDir,'') = ''
select 'Import directory is undefined'
else
begin
/*SELECT T1.[U_A50_1] FROM [dbo].[@DMAKRCPROMPTS] T1 */
/* WHERE */
set @filename = /* T1.[U_A50_1] */ (N'[%0]' )
select @sql = 'copy ' + @FileDir +@filename + ' '+@FileDir + 'Backup\' +
@filename
exec master..xp_cmdshell @sql, no_output
select @sql = @FileDir +'Backup\'+@filename
begin Try
select @task = 'BULK insert #kanbans from ' + char(39)+ @sql
+CHAR(39)+ ' with (Fieldterminator = '','', Rowterminator = ''\n'')'
EXECUTE (@Task)
end Try
begin Catch
Select 'File not found to import. Please check the file
name and include the extension'
Return
end Catch
if @msg = 'Y' select 'File loaded', * from #kanbans
-- now check the data and reject: duplicate kanbans, items not found, whs
not found, quantity = 0
Kanban Processing Page 19
select @error = 0
if (select COUNT(*) from [@DCMKanban] k inner join #kanbans x on x.Kanban
collate SQL_Latin1_General_CP1_CI_AS = k.code) > 0
begin
select 'Already exist' as message, k.code as Kanban,
k.u_itemcode as Item
from [@DCMKanban] k
inner join #kanbans x on x.Kanban collate
SQL_Latin1_General_CP1_CI_AS = k.code
order by k.code
select @error = 1
end
if @msg = 'Y' select 'Checked exist', @error as Error
if @error = 0 and (select COUNT(*) from #kanbans x left join oitm i on
i.itemcode = x.item collate SQL_Latin1_General_CP1_CI_AS
where ISNULL(i.itemcode,'') = '')
> 0
begin
select 'Item not found' as message, x.kanban as Kanban,
x.item as Item
from #kanbans x
left join oitm i on i.itemcode = x.item collate
SQL_Latin1_General_CP1_CI_AS
where ISNULL(i.itemcode,'') = ''
order by x.kanban
select @error = 1
end
if @msg = 'Y' select 'Checked item exist', @error as Error
if @error = 0 and (select COUNT(*) from #kanbans x left join owhs w on
w.whscode = x.whs collate SQL_Latin1_General_CP1_CI_AS
where ISNULL(w.whscode,'') = '')
> 0
begin
select 'Warehouse not found' as message, x.kanban as
Kanban, x.whs as Warehouse
from #kanbans x
left join owhs w on w.whscode = x.whs collate
SQL_Latin1_General_CP1_CI_AS
where ISNULL(w.whscode,'') = ''
order by x.kanban
select @error = 1
end
if @msg = 'Y' select 'Checked whs exist', @error as Error
if @error = 0 and (select COUNT(*) from #kanbans where quantity <1) > 0
begin
select kanban as Kanban, item as Item, whs as Warehouse,
bin as Bin, quantity as Quantity
from #kanbans
where quantity <1
select @error = 1
end
if @msg = 'Y' select 'Checked quantity > 0', @error as Error
if @error = 0
begin
declare mainloop cursor for
select kanban, item, whs, isnull(bin,''), quantity,
ISNULL(po,'N'), ISNULL(pdo,'N')
from #kanbans
open mainloop
fetch mainloop into @kanban, @item, @whs, @bin, @qty, @po,
@pdo
while @@FETCH_STATUS = 0
Kanban Processing Page 20
begin
select @autokey = autokey from ONNM where ObjectCode
= 'Kanbans'
select @time = CONVERT(varchar(5),getdate(),108)
select @time = LEFT(@time,2) + RIGHT(@time,2)
select @timeint = CONVERT(int,@time)
select @docentry = MAX(isnull(docentry,0)) + 1 from
[@dcmkanban]
insert into [@DCMKanban] with (rowlock)
(code,Name, docentry, object, createdate, createtime
,u_itemcode, u_bin, u_quantity, u_whscode,
u_po, u_pdo, u_itemname, u_status)
values(@kanban, @kanban, @docentry, 'Kanbans',
CONVERT(varchar(10),getdate(),112), @timeint,
@item, @bin, @qty, @whs, @po, @pdo, (select
itemname from OITM where ItemCode = @item), 'A')
update ONNM with (rowlock) set AutoKey = @autokey + 1
where ObjectCode = 'Kanbans'
fetch mainloop into @kanban, @item, @whs, @bin, @qty,
@po, @pdo
end
close mainloop
deallocate mainloop
select 'Kanbans loaded' as Message,kanban as Kanban, item
as Item, whs as Whs, isnull(bin,'') as Bin, quantity as 'Kanban Qty', ISNULL(po,'N')
as 'PO Flag', ISNULL(pdo,'N') as 'PDO Flag'
from #kanbans
end
drop table #kanbans
end
Note: In the interest of full disclosure, the update of the table ONNM is not strictly
kosher according to SAP rules. Whenever a ‘master file’ is updated, the next
‘docentry’ field for that master table is automatically updated. So, if you simply go
the Kanban file maintenance and add a new Kanban record, then the field docentry in
the ONNM file for the object ‘Kanbans’ is updated. This query is doing this
programmatically. However, this process does work correctly.