Doubt in  export, import and table para when creating Function Module

Dear fellow ABAPers,
I have a doubt in defining export, import and table parameter while creating a function module.
I am calling a function module inside a user exit. Now in the user exit the SAP fills an internal table called i_lfa1 with all the data user has eneterd.
Now I want to pass this whole internal table to function module and the perform some checks on the values of internal table.
After that function module fills an error structure with values depending on some check.
1)
How do I pass this internal table to function module ? 
When I am creating function module in se37 where do I define this iternal table type ? Is it in Import or Table parameter during function module creation?
2)
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Please clear my doubt..
Relevant points will be awarded.
Regards,
Tushar.

Hi Tushar,
1. How do I pass this internal table to function module ?
   I assume u are creating your own Y/Z FM.
   Pass it thru TABLES parameter.
2. When I am creating function module in se37 where do I define this iternal table type
   Define this in TABLES interface.
   What Type ?
   THE SAME TYPE WHICH HAS BEEN DEFINED
    WHILE PASSING IN THE USER-EXIT FUNCTION MODULE.
   IF U SEE THE FM OF THE USER-EXIT,
   U WILL COME TO KNOW.
3.
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Define it in TABLES interace. (not in export, import)
  (Since what u are going to return is an internal table)
  U can take for eg. BDCMSGCOLL.
  OR u can create your own Y/Z structure
for the same purpose.
  (or u can use the structure type T100)
I hope it helps.
Regards,
Amit M.

