DuplicatePODetailLine

Duplicate PO Detail Lines

Major Business Rule

Object Name: B4301080

Parent DLL: CDIST

Location: Client/Server

Language: C

Functional Description

Purpose

The purpose of this business function is to duplicate a PO Detail Line (F4311) with minimal editing.

Technical Specification





1.If the szVersionName passed in is blank then default in ZJDE0001 as the version name.

2.If the OrderNumber, OrderType, OrderCompany, Order Suffix and OrderLineNumber are all zero or 

blank the stop processing and exit the function.


3.If the ComputerID is not blank and the JobNumber is not zero retrieve a F4301Z record using 

CTID and JOBS as key. 

If a record is found  

cUpdateFlag = '1'

if NewLineNumber passed in is not zero then delete F4311Z record using CTID. JOBS and 

LNID as key.  

else cUpdateFlag = '0'.


4If cUpdateFlag is not '1' then fetch a F4301 record using DOCO, DCTO, KCOOand SFXO as key 

values.

if a record is found

DSF4301ZDSF4301


DSF4301Z.PAACTN'2'

DSF4301Z.PAEDFL='1'


if the ComputerID passed is blank retrieve it using the system function 

GetLocalComputerName  and assign it to DSF4301Z.PACTID else assign ComputerID 

to DSF4301Z.PACTID

If the JobNumber passed in is zero assign a Job Number using the function 

X0010GetNextNumber and copy it to DSF4301Z.PAJOBS otherwise assign the JobNumber passed in 

to DSF4301Z.PAJOBS.


Insert DSF4301Zrecord into F4301Z file.


else issue an error message.


5.Fetch from the F4311 file using DOCO, DCTO, KCOO, SFXO  and LNID as key values.

If a record is found


DSF4311ZDSF4311


DSF4311Z.PWACTN='1'

DSF4311Z.PWEDFL='1'

DSF4311Z.PWCTID=DSF4301Z.PACTID

DSF4311Z.PWJOBS=DSF4301Z.PAJOBS





Retrieve the processing option values for the szVersionName of the P4310 template.


Work With the new line number.


If NewLineNumber is zero

if cUpdateFlag is set to '1' (i.e. a record was found in the F4301Z file) then

DSF4311Z.PWLNID=DSF4301Z.PALNID

else

Select all records in the F4311 file of the same OrderNumber, OrderType, 

OrderCompany 
and OrderSuffix.
Then Sort the selected records with respect to the PDLNID in descending order.
Retrieve the first record after the sort using DOCO, DCTO, KCOO and SFXO as key

 If a record was found 

assign the PDLNID retrieved to the DSF4311Z.PDLNID

Increment the DSF4311Z.PWLNID by theLineNumberIncrement  value specified in the 

processing options and assign it to DSF4311Z.PWLNID.

NewLineNumber = DSF4311Z.PWLNID.


else if NewLineNumber <> zero assign it to DSF4311Z.PWLNID.


DSF4301Z.PALNID =DSF4311Z.PWLNID.



Work with Next and Last Status


if cVerifyStatusCodes is equal to '1'

if LastStatus is blank AND PO_szLastStausCode is not blank

LastStatus = PO_szLastStatusCode


if NextStatus is blank and PO_szOverrideNextStatus is not blank

NextStatus = PO_szOverrideNextStatus


VerifyActivityRuleStatusCode

OrderType->szOrderType
DSF4311Z.PWLNTY->szLineType

LastStatus ->szLineStatusCode

DSF4311Z.PWWRTH<-cLedgerRecordYN

<-cErrorCode


if cErrorCode is equal to '1' return ER_ERROR

else  

DSF4311Z.PWLTTR = LastStaus


If NextStatus is  blank

 DSF4311Z.PWNXTR = VerifyActivityRuleStatusCode. szNextStatus








If NextStatus not blank validate the next status code using  the function

VerifyOverrideNextStatusCode 

NextStatus ->szOverrideNextStatus
VerifyActivityRuleStatusCode.szNextStatus->szNextStatus

VerifyActivityRuleStatusCode.szStatusAllowed1->szAllowedStatus1

VerifyActivityRuleStatusCode.szStatusAllowed2->szAllowedStatus2

VerifyActivityRuleStatusCode.szStatusAllowed3->szAllowedStatus3

VerifyActivityRuleStatusCode.szStatusAllowed4->szAllowedStatus4

VerifyActivityRuleStatusCode.szStatusAllowed5->szAllowedStatus5

<-cErrorCode


if cErrorCode is equal to ''1' the set ER_ERROR

