Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Coding in Smartform inside a Text Box

vivekkrishnan
Active Participant
0 Likes
1,288

Hi All,

Whether this code is correct inside a text box in a Smartform ?

😕 IF &GS_NAME1& <> ''.

  • <T2>&GS_NAME1&</>

ENDIF.

😕 IF &GS_NAME2& <> ''.

  • <T2>&GS_NAME2&</>

😕 ENDIF.

Thanks in Advance ,

Vivek K ..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
976

You can't put code like that in a Smartform textbox. What you can do is in the General Attributes tab, hit the Insert Field button and enter &GS_NAME1&. Then in the Conditions tab put GS_NAME1 in the 'field' column, <> in the 'Relational Operator' column, and INITIAL in the 'Comparison value' column.

Now the GS_NAME1 will only print if it is not initial.

Do the same for another text node for NAME2.

4 REPLIES 4
Read only

Former Member
0 Likes
977

You can't put code like that in a Smartform textbox. What you can do is in the General Attributes tab, hit the Insert Field button and enter &GS_NAME1&. Then in the Conditions tab put GS_NAME1 in the 'field' column, <> in the 'Relational Operator' column, and INITIAL in the 'Comparison value' column.

Now the GS_NAME1 will only print if it is not initial.

Do the same for another text node for NAME2.

Read only

Former Member
0 Likes
976

As suggested in the first post, you cannot use such coding. You may use variables as you would use it in any ABAP program. The only difference is: the variable has to be part of import/export parameters (of the individual code element) for you to use it in the code.

Raj

Reward points if helpful

Read only

Former Member
0 Likes
976

You cannot use IF statements inside the smartforms text nodes.

In you case, you need to create two text nodes.

one to print <T2>&GS_NAME1&</>, in the condition tabs update the condition with field name GS_NAME1 and select <> option on Operartor column and value as Inital for the comparison.

Second to print <T2>&GS_NAME2&</>, in the condition tabs update the condition with field name GS_NAME2 and select <> option on Operartor column and value as Inital for the comparison.

Read only

vivekkrishnan
Active Participant
0 Likes
976

Thank you friends , so i will create separate Text boxes for each of the Texts to be printed with Conditions

Vivek K .