Similar Messages

  • Export, Import and Table declaration in custom function module

    I am creating a custom function module. Parameters needed are export internal table and one data field from the internal table.
    What do i need to fill for 'associated type' for these export parameters since size of the internal table and type for the data field from the internal table vary.

    Hello Albert
    If the function module need not be RFC-enabled then you have many ways to define such dynamic parameters, e.g.:
    FUNCTION ZUS_SDN_DYNAMIC_PARAMS.
    *"*"Local Interface:
    *"  EXPORTING
    *"     REFERENCE(ET_ITAB) TYPE  TABLE
    *"     REFERENCE(ET_ITAB_1) TYPE  ANY
    *"     REFERENCE(ET_ITAB_2)
    *"     REFERENCE(ED_DATA) TYPE  CLIKE
    *"     REFERENCE(ED_DATA_1) TYPE  ANY
    *"     REFERENCE(ED_DATA_2)
    ENDFUNCTION.
    See also: How to return back a structure of dynamic tables in a Function Module
    Regards
      Uwe

  • "Changing" parameter and "Tables" parameter defintions in function module

    If one defines "Changing" or "tables" parameters, they are treated as reference parameters.
    It becomes obvious for "tables" parameters where one does not have option to check box for "Pass by Value". But for "Changing" parameters, they provide the checkbox for "Pass by Value". Even when you select this option, the function module seems to handle the parameter as a reference parameter (whatever changes you make to it in the function module are retained when you return back to a calling program).
    My question is why then SAP has provided the checkbox of "Pass by Value" for "Changing" parameter?
    Thanks.
    Jitendra Mehta

    Hi Chaiphon:
    Thanks for explanation but I know the theory of "Pass by reference" versus "Pass by Value".
    Let me rephrase my question.
    When I use the importing parameter (say as a table with a dictionary table type) with reference (not "passing by value"), and if I modify the value of the parameter, the calling program (which calls function module) receives the changed value after the call.
    When I use the importing parameter with "Pass by Value" box checked, the modifications made to the table inside the function module is not retained after the code leaves function module and returns to the calling program.
    My question is why not the same behaviour with the "Changing parameter" in function module definition?
    And if Changing parameters are always reference parameters, then why SAP has provided the "Pass by Value" check box?

  • Syntax Error with Table Parameter (type: ANY) when Creating Function Module

    Hello experts,
    I want to create a function module with a table parameter and table type is ANY. But when I check (Ctrl+F7) this function module, syntax error occurs - "In this statement, the internal table "MSG_TABLE_ITEM" must have the type "STANDARD TABLE"."
    Could anyone tell me what the wrong is? And how can I fix it?
    Thanks,
    Shelwin

    Hi,
    For table parameters, you can only pass
    MSG_TABLE_ITM   TYPE STANDARD TABLE
    or
    MSG_TABLE_ITM  ( don't fill other columns TYPING ASSOCIATED TYPE  ).
    For reference check FM 'GUI_UPLOAD' - Table parameters
    Regards,
    DPM

  • Difference between client Export/Import and a system refresh

    Hi Experts,
    I would like to know the diffrence between client Export/Import and System refresh.
    Actually i have done client export from our production system and imported it into our quality system, I have asked our functional consultants whether the production data is now available in Quality. They replied me saying whole data of production system is available in Quality system as off date i have copied the export.
    The size of the export was around 8GB, How can this have all the data of Production system which is around 600 GB.
    In this way what is the use of System refresh which is done by database level ( changing the cntrl file etc... ), As i am getting all the data by doing Client Export/Import.
    Thanks & Regards,
    Injamuri

    Hi,
    What is system refresh when and why it is done?
    The system refersh is nothing but the deletion of the client and replacing the data from other client. For example : you have clients 100, 200 and 300. Suppose when you want to refresh the client 100 you remove the client 100 and replace it with 200 0r 300 as per your reqiurement.
    Mostly the refresh of clients will be happen at the time of development stage.
    System Refresh is a simplified term to Client Copy. Client Copy means copying the production client on to the quality to test the real data. As recommend by SAP this need to carried out every 3 months.
    The process to carry out the same is as follows:
    1. Create a client on quality system using txn scc4
    2. Create a RFC between Production system and Quality System (need to create on quality system)
    3. Login to the newly created client using sap* and pass as a password
    4. Txn sccl to start the client copy.
    You can test the client copy by selecting the test run option. (test run will estimate the time taken for the activity).
    Anil

  • Tables used when creating a sales return with and without refrence

    Hiya gurus,
                    I am developing a report to display sales order and sales return created from one partiular storage location and for one particular division. I need to get the tables used when creating the sales order and the sales return's.
                   For sale order I would be using VBAK and VBAP but for sale return with refrence and without refrence i am not sure which tables to look for.
                 kindly please let me know which tables i go for to get the sale return data.
                Thanking you very much, your efforts are deply appreciated
    Cheers,
    ZIa

    Hi,
    U can see VBFA tablefor CompleteDocu flow with differentconditions.
    Regards,

  • What are the important standard table use in FI/CO module?

    What are the important standard table use in FI/CO module?
    Moderator Message: Please avoid asking such queries.
    Edited by: kishan P on Jan 24, 2012 12:37 PM

    Hi Sanj,
    Please go through the available information and then you can ask if there is any queries.
    [Google|http://www.google.co.in/search?sourceid=chrome&ie=UTF-8&q=importanttablesinficoin+sap]
    Regards,
    Madhu.

  • To see the username and datetime who/when created and who/when last updated the record

    Excel Addin and Web UI future:
    We need to see the username and datetime who/when created and who/when last updated the record.
    We need these columns in tables (as shown columns with status error)
    from Moscow with money

    Vincent,
    By the way, Just this week
    we have +20 MDS-users
    from Moscow with money

  • Work flow and tables related with ESS Travel Module

    Hi Experts,
    I am new for work flow. Presently I am working for SAP ESS / MSS Travel module. Can you please let me know the names of work flows and tables related with ESS Travel module.
    Regards,
    Gary

    Hi Gary,
    Check if this [thread1|Let us learn SAP ESS Travel] [thread2|Travel Management Tables] helps you.
    Regards,
    Saumya

  • Error BT616 when calling function module SXPG_COMMAND_EXECUTE in background

    Hi All,
    We use function module SXPG_COMMAND_EXECUTE with a custom command we defined in SM69 to move files in unix (mv command).
    The function module call has worked fine for almost a year and recently we have been seeing an error (BT616) in our job lob (SM37) when the program is run in background. We have not been able to reproduce the error in foreground mode and it seems to be occuring only periodically in the background. (The appropriate SAP authorization objects where assigned to the batch job ID and the steps on the batch job.) We are in the process of setting up the trace flag and performing analysis on the trace log via ST11 to help identify the issue.
    After perform analysis on SXPG_COMMAND_EXECUTE, the error is occurring when calling function module SAPXPG_END_XPG for exception 2, system failure, yet function module SAPXPG_END_XPG does not exist. I assume this is a program at the operating system level and is just a signature of the parameters to be passed to the operating system program.
    Below is part of the SAP function module SXPG_COMMAND_EXECUTE that is failing.
    * Now we have to wait for the termination of the external
    * command if the caller wants us to.
        IF TERMINATIONWAIT = 'X'.
          CALL FUNCTION 'SAPXPG_END_XPG'
            DESTINATION DESTINATION
            IMPORTING   EXITSTAT = STATUS
                        EXITCODE = EXITCODE
            TABLES      LOG      = LOG
            EXCEPTIONS  COMMUNICATION_FAILURE = 1 MESSAGE MSG
                        SYSTEM_FAILURE        = 2 MESSAGE MSG.
    I performed a where used on function module SXPG_COMMAND_EXECUTE, and most of SAP programs call the function module with the parameter TERMINATIONWAIT = 'X', so I assume we should pass ‘X’ as well.
    Any ideas on what could be causing this issue?
    Mike Vondran

    I also remember I have this kind of issue, as I have some UNIX script at OS( UNIX) level . The problem was with the ID , as it don’t have proper authorization at OS level ( UNIX ) . Please check this ID authorization. This could be the one of reasons if you’re sure from SAP standpoint.
    Hope this’ll give you some guide line..
    Thanks
    Bye

  • How to capture errors when a Function module is called as BACKGROUND TASK

    How to capture errors when a Function module is called as BACKGROUND TASK?.Please advise.
    FUNCTION ZRPM_DELETE_PROJECT_DATA_API.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(IV_EXTERNAL_ID) TYPE  RPM_TV_EXTID OPTIONAL
    *"     VALUE(IV_PROJECT_GUID) TYPE  RPM_TV_GUID OPTIONAL
    *"     VALUE(FLAG) TYPE  BOOLEAN OPTIONAL
    *"  EXPORTING
    *"     VALUE(EV_RC) TYPE  I
    *"     VALUE(EV_MSG) TYPE  STRING
    *"     VALUE(ET_MSG) TYPE  RPM_TT_MESSAGES
      IF flag = cl_rpm_co=>sc_true.
        Call function 'RPM_DELETE_PROJECT_DATA' IN BACKGROUND TASK
          EXPORTING
            IV_EXTERNAL_ID  = IV_EXTERNAL_ID
            IV_PROJECT_GUID = IV_PROJECT_GUID
          IMPORTING
            EV_RC           = EV_RC
            EV_MSG          = EV_RC
            ET_MSG          = ET_MSG.
        COMMIT WORK.
      ELSE.
        CALL FUNCTION 'RPM_DELETE_PROJECT_DATA'
          EXPORTING
            IV_EXTERNAL_ID  = IV_EXTERNAL_ID
            IV_PROJECT_GUID = IV_PROJECT_GUID
          IMPORTING
            EV_RC           = EV_RC
            EV_MSG          = EV_MSG
            ET_MSG          = ET_MSG.
      ENDIF.
    ENDFUNCTION.
    In above code how to capture 'EV_RC' when FM is called as background task.

    Prakash,
    CALL FUNCTION IN BACKGROUND TASK allows no IMPORTING parameters, so that your code will produce a syntax error.
    The calling program can only handle errors of remote function calls (RFC) if these are either
    - synchronous RFC  (that is CALL FUNCTION ... DESTINATION ...) or
    - asynchronous RFC (that is CALL FUNCTION STARTING NEW TASK ... DESTINATION ...).
    Both synchronous and asynchronous RFC allow the capturing of errors by means of exceptions. But that is a different topic.

  • How to get tables used by a Function Module

    Hi,
    How to know the tables used by a function module dynamically.
    Cuurently im using BAPI_MATERIAL_SAVEDATA in my report program.
    I tried FM GET_TABLES to know the tables, but could see only tables used in the report.
    Main issue in my case is when im running this update program, could observe different tables being displayed as updated in SM50(Process Overview).Want to clarify as why these tables which are not being used in my report are being displayed in SM50.
    So was doubtin weather this FM is using these displayed tables.
    Thanks in advance for u r replys.
    Regards,
    Dedeepya

    Hi Dedeepya,
    you could use a SQL Trace (tx. ST05) to list all tables affected and operations that realize. Just active the trace, execute FM, and Deactive trace. Then click in "Display trace" and check it.
    Best regards,
    Pablo

  • Passing selection table as parameter to function modules

    i tried to pass a selection table as a parameter to a function module but there is a problem stating the eror the table length is different.
    *& Report  ZSFSELECT_OPTIONS_PGM
    REPORT  zsfselect_options_pgm.
    TABLES zselect_options.
    SELECT-OPTIONS sop FOR zselect_options-id.
    DATA  : fname(15) TYPE c.
    *CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
       formname                 = fname
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
      FM_NAME                  =
    EXCEPTIONS
      NO_FORM                  = 1
      NO_FUNCTION_MODULE       = 2
      OTHERS                   = 3
    *IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    DATA lth(2) TYPE c.
    DATA ty TYPE i.
    DATA o TYPE i.
    DATA l TYPE i.
    DATA k TYPE c.
    DESCRIBE FIELD sop-sign TYPE lth LENGTH ty IN CHARACTER MODE.
    CALL FUNCTION fname
    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
        sf_sop                     =sop
    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.
    in the smart form i have tried to pass the sp as the table.
    i have created a program line node
    :SELECT * FROM zselect_options INTO TABLE it_tab WHERE id IN sf_sop.

    Hi,
    If i understand ur problem correctly u r trying to pass a select-option to Tables for a smartform function module. It gives an error & it correct.
    If u understand the structure of a select option, it will have 4 fields in it & the structure will be
    SIGN                   CHAR1
    OPTION               CHAR2
    LOW                   Type Zfield
    HIGH                   Type Zfield
    But ur receiving Table paramter of the smnartform FM will be having only 1 field - Type Zfield
    So this mismatch gives u an error.
    Solution:
    Case1:
    Write code outsied th FM in ur program to get all the values & build an internal table & pass that to the FM.
    Case2:
    Define the Structure of table in the smartforms as tols earlier & then try passsig the Select option.
    Thanks & Regards,
    Bhargava

  • When change Function Module, how to ensure JAVA sees it

    I added a new TABLE to a remotely-callable Function Module.  I added a new table to the "TABLES" tab of the function module.  The table is then populated by the code in the FM. 
    I now want the JAVA code to be able to access this new TABLE.  I am using the "adaptive RFC" model to make calls to SAP.
    After making a change such as this, do I need to
    1. stop and start the JRA factories?
    2. stop and start the J2EE java application?
    3. stop and start the whole server?
    Thanks,
    Kevin

    1. stop and start the JRA factories? <b>If you are working ARFC then nothing to do with JRA factory.</b>
    2. stop and start the J2EE java application? <b>If you have used Enterprise Connector then Re Impor the Model </b>
    3. stop and start the whole server?<b>After re import you need to restart the server</b>
    Regards
    Abhilash

  • Problem when calling function module CV120_DOC_CHECKOUT_VIEW in background

    Hi ,
    I'm currently developping an abap program which extract document from KPRO for printing into a windows Folder.
    For this I use standard function module CV120_DOC_CHECKOUT_VIEW.
    When i run my program in foreground task there's no problem, but when i run it in background task the extract doesn't work. It seems that the system cannot connect to the Windows Network.
    Whe the program is running in foreground task, the function module user SAPHHTP RFC destination, when it runs in background task it use SAPFTP destination .
    Does somebody can help me ?
    thanks in advance

    Hi Ajay,
    The program extract document into a folder on Windows Network that means on a server not on a PC .
    I know that in background task ther's no connection with sapgui.
    For example when i want to create a file on network n background task i use OPEN_DATASET instruction and that works fine.
    My problem is the use of the standard function module CV120_DOC_CHECKOUT_VIEW in background task because when this function module is running in background task it use the SAPFTP rfc destination instead of SAPHHTP rfc destination in foreground task . I check the RFC destination , thoses works both . SO i think the problem comes from parameters given to the function module.
    Regards.

Maybe you are looking for

  • Still can't send group text messages in 3.0???

    Why??? Someone shine some light. Cheers.

  • My mac bookpro is stole how to find it?

    i am militaire in legion etrangere 2012/1/20 when i return from service in my room i open my drawer case where i put my mac bookpro when i open it there is no my laptop after that i ask all over nd searching i can't find it so i want to help to find

  • Download Oracle 10g Release 2 for Solaris doesn't work

    Hi, I think the file to download Oracle 10g Release 2 for Solaris Sparc 64 has incorrect format. After download I try to do as you suggest: guzip file But the result is: gunzip: 10gr2_db_sol.cpio.gz: invalid compressed data--format violated Could you

  • How to contain the manual po into the PS cost?

    My customer requirement: 1. sometime my customer will use cn22 to create the PR.And then convert PR to PO. we use the menu edit->costs/ itemization  in tcode CN22 to see the item cost. all the item corresponding the cost element we just created will

  • Best Way to get part of a image

    Hi , i´m trying to achieve a behaviour with bitmaps but a little bit confused. Objective: (As shown in image attached) I have a Movieclip with a static Shape on Stage ( Let´s say ... a star) I would like to load a image(img1) , then i would be able t