Quantcast
Channel: SCN : All Content - Output Management
Viewing all articles
Browse latest Browse all 1353

Watermark as background picture on Smartform page conditionally

$
0
0


I have put this up as I could see that a lot of people had the same question as me but I could not find a good solution here.

 

Q: I want to show REPRINT as a background image on a Smartform BUT only when appropriate. Sometimes, in fact usually, I don't want the background image at all.

 

A: Use the Background Picture tab on the PAGE.

 

Set the Name, Object, ID and 'Determine Dynamically' values to be variables.

 

Put logic in the Initialization section to set the values of variables as required. This logic ALWAYS sets the variables to point to an image even when you want to display NOTHING.

 

The trick is to have an empty image saved (ie. some whitespace saved in MS paint or similar and uploaded into SAP via SE78). So my logic was to set the variables to the name and attributes of my 'Reprint' background image when appropriate but to set them to the name and attributes of the empty image if 'Reprint' was not required.

 

*---------------------------------------------------------------------*
*      FORM set_repeat_background_image                                            *
*---------------------------------------------------------------------*
*      If this is a repeat print, set the background image otherwise
*      none is required.
*---------------------------------------------------------------------*
form set_repeat_background_image
using i_v_repeat type flag
changing o_V_REPRINT_LOGO        type tdobname
          o_V_GRAPHIC_OBJECT_TYPE type tdobjectgr
          o_V_BMAP_ID            type tdidgr
          o_v_bmap_type          type tdbtype.

constants:
l_c_REPRINT_image        type tdobname  value 'Z_REPRINT_TEST8',
l_c_no_image            type tdobname  value 'Z_BMAP_EMPTY_IMAGE',
l_c_GRAPHIC_OBJECT_TYPE  type tdobjectgr value 'GRAPHICS',
l_c_BMAP_ID              type tdidgr    VALUE 'BMAP',
l_c_BCOL_TYPE            type tdBTYPE    VALUE 'BCOL',
l_c_BMON_TYPE            type tdBTYPE    VALUE 'BMON'.

CLEAR:
o_v_reprint_logo,
o_V_GRAPHIC_OBJECT_TYPE,
o_V_BMAP_ID.

if i_v_repeat is not initial.
  o_v_reprint_logo        = l_c_reprint_image.
  o_V_GRAPHIC_OBJECT_TYPE = l_c_GRAPHIC_OBJECT_TYPE.
  o_V_BMAP_ID            = l_c_BMAP_ID.
  o_V_BMAP_TYPE          = l_c_BCOL_TYPE.
else.
  o_v_reprint_logo        = l_c_no_image.
  o_V_GRAPHIC_OBJECT_TYPE = l_c_GRAPHIC_OBJECT_TYPE.
  o_V_BMAP_ID            = l_c_BMAP_ID.
  o_V_BMAP_TYPE          = l_c_BMON_TYPE.
endif.

endform.


Viewing all articles
Browse latest Browse all 1353

Trending Articles