ReturnToPriorDraftStatus

Return To Prior Draft Status

Minor Business Rule

Object Name: B03B0197

Parent DLL: CFIN

Location: Client/Server

Language: C

Functional Description


Purpose


The purpose of this function is to return a draft to its prior status.


Setup Notes and Prerequisites


The following validation must be done before calling this business function:

The draft can not be at acceptance status.

The draft can not be void or NSF.


Special Logic


None.


Technical Specification






Parameters

Data Item   Data Structure Desc   I/O   Required   Notes

PYID        mnPaymentID           I     Yes        Payment ID of draft

DGJ         jdGLDate              I     Yes        G/L date for new records

ICU         mnBatchNumber         I     Yes        Batch number for new records

ICUT        szBatchType           I     Yes        Batch type for new records

DICJ        jdDateBatch           I     Yes        Batch date for new records

PID         szProgramID           I     No         ID of calling program. If left

                                                   blank, B03B0197 will default.


Related Tables

Table     Table Description

F007101   Text Processor Header

F03B11    Customer Ledger

F03B13    Receipts Header File

F03B14    A/R Check Detail File

F03B672   Draft Remittance Work File - One World Only


Related Business Functions

Source Name   Function Name

B0000007      Batch - Revise On Transaction Commitment

B03B0190      F03B11Z2 Invoice Outbound Interoperability

B03B0191      F03B13Z2/F03B14Z2 Receipt Outbound Interoperability

B9800100      Get Audit Information

X0903         Fiscal Date Edits +


Processing

This function will return a draft at collection (draft status 0) to remittance status (draft status 

2), if the draft was remitted normally.

This function will return a draft at collection (draft status 0) to remitted w/ contingent liability 

status (draft status 3), if the draft was remitted with contingent liability.

This function will return a draft at remittance (draft status 2 or 3) to acceptance status (draft 

status 4).


The G/L date and batch information will be stored on any new records that are created during the 

process of returning a draft to its prior draft status.


The program ID will be stored on any records that are updated or created during the process of 

returning a draft to its prior draft status.

However, if a program ID is not passed in, the ID of this function will be used.


Pseudo Code

select * from F03B13 where (PYID = FI Payment ID)

if (F03B13.DDST == '0') then

   select * from F03B14 where (PYID = F03B13.PYID) and (TYIN = 'D') and (DDST >= '2') and (DDST <= 

'4') order by RC5 descending

   Last_F03B14 = FetchNext(F03B14)

   if (Last_F03B14.DDST == '2') then

      2ndLast_F03B14 = FetchNext(F03B14)

      if (2ndLast_F03B14.POST == 'D') then

         // create a D-type record to reverse the 2ndLast_F03B14

      else

         delete from F03B14 where (PYID = 2ndLast_F03B14.PYID) and (RC5 = 2ndLast_F03B14.RC5)

      end if

   end if

   if (Last_F03B14.POST == 'D') then

      F03B13.DGJ = FI G/L date

      F03B13.ICU = FI Batch Number

      F03B13.ICUT = FI Batch Type

      // create a D-type record to reverse the Last_F03B14

   else

      NextLast_F03B14 = FetchNext(F03B14)

      F03B13.DGJ = NextLast_F03B14.DGJ

      F03B13.ICU = NextLast_F03B14.ICU

      F03B13.ICUT = NextLast_F03B14.ICUT

      delete from F03B14 where (PYID = Last_F03B14.PYID) and (RC5 = Last_F03B14.RC5)

   end if

   F03B13.DDST = Last_F03B14.DDST

   if (F03B13.POST == 'D') then

      // un-post the F03B13

      F03B13.POST = ''

      F03B13.EULP = ''

      // create a D-type record to reverse the F03B13

      // the draft status of the new D-type record must be 0

   end if

   F03B11_R1.PST = 'G'

   F03B11_R1.AAP = F03B13.CKAM

   F03B11_R1.FAP = F03B13.FCAM

   F03B11_R1.JCL = ''

   if (Last_F03B14.DDST == '4') then

      F03B13.GLBA = ''

      F03B13.AM = ''

      F03B11_R1.PST = 'D'

   end if