else DSF4311Z.PWNXTR = NextStatus


 
else if cVerifyStatusCodes not '1'
DSF4311Z.PWNXTR = NextStatus

DSF4311Z.PWNXTR = LastStatus

Work with quantities and Units Of Measure

DSF4311Z.PWUORG = TransactionQuantity.

DSF4311Z.PWAEXP = ExtendedAmount.
DSF4311Z.PWUOPN = OpenQuantity.
DSF4311Z.PWAOPN = OpenAmount.
DSF4311Z.PWUREC = QuantityReceived.
DSF4311Z.PWAREC = AmountReceived.
DSF4311Z.PWFEA = ForeignExtendedAmount.
DSF4311Z.PWFREC = ForeignAmountReceived.
DSF4311Z.PWUORG = ForeignOpenAmount.

DSF4311Z.PWUOM = UnitOfMeasure

Free Pointer to the processing option version values.

6.If  there have been no errors insert the DSF4311Z structure into the F4311Z file

RecordWrittenToWorkFile  
= '1'
ComputerID  =  DSF4311Z.PWCTID

JobNumber  =  DSF4311Z.PWJOBS

NewLineNumber  =  DSF4311Z.PWLNID

LastStatus  =  DSF4311Z.PWLTTR

NextStatus  =  DSF4311Z.PDNXTR


7.Write or Update the DSF4301Z structure to the F4301Z file.

if cUpdateFlag is equal to '1' UPDATE the F4301Z file using CTID  and JOBS as key.

otherwise INSERT the DSF4301Z structure into the F4301Z file.







^

Data Structure

D4301080A - Duplicate PO Detail Line

Parameter NameData ItemData TypeReq/OptI/O/Both
mnOrderNumberDOCOMATH_NUMERICNONENONE

A number that identifies an original document. This document can be a voucher, a sales order, an invoice, unapplied cash, a journal entry, 
and so on.

szOrderTypeDCTOcharNONENONE

A user defined code (00/DT) that identifies the type of document. This code also indicates the origin of the transaction. J.D. Edwards has 
reserved document type codes for vouchers, invoices, receipts, and time sheets, which create automatic offset entries during the post 
program. (These entries are not self-balancing when you originally enter them.) The following document types are defined by J.D. Edwards and 
should not be changed: P Accounts Payable documents   R Accounts Receivable documents   T Payroll documents   I Inventory documents  
O Purchase Order Processing documents   J General Accounting/Joint Interest Billing documents   S Sales Order Processing documents

szOrderCompanyKCOOcharNONENONE

A number that, along with order number and order type, uniquely identifies an order document (such as a purchase order, a contract, a 
sales order, and so on). If you use the Next Numbers by Company/Fiscal Year facility, the Automatic Next Numbers program (X0010) uses the 
order company to retrieve the correct next number for that company. If two or more order documents have the same order number and order 
type, the order company lets you locate the desired document. If you use the regular Next Numbers facility, the order company is not used to 
assign a next number. In this case, you probably would not use the order company to locate the document.

szOrderSuffixSFXOcharNONENONE

In the A/R and A/P systems, a code that corresponds to the pay item. In the Sales Order and Procurement systems, this code identifies 
multiple transactions for an original order. For purchase orders, the code is always 000. For sales orders with multiple partial receipts against an 
order, the first receiver used to record receipt has a suffix of 000, the next has a suffix of 001, the next 002, and so on.

mnOrderLineNumberLNIDMATH_NUMERICNONENONE

A number that identifies multiple occurrences, such as line numbers on a purchase order or other document. Generally, the system assigns 
this number,but in some cases you can override it.

szVersionNameVERScharNONENONE

A user-defined set of specifications that control how applications and reports run. You use versions to group and save a set of user-defined 
processing option values and data selection and sequencing options. Interactive versions are associated with applications (usually as a 
menu selection). Batch versions are associated with batch jobs or reports. To run a batch process, you must choose a version.

szLastStatusLTTRcharNONENONE

A code (system 40/type AT) specifying the last step in the processing cycle that this order line has successfully completed.

szNextStatusNXTRcharNONENONE

A user defined code (system 40/type AT) indicating the next step in the order flow of the line type.

mnNewLineNumberLNIDMATH_NUMERICNONENONE

A number that identifies multiple occurrences, such as line numbers on a purchase order or other document. Generally, the system assigns 
this number,but in some cases you can override it.

mnTransactionQuantityUORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

mnExtendedAmountAEXPMATH_NUMERICNONENONE

The number of units multiplied by the unit price.

mnOpenQuantityUOPNMATH_NUMERICNONENONE

The original quantity for the order detail line, plus or minus any changes to that quantity, minus all quantities shipped, received, and 
vouchered to date.

