SplitSalesOrderDetailLine

Split Sales Order Detail Line

Major Business Rule

Object Name: B4200060

Parent DLL: CDIST

Location: Client/Server

Language: C

Functional Description

Purpose

Use this function to split the ship quantity from the backorder/cancel quantities in a sales order 
detail line F4211.  After the split, the original line will contain the backorder/cancel quantities 

while a new line is created for the ship quantity.  The new line will essentially be a mirror image o f 

the original line with some differences in the status codes.  - You must pass to this function the Ptr 

to the F4211 record


Setup Notes and Prerequisites

• In order to call this function, you must pass to it a long pointer that points to the Sales Order 
Detail record.  Use a business function to fetch and create this pointer.


Special Logic




Technical Specification


2.2Related Tables 

Table Table Description
F4211Sales Order Detail


2.3Related Business Functions

Source NameFunction Name
X4101.CGetItemMasterByShort

B4000260.CVerifyActivityRulesStatusCode

B4200260.CWriteSalesHistoryOrLedger


2.4Processing 


Insert New Record to Table (F4211)

1.Use the GENLNG to retrieve data from the Sales Order Detail data structure (F4211).
2.Save SDSOBK, SDSOCN, and SDLNID to work fields.

3.Calculate the line number of the split line.

If SDRLIT == ' ',

    default line increment to .01;

else

    default line increment to .1;


4.If Increment From Line Number (LNID) in the parameter is zero,

The new line number is the current line number plus the line increment (RLLN) passed.  (i.e., SDLNID 
= SDLNID + RLLN)

    else

Calculate the new line number by adding the Kit Master Line Number and the line increment.  (i.e., 
SDLNID = LNID + RLLN).

5.Validate against F4211 to make sure the new line number is unique.  Use an existing business 

function.  If not unique, repeat step 3b-4.

6.Use the original F4211 record as a copy, map all fields to a new F4211 record.  (Use the best 

technique in C)

7.Save current line number to LNID.


8.SDUORG = SDSOQS;


9.Zero out SDSOBK and SDSOCN.


10.Retieve the Inventory Interface flag (LFIVI) from Line Type Master (F4205).  (Use existing 

business function)

11.If stock item (LFIVI = 'Y' or LFIVI = 'D'),

Retrive pointer to F4101 (use bf GetItemMasterByShort)


12.Call GetItemUOMConversionFactor and save the update the following fields:


BranchPlant<=SDMCU

FromUnitOfMeasure<=SDUOM

ToUnitOfMeasure<=SDUOM4

QuantityToConvert<=SDUORG

InventoryInterfaceFlag<=LFIVI

ShortItemNumber<=SDITM

ConversionFactorFrom_to_Tonot used
ConversionFactorFrom_to_Primary=>ConversionFactor_From_Prim

ConversionFactorTo_to_Primary=>ConversionFactor_To_Prim

UnitOfMeasureToPrimary<=SDUOM1

QuantityConvertedToPrimary=>SDPQOR
ConvertToSecondary<=1

UnitOfMeasureToSecondary<=SDUOM2

QuantityCOnvertedToSecondary=>SDSQOR
ConvertToPurchasingnot used

UnitOfMeasureToPurchasingnot used

QuantityConvertedToPurchasingnot used
ConvertToPricingnot used

UnitOfMeasureToPricingnot used

QuantityConvertedToPricingnot used
ConvertToShippingnot used

UnitOfMeasureToShippingnot used

QuantityConvertedToShippingnot used
ConvertToWeight<=1

UnitOfMeasureToWeight<=SDWTUM

QuantityConvertedToWeight=>SDITWT
ConvertToVolume<=1

UnitOfMeasureToVolume<=SDVLUM

QuantityConvertedToVolume=>SDITVL
UOMByBranchnot used

PotencyModenot used

LotNumber<=SDLOTN

PotencyControlfuture use

StandardPotencyfuture use

ErrorMessageIDnot used

SuppressMessageFlag<=' '


13.SDLTTR = LTTR (override last status in input parameter).

14.(Future) Calculate promised ship and delivery dates if specified in parameter (EV01 = '1').

15.Call GetAuditInfo and load the following fields:  SDUSER, SDJOBN, SDUPMJ, SDTDAY.
16.If line is a kit parent, and the ship quantity is hard committed, flag the parent as committed 

(SO10).

17.i.e., If SDCOMM = 'K' && FLD2 = '1' && SDSOBK = 0 && SDSOQS <> 0, then SDSO10 = '1'.

18.Insert record to table (F4211).

19.If warehousing, return new line number of shippable quantity. (i.e., LNID = SDLNID)

20.(Future) Copy associated text and price history.

21.Write ledger record only if specified in status flow:
I.If SDNXTR == '999', call VerifyActivityRuleStatusCode by passing the SDDCTO, SDLNTY, and SDNXTR 
to retrieve the Write Ledger field (FSWRTH).

II.If WRTH = 'Y' or FSWRTH == 'Y',

Call WriteSalesHistoryOrLedger to write a ledger record to F42199.

Adjust Original Detail Line


1. SDUORG = backorder save field + cancel save field

2.If SDSOBK == 0

SDSOCN = SDUORG

SDLTTR = NXT2

SDNXTR = '999'

else

SDSOBK = backorder save field

SDSOCN = Cancel save field

SDLTTR = LTT2

3.SDSOQS = 0

4.SDAEXP = 0

5.SDFEA = 0

6.SDECST = 0

7.SDFEC = 0

8.Call GetItemUOMConversionFactor and save the update the following fields:


BranchPlant<=SDMCU

FromUnitOfMeasure<=SDUOM

ToUnitOfMeasure<=SDUOM4

QuantityToConvert<=SDUORG

InventoryInterfaceFlag<=LFIVI

ShortItemNumber<=SDITM

ConversionFactorFrom_to_Tonot used
ConversionFactorFrom_to_Primary=>ConversionFactor_From_Prim

ConversionFactorTo_to_Primary=>ConversionFactor_To_Prim

UnitOfMeasureToPrimary<=SDUOM1

QuantityConvertedToPrimary=>SDPQOR
ConvertToSecondary<=1

UnitOfMeasureToSecondary<=SDUOM2

QuantityCOnvertedToSecondary=>SDSQOR
ConvertToPurchasingnot used

UnitOfMeasureToPurchasingnot used

QuantityConvertedToPurchasingnot used
ConvertToPricingnot used

UnitOfMeasureToPricingnot used

QuantityConvertedToPricingnot used
ConvertToShippingnot used

UnitOfMeasureToShippingnot used

QuantityConvertedToShippingnot used
ConvertToWeight<=1

UnitOfMeasureToWeight<=SDWTUM

QuantityConvertedToWeight=>SDITWT
ConvertToVolume<=1

UnitOfMeasureToVolume<=SDVLUM

QuantityConvertedToVolume=>SDITVL
UOMByBranchnot used

PotencyModenot used

LotNumber<=SDLOTN

PotencyControlfuture use

StandardPotencyfuture use

ErrorMessageIDnot used

SuppressMessageFlag<=' '


9.(Future) Calculate promised ship and delivery dates for preference processing.

10.Call GetAuditInfo and load the following fields:  SDUSER, SDJOBN, SDUPMJ, SDTDAY.
11.Update record to table (F4211).

12.Write ledger record only if specified in status flow:

I.If SDNXTR == '999', call VerifyActivityRuleStatusCode by passing the SDDCTO, SDLNTY, and SDNXTR 
to retrieve the Write Ledger field (FSWRTH).

II.If WRTH = 'Y' or FSWRTH == 'Y',

Call WriteSalesHistoryOrLedger to write a ledger record to F42199.


^

Data Structure

D4200060 - Split Sales Order Detail Line

