11 Replies Latest reply: Mar 25, 2014 6:21 PM by Jānis B RSS

Activate Smartform in Background

Vikas Mulay
Currently Being Moderated

Hi Experts,

 

Is there any way by which i can activate the Smartform in Background?

 

I am not able to activate the smartform in foreground due to 'Time Out' Dump which comes due to large load on the system.Also the smartforms is pretty big and messed up(Lots of loop and nodes and conditions) which increses the time required for the activation.


I are not supposed to change the parameter rdisp/max_wprun_time from 600 to some more value.

Also i am not supoposed to update the database statistics of the table D010INC.

 

So is there any othere way in which i will be able to activate the smartforms?

 

Thanks in Advance!!!

 

Kindest Regards,

Vikas

  • Re: Activate Smartform in Background
    Nick Young
    Currently Being Moderated

    Hi Vikas,

     

    The code that does the generation in dialog is the subroutine GENERATE in program LSTXBF01, and is not written in such a way as to be able to be called stand alone.

     

    It is however fairly self-contained, so you could in theory write your own program that uses this subroutine, but to be honest I think the time would be better spent simplifiying your Smartform.

     

    Another option is to look into how when importing a transport the form gets generated, maybe more of a basis question.

     

    My basic reaction though is that the form needs simplifying, there are quick wins like moving any large amounts of initisation code into a method or function module that you could consider.

     

    Regards,

    Nick

  • Re: Activate Smartform in Background
    Jānis B
    Currently Being Moderated

    Hi,

     

    SF_BATCH_GENERATE (single form) or RFRECPSFTLGEN (many).

     

    cheers,

    Janis

    • Re: Activate Smartform in Background
      Nick Young
      Currently Being Moderated

      Janis, I pretty much had the answer and didn't realise it.  I think I'll quit for this week....

    • Re: Activate Smartform in Background
      Jānis B
      Currently Being Moderated

      Also, I'd reccomend setting up the folowing function module as TMS  AFTER_IMP Method, so the Forms are generated after importing them in source target  (I think, I'm done for today as well ) system:

       

      *"----------------------------------------------------------------------
      *"*"Lokale Schnittstelle:
      *"  IMPORTING
      *"     REFERENCE(IV_TARCLIENT) LIKE  E070C-TARCLIENT
      *"     REFERENCE(IV_IS_UPGRADE) LIKE  TRPARI-W_UPGRADE
      *"  TABLES
      *"      TT_E071 STRUCTURE  E071
      *"      TT_E071K STRUCTURE  E071K
      *"----------------------------------------------------------------------
      *   Der FUBA führt mit der AFTER_IMP Methode die Neugeneriereung der
      *   ausgelieferte SmartForm (Transportobjektype: SSFO) in Zielsystem
      *   aus
      * ----------------------------------------------------------------------
      *   E071  - Objekteinträge von Aufträgen/Aufgaben
      *   E071K - Schlüsseleinträge von Aufträgen/Aufgaben
      * ----------------------------------------------------------------------

        field-symbols: <tr_obj_ssfo> like line of tt_e071 .
        DATA: l_ssfo_name TYPE rs38l_fnam .

        LOOP AT tt_e071 ASSIGNING <tr_obj_ssfo>
          WHERE
            pgmid = 'R3TR' AND
            object = 'SSFO' AND
            objfunc NE 'D'. "not for Delete

          l_ssfo_name = <tr_obj_ssfo>-obj_name .
          CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
            EXPORTING
              formname                 = l_ssfo_name
           EXCEPTIONS
             no_form                  = 1
             no_function_module       = 2
             OTHERS                   = 3
                    .
          IF sy-subrc <> 0.
      *      MESSAGE ... your error message

          ENDIF.

        ENDLOOP .

       

      ENDFUNCTION.

       

      The imports will run significantly longer, but it's a better option than letting users to time-out/deadlock when accessing the form for the first time after import. Let me know if you want that/need more info on how to set up AFTER_IMP method.

       

      cheers

      Janis

       

      Message was edited by: Jānis B

    • Re: Activate Smartform in Background
      Vikas Mulay
      Currently Being Moderated

      Hi Janis,

       

      Thanks for the Reply.

       

      Basically the Program that you suggested will regenerate the Smartform,But will not help me to activate the smartform..

       

      Regards,

      Vikas

      • Re: Activate Smartform in Background
        Jānis B
        Currently Being Moderated

        Yes, sorry, you are right of course... it's not my day apparently, but it does look doable -  i'l try to write a quick abap for that

         

        cheers

        Janis

        • Re: Activate Smartform in Background
          Vikas Mulay
          Currently Being Moderated

          Appreciate Your Efforts.

          Thank you.

           

          Regards,

          Vikas Mulay

          • Re: Activate Smartform in Background
            Jānis B
            Currently Being Moderated

            Ok, here you go. It worked, it catches errors, but...

             

            please make copies of Forms (and a socond copy as xml,  just to be double safe )... use at your own risk... I've done only basic testing.

             

            PROGRAM zjbtst1 .

            PARAMETERS: p_name TYPE  tdsfname .

            DATA: go_ssf_fb TYPE REF TO cl_ssf_fb_smart_form .
            DATA: go_ssf_check TYPE REF TO cl_ssf_fb_check.
            DATA: gx_ssf_fb TYPE REF TO cx_ssf_fb .
            DATA: gx_ssf_check TYPE REF TO cx_ssf_fb_check .

            CREATE OBJECT go_ssf_fb.
            * Lock
            TRY.
                CALL METHOD go_ssf_fb->enqueue
                  EXPORTING
                    suppress_language_check = 'X'
                    suppress_corr_check     = 'X'
                    mode                    = 'MODIFY'
                    formname                = p_name.
              CATCH cx_ssf_fb INTO gx_ssf_fb.
                MESSAGE gx_ssf_fb TYPE 'E' .
            ENDTRY.

            * Load inactive
            TRY.
                CALL METHOD go_ssf_fb->load
                  EXPORTING
                    im_formname = p_name
                    im_active   = space.
              CATCH cx_ssf_fb INTO gx_ssf_fb .
                MESSAGE gx_ssf_fb TYPE 'E' .
            ENDTRY.

            * Check
            TRY.
                CALL METHOD go_ssf_fb->check
                  EXPORTING
                    global_check_flag = 'X'
                  CHANGING
                    check_object      = go_ssf_check.

              CATCH cx_ssf_fb_check INTO gx_ssf_check.
                MESSAGE gx_ssf_check TYPE 'E' .
            ENDTRY.

            * Save active
            go_ssf_fb->header-lastuser = sy-uname.
            go_ssf_fb->header-lastdate = sy-datum.
            go_ssf_fb->header-lasttime = sy-uzeit.

            TRY .
                go_ssf_fb->store(
                  EXPORTING
                    im_active   = 'X'
                    im_formname = p_name
                ).
              CATCH cx_ssf_fb INTO gx_ssf_fb .
            * Something's wrong, shut the light
                ROLLBACK WORK .
                MESSAGE gx_ssf_fb TYPE 'E' .
            ENDTRY .

            * Dequeue
            TRY.
                CALL METHOD go_ssf_fb->dequeue
                  EXPORTING
                    formname = p_name.
              CATCH cx_ssf_fb_check INTO gx_ssf_check.
                MESSAGE gx_ssf_check TYPE 'E' .
            ENDTRY.

            * Generate
            CALL FUNCTION 'FB_GENERATE_FORM'
              EXPORTING
                i_formname       = p_name
              EXCEPTIONS
                no_name          = 1
                no_form          = 2
                no_active_source = 3
                generation_error = 4
                illegal_formtype = 5
                OTHERS           = 6.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ELSE .
              COMMIT WORK .
            ENDIF.

             

            cheers

            Janis

             

            Edit in: are you able to check the form in dialog? Because this code will give simple message "check(): Error occurred during check" when the form is not ok...

Actions