Description
This method deletes element by it's ID.
Parameters
icSharedSetTypeCode | input | character | |
iiObjectId | input | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bsharedsetmerge.p)
/* =================================================================================================== */
/* Method : MergeDeleteElement */
/* Desc : This method deletes element by it's ID. */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) SharedSetTypeCode Code of shared set type */
/* (I) ObjectId Id of the element to be deleted */
/* =================================================================================================== */
assign oiReturnStatus = -98
viExternalReturnStatus = 0.
/* =================================================================================================== */
/* Normalize input parameters */
/* =================================================================================================== */
if icSharedSetTypeCode = '':U then assign icSharedSetTypeCode = ?.
if iiObjectId = 0 then assign iiObjectId = ?.
/* =================================================================================================== */
/* Validate input parameters */
/* ============0======================================================================================= */
if icSharedSetTypeCode = ? or
iiObjectId = ?
then do:
assign vcMessage = #T-1'You have not entered all the mandatory values.':255(63250)t-1#
vcContext = 'SharedSetTypeCode=&1|ObjectId=&2':U
vcContext = substitute(vcContext, icSharedSetTypeCode, iiObjectId)
vcContext = replace(vcContext, '|':U, chr(2)).
<M-2 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6627':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input vcContext (icFcContext),
output viExternalReturnStatus (oiReturnStatus)) in BSharedSetMerge>
assign oiReturnStatus = -1.
return.
end.
/* =================================================================================================== */
/* Delete element */
/* =================================================================================================== */
assign vhFcComponent = ?
vcKey = 'Primary=':U + string(iiObjectId).
case icSharedSetTypeCode:
when {&SHAREDSETTYPECODE-COSTCENTRE}
then do:
<I-13 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BCostCentre"}>
<M-3 run apiDeleteInstance
(input vcKey (icKey),
output viExternalReturnStatus (oiReturnStatus)) in BCostCentre>
<I-14 {bFcCloseAndStopInstance
&CLASS = "BCostCentre"}>
end.
when {&SHAREDSETTYPECODE-CREDITOR}
then do:
<I-15 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BCreditor"}>
<M-4 run apiDeleteInstance
(input vcKey (icKey),
output viExternalReturnStatus (oiReturnStatus)) in BCreditor>
<I-16 {bFcCloseAndStopInstance
&CLASS = "BCreditor"}>
end.
when {&SHAREDSETTYPECODE-DEBTOR}
then do:
<I-17 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BDebtor"}>
<M-5 run apiDeleteInstance
(input vcKey (icKey),
output viExternalReturnStatus (oiReturnStatus)) in BDebtor>
<I-18 {bFcCloseAndStopInstance
&CLASS = "BDebtor"}>
end.
when {&SHAREDSETTYPECODE-DIVISION}
then do:
<I-11 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BDivision"}>
<M-6 run apiDeleteInstance
(input vcKey (icKey),
output viExternalReturnStatus (oiReturnStatus)) in BDivision>
<I-12 {bFcCloseAndStopInstance
&CLASS = "BDivision"}>
end.
when {&SHAREDSETTYPECODE-EXCHANGERATE}
then do:
<I-19 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BExchangeRate"}>
<M-7 run apiDeleteInstance
(input vcKey (icKey),
output viExternalReturnStatus (oiReturnStatus)) in BExchangeRate>
<I-20 {bFcCloseAndStopInstance
&CLASS = "BExchangeRate"}>
end.
when {&SHAREDSETTYPECODE-GL}
then do:
<I-21 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BGL"}>
<M-8 run apiDeleteInstance
(input vcKey (icKey),
output viExternalReturnStatus (oiReturnStatus)) in BGL>
<I-22 {bFcCloseAndStopInstance
&CLASS = "BGL"}>
end.
when {&SHAREDSETTYPECODE-JOURNAL}
then do:
<I-23 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BJournal"}>
<M-9 run apiDeleteInstance
(input vcKey (icKey),
output viExternalReturnStatus (oiReturnStatus)) in BJournal>
<I-24 {bFcCloseAndStopInstance
&CLASS = "BJournal"}>
end.
when {&SHAREDSETTYPECODE-PROJECT}
then do:
<I-25 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BProject"}>
<M-10 run apiDeleteInstance
(input vcKey (icKey),
output viExternalReturnStatus (oiReturnStatus)) in BProject>
<I-26 {bFcCloseAndStopInstance
&CLASS = "BProject"}>
end.
end case.
if viExternalReturnStatus <> 0 then assign oiReturnStatus = viExternalReturnStatus.
if viExternalReturnStatus < 0 then return.
/* =================================================================================================== */
/* Return */
/* =================================================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.