mnOpenAmountAOPNMATH_NUMERICNONENONE

The amount of the order, invoice, or voucher that is still unpaid or open. When you enter a document (for example, an order, invoice, or 
voucher), the open amount is the original amount of that document. If you change the original amount, the open amount is reduced by the net 
change. For example,payments, shipments, or receipts against a document result in a reduction of the open balance.

mnQuantityReceivedURECMATH_NUMERICNONENONE

The original quantity of the order line, plus or minus any changes to that quantity, less all quantities shipped, received and/or vouchered to 
date. This number can also be the actual quantity received.

mnAmountReceivedARECMATH_NUMERICNONENONE

The value of the goods received to date against the original order line.

szUnitOfMeasureUOMcharNONENONE

A user defined code (00/UM) that indicates the quantity in which to express an inventory item, for example, CS (case) or BX (box).

cRecordWrittenToWorkFileEV01charNONENONE

An option that specifies the type of processing for an event.

cVerifyStatusCodesEV02charNONENONE

An option that specifies the type of processing for an event.

mnForeignAmountReceivedFRECMATH_NUMERICNONENONE

Amount - Received Foreign

mnForeignAmountOpenFAPMATH_NUMERICNONENONE

The unpaid foreign amount of a transaction.

mnForeignExtendedAmountFEAMATH_NUMERICNONENONE

The product of the foreign price times the number of units.

szComputerIDCTIDcharNONENONE

mnJobNumberJOBSMATH_NUMERICNONENONE

The job number (work station ID) which executed the particular job.

szBaseCurrencyCodeCRDCcharNONENONE

A code that identifies the domestic (base) currency of the company on a transaction. 

mnUnitsPrimaryQtyOrderPQORMATH_NUMERICOPTNONE

The quantity ordered by the customer expressed in the primary stocking unit of measure.

mnUnitsSecondaryQtyOrSQORMATH_NUMERICOPTNONE

If the secondary unit of measure option in Inventory Constants is selected,this field will display on data entry screens.

mnAmountUnitWeightITWTMATH_NUMERICOPTNONE

The weight of one unit of an item, expressed in the primary unit of measure.

mnAmountUnitVolumeITVLMATH_NUMERICOPTNONE

The cubic units occupied by one inventory item. The definition of the unit itself (cubic feet, yards, meters, and so on) is defined in the volume 
unit of measure.

mnPOProcessIDPEIDMATH_NUMERICOPTNONE

A code that identifies the Inter-Process Communication ID.

mnPOTransactionIDTCIDMATH_NUMERICOPTNONE

mnProjectNumberPRJMMATH_NUMERICOPTNONE

A number that identifies an EPM project in the system. The project must be set up in the Add/Revise Project program (P31P011).

szSecUnitOfMeasureUOM2charOPTNONE

A user defined code (00/UM) that indicates an alternate unit of measure for the item.

mnMatrixControlLineMCLNMATH_NUMERICOPTNONE

A number that the system uses to group line numbers on a purchase order or sales order for use in a matrix. Although the number is 
generated automatically, you can override it.

cMultipleAccountsMACTcharOPTNONE

This code indicates whether the expense on the detail line has been distributed to multiple accounts.

szProgramIDPIDcharOPTNONE

The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry 
interactive program is P4210, and the number of the Print Invoices batch process report is R42565. The program ID is a variable length value. 
It is assigned according to a structured syntax in the form TSSXXX, where: T The first character of the number is alphabetic and identifies the 
type, such as P for Program, R for Report, and so on. For example, the value P in the number P4210 indicates that the object is a 
program. SS The second and third characters of the number are numeric and identify the system code. For example, the value 42 in the number P4210 
indicates that this program belongs to system 42, which is the Sales Order Processing system. XXX The remaining characters of the numer are 
numeric and identify a unique program or report. For example, the value 10 in the number P4210 indicates that this is the Sales Order Entry 
program.

szUserIDUSERcharOPTNONE

The code that identifies a user profile.

cCurrencyModeCRRMcharOPTNONE

An option that specifies whether the system displays amounts in the domestic or foreign currency. On  The system displays amounts in the 
foreign currency of the transaction. Off  The system displays amounts in the domestic currency of the transaction.

Related Functions

B4000260 Line Type - Activity Rules
B4000960 Verify Override Next Status Code
B4002000 Compute Unit Or Extended Amount
B9800181 Environment List Business Functions

Related Tables

F4301 Purchase Order Header
F4301Z PO Header Work File
F4311 Purchase Order Detail File
F4311Z Purchase Order Generator File