Use of API in QAD EE
/*Sample API Program to create currency in QAD EE*/
{us/mf/mfdtitle.i}
{us/bbi/gplabel.i}
{us/wb/wbrp01.i}
{us/gl/glsec.i}
{us/gp/gpuid.i}
{proxy/bcurrencydef.i }
/* ======== FOR API ========= */
DEFINE VARIABLE viReturn AS INTEGER NO-UNDO.
DEFINE VARIABLE ilReturnDataset AS LOGICAL NO-UNDO.
DEFINE VARIABLE ilPartialUpdate AS LOGICAL NO-UNDO.
DEFINE VARIABLE icPartialUpdateExceptionList AS CHARACTER NO-UNDO.
DEFINE VARIABLE ocPrimaryKey AS CHARACTER NO-UNDO.
DEFINE VARIABLE ocRowid AS CHARACTER NO-UNDO.
DEFINE VARIABLE oiDraftInstance AS INTEGER NO-UNDO.
DEFINE VARIABLE ocPrimaryKeyName AS CHARACTER NO-UNDO.
DEFINE VARIABLE vho AS HANDLE.
DEFINE VARIABLE oiReturnStatus AS INTEGER NO-UNDO.
empty temp-table tCurrency.
for first RoundingMethod no-lock where RoundingMethodCode = "2" :
End.
create tCurrency.
Assign
tCurrency.Currency_ID = 9999 /*int*/
tCurrency.RoundingMethod_ID = RoundingMethod.RoundingMethod_ID /*int*/
tCurrency.CurrencyCode = "INP" /*char*/
tCurrency.CurrencyDescription = "INDIAN CURRENCY" /*char*/
tCurrency.CurrencyIsActive = YES /*log*/
tCurrency.tcRoundingMethodCode = RoundingMethod.RoundingMethodCode /*char*/
tCurrency.tcRoundingMethodDescription = RoundingMethod.RoundingMethodDescription /*char*/
tCurrency.tc_Rowid = "101". /*char*/
run proxy/bcurrency.p persistent set vhProxyComponent.
run ApiMaintainByDatasetWithOutput in vhProxyComponent
(input "0675",
input "save",
input true,
input true,
input icPartialUpdateExceptionList,
input dataset Bcurrency by-reference,
output ocPrimaryKey,
output ocRowid,
output oiDraftInstance,
output ocPrimaryKeyName,
output DATASET-HANDLE vho,
output dataset tFcMessages,
output oiReturnStatus).
Message ocPrimaryKey oiReturnStatus view-as alert-box.
FOR EACH tFcMessages no-lock :
DISPLAY
tFcMessages
WITH FRAME a side-label.
end.
delete procedure vhProxyComponent.
{us/mf/mfdtitle.i}
{us/bbi/gplabel.i}
{us/wb/wbrp01.i}
{us/gl/glsec.i}
{us/gp/gpuid.i}
{proxy/bcurrencydef.i }
/* ======== FOR API ========= */
DEFINE VARIABLE viReturn AS INTEGER NO-UNDO.
DEFINE VARIABLE ilReturnDataset AS LOGICAL NO-UNDO.
DEFINE VARIABLE ilPartialUpdate AS LOGICAL NO-UNDO.
DEFINE VARIABLE icPartialUpdateExceptionList AS CHARACTER NO-UNDO.
DEFINE VARIABLE ocPrimaryKey AS CHARACTER NO-UNDO.
DEFINE VARIABLE ocRowid AS CHARACTER NO-UNDO.
DEFINE VARIABLE oiDraftInstance AS INTEGER NO-UNDO.
DEFINE VARIABLE ocPrimaryKeyName AS CHARACTER NO-UNDO.
DEFINE VARIABLE vho AS HANDLE.
DEFINE VARIABLE oiReturnStatus AS INTEGER NO-UNDO.
empty temp-table tCurrency.
for first RoundingMethod no-lock where RoundingMethodCode = "2" :
End.
create tCurrency.
Assign
tCurrency.Currency_ID = 9999 /*int*/
tCurrency.RoundingMethod_ID = RoundingMethod.RoundingMethod_ID /*int*/
tCurrency.CurrencyCode = "INP" /*char*/
tCurrency.CurrencyDescription = "INDIAN CURRENCY" /*char*/
tCurrency.CurrencyIsActive = YES /*log*/
tCurrency.tcRoundingMethodCode = RoundingMethod.RoundingMethodCode /*char*/
tCurrency.tcRoundingMethodDescription = RoundingMethod.RoundingMethodDescription /*char*/
tCurrency.tc_Rowid = "101". /*char*/
run proxy/bcurrency.p persistent set vhProxyComponent.
run ApiMaintainByDatasetWithOutput in vhProxyComponent
(input "0675",
input "save",
input true,
input true,
input icPartialUpdateExceptionList,
input dataset Bcurrency by-reference,
output ocPrimaryKey,
output ocRowid,
output oiDraftInstance,
output ocPrimaryKeyName,
output DATASET-HANDLE vho,
output dataset tFcMessages,
output oiReturnStatus).
Message ocPrimaryKey oiReturnStatus view-as alert-box.
FOR EACH tFcMessages no-lock :
DISPLAY
tFcMessages
WITH FRAME a side-label.
end.
delete procedure vhProxyComponent.
Comments
I am getting error as BLF-412.
Any idea what is it?
if you are getting error BLF-412, then just change the entity code from 0675 to your entity code.