| icXmlHandle | input | character | XmlHandle: String that represents the Handle that refers to the XML file that represents the address and contact data that you want to insert into Scba. This handle should be valid and created like this; Create X-document <handle> <handle>:load("File":U,<file-name>) |
| icXmlFileName | input | character | XmlFileName; You can specify a relative pathname, an absolute pathname, or an HTTP URL.. Make sure the file is available to the server where this API is running on. This parameter will only be used if parameters ihXmlFileHandle and tApiXml are invalid, unknown or empty. |
| icAction | input | character | Action Possible values; "SAVE": data will be saved (if errors then no further actions will be taken) "SAVESTORE": data will be saved (it errors then the data will be stored (=DraftInstance) if possible but you will find tFcMessages that contain the reason why the save failed) "STORE": data will be stored (=DraftInstance) if possible "VALIDATE": dat will only be validated. |
| ocLstPrimKey | output | character | LstPrimKey Char4 separated list with the primary keys of the newly created main-table records. The fields of a primkey are separated with Char2. E.g. 1<Char2>2002<Char2>100<Char4>1<Char2>2002<Char2>101 |
| ocLstReturn | output | character | LstReturn Char4 separated list with the return-status of the newly created main-table records. Zero means no errors occured. E.g. 0<Char4>-1<Char4>-504<Char4>1<Char4>0 |
| ocLstRowid | output | character | LstRowid Char4 separated list with the temporarely rowids (negative for new ones) of the newly created main-table records. . E.g. -1<Char2>aox00098001<Char2>-26 |
| oiReturnStatus | output | integer | Return status of the method. |
/* Clear all data from any previous attempts. */
assign vcMessage = "":U.
empty temp-table tApiBankNumber.
empty temp-table tApiBankNumberPayCode.
<M-3 run MainBlock () in XML>
/* We must do this due to some change that the parent variable will
* contain an invalid handle further in the procedure. */
assign vhXmlComponent = vhFcComponent.
/* When this fails, there is no reason to continue, so inform the
* the user and return. */
/*V8
<M-? run GetXDocHandle (input icXmlHandle (icXmlHandle),
input tApiXmlBankNumber (tApiXml),
input icXmlFileName (icXmlFileName),
output vcMessage (ocErrorMessage),
output vhXmlComponentDocument (ohXDocHandle),
output viFcReturnSuper (oiReturnStatus)) in XML>
*/
if viFcReturnSuper <> 0
then do:
run gipr_DeleteProcedure in vhXmlComponent no-error.
delete procedure vhXmlComponent no-error.
assign oiReturnStatus = viFcReturnSuper.
<M-5 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1567':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
return.
end.
/* When this fails, there is no reason to continue, so inform the
* the user and return. */
<M-6 run ConvertXmlToTable (input {&TARGETPROCEDURE} (ihComponent),
input vhXmlComponentDocument (ihParentNode),
input string(buffer tApiBankNumber:handle) + ',BankNumber':U (icTables),
output tTableRefXmlBankNumber (tTableRef),
output viFcReturnSuper (oiReturnStatus)) in XML>
run gipr_DeleteProcedure in vhXmlComponent no-error.
delete procedure vhXmlComponent no-error.
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
<M-7 run SetMessage
(input trim(#T-9'The XML file could not be converted to the corresponding temp table. If this problem persists, contact your system administrator.':255(377)t-9#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1568':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
return.
end.
/* TODO: When relations are used, this is the place to add them
* (through the tTableRefXmlCreditor temp-table). */
/* Since our input Xml document is now converted into a temp-table,
* just call the MaintainTT method on this component to finish the job. */
<M-8 run ApiStdMaintainTT (input tApiBankNumber (tApiBankNumber),
input tApiBankNumberPayCode (tApiBankNumberPayCode),
input icAction (icAction),
output ocLstPrimKey (ocLstPrimKey),
output ocLstReturn (ocLstReturn),
output ocLstRowid (ocLstRowid),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>define temp-table ttContext no-undo
field propertyQualifier as character
field propertyName as character
field propertyValue as character
index entityContext is primary unique
propertyQualifier
propertyName
index propertyQualifier
propertyQualifier.
define dataset dsContext for ttContext.
define variable vhContextDS as handle no-undo.
define variable vhExceptionDS as handle no-undo.
define variable vhServer as handle no-undo.
define variable vhInputDS as handle no-undo.
define variable vhInputOutputDS as handle no-undo.
define variable vhOutputDS as handle no-undo.
define variable vhParameter as handle no-undo.
/* Create context */
create ttContext.
assign ttContext.propertyName = "programName"
ttContext.propertyValue = "BBankNumber".
create ttContext.
assign ttContext.propertyName = "methodName"
ttContext.propertyValue = "ApiStdMaintainXml".
create ttContext.
assign ttContext.propertyName = "applicationId"
ttContext.propertyValue = "fin".
create ttContext.
assign ttContext.propertyName = "entity"
ttContext.propertyValue = "1000".
create ttContext.
assign ttContext.propertyName = "userName"
ttContext.propertyValue = "mfg".
create ttContext.
assign ttContext.propertyName = "password"
ttContext.propertyValue = "".
/* Create input dataset */
create dataset vhInputDS.
vhInputDS:read-xmlschema("file", "xml/bbanknumber.apistdmaintainxml.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().
assign vhParameter::icXmlHandle = <parameter value>
vhParameter::icXmlFileName = <parameter value>
vhParameter::icAction = <parameter value>.
/* Connect the AppServer */
create server vhServer.
vhServer:connect("-URL <appserver-url>").
if not vhServer:connected()
then do:
message "Could not connect AppServer" view-as alert-box error title "Error".
return.
end.
/* Run */
assign vhContextDS = dataset dsContext:handle.
run program/rpcrequestservice.p on vhServer
(input-output dataset-handle vhContextDS by-reference,
output dataset-handle vhExceptionDS,
input dataset-handle vhInputDS by-reference,
input-output dataset-handle vhInputOutputDS by-reference,
output dataset-handle vhOutputDS).
/* Handle output however you want, in this example, we dump it to xml */
if valid-handle(vhExceptionDS)
then vhExceptionDS:write-xml("file", "Exceptions.xml", true).
if valid-handle(vhOutputDS)
then vhOutputDS:write-xml("file", "Output.xml", true).
/* Cleanup */
vhServer:disconnect().
assign vhServer = ?.
if valid-handle(vhInputDS)
then delete object vhInputDS.
if valid-handle(vhOutputDS)
then delete object vhOutputDS.
if valid-handle(vhExceptionDS)
then delete object vhExceptionDS.