What more a Business Service can do?
- by Rajesh Sharma
Business services can be accessed from outside the application via XAI inbound service, or from within the application via scripting, Java, or info zones. Below is an example to what you can do with a business service wrapping an info zone.
Generally, a business service is specific to a page service program which references a maintenance object, that means one business service = one service program = one maintenance object.
There have been quite a few threads in the forum around this topic where the business service is misconstrued to perform services only on a single object, for e.g. only for CILCSVAP - SA Page Maintenance, CILCPRMP - Premise Page Maintenance, CILCACCP - Account Page Maintenance, etc.
So what do you do when you want to retrieve some "non-persistent" field or information associated with some object/entity? Consider few business requirements:
· Retrieve all the field activities associated to an account.
· Retrieve the last bill date for an account.
· Retrieve next bill date for an account.
It can be as simple as described below, for this post, we'll use the first scenario - Retrieve all the field activities associated to an account. To achieve this we'll have to do the following:
Step 1: Define an info zone
(A basic Zone of type F1-DE-SINGLE - Info Data Explorer - Single SQL has been used; you can use F1-DE - Info Data Explorer - Multiple SQLs for more complex scenarios)
Parameter Description
Value To Enter
User Filter 1
F1
Initial Display Columns
C1 C2 C3
SQL Condition
F1
SQL Statement
SELECT
FA_ID, FA_STATUS_FLG, CRE_DTTM
FROM
CI_FA
WHERE
SP_ID IN
(SELECT SP_ID
FROM CI_SA_SP
WHERE
SA_ID IN
(SELECT SA_ID
FROM CI_SA
WHERE
ACCT_ID = :F1))
Column 1
source=SQLCOL sqlcol=FA_ID
Column 2
source=SQLCOL sqlcol=FA_STATUS_FLG
Column 3
type=TIME source=SQLCOL sqlcol=CRE_DTTM order=DESC
Note: Zone code specified was 'CM_ACCTFA'
Step 2: Define a business service
Create a business service linked to 'Service Name' FWLZDEXP - Data Explorer.
Schema will look like this:
<schema>
<zoneCd mapField="ZONE_CD" default="CM_ACCTFA"/>
<accountId mapField="F1_VALUE"/>
<rowCount mapField="ROW_CNT"/>
<result type="group">
<selectList type="list" mapList="DE">
<faId mapField="COL_VALUE">
<row mapList="DE_VAL">
<SEQNO is="1"/>
</row>
</faId>
<status mapField="COL_VALUE">
<row mapList="DE_VAL">
<SEQNO is="2"/>
</row>
</status>
<createdDateTime mapField="COL_VALUE">
<row mapList="DE_VAL">
<SEQNO is="3"/>
</row>
</createdDateTime>
</selectList>
</result>
</schema>
What's next? As mentioned above, you can invoke this business service from an outside application via XAI inbound service or call this business service from within a script.
Step 3: Create a XAI inbound service for above created business service
Step 4: Test the inbound service
Go to XAI Submission and test the newly created service
<RXS_AccountFA>
<accountId>5922116763</accountId>
</RXS_AccountFA>