Friday, 1 April 2016

Baan/LN program to create production order - (2 ways)

1.       Use standard DLL:

long tisfc.dll9010.generate.production.order( <parameters-list>)

2.       Use DLL developed by me with an AFS code in it:

table ttisfc000
table ttisfc002
#pragma used dll ottstpapihand
#pragma used dll ottdllbw

function extern domain                tcpdno tietc.dll0001.generate.lot(
               domain tcpdno                             i.pdno,
               domain  tcitem                  i.item,
               domain tcuef.effn           i.effn,
               domain  tiqep1                  i.qrdr,
ref          domain tcmcs.str100       o.error)
{
                DllUsage
                Expl        : AFS to generate production
                Pre         : NA
                Post       : NA
                Input     :
                                i.pdno -> Production Order Series
                                i.item -> Main Item
                                i.effn -> Effectivity Unit
                                i.qrdr -> Quantity
                Output :
                                o.error -> Error Msg
                Return  : Production Order number of the generated production order
                EndDllUsage
               
                                long       retval
                               
                domain tcpdno  v.pdno
               
               

                retval = 0
                o.error = ""
                v.pdno = ""
               
                retval = tcmcs.dll0095.read.parm("tisfc000")
               
                if retval or isspace(tisfc000.ngpd) then
                                o.error = "Error: Shop Floor control Parameters not maintained"
                                return("")
                endif
               
                select    tisfc002.*
                from      tisfc002
                where   tisfc002._index1 = {:tisfc000.ngpd, :i.pdno(1;3)}
                selectdo
                selectempty
                                o.error = "Error: Default Production Order Data not maintained"
                                return("")
                endselect
               
                stpapi.form.command("tisfc0101s000", 5, "exec.add.set",o.error)
                if not isspace(o.error) then
                                return("")
                endif
                stpapi.put.field("tisfc0101s000", "tisfc001.pdno", trim$(i.pdno))
                stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.1","")
                stpapi.put.field( "tisfc0101s000", "tisfc001.mitm.segment.2", trim$(i.item))
                stpapi.put.field("tisfc0101s000", "tisfc001.qrdr", str$(i.qrdr))
                stpapi.put.field("tisfc0101s000", "tisfc001.clco", tisfc002.clco)
               
                retval = stpapi.insert( "tisfc0101s000", 1, o.error )

                if not retval then
                                retval = stpapi.recover("tisfc0101s000",o.error)
                else
                                stpapi.form.command("tisfc0101s000", 2, "tisfc0105m000",o.error)
                               
                                stpapi.form.command("tisfc0105m000", 5, "exec.add.set",o.error)
                                stpapi.put.field( "tisfc0105m000", "tisfc005.dlin", str$(1))
                                stpapi.put.field( "tisfc0105m000", "tisfc005.effn", str$(i.effn))
                                stpapi.put.field( "tisfc0105m000", "tisfc005.qrdr", str$(i.qrdr))
                                retval = stpapi.insert( "tisfc0105m000", 1, o.error )
                                if not retval then
                                                retval = stpapi.recover("tisfc0105m000",o.error)
                                endif
                                stpapi.end.session("tisfc0105m000", o.error)
                               
                                stpapi.get.field("tisfc0101s000","tisfc001.pdno",v.pdno)
                                stpapi.form.command("tisfc0101s000", 5, "release.order",o.error)
                endif
               
                stpapi.end.session("tisfc0101s000", o.error)
                stpapi.end.session("tisfc0101m100", o.error)
                return(v.pdno)
               

}

4 comments:

  1. Nice Blog for the LN Developers.

    You are posting the interesting topics.

    Keep it up

    ReplyDelete
  2. Can you provide the DAL for uploading opening balances in finance?

    It will be really helpful for me.

    I am learning BAAN...

    ReplyDelete