Special Input Expected
GENLNGF4211LongPointer

RLLN  Line IncrementerPass the value of the line increment.  Default to .01 if not sent.

LNID Kit Master Line Number

LTTROverride Last Ship StatusThis is the override last status of the new line.

LTT2Override Last Backorder StatusThis is the overide last status of the backorder line

NXT2Override Last Cancel StatusThis is the override last status of a cancel line.

EV01Preference ProcessingFuture use.  Set to '1' if preference option is set in SOE and not warehouse.

FLD2Hard Commit FlagPass '1' if hard commiting


Special Output Returned

LNID Kit Master Line Number



^

Parameter NameData ItemData TypeReq/OptI/O/Both
idF4211RowPtrGENLNGIDNONENONE

General purpose ID variable.

mnLineIncrementerRLLNMATH_NUMERICNONENONE

A number of the detail line on the related order for which the current order was created. For example, on a purchase order created to fill 
open sales orders, this is the line number of the sales order on which the item you are ordering appears.

mnLineNumberLNIDMATH_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.

szOverrideLastShipStatusLTTRcharNONENONE

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

szOverrideLastCancelStatusNXT2charNONENONE

User defined code (40/AT) that specifies what the next standard step is in the processing cycle for this order type. You set up the steps for 
the processing cycle on the Order Activity Rules form.

szOverrideLastBackorderStatusLTT2charNONENONE

The code that specifies what step in the processing cycle was last completed successfully for this order line.

cPreferenceProcessingEV01charNONENONE

Special Input Expected
EV01ab Preference  Processingab Future use.  Set to '1' if preference option is set in SOE and not 

warehouse.ab 


^

cHardCommitFlagFLD2charNONENONE

An option that determines how the Shop Floor Management system commits inventory. The options are as follows:     o Hard commitment at 
creation of parts list. The system performs a hard commitment at the creation of the parts list. The hard commitment remains in effect until 
inventory is relieved.     o Soft commitment, then changed to hard commitment when printing. The system performs a soft commitment at the 
creation of the parts list.        The system then changes the commitment to a hard commitment during the pick list print process (P31410) for the 
work order. The hard commitment remains in effect until inventory is relieved.     o Soft commitment at creation of parts list. The system performs a 
soft commitment at creation of the parts list. The soft commitment remains in effect until inventory is relieved. When you set the Commitment 
Method field in the Branch/Plant Constants form to 2 or 3, you must use either Hard commitment at creation of parts list or Soft commitment, 
then hard commitment when printing because a hard commitment must be performed. If you want to identify substitute items when a shortage 
occurs, you must choose the hard commitment at creation of parts list option. When you choose either Soft, Hard when printing or Soft at creation 
of Parts List, any line item in the parts list may be hard-committed prior to printing or relieving the inventory. For World: When the hard/soft 
commit option is set to 2 or 3, any line item in the parts list may be hard committed prior to printing or relieving the inventory. Valid codes are:    1   
Hard commitment    2   Soft commitment, hard commitment when printing (P31410)    3   Soft commitment For OneWorld: To specify how the 
program commits inventory, click one of the following options under the Hard/Soft Commit heading:     o Hard at creation of parts list     o Soft, Hard 
when printing (P31410)     o Soft at creation of parts list

cErrorCodeERRCcharNONENONE

This error code indicates if any errors occurred during the creation of the Trip Document Detail (F4914) records by the Delivery Document 
Set Server program (XT4914).

cSuppressErrorMsgEV01charNONENONE

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

szErrorMsgIDDTAIcharNONENONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

Related Functions

B4000260 Line Type - Activity Rules
B4000520 Get Item UoM Conversion Factor
B4200210 Get F4211 Detail Information
B4200260 Write Sales History Or Ledger
B4500200 F4573 Get Next Free Good
B9800100 Get Audit Information
X4101 Validate and Retrieve Item Master

Related Tables

F4211 Sales Order Detail File