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

Similar Messages

  • 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.

  • Update the custom table by using Custom Function module.

    Hi Experts,
            My requirement is ,
    1) To create the Custom Z table with fields
               vbak-vbeln
               likp-vbeln
               vbuk-vbeln
      After creating this Z table.
    2) I have to create one custom function module.
        Based on this function module i have to update that Z table.
    3) Before these steps i have to write down an ALV report based on the tables vbak and vbeln, in that table i have to print vbak-vbeln. and also in report i generated check box and one custom button in application toolbar. after the report will displayed , when ever i click the button in application tollbar , this function module will executed and the table will be updated.
        But I developed the ALV report with custom button and check box successfully.
      My doubt is how to write the function module and based on that function module how to update the table.
          Please suggest me on this requirement.
        Thanks in Advance.
    Thanks and Regards
    Srihari.

    HI ,
         Can any one help me out on my above requiremnet..
    Thanks and Regards
    Srihari.

  • "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?

  • Export tables in custom function module

    I am creating a custom function module and want to return a table of contacts i_contacts.
    In the global data area I created a structure
    TYPES: BEGIN OF t_contacts,
              prsnr       TYPE knvk-prsnr,
              contactinfo TYPE adr6-smtp_addr,
           END OF t_contacts.
    And then in my interface I am trying to include as a table
    i_contacts like t_contacts
    But it keeps saying t_contacts not defined. Does that mean I have to define t_contacts as a global structure in SE11. Isnt there another way to define an internal table in the interface. Please advice.

    Hi..
    Declare like this..
    Data: i_contacts type standard table of t_contacts.
    i_contacts like t_contacts does not work because t_contacts is not an internal table with header line.
    Hope this helps.
    regards,
    chaithanya.

  • OO ABAP inerenal table and tables declarations?

    Hi All,
    1.I am new to OO ABAP, can any one give me clear idea how to declare Internal tables, work area and table declarations and how to use and read them?
    2. I am having a problem,
    I declare a table like this
    IT_CRMD_ORDERADM_H TYPE TABLE OF CRMD_ORDERADM_H.
    and in the perform statement
    Pefrom using
    IT_CRMD_ORDERADM_H[]
    and in form ( i need to read and select a record from this table)
    can any one give me solution how to do this?
    thanks for ur time.
    sandhya

    Hai Sandhya
    Go through the following Code
    *& Report  ZABAP_OBJ_01                                          *
    report  zabap_obj_01                      .
    parameters : p_vbeln like vbap-vbeln obligatory,
                 p_matnr like mara-matnr.
    <b>types : begin of ty_vbap,
            vbeln type vbap-vbeln,
            matnr type vbap-matnr,
            arktx type vbap-arktx,
            end of ty_vbap.</b>
          CLASS sales_order DEFINITION
    class sales_order definition.
      public section.
        data : v_matnr type mara-matnr,
               v_vbeln type vbap-vbeln.
        events : no_data_found.
        methods : constructor importing vbeln type vbap-vbeln
                                        matnr type mara-matnr optional,
                  get_vbap_details,
                  disp_vbap_details,
                  Handle_no_data_found
                  for event no_data_found of sales_order.
    <b>    data : it_vbap type standard table of ty_vbap.</b>
    endclass.                    "sales_order DEFINITION
          CLASS sales_order IMPLEMENTATION
    class sales_order implementation.
      method get_vbap_details.
        clear : it_vbap.
        refresh : it_vbap.
        select  vbeln
                matnr
                arktx
                from vbap
                into table it_vbap
                where vbeln = p_vbeln.
        if sy-subrc <> 0.
          raise event no_data_found.
        endif.
      endmethod.                    "get_vbap_details
      method constructor.
        clear : v_vbeln,
                v_matnr.
        v_vbeln = vbeln.
        v_matnr = matnr.
      endmethod.                    "constructor
      method Handle_no_data_found.
        write : / 'No Data Found for the given selection Criteria'.
      endmethod.
      method disp_vbap_details.
        data : wx_vbap like line of it_vbap.
        loop at it_vbap into wx_vbap.
          write :/ wx_vbap-vbeln,
                   wx_vbap-matnr,
                   wx_vbap-arktx.
        endloop.
        clear : it_vbap.
      endmethod.                    "disp_vbap_details
    endclass.                    "sales_order IMPLEMENTATION
    data : obj type ref to sales_order.
    start-of-selection.
      if not p_matnr is initial.
        create object obj exporting vbeln = p_vbeln
                                    matnr = p_matnr.
      else.
        create object obj exporting vbeln = p_vbeln.
      endif.
      set handler obj->Handle_no_data_found for obj.
      call method obj->get_vbap_details.
      call method obj->disp_vbap_details.
    Thanks & regards
    Sreenivasulu P

  • 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

  • How to declare Dynamic table in Tables Parameters of a Function Module...

    Hi Gurus,
    I would like to Know how to declare a Dynamic table in Tables parameters of a Function Module.
    so that it should be able to hold any table data ....
    I have tried all possible ways of trying to assign fields-symbol like declarations which doesnt allow here ...
    plz Dont reply with the basics of creating dynamic internal tables, coz my case is not an Internal table it is FM table parameter declaration.....

    Hi,
    If you are requirement is to create a function module with tables parameter having a generic line type i.e. no specific line type
    just declare it with a name under Parameter name with out specifying the type.
    A reference function module with such parameter, i would quote is the standard GUI_UPLOAD/ GUI_DOWNLOAD where the parameters specified under TABLES are generic.
    If you want to process the values passed to these parameters in the source code of function module, field symbols would be a preferable option.
    Regards,
    Sharath Panuganti

  • How to create a custom function module with the records in SAP R/3?

    Hi All,
    How to create a custom function module with the records in SAP R/3? Using RFC Adapter I have to fetch the custom function module records.
    Regards
    Sara

    Hi
    goto se37...here u need to create a function group... then u need to create a function module. inside assign import/export parameters. assign tables/exceptions. activate the same. now write ur code within the function module
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm
    Look at the below SAP HELP links, These links will show you the way to create a Function Module
    http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm

  • How to develope custom function modules in SAP R/3 system to maintain c...

    How to develope custom function modules in SAP R/3 system to maintain cross
    referencing tables for sales order number.

    Hi Raja,
    Steps to crate FM..
    Follow these steps..
    Go to the T: code SE37
    First You Create Function Group
    On That u specify
    Function Group Name..............
    Short Text..............................
    save...
    Go to SE 37
    Specify the Function Module Name: Eg: Z_Bapi_Materialmaster
    Short Text.......
    Save...
    Next Go to Attributes..
    Select Radio button : Remote enabled model
    Go to Parameters..
    Click Import...
    Give Parameter Type Associate type S.t
    next Click Export...
    Give Parameter Type Associate type S.t
    Next Click Tables Button..
    Specify tables..
    Next click source code button..
    Write Source code here..
    Eg : Select statements Etc..
    Finally we should be select the Radio button Enable remorely
    https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action?pageId=39728
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/bapi%2bstep%2bby%2bstep
    Hope this information is useful to you..
    Reward points if it is usefulll....
    Thanks ,
    Satya Kumar..

  • Error in Custom Function Module

    Hi,
    I am working on implementing General Ledger Business content in financial Accounting.
    We had a requirement of creating a Custom Virtual cube similar to 0FIGL_V10. Hence, we had copied the standard function module RS_BCT_FIGL_DATA_GET_VC10 and created a custom function module. Before doing that, we had copied the function group RS_BCT_FIGL and created a custom function group for the custom function module.Both were activated subsequently. Then, we had created a custom virtual cube (ZFIGL_V10) using the custom function module.
    The queries on the Standard virtual cube were migrated to ZFIGL_V10 using the RSZC transaction code. when the queries are executed in RSRT, we get an error message "**An exception with the type CX_SY_DYN_CALL_ILLEGAL_FUNC occurred" and the ABAP debugger is started post that error.
    Has anyone faced this problem before?could any of you provide some pointers to it.
    Regards,
    Sainath

    You cannot use the standard function module which is used for standard cube for another cube.
    You should not change the function module.
    Instead you can make a copy of the function module you are using aand use this copy in ur virtual cube which will work in the same way the actual Fm used to work and it will make you perfrom the changes.
    Follow the below steps:
    1) Goto SE37 and In the top tool bar click on the copy button which is on right side of delete button.
    2) in fr FM give the name of the actual FM and in to Fm give the name of the function module you want to copy.
    3) Then click on copy.
    4) Now open this new function in edit mode and goto the import/export parameters and check. it will have all the same parameters as the actual FM. Here you can make the changes you want.
    5) Now use this FM in your virtual cube and it will be working as per your requirement
    https://forums.sdn.sap.com/click.jspa?searchID=9605118&messageID=4999763
    Hope it Helps
    Chetan
    @CP..

  • Regarding custom Function Module

    Hi Group,
    Could anyone please guide me on a custom Function Module.
    Scenario:
    I have to use this function module to get either active records or inactive records.
    This function module which has yet to be created should have to code to fetch both active records and inactive records. It depends on what user has selected in a report.
    The report has 2 radio buttons in the selection screen. If rb_1 is selected then we have to call this function module and pass all the inactive records.
    And if rb_2 is selected then all the active records should be selected.
    Now I have to code the function module depending on the selection of the radio button. I can keep a flag in the function module and assign it 1 or 2 depending of the selection of the radio button.
    Guys could you guide me on how do I set a flag in such scenario in the function module?
    Like:
    In the Source code of function module.
    If flag = 1.
    select all invalid records
    endif.
    If flag = 2.
    select all valid records.
    endif.
    where should I keep this flag in my function module.
    After setting this how do I call it in the report, depending on the radio button selected and how do I code in my report.
    Hope you will understand this.
    A million thanks in advance.
    Kumar.

    hi,
    in the function module u have to declare "FLAG" as an import parameter. n then while calling this functon module from the report, u should paas a value to this "FLAG" based on the radio button selected.
    tell me if this information was helpful.

  • LSMW + Custom Function Module

    Hello Friends,
    Is it possible to call a custom function module from LSMW? Please let me know!
    Thanks,
    Sam

    Hi Sam,
    You can have your own custom programs for LSMW if the standard DI/BI IDOC , BAPI dont meet your requirements.
    Its little bit complex. You need to register you custom program in table through SM30.
    SDX0 - Program Definition ( BI or DI )
    SDX1 - Program Assignment
    SDX2 - Declaring Structures
    SDX3 - Declaring field identifiers for structures
    You can goto SM30 and can view the standard BI/DI programs definition by using the four digit Obejct Number...
    <b>AS</b>

  • Inconsistent Errors when processing  IDocs using custom Function Module

    I am encountering a most perplexing error. Here is the situation.
    We have a custom function module to update data in the EH&S system. We are having a bizarre error occurring. This is the basic processing of the function module:
    1. IDoc data is read and loaded into an internal table.
    2. Data is run through a series of checks to determine if the data is valid for entry into the system.
    3. After validation we use function module  C1F2_SUBSTANCES_READ_WITH_REF to read  characteristic data for the  substance. This data is used to validate whether current data exists to allow for loading of the IDoc data. (This is the step where the IDoc is receiving an error even if the data is valid. This only occurs if we are processing a large amount of Idocs and one IDoc contains valid data and another invalid data for the same substance. It occurs even if the Idocs are not processed in sequence.  If individually processed or reprocessed after initial failure they pass. This is what is so confusing!) If it exists, a flag is set and  the data is loaded using function module BAPI_BUS1077_CHANGE to modify the data.
    4. If the flag is set to allow further processing, the function module C1F2_SUBSTANCES_READ_WITH_REF is used again to select different characteristic data for the substance. A similar validation process occurs and if it passes, data is loaded using BAPI_BUS1077_CHANGE to update and BAPI_BUS1077_CREATE to create new data.
    Here is the situation:
    When processing one valid record for one substance, the record loads successfully.  When processing multiple valid records (all are valid) for one substance, they all load successfully.  The problem occurs when attempting to load valid and invalid records for the same substance.  Some times the program successfully loads the valid data (as expected).  Other times, it will not load any records.  It is not consistent!
    The order of IDoc processing does not have an impact on the success of the load.  Whether the valid or invalid record processes first does not have an impact on the success of the valid substance load.
    Does anyone have ANY Idea of what is going on? I am clearing all fields in the function module before processing occurs. I cannot find what is causing the error to occur.
    HELP!
    Jim Hardy

    I have some further information. It seems that if data for a substance is sent in two separate Idocs, one with valid and one with invalid data, As long as the two IDocs are processed consecutively, they process correctly. If they are separated by IDocs containing other substance information, they fail.
    thanks
    Jim

  • 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

