Call function POPUP_TO_CONFIRM after Excel close

Good morning
I have written code like this
DATA: EXCEL TYPE OLE2_OBJECT.
  DATA: BOOKS TYPE OLE2_OBJECT.
  DATA: BOOK  TYPE OLE2_OBJECT.
  DATA: CELL  TYPE OLE2_OBJECT.
  DATA: FONT  TYPE OLE2_OBJECT.
  DATA: FILE  TYPE OLE2_OBJECT.
  CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
  CALL METHOD OF EXCEL 'WORKBOOKS' = FILE.
  CALL METHOD OF FILE 'OPEN'
    EXPORTING
      #1 = 'C:temp8D.xls'
      #2 = 1.
CALL METHOD OF EXCEL 'CELLS' = CELL
    EXPORTING
      #1 = 6
      #2 = 'C'.
  SET PROPERTY OF CELL 'VALUE' = zak_pomoc.
CALL METHOD OF EXCEL 'QUIT'.
  FREE OBJECT EXCEL.
If user has modified the 8D file I want display this file on the screen, but first function POPUP_TO_CONFIRM  should ask him if he really wants to show file.
I make it like this.
  call function 'POPUP_TO_CONFIRM'
    EXPORTING
      TITLEBAR              = 'Display report'
      TEXT_QUESTION         = 'Display report 8D?'
      DEFAULT_BUTTON        = '1'
      DISPLAY_CANCEL_BUTTON = 'X'
      START_COLUMN          = 25
      START_ROW             = 6
    IMPORTING
      answer                = ans.
         if ans eq '1'.
DATA gs_excel TYPE ole2_object .
  DATA gs_wbooks TYPE ole2_object .
  DATA gs_wbook TYPE ole2_object .
  DATA gs_application TYPE ole2_object .
  CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
  SET PROPERTY OF gs_excel 'Visible' = 1 .
  GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
  GET PROPERTY OF gs_wbooks 'Application' = gs_application .
*--Opening the existing document
  CALL METHOD OF gs_wbooks 'Open' = gs_wbook
    EXPORTING
      #1 = 'c:temp8D.xls'.
endif.
But there is my problem because two windows: first- asking about saving the file and the second- asking about showing the file, pop up in this same time.
What condition should I write to call second window after this first one?
Please, any suggestions?
Thank you.

Hello
I'm just beginner and there is one thing I don't understand. Between lines
CALL METHOD OF EXCEL 'QUIT'
and
FREE OBJECT EXCEL
the window 'Do you want save changes' appears. And in that moment what is the value that says if the user chooses OK or QUIT?
If I would know that value, I could call function POPUP_TO_CONFIRM in the right moment.

