cancel
Showing results for 
Search instead for 
Did you mean: 

if condition

Former Member
0 Kudos

Hi All,

Does If condition work in Text in smartforms?

I have a requirement where in i have to print different text based on different conditions. I have put the condition in If , ifelse statement in texts in smartforms. But all the texts are getting printed. I dont want to use the condition tab when declaring the text. Pls help.

Thanks,

Raju

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Pls follow the below steps to get your requirement fulfill.

1. First of all create three variables in "Global Definition", Like w_text1, w_text2 & W_text3.

2.There is a initialization tab is well, you can use that to intialize some variable..

3.Now goto that node where you like use these text, now right click -> create -> program lines (Here you will get abap editor works same as SE38)

4. write your code like that:

if condition1 = true. 
w_text 1= 'Testing text 1'. 
endif. 
if condition2 = true. 
w_text 2= 'Testing text 2'. 
endif. 
if cond3 = true. 
w_text3 = 'Testing text 3'. 
endif.

5.Now create a "TEXT" Node in that, click on the editor tab, end put your w_text1,2 ,3... whatever you like to display. I will according to your condition now.

Pls tell me if anything is unclear.

Regards,

Lokesh.

Answers (4)

Answers (4)

prakashjasti
Contributor
0 Kudos

goto condition tab of the text and directly place the condition

Former Member
0 Kudos

Raj,

You need to use one 'Program Lines' node to add your logic. It exactly works like SE38.

You right click on the previous node of the text element which you want to display your text in. Select Create -> Flow Logic -> Program Lines. And cut the logic which you have written in text element and paste it in the program lines. And define the variables as import and export parameters, which you are getting from outside of this program lines. This program lines will populate the text variables which you can display using text element nodes.

But that text element should be placed after program lines.

Hope it will help you.

Former Member
0 Kudos

Hi Raju,

You can use Alternative option in the smartforms.

Right click on the Window--> Create --> Flow logic --> Alternative.

Thanks,

Chinmay

Former Member
0 Kudos

Go to the Tree node where you want to create the condition, Right click->Select Create ->Flow Logic -> Alternative. Create your condition here.

Regards

Vinod