Saturday, September 10, 2011

BC427: Classic BAdI


The following figure shows how a program exit that is implemented using the classic BAdI technology works.


A BAdI definition is called and a BAdI interface is specified in TCODE SE18.This automatically generates a BAdI adapter class and the corresponding bridging method, which SAP application calls to branch to the relevent program.The only task for this bridging method is to call existing active implementation methods of industry solutions , partners and customers one after the other. The sequence in which they are called is not specified.
The following figure shows the syntax that is used to prepare and call the bridging method in the SAP program.


in the SAP program, after you define the BAdI and generate the adapter class including the bridging method, a type is assigned to a reference variable using the BAdI interface.
when the static method GET_INSTANCE of the standard class CL_EXITHANDLER is called , an instance of the adapter class (BAdI instance) is created.
The briding method in the BAdI instance is then called and it branches to the relevant program.

The following figures show how to find the classic BAdI in SAP programs and how to use them for enhancements.

Tuesday, September 6, 2011

WebMethods , REPEAT Step


REPEAT Step :
The REPEAT step allows you to conditionally repeat a sequence of child steps based on the success or failure of those steps.You can use REPEAT to :
.  Re-excute (retry) a set of steps if any step within the set fails.
.Re-execute a set of steps until one of the steps within the set fails.


.Specifying the REPEAT Condition : Repeat on (FAILURE or SUCCESS) .


.Specifying the REPEAT Counter :
0 : does not re-execute children.
Any value > 0 : re-execute children up to this number of times.
-1 or blank : re-execute children as long as the specified Repeat on condition is true.


Important :
 note that the children of a REPEAT always execute at least once. The Counter property specifies the maximum number the children will be re-executed.




Using REPEAT to Retry a Failed Step
If your flow invokes services that access external systems, you can use the REPEAT step to accommodate network errors, such as busy servers or connection errors, at run time. If you use the REPEAT step for this purpose, keep the following points in mind:
􀂄 The following types of failures satisfy the FAILURE condition:
􀂄 Expiration of a child step’s Timeout limit
􀂄 An exception thrown by a Java service
􀂄 A document query that returns an unpermitted null value
􀂄 If you specify multiple children under a REPEAT step, the failure of any one of the children will cause the entire set of children to be re-executed.
􀂄 The REPEAT step immediately exits a set of children at the point of failure (that is, if the second child in a set of three fails, the third child is not executed).
􀂄 When Repeat on is set to FAILURE, the failure of a child within a REPEAT step does not cause the REPEAT step itself to fail unless the Count limit is also reached.
􀂄 The Timeout property for the REPEAT step specifies the amount of time in which the entire REPEAT step, including all of its possible iterations, must complete. When you use REPEAT to retry on failure, you may want to leave the Timeout value at 0 (no limit) or set it to a very high value. You can also set the property to the value of a pipeline variable by typing the name of the variable between % symbols.
􀂄 As a developer, you must be thoroughly familiar with the processes you include  within a REPEAT step. Make  certain that the child steps you specify can safely be repeated in the event that a failure occurs. You don’t want to use REPEAT if there is  the possibility that a single action, such as accepting an order or crediting an account balance, could be applied twice.

Using REPEAT to Retry a Successful Step
Apart from using REPEAT to retry a failed step, you can also use it as a looping device to repeat a series of steps until a failure occurs.
If you use the REPEAT step to re-execute successful child steps, keep the following points in mind:
􀂄 The success condition is met if all children of the REPEAT step execute without returning a single exception.
􀂄 If one child in the set fails, the REPEAT step exits at the point of failure, leaving the remaining children unexecuted.
􀂄 The failure of a child does not cause the REPEAT step to fail; it merely ends the loop.
(In this case, the REPEAT step itself succeeds and execution of the flow proceeds normally).

NET100 : ITS , Introduction

















BC427 , Unit3 (cont) : Enhancements in Other SAP Objects


Other Implicit Enhancement Points :

What else Can We Implicitly Enhance :

How to Enhance these objects (subroutine , include , structure) :
1. Display the source code of the corresponding SAP object
2. in the GUI status , choose the enhancement button
3.choose the options Edit-->Enhancement Operation -->Show Implicit Enhancement Options to show the implicit enhancement options.
4. in the editor , put the cursor on one of the implicit enhancement points/options to and from the context menu create the enhancement implementation.
5.Insert the source code.
6. In GUI status , choose 'Activate Enhancements'.

Important  :
when you enhance a structure (type ) decleration (before 'END OF ...') you must use the syntax.
DATA: <additional field1> TYPE <TYPE1>,<Additional field 2 > TYPE <TYPE2> ,..
otherwise it would give a syntax error.


BC427 : Unit 3(Cont) : Enhancements in local Classes


Implicit Enhancement Classes:

What  Can We Implicitly Enhance in local SAP Classes:

How to Enhance Local SAP Classes   :
1. Display the source code of the local   class
2. in the GUI status , choose the enhancement button
3.choose the options Edit-->Enhancement Operation -->Show Implicit Enhancement Options to show the implicit enhancement options.
4. in the editor , put the cursor on one of the implicit enhancement points/options to and from the context menu create the enhancement implementation.
5.Insert the source code.
6. In GUI status , choose 'Activate Enhancements'.




Monday, September 5, 2011



Branching on an Expression :

When you branch on an expression , you assign an expression to each child of a branch step. At run time , The BRANCH step evaluates the expression assigned to the child steps. It excutes the first child step with an expression that evaluates to true.


To Branch on an expression :

1.Create a list of the conditional steps (target steps) and make them children of the BRANCH step.

2 In the Properties panel for the BRANCH step, set Evaluate labels to True.

3 In the Label property of each target, specify the expression that, when true, will cause the target step to execute. The expressions you create can include multiple variables and can specify a range of values for variables. Use the syntax provided by webMethods to create the expression. For more information about expression syntax, see Appendix D, “Conditional Expressions”.





* only one step will be executed .

* To define a default step , write $default  in the label property of the default step.


Branch to Null  or Empty ?




Branch
on

When
to use it ?

how ?

Null

if the switch variables is
explicitly set to null or does not exist in the pipeline. you can use $null with
any type of switch variable

set label property to $null

Empty

if the switch variable is present but
contains no characters . you can use it with type
string only.

leave the label property blank



Important!
If you branch on expressions (Evaluate labels is set to True), you cannot branch on null or empty values. When executing the BRANCH step and evaluating labels, the server ignores target steps with a blank or $null label.




example :

The following example shows a BRANCH step used to authorize a credit card number based on the buyer’s credit card type (CreditCardType). It contains three target steps. The first target step handles situations
where the value of CreditCardType is null or where
CreditCardType does not exist in the pipeline. The second target step handles cases where the value of CreditCardType is an empty string. (Note that the first two target steps are EXIT steps that will return a failure condition when executed.) The third target step has
the $default label, and will process all specified credit card types.












Important!

You can only have one default target step for a BRANCH step.
Developer always evaluates the default step last. The default step does not need to be the last child of the BRANCH step.




If you want to use the value of a pipeline variable for this property, type the variable name between % symbols (e.g. %expression%).





Sunday, September 4, 2011

WebMethods: Invoke Step , Branch on Value

You use the INVOKE step to request a service within a flow. You can use the INVOKE step to:
 

When you build a BRANCH step, you can:


􀂄 Invoke any type of service, including other flow services and Web service connectors.

􀂄 Invoke any service for which the caller of the current flow has access rights on the local webMethods Integration Server.

􀂄 Invoke built-in services and services on other webMethods Integration Servers.

􀂄 Invoke flow services recursively (that is, a flow service that calls itself). If you use a flow service recursively, bear in mind that you must provide a means to end the recursion.
* Built-in services reside in the WmPublic package
 

Invoking a Service on Another webMethods Integration
Server You can use the built-in service pub.remote:invoke to invoke a service on a remote Integration Server and return the results. The remote server is identified by an alias, which is configured on the Remote Servers screen in the Integration Server Administrator. The
pub.remote:invoke service automatically handles opening a session and authentication on the remote server.


The pub.remote:invoke service resides in the WmPublic package and requires the alias of the remote server and the fully qualified name of the service that you want to invoke as input.


The BRANCH Step
The BRANCH step allows you to conditionally execute a step based on the value of a variable at run time. For example, you might use a BRANCH step to process a purchase order one way if the PaymentType value is “CREDIT CARD” and another way if it is “CORP ACCT”.

When you build a BRANCH step, you can:
 

􀂄 Branch on a switch value. Use a variable to determine which child step executes. At run time, the BRANCH step matches the value of the switch variable to the Label property of each of its targets. It executes the child step whose label matches the value of the switch.
􀂄 Branch on an expression. Use an expression to determine which child step executes. At run time, the BRANCH step evaluates the expression in the Label property of each child step. It executes the first child step whose expression evaluates to “true.”