else

   if ((F03B13.DDST == '2') or (F03B13.DDST == '3')) then

      // WARNING - the remittance batch containing this draft may already have been sent to the bank

      select * from F03B14 where (PYID = F03B13.PYID) and (TYIN = 'D') and (DDST = F03B13.DDST) order 

by RC5 descending

      F03B14 = FetchNext(F03B14)

      if (F03B14.POST == 'D') then

         // create a D-type record to reverse the F03B14 record we just fetched

      else

         delete from F03B14 where (PYID = F03B14.PYID) and (RC5 = F03B14.RC5)

      end if

      if (F03B13.DDST == '2') then

         // contingent liability writes a second remittance record

         F03B14 = FetchNext(F03B14)

         if (F03B14.POST == 'D') then

            // create a D-type record to reverse the F03B14 record we just fetched

         else

            delete from F03B14 where (PYID = F03B14.PYID) and (RC5 = F03B14.RC5)

         end if

      end if

      select * from F03B14 where (PYID = F03B13.PYID) and (TYIN = 'D') and (DDST = '4') order by RC5 

descending

      F03B14 = FetchNext(F03B14)

      Prev_F03B14 = FetchNext(F03B14)

      if (F03B14.POST == 'D') then

         F03B13.DGJ = FI G/L date

         F03B13.ICU = FI Batch Number

         F03B13.ICUT = FI Batch Type

         // create a D-type record to reverse the F03B14 record we just fetched

      else

         F03B13.DGJ = Prev_F03B14.DGJ

         F03B13.ICU = Prev_F03B14.ICU

         F03B13.ICUT = Prev_F03B14.ICUT

         delete from F03B14 where (PYID = F03B14.PYID) and (RC5 = F03B14.RC5)

      end if

      F03B11_R1.AID = Prev_F03B14.AID2

      F03B11_R1.PST = 'D'

      delete from F03B672 where (PYID = F03B13.PYID)

      // flag F007101 as invalid data

      F03B13.GLBA = ''

      F03B13.AM = ''

      F03B13.DREG = ''

      F03B13.DDST = '4'

   else

      if (F03B13.DDST == '4') then

         ERROR - No Prior Draft Status

                 The draft can not be returned to a prior status, because it is at the first draft 

status.

      else

         if (F03B13.DDST == '1') then

            ERROR - Draft Status Not Used

                    The draft status field contains a valid value, but it is not used.

         else

            ERROR - Draft Status Invalid

                    The draft status field does not contain a valid value.

         end if

      end if

   end if

end if




Data Structure

D03B0197 - Return To Prior Draft Status

Parameter NameData ItemData TypeReq/OptI/O/Both
mnPaymentIDPYIDMATH_NUMERICREQINPUT

A number that the system assigns from Next Numbers to identify and track payment records.

jdGLDateDGJJDEDATEREQINPUT

A date that identifies the financial period to which the transaction will be posted. You define financial periods for a date pattern code that you 
assign to the company record. The system compares the date that you enter on the transaction to the fiscal date pattern assigned to the 
company to retrieve the appropriate fiscal period number, as well as to perform date validations.

mnBatchNumberICUMATH_NUMERICREQINPUT

A number that identifies a group of transactions that the system processes and balances as a unit. When you enter a batch, you can either 
assign a batch number or let the system assign it using the Next Numbers program.

szBatchTypeICUTcharREQINPUT

A code that specifies the system and type of transactions entered in a batch. The system assigns the value when you enter a transaction. 
Valid values are set up in user defined code table 98/IT. You cannot assign new values. All batch types are hard coded.

jdDateBatchDICJJDEDATEREQINPUT

The date of the batch. If you leave this field blank, the system date is used.

szProgramIdPIDcharOPTINPUT

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.

Related Functions

B0000007 Batch - Revise On Transaction Commitment
B03B0190 F03B11Z2 Invoice Outbound Interoperability
B03B0191 F03B13Z2/F03B14Z2 Receipt Outbound Interoperability
B9800100 Get Audit Information

Related Tables

F007101 Text Processor Header
F03B11 Customer Ledger
F03B13 Receipts Header
F03B14 Receipts Detail
F03B672 Draft Remittance