Similar Messages

  • Calling DbEnv- remove after DbEnv- close results in a segmentation fault

    I have two classes of database files: definitions that change slowly, and instances that are transient and change quickly.
    What I'm trying to do is this:
    close databases, environment
    back up files
    remove instance databases
    open new environment, existing definitions and create new instances
    This keeps returning ENOENT errors, but not consistently. The results are unpredictable and will sometimes hang. It seems to me that this is due to something in the environment not being cleared correctly. So I tried adding a remove after a close, and I get a regular and consistent segment fault as the unwrap function in cxx_env.cpp returns a NULL environment.
    This behaviour is consistent in versions 4.3, 4.5, and 4.7 on Solaris 10 and RHEL 5.
    So my question is twofold: Is there a better way to do what I'm tying to do, on that will work reliably, and shouldn't the remove operation work, even if ther's nothing to remove? I've had this problem for quite some time so any pointers would be appreciated.
    TIA,
    Dave

    Sorry. I had a major attack of the stupids. I was using old code that unlinked the underlying files instead of using a db->remove. It works much better now.

  • Direct approach for - Message class used in Call Function - possible?

    Hi All
    This is I guess a very simple question, but I could not find the solution.
    If i use the function: POPUP_TO_CONFIRM, I can hand over to the export some text symbols directly from the text elements.
    Example:
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            titlebar              = text-011
            text_question         = text-030
            text_button_1         = text-024
            icon_button_1         = 'icon_checked '
            text_button_2         = text-026
            icon_button_2         = 'icon_incomplete'
            default_button        = '2'
            display_cancel_button = ''
            start_column          = 25
            start_row             = 6
          IMPORTING
            answer                = answer.
    But I'm using a message class in this progamm.
    <b>So my question is, how can I use directly a message from the message class within the function?</b>
    I'm not asking for a 2-step approach (copy into text1 and set text1 to function). I would like to know how to use the text from the class directly into the function.
    Thanks
    Petra

    Hi
    May be this way.
       data : v_text1(72) type c,
              v_text2(72) type c,
           v_text3(72) type c,
              v_text4(72) type c.
        message i175(YVV) into v_text1.
        message i176(YVV) into v_text2.
        message i177(YVV) into v_text3.
        message i178(YVV) into v_text4.
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            titlebar              = v_text1
            text_question         = v_text2
            text_button_1         = v_text3
            icon_button_1         = 'icon_checked '
            text_button_2         = v_text4
            icon_button_2         = 'icon_incomplete'
            default_button        = '2'
            display_cancel_button = ''
            start_column          = 25
            start_row             = 6
          IMPORTING
            answer                = answer.
    aRs

  • Commit changes after CALL FUNCTION ... IN UPDATE TASK

    Hi ABAPers,
    I'm a bit confused about the behaviour of Update Function Modules.
    Following scenario:
    In our transaction (Modulpool with dynpros) the user clicks a butto to change some data:
    1. PAI-Modul performs FORM_A
    2. FORM_A calls FM_A several times in a LOOP
    3. FM_A does some business logic and calls FM_B IN UPDATE TASK
    4. FM_B modifies database tables
    5. After the LOOP FORM_A does COMMIT WORK AND WAIT
    Then the changes are not in the db immediately, the user will see the old data for a short time.
    Why does the COMMIT-statement not start the Update-process?
    Thanks,
    Markus

    Hi,
    This executes all high-priority update function modules registered using CALL FUNCTION ... IN UPDATE TASK in the order of their registration and in a common database LUW. If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating). If you specify the addition AND WAIT, however, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).
    If all high-priority update function modules are completed successfully, the statement executes the low-priority update function modules together in a common database LUW.
    here high priority function moudles are function module with V1 task.
    Regards,
    Siva chalasani.

  • Call Function Modules of R/3 from an Excel file.

    HI All,
    The requirement is to create a button on the excel file. On Click of the button, the data present in Excel file shud be uploaded to a R/3 DataBase table. Is it possible? If yes, how ?
    Regards
    Mrinalini

    I am sure it's specific requirement otherwise yuo can create button in SAP applicaation toolbar and upload from excel
    using FM TEXT_CONVERT_XLS_TO_SAP function .
    TYPE-POOLS : truxs.
    -Create selection screen Parameter for file path.
    PARAMETERS : pa_file LIKE rlgrap-filename DEFAULT 'C:\excel.xls'.
    -The selection-screen uses cl_gui_frontend_services=>file_open_dialog method for displaying Windows type file exporer for file open dialog screen.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_file.
    " Display File Open Dialog control/screen
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title = 'Select Source Excel File'
      default_filename = '*.xls'
      multiselection = ' '
    CHANGING
      file_table = lt_it_tab
      rc = lv_subrc.
    -At user command 'PUSHBUTTON'
        CALL functionTEXT_CONVERT_XLS_TO_SAP function
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
      i_line_header = 'X'
      i_tab_raw_data = g_raw_data
      i_filename = pa_file
    TABLES
      i_tab_converted_data = gt_Vendors[] " Data
    EXCEPTIONS
      conversion_failed = 1
      OTHERS = 2.
    ~Pramod

  • After SocketChannel.close, must call Selector.wakeup

    When I am reading from a tcp socket using NIO channels & selectors, I have the following problem when I go to close the channel.
    If I close the channel in the thread where I called selector.select(), then the channel is closed and the client application gets the event that the channel was closed.
    However, if I do the reading in a seperate thread, after calling channel.close(), I must call selector.wakeup() or the socket is not closed.
    Any idea what is going on?
    thanks - dave

    The main point of NIO is that you don't need multiple threads to read and write multiple sockets. You can use multiple threads, but it complicates things. After you close a channel you must let the select run one more time, this is the reason that I try to close channels from the thread that is running the select. You probably already have a queue of runnables to process interestOps and register in the select thread. You should use that for the close activity as well.
    I've posted a lot of topics on NIO, that cover this and other tricks of using NIO. Here are the most useful.
    Taming the NIO Circus, NIO Server Example, NIO Client Example

  • Performance After Using Call Function

    Hi All,
       I have a program, where it is having some performance issues.
    It is taking a lot of time at a customized Z Call Function.
    Please suggest some solutions.

    Hi,
    Firstly check if the Z Function module is remote enables or not...
    if it is remote enabled then it will take some time....
    then debug the function module and check which statement is hitting on performance, try to find out the other way round for that statement or if its a long loop then try to find out some optimized way for that loop...
    still if you are not able to then paste the code of the z function module may be we are of some help there
    Regards,
    Siddarth

  • Doubt in call function

    Hi,
    Call Function 'FM' starting new task task-name
    Exporting
    What does this statement does.

    Hi
    chk this out
    CALL FUNCTION STARTING NEW TASK
    Variant 2
    CALL FUNCTION func ...STARTING NEW TASK task name.
    Extras:
    1. ... DESTINATION dest
    2. ... DESTINATION IN GROUP group name
    3. ... DESTINATION IN GROUP DEFAULT
    4. ... PERFORMING form ON END OF TASK
    5. ... EXPORTING  p1 = f1    ... pn = fn
    6. ... TABLES     p1 = itab1 ... pn = itabn
    7. ... EXCEPTIONS syst_except = rc MESSAGE mess
    Effect
    Starts the function module func asynchronously in a new session. In contrast to normal function module calls, the calling program resumes processing as soon as the function module is started in the target system. It does not wait until the function module has finished. Using CALL SCREEN, the called function module can, for example, display a screen and thus interact with the user. Note that taskname must be a valid string of at least 2 characters, preferably fewer than 8 characters. You cannot use either ' ' or SPACE as tasknames.
    Notes
    Note that under certain circumstances, an RFC may cause a database commit. For this reason, do not insert an RFC between two OpenSQL statements that open and close a database cursor (such as SELECT...ENDSELECT).
    This variant applies only from R/3 Release 3.0, so both the client system and the server system must have Release 3.0 at least.
    With this variant, the called function module must also be flagged in the Function Builder as externally callable, even if it is executed locally (without the addition Destination).
    There can be no function call to the destination 'BACK' in the called function module (for more information about the destination 'BACK', see CALL FUNCTION func DESTINATION dest).
    This variant does not allow you to execute external programs that you access from a TCP/IP-type detination asynchronously. (See the Transaction Tools -> Administration, Administration -> Network -> RFC destinations for maintaining destinations).
    Neither does this variant allow you to display images such as lists or screens in a separate window during RFC communication using a SAProuter.
    From Release 4.0 onwards, you can carry out a new, stricter system load check on RFC destinations. (In RFC destination maintenance of an R/3 connection, choose Destination -> ARFC-Optionen). Before the function module is executed, the system checks that the destination has sufficient resources available. If not, the system delays execution of the function module for a given period of time. The algorithm used to determine the system load on the target machine is the same as that used for an asynchronous RFC with the DESTINATION IN GROUP addition. Note that this option is only available for target systems from Release 3.1H onwards. This procedure is active as default.
    In principle, parallel processing makes sense whenever application servers have the necessary resources. In this case, the application servers must be configured with at least 3 dialog work processes.
    A program that is run in the background and uses RFC parallel processing requires at least 1 dialog work process per application server (because parallel processing takes place in a dialog work process).
    If the instance profile parameter 'auth/rfc_authority_check' is set to 1, the system automatically performs an RFC authorization check. The authorization check refers to the relevant function group for the function module to be called. If no authorization is found, a runtime error occurs. You can check the authorization in advance with the function module AUTHORITY_CHECK_RFC. If the RFC communication takes places in one system and in the same user context (that is, the same client and User ID) the system does not perform an RFC authority check. For more information, see: RFC Authorization Concept.
    When you are using asynchronous RFC to implement parallel windows, all these windows are closed if the caller session is the only session and terminates.
    Note that asynchronous tasks that have been started are not necessarily closed when the calling program ends.
    See also RFC Logons to the Target System (Remote Logon).
    Addition 1
    ... DESTINATION dest
    Effect
    Executes the function module externally as a Remote Function Call (RFC); dest can be a literal or a variable. The R/3 System where the function module is executed depends on the specified destination. Externally callable function modules must be flagged as such in the Function Builder (of the target system).
    Note
    If the destination is not explicitly specified, the system uses the default destination 'NONE'.
    Note
    If, during a Remote Function Call, an error occurs in the target system, details of the error message are passed back to the calling system in the following system fields: SY-MSGNO, SY-MSGID, SY-MSGTY, SY-MSGV1, SY-MSGV2, SY-MSGV3, and SY-MSGV4. These fields are initialized before every RFC. If a short dump or a type X message occurs, the short text of the dump is transferred to the caller, and the contents of SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 assigned by the system.
    In RFC-enabled function modules, no ABAP statements are allowed that would end the RFC connection (for example, either LEAVE or SUBMIT without the AND RETURN addition).
    Note
    Note that a database commit occurs at each Remote Function Call (RFC). Consequently, you cannot use Remote Function Calls between pairs of statements that open and close a database cursor (such as SELECT ... ENDSELECT).
    Addition 2
    ... DESTINATION IN GROUP group name
    Addition 3
    ... DESTINATION IN GROUP DEFAULT
    Effect
    You use this addition to perform parallel execution of function modules (asynchronous calls) on a predefined group of R/3 System application servers.
    You use addition 2 (DESTINATION IN GROUP group name) to perform parallel execution of function modules on a predefined group of application servers. To maintain the RFC groups, choose Tools -> Administration -> Administration ->Network -> RFC destinations -> RFC -> RFC groups. The application programmer is responsible for the availability of RFC groups in the production system. In this case the group name variable must be of the type RZLLITAB-CLASSNAME
    You use addition 3 (DESTINATION IN GROUP DEFAULT) to perform parallel execution of function modules (asynchronous calls) on all currently available R/3 System application servers. However, instead of this variant, you are recommended to use an RFC group with appropriate resources for parallel processing of asynchronous calls (at least for performance reasons). Please note that the addition DESTINATION IN GROUP ' ' has the same effect as the addition DESTINATION IN GROUP DEFAULT.
    When you first call a function module with these additions, the system initializes the specified RFC group (unless the group has already been explicitly identified).
    To obtain current information about resources (that is, the resources available to process function modules), you can also initialize the RFC group explicitly in the program using the function module SPBT_INITIALIZE. You must perform this action before the first function module call.
    In both cases, the system first ascertains the currently available resources (work processes) on the available application servers (either a group of servers or all servers). By checking the current system load of each application server, the system determines how many work processes are available to execute asynchronous calls.
    After ascertaining the available resources, the asynchronous call is executed to one of the
    destinations. If no resources are available at that particular time, the system executes the
    exception routine RESOURCE_FAILURE (see the addition EXCEPTIONS). In the case of
    an asynchronous function module call, this exception must be handled by the application
    program (see example).
    No resources are made available by the system if resource availability limits are exceeded:
    Notes
    To be taken into consideration for RFC parallel processing, an application server must have at least 3 free dialog processes.
    The system triggers the exception RESOURCE_FAILURE only for asynchronous RFCs with the additions DESTINATION IN GROUP group name and DESTINATION IN GROUP DEFAULT.
    At present, only one RFC group per program environment is supported for parallel execution of asynchronous calls. Using both the additions DESTINATION IN GROUP group name and DESTINATION IN GROUP DEFAULT in a program is thus not allowed.
    To find out which destination was automatically selected, call the function module SPBT_GET_PP_DESTINATION immediately after the function module call with the two additions. This returns the selected RFC destination.
    If you want to delete an application server from the list of the configured RFC group at runtime (for example, when the application server is not accessible for technical reasons), use the function module SPBT_DO_NOT_USE_SERVER.
    Addition 4
    ... PERFORMING form ON END OF TASK
    While the parameters for receiving results (that is IMPORTING and TABLES parameters) are specified directly as additions in the case of "conventional" function modules (see variant 2), these are logged in the FORM routine form when making an asynchronous call (see RECEIVE).
    Notes
    If a function module returns no result, and you are not interested in error messages that arise when executing the function module, this addition (... PERFORMING form ON END OF TASK) can be omitted.
    If you want to handle the error messages that arise when executing the asynchronous function module call, you must use this addition. Also, when receiving the results in the FORM routine (see RECEIVE), you must react accordingly to the system exceptions SYSTEM_FAILURE and COMMUNICATION_FAILURE.
    With asynchronous RFC, the task name uniquely identifies the asynchronous connection and thus the context called.
    If several asynchronous function modules are executed consecutively to the same destination, you must assign a different task name to each.
    A calling program that starts an asynchronous RFC with the PERFORMING form ON END OF TASK addition cannot switch roll areas or change to an internal mode. This is because the asynchronous function module call reply cannot be passed on to the relevant program. You can perform a roll area switch with SUBMIT or CALL TRANSACTION.
    If a calling program makes asynchronous calls, finishes, and then expects responses, it cannot receive these responses.
    To wait for the reply to a started asynchronous function module, use the WAIT command with the addition PERFORMING form ON END OF TASK. Here, WAIT must be in the same program context (mode).
    Note that executing asynchronous calls is subject to a roll area change.That is, subroutines performed to receive asynchronous calls can take place while other asynchronous calls are being made. Thus as a developer you must ensure that subroutines can be executed at any time. You must not make assumptions about the implicit processing sequence.
    Addition 5
    ... EXPORTING p1 = f1 ... pn = fn
    Effect
    Passes values of fields and field strings from the calling program to the function module. In the function module, the formal parameters are defined as import parameters.
    Addition 6
    ... TABLES p1 = itab1 ... pn = itabn
    Effect
    Passes references to internal tables.
    Addition 7
    ... EXCEPTIONS syst_except = rc MESSAGE mess
    Effect
    While any exceptions arising in the called function module are handled by the second
    addition (see the FORM subroutine RETURN_INFO), this addition can handle two special
    system exceptions, (as with function module calls with the DESTINATION addition):
    SYSTEM_FAILURE
    is triggered, if a system crash occurs on the receiving side.
    COMMUNICATION_FAILURE
    is triggered if there is a connection or communication problem.
    In both cases, you can get a description of the error with the optional ... MESSAGE messaddition
    Note
    In principle, you should always react to these two system exceptions, whether you are making an asynchronous function module call or receiving results.
    Examples
    Calling a transaction in a seperate session.
    DATA: MSG_TEXT(80) TYPE C. "Message text
    Asynchronous call to Transaction SM59 -->
    Create a new session
    CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'TEST'
      DESTINATION 'NONE'
      EXPORTING
          TCODE = 'SM59'
      EXCEPTIONS
        COMMUNICATION_FAILURE = 1 MESSAGE MSG_TEXT
        SYSTEM_FAILURE        = 2 MESSAGE MSG_TEXT.
      IF SY-SUBRC NE 0.
        WRITE: MSG_TEXT.
      ELSE.
        WRITE: 'O.K.'.
      ENDIF.
    Using RFC groups to parallelize function module calls(RFC parallel processing)
    TYPES: BEGIN OF TASKLIST_TYPE,
             TASKNAME(4) TYPE C, "Verwaltung der Tasks
             RFCDEST     LIKE RFCSI-RFCDEST,
          END OF TASKLIST_TYPE.
    DATA: INFO LIKE RFCSI, C,  "Message text
          JOBS TYPE I VALUE 10,  "Number of parallel jobs
          SND_JOBS TYPE I VALUE 1,  "Sent jobs
          RCV_JOBS TYPE I VALUE 1,  "Received replies
          EXCP_FLAG(1) TYPE C,  "Number of RESOURCE_FAILUREs
          TASKNAME(4) TYPE N VALUE '0001',  "Task name administration
          TASKLIST TYPE TABLE OF TASKLIST_TYPE,
          WA_TASKLIST TYPE TASKLIST_TYPE.
    DO.
      CALL FUNCTION 'RFC_SYSTEM_INFO'
           STARTING NEW TASK TASKNAME DESTINATION IN GROUP DEFAULT
           PERFORMING RETURN_INFO ON END OF TASK
           EXCEPTIONS
             COMMUNICATION_FAILURE = 1
             SYSTEM_FAILURE        = 2
             RESOURCE_FAILURE      = 3.
      CASE SY-SUBRC.
        WHEN 0.
    Administration of asynchronous tasks
            WA_TASKLIST-TASKNAME = TASKNAME.
            CLEAR WA_TASKLIST-RFCDEST.
            APPEND WA_TASKLIST TO TASKLIST.
            WRITE: /  'Started Task: ', WA_TASKLIST-TASKNAME COLOR 2.
          TASKNAME = TASKNAME + 1.
          SND_JOBS = SND_JOBS + 1.
          JOBS     = JOBS - 1.  "Number of existing jobs
          IF JOBS = 0.
            EXIT.  "Job processing finished
          ENDIF.
        WHEN 1 OR 2.
    Handling of communication and system failure
        WHEN 3.  "No resources available at present
    Receive reply to asynchronous RFC calls
          IF EXCP_FLAG = SPACE.
             EXCP_FLAG = 'X'.
    First attempt for RESOURCE_FAILURE handling
             WAIT UNTIL RCV_JOBS >= SND_JOBS UP TO '0.01' SECONDS.
          ELSE.
    Second attempt for RESOURCE_FAILURE handling
             WAIT UNTIL RCV_JOBS >= SND_JOBS UP TO '0.1' SECONDS.
          ENDIF.
          IF SY-SUBRC = 0.
            CLEAR EXCP_FLAG.  "Reset flag
          ELSE.  "No replies
            "Endless loop handling
          ENDIF.
        ENDCASE.
    ENDDO.
    Receive remaining asynchronous replies
    WAIT UNTIL RCV_JOBS >= SND_JOBS.
    LOOP AT TASKLIST INTO WA_TASKLIST.
        WRITE:/   'Received Task:', WA_TASKLIST-TASKNAME COLOR 1,
              30  'Destination: ', WA_TASKLIST-RFCDEST COLOR 1.
    ENDLOOP.
    FORM RETURN_INFO USING TASKNAME.
      RECEIVE RESULTS FROM FUNCTION 'RFC_SYSTEM_INFO'
        IMPORTING RFCSI_EXPORT = INFO
        EXCEPTIONS
          COMMUNICATION_FAILURE = 1
          SYSTEM_FAILURE        = 2.
      RCV_JOBS = RCV_JOBS + 1.  "Receiving data
        IF SY-SUBRC NE 0.
    Handling communication and system failure
       ELSE.
         READ TABLE TASKLIST WITH KEY TASKNAME = TASKNAME
                    INTO WA_TASKLIST.
         IF SY-SUBRC = 0. "Daten registrieren
           WA_TASKLIST-RFCDEST = INFO-RFCDEST.
           MODIFY TASKLIST INDEX SY-TABIX FROM WA_TASKLIST.
         ENDIF.
       ENDIF.
    ENDFORM.
    plz reward if useful

  • MS ACCESS 2010 VBA Excel Close

    I am using Window 7 SP1, and MS Office 2010. I am running queries in Access 2010, and writing the results in a report to Excel 2010, and noted that the instance of Excel does not terminate from the process listing. To make sure that it is not my code, I
    have stripped it down basics.
    1. The following code opens and terminates Excel as expected:
      Public Sub Test()
        Dim strRptDirPath As String: strRptDirPath = "C:\Projects\WeeklyAlarms\Report\"
        Dim xlApp As Object,
    '   Dim xlWkBk As Object
    '   Dim xlWkSht As Object
        Dim strRptTl As String: strRptTl = "Report Template.xls"
        Dim strRptSht As String: strRptSht = "Rpt"
        Set xlApp = CreateObject("Excel.Application")
             xlApp.Visible = False
    '    Set xlWkBk = xlApp.Workbooks.Open(strRptDir & strRptTl)
    '    Set xlWkSht = xlWkBk.Worksheets(strRptSht)
    '        xlWkSht.Cells(1, 1).Value = "TEST 1"
    '        xlWkSht.Cells(2, 2).Value = "TEST 2"
    '        xlWkSht.Cells(3, 3).Value = "TEST 3"
    '        xlWkBk.SaveAs (strRptDirPath & "TESTING.xls")
    '        xlWkBk.Close True
            xlApp.Quit
    '    Set xlWkSht = Nothing
    '    Set xlWkBk = Nothing
        Set xlApp = Nothing
    End Sub
    2. However, if i reference the workbook, the Excel process instance does not terminate. Searches through talk topics make references to the process terminating after a timeout 'ping' a period after Access closes - this is not the case here.
    Public Sub Test()
        Dim strRptDirPath As String: strRptDirPath = "C:\Projects\WeeklyAlarms\Report\"
        Dim xlApp As Object,
       Dim xlWkBk As Object
    '   Dim xlWkSht As Object
        Dim strRptTl As String: strRptTl = "Report Template.xls"
        Dim strRptSht As String: strRptSht = "Rpt"
        Set xlApp = CreateObject("Excel.Application")
             xlApp.Visible = False
        Set xlWkBk = xlApp.Workbooks.Open(strRptDir & strRptTl)
    '    Set xlWkSht = xlWkBk.Worksheets(strRptSht)
    '        xlWkSht.Cells(1, 1).Value = "TEST 1"
    '        xlWkSht.Cells(2, 2).Value = "TEST 2"
    '        xlWkSht.Cells(3, 3).Value = "TEST 3"
            xlWkBk.SaveAs (strRptDirPath & "TESTING.xls")
            xlWkBk.Close True
            xlApp.Quit
    '   Set xlWkSht = Nothing
        Set xlWkBk = Nothing
        Set xlApp = Nothing
    End Sub
    I have un-checked Microsoft Excel 14.0 Object library reference. I don't think i have made any global reference calls. I cant see what I am doing incorrectly.

    ​Hi totally,
    I made a simple test with your two methods, and I could not reproduce your issue. Both of the methods have open the excel process and terminated after the methods. I am wondering when you checked the excel process. Before you test the method, if the excel
    process has been started up, then your method would open another excel process and would terminate the excel process which was started up by the method. The original excel process would not be terminated.
    I think you could terminate all of the excel process before testing your methods, and when debugging the methods, open the task manager to check whether the excel process would be created and terminated.
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

  • What is the use of CALL FUNCTION MODULE - AT BACKGROUND TASK?

    Hi experts,
    I found Call functional module in background task will make the FM run at the next commit work as some people said. So I have some questions:
    1 if we use COMMIT WORK commend, the pending FM will be called? If there are several FMs called at background task, what is the sequence of them? How many conditions will trigger the running of these FMs?
    2 Where can I find the log of this pending FMs? In SAP library, it says there are 2 tables. But I checked these tables and can only find the FM name and user of it. And I can not understand content of these tables. It seems one is for the main information of FM, and the other is for the data of the FM, maybe the parameters.
    3 If I call a FM in this way, Can I canncel it before the next commit work in some way?
    Finally, thanks for reading and help.

    HI,
    When the COMMIT WORK statement is executed, the function modules registered for the current SAP-LUW are started in the order in which they were registered. ROLLBACK WORK deletes all previous registrations for the current SAP-LUW.
    If the specified destination is not available when COMMIT WORK is executed, an executable program called RSARFCSE is started in background processing. By default, this tries to start the function modules registered for a SAP-LUW in their destination every 15 minutes and up to 30 times. These parameters can be changed in the transaction SM59. If the destination does not become available within the defined time, it is recorded in the database table ARFCSDATA as the entry "CPICERR". The entry in the database table ARFCSSTATE is deleted after a standard period of eight days

  • Call function '' in update task - code inside is BDC

    hi to all,
    in using call function '' in update task
    the code inside is bdc. is this possible? 
    my scenario is from VA01 then post billing to VF01,
    i am using user-exit MV45AFZZ in subroutine userexit_save_document.
    i need to post billing after va01 save.
    thanks to all.

    To debug in the update task, you have to set that option on in the debugger.
    If the user exit runs in the update task, then you must have something like: CALL FUNCTION MODULE my_fm_to_do_BDC STARTING NEW TASK.   ( This function module should wait until the SD is created.  You might want to check in a loop, with a WAIT command.   Once it is created, then you start your BDC and CALL TRANSACTION. )  This is NOT an update function module.  It may need to be RFC enabled - I'm not certain at the moment.
    If the user exit doesn't run in the update task, you need to create, and call from the user exit, an update function module that calls your function module "my_fm_to_do_BDC" STARTING NEW TASK. 
    The attribute "collective run", which is V3, means that the update task won't run that function module until a regularly scheduled job on the application server runs.  For processing to run during the rest of the SD save, you must use V1 (could be run in any order with other V1s) or V2 (Will run after V1, but in any order with other V2s).  Typically, I use V2 for this kind of task.
    matt

  • How to use CALL FUNCTION '/1BCDWB/SF00000014' in smartform urgent

    hiiiiiiiii
    Iam doing classical report n i want my output to be printed in smartform.
    So my output is in IT_FINAL table.In smartform in Form Interface Table column i had declare :::
    Parameter Name: IT_FINAL
    Type Assignment:LIKE
    Associated Type:ZSD_FINAL ( Its a structure of IT_FINAL)
    And in SE38..iam using...............
    data: FM_NAME1 type RS38L_FNAM.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    FORMNAME = 'ZCSF_SDPRSR03_PR'
    importing
    FM_NAME = FM_NAME1.
    CALL FUNCTION FM_NAME1
    EXPORTING
    IT_FINAL = IT_FINAL.
    So while running its giving dump..
    I DONT KNOW HOW TO USE THE ABOVE FUNCTION MODULE.
    CALL FUNCTION '/1BCDWB/SF00000014'
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Please suggest me with example if possible......URGENT.
    (Rewards if solved)
    Regards.

    Hi
    see the below doc and do accordingly
    How to create a New smartfrom, it is having step by step procedure
    http://sap.niraj.tripod.com/id67.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    Here is the procedure
    1. Create a new smartforms
    Transaction code SMARTFORMS
    Create new smartforms call ZSMART
    2. Define looping process for internal table
    Pages and windows
    First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
    Here, you can specify your title and page numbering
    &SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
    Main windows -> TABLE -> DATA
    In the Loop section, tick Internal table and fill in
    ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
    3. Define table in smartforms
    Global settings :
    Form interface
    Variable name Type assignment Reference type
    ITAB1 TYPE Table Structure
    Global definitions
    Variable name Type assignment Reference type
    ITAB2 TYPE Table Structure
    4. To display the data in the form
    Make used of the Table Painter and declare the Line Type in Tabstrips Table
    e.g. HD_GEN for printing header details,
    IT_GEN for printing data details.
    You have to specify the Line Type in your Text elements in the Tabstrips Output options.
    Tick the New Line and specify the Line Type for outputting the data.
    Declare your output fields in Text elements
    Tabstrips - Output Options
    For different fonts use this Style : IDWTCERTSTYLE
    For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
    5. Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    <b>call function 'SSF_FUNCTION_MODULE_NAME'</b>
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    <b>call function FM_NAME</b>
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Smartform
    you can check this link here you can see the steps and you can do it the same by looking at it..
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    SMARTFORMS STEPS.
    1. In Tcode se11 Create a structure(struct) same like the Internal table that you are going to use in your report.
    2. Create Table type(t_struct) of stracture in se11.
    3. In your program declare Internal table(Itab) type table of structure(struct).
    4. Define work area(wa) like line of internal table.
    5. Open Tcode Smartforms
    6. In form Global setting , forminterface Import parameter define Internal table(Itab) like table type of stracture(t_struct).
    7. In form Global setting , Global definitions , in Global data define Work area(wa) like type stracture(struct).
    8. In form pages and window, create Page node by default Page1 is available.
    9. In page node you can create numbers of secondary window. But in form there is only one Main window.
    10. By right click on page you can create windows or Go to Edit, Node, Create.
    11. After creating the window right click on window create table for displaying the data that you are passing through internal table.
    12. In the table Data parameter, loop internal internal table (Itab) into work area(wa).
    13. In table there are three areas Header, Main Area, Footer.
    14. Right click on the Main area create table line by default line type1 is there select it.
    15. Divide line into cells according to your need then for each cell create Text node.
    16. In text node general attribute. Write down fields of your work area(wa) or write any thing you want to display.
    17. Save form and activate it.
    18. Then go to Environment, function module name, there you get the name of function module copy it.
    19. In your program call the function module that you have copied from your form.
    20. In your program in exporting parameter of function pass the internal table(itab).
    SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.
    SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can
    configure forms with data from an SAP System for the relevant business processes.
    To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.
    You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.
    You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.
    SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.
    SAP Smart Forms also support postage optimizing.
    Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C
    What Transaction to start SAP Smart Forms?
    Execute transaction SMARTFORMS to start SAP Smart Forms.
    Key Benefits of SAP Smart Forms:
    SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.
    You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.
    To make changes, use Drag & Drop, Copy & Paste, and select different attributes.
    These actions do not include writing of coding lines or using a Script language.
    Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.
    For Web publishing, the system provides a generated XML output of the processed form.
    Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.
    SmartForms System Fields
    Within a form you can use the field string SFSY with its system fields. During form processing the system replaces these fields with the corresponding values. The field values come from the SAP System or are results of the processing.
    System fields of Smart Forms
    &SFSY-DATE&
    Displays the date. You determine the display format in the user master record.
    &SFSY-TIME&
    Displays the time of day in the form HH:MM:SS.
    &SFSY-PAGE&
    Inserts the number of the current print page into the text. You determine the format of the page number (for example, Arabic, numeric) in the page node.
    &SFSY-FORMPAGES&
    Displays the total number of pages for the currently processed form. This allows you to include texts such as'Page x of y' into your output.
    &SFSY-JOBPAGES&
    Contains the total page number of all forms in the currently processed print request.
    &SFSY-WINDOWNAME&
    Contains the name of the current window (string in the Window field)
    &SFSY-PAGENAME&
    Contains the name of the current page (string in the Page field)
    &SFSY-PAGEBREAK&
    Is set to 'X' after a page break (either automatic [Page 7] or command-controlled [Page 46])
    &SFSY-MAINEND&
    Is set as soon as processing of the main window on the current page ends
    &SFSY-EXCEPTION&
    Contains the name of the raised exception. You must trigger your own exceptions, which you defined in the form interface, using the user_exception macro (syntax: user_exception <exception name >).
    Example Forms Available in Standard SAP R/3
    SF_EXAMPLE_01
    Simple example; invoice with table output of flight booking for one customer
    SF_EXAMPLE_02
    Similar to SF_EXAMPLE_01 but with subtotals
    SF_EXAMPLE_03
    Similar to SF_EXAMPLE_02, whereby several customers are selected in the application program; the form is called for each customer and all form outputs are included in an output request
    Advantages of SAP Smart Forms
    SAP Smart Forms have the following advantages:
    1. The adaption of forms is supported to a large extent by graphic tools for layout and logic, so that no programming knowledge is necessary (at least 90% of all adjustments). Therefore, power user forms can also make configurations for your business processes with data from an SAP system. Consultants are only required in special cases.
    2. Displaying table structures (dynamic framing of texts)
    3. Output of background graphics, for form design in particular the use of templates which were scanned.
    4. Colored output of texts
    5. User-friendly and integrated Form Painter for the graphical design of forms
    6. Graphical Table Painter for drawing tables
    7. Reusing Font and paragraph formats in forms (Smart Styles)
    8. Data interface in XML format (XML for Smart Forms, in short XSF)
    9. Form translation is supported by standard translation tools
    10. Flexible reuse of text modules
    11. HTML output of forms (Basis release 6.10)
    12. Interactive Web forms with input fields, pushbuttons, radio buttons, etc. (Basis-Release 6.10)
    Regards
    Anji

  • Timeout when using  ALV build-in functionality: exporting to Excel

    Hello,
    I have the following problem within one of my web dynpro abap applications:
    I need to be able to display data in a table that preferably should be via alv component.
    Then I shall also be able to download the displayed data via Excel.
    So I have embedded the ALV component I added to the component within a view and activated the export to excel button.
    Downloading small amount of data does no lead to any problem, but when trying to process a larger amount of data (in this case 22500 entries), I get a timeout.
    Does anybody have any idea if it is possible to increase performance here without reducing the amount of data to be downloaded?
    thanks a lot ion advance!
    Ana

    Hello,
    coming back to the UI element download.
    I managed to get the data being saved to the desktop, but unfortunately, the data remains being displayed as in chines letters.
    Anybody got an idea, what parameters I might have set wrong? Or if I have to do an additional encoding before generating the XString?
    Here is the supply method code and the parameters I have set in the UI element:
    The Supply method
    method GEN_EXCEL_DOWNLOAD_DATA .
      data: wa_cmx_line type zksb_cmxshowline.
      data: lt_excel type zksb_cmx_excel_download_t.
      data: wa_excel type zksb_cmx_excel_download.
      data: l_guid type guid_32.
      data: l_url type string.
    * read context-------------------------------------------------------------------------------------
      data lo_nd_z_ksb_get_prcm type ref to if_wd_context_node.
      data lo_nd_exporting type ref to if_wd_context_node.
      data lo_nd_rt_zksb_cmx_show type ref to if_wd_context_node.
      data lo_el_rt_zksb_cmx_show type ref to if_wd_context_element.
      data lt_rt_zksb_cmx_show type table of wd_this->element_rt_zksb_cmx_show.
      data wa_rt_zksb_cmx_show like line of lt_rt_zksb_cmx_show.
    *   navigate from <CONTEXT> to <Z_KSB_GET_PRCM> via lead selection
      lo_nd_z_ksb_get_prcm = wd_context->get_child_node( name = wd_this->wdctx_z_ksb_get_prcm ).
    *   navigate from <Z_KSB_GET_PRCM> to <EXPORTING> via lead selection
      lo_nd_exporting = lo_nd_z_ksb_get_prcm->get_child_node( name = wd_this->wdctx_exporting ).
    *   navigate from <EXPORTING> to <RT_ZKSB_CMX_SHOW> via lead selection
      lo_nd_rt_zksb_cmx_show = lo_nd_exporting->get_child_node( name = wd_this->wdctx_rt_zksb_cmx_show ).
    *   @TODO handle not set lead selection
      if lo_nd_rt_zksb_cmx_show is initial.
      endif.
    * get static attributes table
      lo_nd_rt_zksb_cmx_show->get_static_attributes_table( importing table = lt_rt_zksb_cmx_show ).
    * reduce data to only the data that shall be displayed----------------------------------------
      loop at lt_rt_zksb_cmx_show into wa_rt_zksb_cmx_show.
        move-corresponding wa_rt_zksb_cmx_show to wa_excel.
        append wa_excel to lt_excel.
      endloop.
    * populate data as tab separated strings-----------------------------------------------------
      data l_str  type string.
      data lv_struct type extdfiest.
      data itab type ref to zksb_cmx_excel_download_t.
      data r_xstring type xstring.
      data s(256) type c.
      field-symbols <wa_desc> like line of lv_struct.
      field-symbols: <tab> type table.
      field-symbols:  <wa> type any.
      field-symbols:  <f> type any.
    * populate the column headers----------------------
      get reference of lt_excel into itab.
    * assign lt_excel to <tab>.
      assign itab->* to <tab>.
      lv_struct = wd_this->get_table_structure( itab = itab ).
      loop at lv_struct assigning <wa_desc>.
        concatenate wa_cmx_line
                    <wa_desc>-coltitle
                    cl_abap_char_utilities=>horizontal_tab
                    into wa_cmx_line.
      endloop.
      concatenate wa_cmx_line
                  cl_abap_char_utilities=>cr_lf
                  into wa_cmx_line.
    * loop through the data table-----------------------
      loop at <tab> assigning <wa>.
        loop at lv_struct assigning <wa_desc>.
          assign component sy-tabix of structure <wa> to <f>.
          check sy-subrc = 0.
          if <wa_desc> is assigned and <wa_desc>-convexit is not initial.
    *  Process any output conversion routines
            concatenate 'CONVERSION_EXIT_' <wa_desc>-convexit '_OUTPUT' into wa_cmx_line.
            call function wa_cmx_line
              exporting
                input  = <f>
              importing
                output = s.
          else.
            concatenate wa_cmx_line
                     <f>
                      cl_abap_char_utilities=>horizontal_tab
                      into wa_cmx_line.
          endif.
        endloop.
        concatenate wa_cmx_line
                    cl_abap_char_utilities=>cr_lf
                    into wa_cmx_line.
      endloop.
    *Convert the strings to Binary strings (UTF-16le)------------------------------------------------
      call function 'SCMS_STRING_TO_XSTRING'
        exporting
          text     = wa_cmx_line
          mimetype = ''
        importing
          buffer   = r_xstring.
    *Add the UTF-16 Little Endian Byte Order Mark to the begining of the file
      concatenate  cl_abap_char_utilities=>byte_order_mark_little
                   r_xstring
                   into r_xstring in byte mode.
    * set context
      DATA lo_nd_excel_download TYPE REF TO if_wd_context_node.
      DATA lo_el_excel_download TYPE REF TO if_wd_context_element.
      DATA ls_excel_download TYPE wd_this->element_excel_download.
      DATA lv_excel_download_data LIKE ls_excel_download-excel_download_data.
    * navigate from <CONTEXT> to <EXCEL_DOWNLOAD> via lead selection
      lo_nd_excel_download = wd_context->get_child_node( name = wd_this->wdctx_excel_download ).
    * get element via lead selection
      lo_el_excel_download = lo_nd_excel_download->get_element(  ).
    * set single attribute
      lo_el_excel_download->set_attribute( name =  `EXCEL_DOWNLOAD_DATA`  value = r_xstring ).
    endmethod.
    and the parameters to the UI are as follows
    behaviour: allowSave
    data: <data that was created by supply method>
    fileName: CMX.xls          also tried CMX.cvs
    mime-type: ms-excel     also tried  /vnd.ms-excel
    text: $OTR:SOTR_VOCABULARY_BASIC/DOWNLOAD
    textDirection: inherit
    type: navigation
    visible: Visible
    Any suggestion of what I might have to change would be great!
    Tx
    Ana

  • How to call smartform FM after using SSF_FUNCTION_MODULE_NAME?

    Hi Experts,
    How to call smartform FM after using SSF_FUNCTION_MODULE_NAME?
    I mean, in driver program i called SSF_FUNCTION_MODULE_NAME to get the related FM  for my smart form. after that How do I call it(smartform fm) . I tried to call by pressing PATTERN button in Report. but it is showing FM is not exist error.
    Call function SSF_FUNCTION_MODULE_NAME
    Export
    formname = 'zsmartform'
    import
    fm_name = function_name.
    function_name is stored the corresponding smartform fm. then How do i call it to process my smartform?
    thanks in advance.

    hi,
    Chk this sample.
    DATA: p_output_options TYPE ssfcompop, "occurs 0 with header line
    p_control_parameters TYPE ssfctrlop. "occurs 0 with header line
    p_output_options-TDCOPIES = 3. "number of copies.
    p_output_options-tddest = 'LP01'. "def
    p_control_parameters-no_dialog = 'X'. "no dilog box
    p_control_parameters-preview = 'X'. "no preview
    DATA : v_form_name TYPE rs38l_fnam.
    *---- Function to get the function module name of the    ----
    *---- specified Smart form.                              ----
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'GIVE YOUR SMART FORM NAME'   
    * VARIANT = ' '
    * DIRECT_CALL = ' '
    IMPORTING
    fm_name = v_form_name
    EXCEPTIONS
    no_form = 1
    no_function_module = 2
    OTHERS = 3 .
    *---- Function Module to call the Smart Form          ----
    *step 1 - go to ur smart form
    *step2 - take environment
    *step3-take function module name
    *copy that unique number.
    *step4 -come back to ur driver program.
    *step5 - place ur cursur here. take patter,.give that unique number.
    *at that time u will get the below code.
    *step6 - rename that unique number with 'v_form_name' in the code generated by pattern.
    CALL FUNCTION v_form_name
    EXPORTING
    * ARCHIVE_INDEX =
    * ARCHIVE_PARAMETERS =
    control_parameters = p_control_parameters
    * MAIL_APPL_OBJ =
    * MAIL_RECIPIENT =
    * MAIL_SENDER =
    output_options = p_output_options
    user_settings = ' '
    * ARCHIVE_INDEX_TAB =
    * IMPORTING
    * DOCUMENT_OUTPUT_INFO =
    * JOB_OUTPUT_INFO =
    * JOB_OUTPUT_OPTIONS =
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    for any clarifiaction pls revert.
    regards,
    Reshma

  • CALL FUNCTIONS

    HI ALL
    WHERE CAN I FIND ALL THE FUNCTION MODULES USED IN ABAP AND I ALSO NEED EXPLANATIONS ....CAN ANYONE HELP
    WITH REGARDS
    VIJAY

    Hi,
    You can use the table TFDIR  to see all the fun modules in ABAP.
    see the doc  and links for further details
    Function Modules;
    Check this matter.
    Function Modules are Glopbal ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.
    You can create them from TCode SE37.
    Go through the following doc:
    Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder.
    Function Module Interfaces
    The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax:
    Syntax
    ... [IMPORTING parameters]
    [EXPORTING parameters]
    [CHANGING parameters]
    [TABLES table_parameters]
    [{RAISING|EXCEPTIONS} exc1 exc2 ...]
    The syntax and semantics of IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS mainly correspond to the definition of method interfaces with [CLASS-]METHODS. The additional option of defining table parameters using TABLES is obsolete.
    Interface parameters
    The interface parameters are defined on the relevant tab pages in the Function Builder.
    IMPORTING parameters are input parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which 'pass by reference' is defined cannot be changed in the function module.
    EXPORTING parameters are output parameters. When the function module is called, a suitable actual parameter can be specified for every output parameter. The content of an output parameter that is defined for 'pass by value' is transferred to the actual parameter if the function module is completed without errors. An output parameter that is defined for pass by reference is not initialized when the function module is called.
    CHANGING parameters are input and output parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input or output parameter. When the function module is called, the content of the actual parameter is passed to the input/output parameter, and when the function module is completed, the content of the input/output parameter is passed to the actual parameter.
    TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
    Exceptions
    The exception of a function module are defined on the Exceptions tab page in the Function Builder. Here you can select exception classes to define whether class-based exceptions are declared or non-class-based exception are defined. Class-based exceptions are represented in the above syntax by RAISING, and non-class-based exceptions are represented by EXCEPTIONS.
    The addition RAISING is used to declare class-based exceptions that can be propagated from the function module to the caller. Exceptions in the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be explicitly declared, otherwise a propagation can lead to an interface violation. A violation of the interface leads to the treatable exception CX_SY_NO_HANDLER. Exceptions of the category CX_NO_CHECK are implicitly always declared. The declaration of exceptions of the category CX_STATIC_CHECK is statically checked in the syntax check. For exceptions of the category CX_DYNAMIC_CHECK, the check is not performed until runtime. In a function module in which class-based exceptions are declared with the RAISING addition, the statement CATCH SYSTEM-EXCEPTIONS cannot be used. Instead, the relevant treatable exceptions should be handled in a TRY control structure.
    The addition EXCEPTIONS is used to define a list of non-class-based exceptions that can be triggered in the function module using the statements RAISE or MESSAGE RAISING. Exceptions defined in this way - as with formal parameters - are bound to the function module and cannot be propagated. If an exception of this type is triggered in a function module, and no return value has been assigned to it with the homonymous addition EXCEPTIONS of the CALL FUNCTION statement when the call was made, this leads to a runtime error.
    Note
    For new developments after release 6.10, SAP recommends that you work with class-based exceptions that are independent of the function module.
    RFC is a technology which is used to access a functions (Modules) from
    the remote systems.
    If a function module is set as remote enabled which can be access from
    the remote system via RFC.Eg: U can access the Remote enabled function modules in ur VB,Webdynpro,Java,Visual composer program.
    A function module can be set as remote enabled by SE37->Go to ur FM->click the option Button "remote enabled".
    But Normal function modules can not accessd from the remote system.
    Good Example for RFC enabled function module is : BAPI(Business Application Programming Interface)
    Note: All BAPIs are Remote enabled but not all remote enabled function modules are BAPI.
    CALLING A FUNCTION MODULE:
    1)In U ABAP Editor --> Click "Patter" ---> Selection Option Button "Call Function"
    --> Write the Corresponding FM name --> Hit Enter
    2)The appropriate import ,export Parameters will be displayed in ur editor
    3)Pass the Values Here.
    Also check these links.
    Check this link:
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    Check this link:
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    See the following links:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
    reward if useful
    regards,
    Anji