Maybe you are looking for

  • I can't sync my iPhone 5 in iTunes. This just started about 3 weeks ago???

    I bought my iPhone 5 on 11-7-12, 12:25:25 p.m., from the AT&T store in Norman, OK. Everything has been fine, up until about three weeks ago, around the time that the 6.0.2 iOS update was sent out. I don't *know* that that is what is causing the probl

  • Photoshop images with spot channels in Indesign CS6 (layout question)

    I've got an Indesign CS6 layout that will have a spot varnish when it goes to press. Right now I've got a layout with psd files that have spot channels in them that will be used for the spot varnish. My question is, in Indesign when I'm laying this o

  • Multiple Page PDF

    I made an order form in LiveCycle a couple months back, and the first page of the PDF shows up fine. I decided to add a couple things to the form, making the form a couple pages longer, and in design view, the extra pages show up, and they look nice

  • Restoring Firefox tabs to new desktop, from earlier synced smartphone?

    I was refreshing my computer, by installing a new hard drive, and thus had to re install everything on it. But, before doing that, I synced my Firefox tabs, to my mobile's Firefox browser. But, now, when I'm trying get those tabs back on the desktop,

  • Clearlooks-gtk2 vs with gtk-engines

    The 2 packages in the title conflicts one with the other, and this is fine, because they both provide the engine for clearlooks. But what about the icons and the metacity themes that come with the first of the two? clearlooks-gtk2 provide a greater s