Hi,

just want to share my findings and code regarding the topic.

Recently I’ve been working on the functionality which would allow our users to interact with the Smartform’s text (which is usually comes from SO10 texts) before it is passed on to the Smartform function.

We already have gone through some iterations of implementation. First we have delivered it using standard simple text edit gui component which was fine from the technical side but was not good enough from the user’s perspective as the initial SO10’s formatting was lost ones text have been processed using text edit.

The next iteration was logical one. We have switched from text edit to CL_GUI_SAPSCRIPT_EDITOR, which give a native SO10 text editing environment. The issue with this editor though is that you have to provide a suitable style during initialization. We can always init it with style SYSTEM but our approach was to limit user’s formatting options down to the ones supported by particular smartform.

So this post is about how we are getting style name from the smartform.

Bellow is the form’s code which determines the proper smartstyle name based on the smartform name. Hope it will help some of you. If you have any better solution, please share here.

FORM get_form_smartstyle USING    p_form        TYPE tdsfname

                          CHANGING cp_smartstyle TYPE tdssname.

   DATA:

       nodename     TYPE ssfname VALUE ‘HEADER’,

       ivarheader   TYPE tsfivhd,

       varheader_wa TYPE ssfivhd.

   cp_smartstyle = ‘SYSTEM’.

   IF NOT p_form IS INITIAL.

     CALL FUNCTION ‘SSF_READ_FORM’

       EXPORTING

         i_formname = p_form

         i_language = sylangu

       EXCEPTIONS

         OTHERS     = 4.

     IF sysubrc EQ 0.

       CALL FUNCTION ‘SSF_READ_NODE_BEGIN’

         EXPORTING

           i_nodetype = ‘SF’

           i_nodename = nodename

         EXCEPTIONS

           OTHERS     = 4.

       IF sysubrc EQ 0.

         CALL FUNCTION ‘SSF_READ_DATE’

           EXPORTING

             i_name = ‘IVARHEADER’

           IMPORTING

             o_date = ivarheader

           EXCEPTIONS

             OTHERS = 4.

         IF NOT ivarheader[] IS INITIAL.

           READ TABLE ivarheader INTO varheader_wa INDEX 1.

           cp_smartstyle = varheader_wastdstyle.

         ENDIF.

       ENDIF.

     ENDIF.

   ENDIF.

ENDFORM.                    “get_form_smartstyle

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply