Expand my Community achievements bar.

How to apply condition on subform in adobe form in sap

Avatar

Level 1

Hello all,

How to apply the condition on subform in adobe form in sap abap without using javascript?
i will pass the value from driver code and if 'that' value matches to the 1st condition let's say 'ABC' then first subform should be display and if it matches to 2nd condition let's say 'PQR' then second subform should display.
(if subform get hidden or visible according to condition it is also -OK)

1 Reply

Avatar

Level 10

You can use predicates in the data bindings to create conditions. As an example, you can have the following XML with addresses: 

<addresses>
	<address>
		<country>DE</country>
		<city>Berlin</city>
		<street>Brandenburger Tor</street>
	</address>
	<address>
		<country>DE</country>
		<city>München</city>
		<street>Stachus</street>
	</address>
		<address>
		<country>UK</country>
		<city>London</city>
		<street>Oxford street</street>
	</address>
	<address>
		<country>US</country>
		<city>New York</city>
		<street>Times Square</street>
	</address>
</addresses>

 

Create a data connection based on that XML to your form.

Then create a related fields by dragging the elements from the data connection palette into the design window ob by double clicking them. 

radzmar_0-1726505914730.png

 

Select that newly created subform „address“ and open its binding palette. By default it's bound to $.address[*]. This needs to changed. 

radzmar_1-1726505995195.png

 

Change the string into $.address.[country == "DE"], so it contains a predicate which dictates under which condition the binding should happen. Rename the subform accordingly and remove the Min count. This subform now is only visible, when the XML data contains at least one element where the country is set to "DE". 

radzmar_2-1726506212723.png

 

Duplicate the subform and change the binding for the copy to $.address.[country == "UK"] for UK and so on. The forms hierarchy could looks like this. 

radzmar_3-1726506496673.png

When the XML data is populated into the form, the subforms will be added depending on the conditions met. The colors are just for demonstrations. 

radzmar_5-1726506787923.png