Hello Suman,
If I understood correctly, you have 1. Datasource for which a table fields needs to be checked. 2. Have to post data incase of failure only once. 3. Stop the scheduling once unit is operational and create notification again. .
I would do something like this, something similar to your earlier logic,
1. Use a query to check if the unit is operational or not.
Condition::If not operational,
2. Check if notification is sent, for this use a flag. You can either create a MDO or better create a shared property.
3. Use a conditional action block.. If flag is true, terminate the transaction. Below actions will not be processed. For logging, you can use event logger action block before terminating to print your message. Use transaction terminate action block.
4. If flag is false, Use JCo to update ECC by calling a BAPI.
5. Get the notification number from response. Store it in a shared property.
6. Map this transaction with a scheduler. Schedule it for 10 seconds.
If the unit is operational
1. Get the timestamp from the query.
2. Get notification number from shared property
3.Use JCo to call a BAPI and map the data.
The only issue is you cannot help the query from hitting the database every 10 seconds. If that's the requirement, then I guess there is no other way too. You have to query the database every 10 seconds.
Also, Shared memory variables are accessible across the project and can be used as flags. The same can be used to store the notification number. They are easy to handle too.
For more info on Shared properties check Shared Properties (SAP Library - SAP Manufacturing Integration and Intelligence)
Regards
Tufale Ashai.