Application Development 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: 

Smart forms: I want to display only the non empty lines

0 Kudos
291

Hi, I have multiple variables on same text note, how to suppress the variable whose value is initial,

because the variable which doesn't have any value showing a blank line it the print output.

Below &wa_final-so_desc4& and &wa_final-so_desc4& doesn't have any value assigned, but in print output they are showing as blank lines.

&WA_FINAL-SO_DESC1(C)&

&WA_FINAL-SO_DESC2(C)&

&WA_FINAL-SO_DESC3(C)&

&WA_FINAL-SO_DESC4(C)&

&WA_FINAL-SO_DESC5(C)&

&WA_FINAL-TI(C)&

2 REPLIES 2

Foivos
Participant

Sandra_Rossi
Active Contributor
260

You could:

  • define a new variable of type TSFTEXT, named say "IT_TEXT"
  • add a Code node before your Text node with code below,
  • define text node as being the variable IT_TEXT

If you don't really need the (C) option (condense spaces), this way is the shortest code:

it_text = VALUE #(
    ( tdformat = '*' tdline = WA_FINAL-SO_DESC1 )
    ( tdformat = '*' tdline = WA_FINAL-SO_DESC2 )
    ( tdformat = '*' tdline = WA_FINAL-SO_DESC3 )
    ( tdformat = '*' tdline = WA_FINAL-SO_DESC4 )
    ( tdformat = '*' tdline = WA_FINAL-SO_DESC5 )
    ( tdformat = '*' tdline = WA_FINAL-TI ) ).
DELETE it_text WHERE tdline IS INITIAL.

Otherwise:

CLEAR it_text.
IF WA_FINAL-SO_DESC1 IS NOT INITIAL.
  APPEND VALUE #( tdformat = '*' tdline = '&WA_FINAL-SO_DESC1(C)&' ) TO it_text.
ENDIF.
IF WA_FINAL-SO_DESC2 IS NOT INITIAL.
  APPEND VALUE #( tdformat = '*' tdline = '&WA_FINAL-SO_DESC2(C)&' ) TO it_text.
ENDIF.
IF WA_FINAL-SO_DESC3 IS NOT INITIAL.
  APPEND VALUE #( tdformat = '*' tdline = '&WA_FINAL-SO_DESC3(C)&' ) TO it_text.
ENDIF.
IF WA_FINAL-SO_DESC4 IS NOT INITIAL.
  APPEND VALUE #( tdformat = '*' tdline = '&WA_FINAL-SO_DESC4(C)&' ) TO it_text.
ENDIF.
IF WA_FINAL-SO_DESC5 IS NOT INITIAL.
  APPEND VALUE #( tdformat = '*' tdline = '&WA_FINAL-SO_DESC5(C)&' ) TO it_text.
ENDIF.
IF WA_FINAL-TI IS NOT INITIAL.
  APPEND VALUE #( tdformat = '*' tdline = '&WA_FINAL-TI(C)&' ) TO it_text.
ENDIF.