Maybe you are looking for

  • My gmail folder structure was corrupted and content apparently lost following a freeze of Thunderbird that required stop of process from Task Manager.

    The freeze occurred when I attempted to drag a message into a subfolder of the structure that is now corrupted. Only one subfolder remains available. The label of the folder appears grayed and italicized.

  • Initialize a stateful session bean from another

    Hi, I am trying to create and initialize a stateful session bean from another stateful session bean. The code is as follows This method belongs to DefaultSessionBean where it creates the AdminSessionBean based on few checks and returns it to the clie

  • Any week 22 or 49 Macbook Pro Retina Builds

    I have recently purchased a MBPr, and have recently come across this forum of burn in issues. I have tried to figure out if my display is LG or Samsung, but still have not come across a way to do that without opening the package. Anybody know of a wa

  • How to uninstall BI 10.3.3.0 SILENTLY?

    I have to package BI 10.3.3.0 for mass distribution. I can install it silently with the response file, that's no problem. However, the silent UNINSTALL does not seem to work. I believe this is because it wants the password for the OC4JADMIN account.

  • BEx End-Of-Support

    Can someone from SAP provide some details about the BEx end-of-life schedule/timeline.  If there is a document describing this, you could just refer to that document.  I'm not talking about end of enhancements, rather end of support.  Thanks. Edited