Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Seeburger variable?

Hey Experts,

I need to create a Seeburger variable and if a given condition is met, increase it and save it again with that new value (and so on), if not leave it like it was loaded initially with any change

for example, i have created a Seeburger variable called "CounterVar"

CounterVar at first try will be 0

Could anyone provide a example java code to do that? (I do know about Seeburger variables but I really don't understand much of Java code to do that)

Thanks!

replied

This is working for me :

//write your code here

        • Code for reading and incrementing the variable*

try {

CounterBean be=CounterFactory.getCounterInstance();

return ""+be.nextCounter(a );

} catch (Exception e) {

throw new RuntimeException(e.getMessage());

}

It increment the counter and return.

If you want to set variable first time :

try {

VariableBean be=VariableFactory.getVariableInstance("");

be.setStringVariable("VARIABLENAME",value);

return "";

} catch (Exception e) {

throw new RuntimeException(e);

}

If you only want to read the variable :

try {

VariableBean be=VariableFactory.getVariableInstance("");

return be.getStringVariable("VARIABLENAME");

} catch (Exception e) {

throw new RuntimeException(e);

}

Let me know if you have any difficulties regarding the same.

Thanks & Regards,

Dijesh Tanna.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question