8

Create a dynamic logo in smart form through SE38 Program

 1 year ago
source link: https://blogs.sap.com/2023/05/19/create-a-dynamic-logo-in-smart-form-through-se38-program/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
May 19, 2023 2 minute read

Create a dynamic logo in smart form through SE38 Program

Introduction

Dealing with logos is always a big deal in Smart form. This blog shows how to generate a Smart form with a dynamic logo in SE38. The objective is by using the parameter values set dynamic logo in the report program.

Requirement: Pass Purchase document number (EBELN) as input parameter and fetch Document date (BEDAT). If the Purchase document date is lower than require date then, print the First logo. Else print the Second logo.

  • Upload logos in the Graphic library using T-code SE78.
    • Demo Logo 1
3-41.png
    •    Demo Logo 2
4-30.png
  • The below structure is a source of this object. Create a Smart form using the below structure and save it in a local object.
5-30.png
  • Creating a program in Abap editor using T-code SE38. Save it in a local object.
6-25.png
  • Write below code to call smart form through report. In this code, logo name changed based on the condition.
SELECTION-SCREEN BEGIN OF BLOCK b1.
  PARAMETERS p_ebeln TYPE ebeln.
SELECTION-SCREEN END OF BLOCK b1.

DATA: ls_data       TYPE zdemo_str_dym_logo,
      lv_fmname     TYPE rs38l_fnam,
      ls_cntl_parm  TYPE ssfctrlop,
      ls_op_options TYPE ssfcompop,
      lv_date       TYPE sydatum.

SELECT SINGLE ebeln, bedat
  FROM ekko
  INTO @ls_data
       WHERE ebeln = @p_ebeln.

IF ls_data-doc_date <= '20210131'.
  ls_data-logo = 'DEMO LOGO 1'.
ELSE.
  ls_data-logo = 'DEMO LOGO 2'.
ENDIF.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname           = 'ZDEMO_SFM_DYM_LOGO'
  IMPORTING
    fm_name            = lv_fmname
  EXCEPTIONS
    no_form            = 1
    no_function_module = 2
    OTHERS             = 3.

ls_cntl_parm-langu = 'EN'.
ls_cntl_parm-preview = space.
ls_cntl_parm-no_dialog = abap_true.

ls_op_options-tddest = 'LP01'.
ls_op_options-tdnewid   = abap_true.
ls_op_options-tdimmed   = abap_true.
ls_op_options-tddelete = space.


CALL FUNCTION lv_fmname "'/1BCDWB/SF00000086'
  EXPORTING
    control_parameters = ls_cntl_parm
    output_options     = ls_op_options
    user_settings      = 'X'
    e_structure        = ls_data
  EXCEPTIONS
    formatting_error   = 1
    internal_error     = 2
    send_error         = 3
    user_canceled      = 4
    OTHERS             = 5.
  • In smart form create a window. Inside the window create a Graphic.
8-24.png
  • Inside the graphic window fill the name, object, and Id of images as shown below.
9-19.png
  • Get the above details in t-code SE78 as shown below.
10-19.png

Output

  • Demo output 1 Document date is lesser than 30.01.2021.
13-13.png
  • Demo output 2 Document date is greater than 30.01.2021.
14-11.png

Conclusion

  • Hope you all know how to achieve a dynamic logo in the smart form now. It will be a pleasure to receive comments from you.
  • Preparing more new topics to connect with you all.

Thanks,

Jeevitha.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK