BaBernd
13th December 2016, 10:20
Hello to All,

I'm searching a function or dll where I can select the original sales order out of the production orders. As I found the item is the combining element in table cprrp041. But somehow it will not be enough for uniqueness.

In the session Production Orders (tisfc0501m000) I can call the session cprrp0740m100 (Order Pegging Browser). I found also some libraries for that calling. But all is only programmed for this browser display.
I'd like to get the raw data for sales order is related with production order.

Thanks a lot in advance.

Best Regards
Bernd

pillai.ganesh
13th December 2016, 15:06
void cprrp.dll0045.print.pegging.relations( domain tcyesno i.print.signals, domain tcyesno i.print.specification, domain cpcom.plnc i.scenario, domain cpstream i.streaming, domain cprao.prio i.critical.priority, domain tcyesno i.where.used, domain tcsrnb i.print.levels, domain tcmcs.str215m i.sel.criteria.desc mb, domain tcmcs.str215m i.options.desc mb, long i.peg.arrays.depth, const domain tccom.long i.parent.array(), const domain tcncmp i.parent.site.array(), const long i.parent.subset.array(), const domain tccom.long i.child.array(), const domain tcncmp i.child.site.array(), const long i.child.subset.array(), const domain tcqiv1 i.child.qty.array(), const domain tcqiv1 i.partial.qty.array() )

Expl. : This function will print the pegging relations based on the
array's loaded by cprrp.dll0041.load.pegging.relations.
Pre : -
Post : -
Input : i.print.signals - Print signals
i.print.specification - Print specifications
i.scenario - Scenario
i.streaming - Streaming
i.critical.priority - Critical priority
i.where.used - Analyse where-used quantity
i.print.levels - Levels to be printed
i.sel.criteria.desc - Description of selection criteria
i.peg.arrays.depth - Depth of pegging arrays
i.parent.array - Array with parent transactions
i.parent.site.array - Array with site of parent transaction
i.parent.subset.array - Array with subset of parent
i.child.array - Array with child transactions
i.child.site.array - Array with site of child transaction
i.child.subset.array - Array with subset of child
i.child.qty.array - Array with where-used quantity
Output : -
Return : -

BaBernd
13th December 2016, 15:21
Hello Pillai Ganesh,

thanks for fast help. For further clarification, will that function "print" the data into a browser window? Cause as written in the explanation comments the Output: is nothing. And as I found the functions in cprrp.dll0041 will only deliver data into the browser.
But I need the data explicitly within an Infor LN Report.

Best Regards
Bernd

pillai.ganesh
13th December 2016, 15:34
Bernd,

Honestly, I have not tried using the dlls. After reading your post I was curious if such a dll exist. That's the reason I searched the DLL with the help of "Generate Library Documentation". Found this!

On further exploration, I found these two tables-
cprrp040 (Pegging Relations)
cprrp041 (Pegging Transactions)

I think you will have to run dll - cprrp.dll0041.load.pegging.relations to load these tables.

Let know if this works.

BaBernd
13th December 2016, 16:41
Hi Pillai,
fast reply :-) and a good hint: "Generate Library Documentation" => I've missed to do that.
I've additionally found a helpful session cprrp0520m000 "Item Order Plan" called out of the Pegging - Downstream Browser Session (cprrp0740m100).
Here the sales order will listed again together with the production orders.

Thanks a lot for help.

Best Regards
Bernd

BaBernd
15th December 2016, 12:31
Hello Pillai,

for additional clarification. I've found the table cprpd100 - Items-Planning.
In that table the cprpd100.plni = cprrp041.plni and cprpd100.item = tisfc001.mitm are equivalent. For that I can join the tables for selecting the correct sales order number out of cprrp041.orno (with cprrp041.koor = 3 => tckoor.act.sls => sales order) with the item-field.

Best Regards
Bernd

pillai.ganesh
15th December 2016, 13:52
cprpd100 (Items-Planning) => Contains the Planning settings for the items with Order System Planned. So I'm not sure how it will help for getting the Sales Order for the Production Order.

Table cprrp040 (Pegging Relations) => Contains scenario wise demand and supply transaction number. Which is the pegging relationship between Sales Order (Demand) and Production Order (Supply).

Thus, you can query the cprrp041 table for the getting the supply transaction number of your production Order and then use that transaction number and scenario number to query cprrp040 table to get the demand transaction against the supply transaction number and scenario we queried from the cprrp041 table previously.
Then take the demand transaction number and query the cprrp041 table again to get the SO number.
Hope I didnt confuse you :)

BaBernd
16th December 2016, 11:44
Hi Pillai,

yes you confused me ;-).

But you're right. Your query seems to be the better/correct way. I've checked it and got the correct values.

Best Regards
Bernd

pillai.ganesh
17th December 2016, 14:32
Ahh ha!! Sounds good...

vahdani
20th December 2016, 18:01
Hi Pillai,

here is a DLL-Code Fragment that I did a couple of years ago to do the same thing you are trying to achieve. Hope it helps.
Note: A production order can be pegged to more than one sales order line. Therefore the tolerance Input variable.


#include "itcmcs2000" |RETIFNOK,...
#include "itcmcs0012" |Compare Doubles
#pragma used dll otcmcsdll0095 |read parmeters

function extern long tixsfdllxxxx.find.pegged.sales.order.for.prod.order(
domain tcpdno i.pdno,
double i.tolr,
ref domain tcorno o.orno,
ref domain tcpono o.pono)
{
dllusage
This function searches for the sales order which was the requirement
for a certain production order. This is done by searching Pegging
relations in enterprise planning for the actual scenario. The found
sales order line must have generated a demand to supply ratio more than
or equal to the input field i.tolr (say 0.9).

Pre: Pegging relationships are generated in Enterprise Planning

Return 0: Pegged sales order is found
o.orno is filled with sales order
o.pono is filled with sales line
DALHOOKERROR: No pegged sales order is found.
o.orno is empty
o.pono is zero
enddllusage
table tcprpd000 |Enterprise planning parameters
table tcprrp040 |Pegging relations
table tcprrp041 |Pegging transactions

domain tcorno l.sales.orno
domain tcpono l.sales.pono
domain tcqiv1 l.demand.quan
domain tcqiv1 l.supply.quan
boolean l.found

o.orno = ""
o.pono = 0

RETIFNOK(tcmcs.dll0095.read.parm("cprpd000"))

l.found = false

select demand.orno:l.sales.orno,
demand.pono:l.sales.pono,
supply.quan:l.supply.quan,
cprrp040.quan:l.demand.quan
from cprrp041 supply,
cprrp040,
cprrp041 demand
where supply.plnc = :cprpd000.aplc
and supply.koor = tckoor.act.sfc
and supply.orno = :i.pdno
and supply.pono = 0
and supply.kotr = tckotr.receipt
and cprrp040.plnc = supply.plnc
and cprrp040.strn = supply.trns
and demand.plnc = cprrp040.plnc
and demand.trns = cprrp040.dtrn
and demand.koor = tckoor.act.sls
and demand.kotr = tckotr.requirement
selectdo
if GREATER.OR.EQUAL(l.demand.quan, l.supply.quan * i.tolr) then
o.orno = l.sales.orno
o.pono = l.sales.pono
l.found = true
break
endif
endselect

if not l.found then
dal.set.error.message("xxxxxxx", i.pdno)
|Your Error Message....
return(DALHOOKERROR)
endif

return(0)
}