Exporting int table in a function module

Hi,
How to export the resultant table in function module ? I have  created a itab in my function module and it's getting filled up.I need to export this table ? how to do it?
DATA : BEGIN of itab occurs 0,
          empno type p0001-pernr,
          ename type p0001-ename,
          END of itab.
I don't want to create structure in se11.
Rgds,
jothi.P

Hello Mr. Jothi,
This is Venkat.O here.
Just follow this ..
<b>1. Function module source code.</b>
FUNCTION zvenkat_testfun.
""Local Interface:
*"  IMPORTING
*"     REFERENCE(PERNR) TYPE  PERNR-PERNR
*"  TABLES
*"      II_TAB
DATA:
  BEGIN OF li_output occurs 0,
      pernr TYPE pa0001-pernr,
      ename TYPE pa0001-ename,
  END OF li_output.
  SELECT pernr ename
    FROM  pa0001
    into table li_output
    WHERE  pernr  = pernr.
  IF sy-subrc = 0.
   ii_tab[] = li_output[].
  ENDIF.
ENDFUNCTION.
<b>2.Sample abap program  with Logical database PNP.</b>
REPORT zvenkat_notebook.
TABLES pernr.
DATA: BEGIN OF i_tab OCCURS 0,
        pernr TYPE pa0001-pernr,
        ename TYPE pa0001-ename,
      END OF i_tab.
START-OF-SELECTION.
GET pernr.
  CALL FUNCTION 'ZVENKAT_TESTFUN'
    EXPORTING
      pernr = pernr-pernr
  TABLES
    ii_tab        = i_tab.
  loop at i_tab.
   write:/ i_tab-pernr,
           i_tab-ename.
  endloop.
It is working fine.
By the way How are you .
Thanks,
Venkat.O

Similar Messages

  • Import and Export Vs. Tables in a Function module interface

    Hi,
    i need to import and export internal tables to/from a Function Module.
    Passing internal tables using import and export is good enough or do i need to use 'Tables' option. Please let me know the reasons if possible.
    thanks for your help.
    GK.

    you can use changing but you have declare a table type and use it in changing..
    however TABLES is declared aas oblselete in ECC version 6.0
    No Points Plz

  • Dynamic Export table of a function Module

    Hi Friends,
    I have a requirement where fields of  Export table of my function Module is dynamic. It is like the Fields to be expoerted by the Function Module would be stored in a seperate Z table
    The Z table would contain the records as follows .
    Table Name              FieldName
    =========     
    MARA                      MATNR
    MARC                      WERKS
    and So on..
    . How can I define my Export table in Function module dynamically so that the structure of my Export Function Module would be same as that of the Fieldnames in Z table..
    Thanks

    Just declare the associate type as "ANY TABLE" in the exporting parameter.
    FUNCTION ZTEST.
    *"*"Local Interface:
    *"  EXPORTING
    *"     REFERENCE(IT_TAB) TYPE  ANY TABLE

  • Table Name or Function Module to find out all the Screens & Subscreens for

    Hello Experts,
          Table Name or Function Module to find out all the Screens & Subscreens for all T-Codes
    Helpful Answer will b rewarded
    Arif Shaik

    Hi Balaji,
       But TSTC only Gives the Program Name , T-Code and Screen but not all the Subscreen details
    Any other which U know

  • Reg : Table name of Functional Module

    Can some one sent me the table name where functional module details get stored

    HI,
    Check for Function Module.
    Tables
    TFDIR----
    > Table contains Function Modules.
    TFTIT----
    >Table contains Function Module Short Text.
    ENLFDIR-----> Additional Attributes for Function Modules.
    rewards if useful,
    regards,
    nazeer

  • Add entries to database tables using update function module

    Hi All,
    I have a small requirement, in which I need to update Z-tables usimg update function module in update task. In the calling program, I have gathered the data in a field symbol value of type any. I need to pass the same to that function module to update the data which is in the field symbol.
    Please guide me how to achieve this technically.
    Thanks in advance,
    Pradipta .

    Hi,
    I believe you already have evrything with you.....Start Coding the same and come back with any Coding issue.
    I believe you will not be able to pass the Field Symbol in FM Interface.....You need to pass the Variable which Field Symbol is referring....

  • Tables-Parameter in Function module

    Hello together,
    i created a new function module in CRM with one "Tables"-Parameter. The parameter will be filled in debugging but if i call the fm in SAPRFC test script the table is empty. Do have any idea how i could solve this?
    Best regards
    Sascha

    Changing parameters can be used as work areas as well as tables, tables can not be used as work areas.
    Reference    Difference between changing and table parameters in Function Modules SAP ABAP - Modularization techniques in SAP ABAP | at SAPNuts.com

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

  • Table used in function module

    Hi,
    As I am programming ABAP for the first time I have a question which I think is pretty basic.
    I have created a function module Z_POPUP_GET_VALUES which calls the function POPUP_GET_VALUES. I got some sample code from another forum post and it defines a table name and fieldname. But I am not sure what this table is suppose to be (or do)? Is it an ABAP dictionary table? If so, how do I create one based on the characteristic I want to display??
    The implemented code is as follows:
    DATA: i_sval Like sval occurs 1 with Header Line.
    data: v_subrc like sy-subrc.
    i_sval-tabname =
    i_sval-fieldname = '?????'.i_sval-fieldtext = 'Eiendelsområde'.
    i_sval-field_obl = 'X'.
    append i_sval.
    CALL FUNCTION 'POPUP_GET_VALUES'
    EXPORTING
    NO_VALUE_CHECK = ' '
    POPUP_TITLE = 'Asset Area'
    START_COLUMN = '5'
    START_ROW = '5'
    IMPORTING
    RETURNCODE = v_subrc
    TABLES
    FIELDS = i_sval
    EXCEPTIONS
    ERROR_IN_FIELDS = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    All help appreciated!
    Best regards,
    TM

    Hi,
    Tables in function modules are parameter to that function module.
    That can be processed when the function module code is called.
       and the result can be stored in the tables.
    Tables have a structure like ABAP Dictionary structure .ie. You will be
    define the table type as a dictionary table.
    Regards,
    <b>Ramganesan K</b>

  • Associated table type of the Table parameters in function module

    Hi,
    If I want to select all the associated table types of the Table parameters used in a given function module in a report, how can that be done ?
    Thanks.
    Regards,
    Rajesh

    Try this.
    report zrich_0001 .
    data: import type table of rsimp with header line,
          change type table of rscha with header line,
          export type table of rsexp with header line,
          tables type table of rstbl with header line,
          except type table of rsexc with header line,
          docume type table of rsfdo with header line,
          source type table of rssource with header line.
    parameters: p_func type rs38l-name.
    call function 'RPY_FUNCTIONMODULE_READ'
      exporting
        functionname             = p_func
      tables
        import_parameter         = import
        changing_parameter       = change
        export_parameter         = export
        tables_parameter         = tables
        exception_list           = except
        documentation            = docume
        source                   = source
    exceptions
       error_message            = 1
       function_not_found       = 2
       invalid_name             = 3
       others                   = 4.
    loop at tables.
      write:/ tables-parameter,
              tables-dbstruct,
              tables-types,
              tables-optional,
              tables-typ,
              tables-class,
              tables-ref_class,
              tables-line_of,
              tables-table_of.
    endloop.
    Regards,
    Rich Heilman

  • Passing Internal Table to a Function Module.

    I am new to Web Dynpro Abap. Using the Function Builder, I am trying to pass an Internal Table (IT) as an import parameter into my Function Module (FM), fill it within the FM and be able to recieve the filled IT back as an Export parameter from the FM to my program. My problem here is that I do not know how to specify the Internal Table as an import OR export parameter for a Function Module, I tried using the Table Tab, but it says that is obsoleted.
    Anyone! Thanks.

    Hi,
    You want to pass the internal table to FM inside WD component and that table contains fields from diff table, right?
    Open the FM through SE37. Goto 'Tables' tab of FM. Create table of type mentioned in the 'Associated Type' column of the FM. Fill the internal table with data and pass the internal table to FM.
    You can create Table type with different fields through SE11.
    I hope I interpreted your question correctly.
    Regards,
    Saket.

  • How to set optional for table structure in functiona module

    hi experts,
    as i have small doubt regarding
    while publishing web service by using rfc where i am unable to set optional for table structure i am able to put optional for import parameters may i know how to set optional for table structure ....
    reagrds prabhanjan

    Ignoring the TABLES/CHANGING/EXPORTING argument...
    while publishing web service by using rfc where i am unable to set optional for table structure i am able to put optional for import parameters may i know how to set optional for table structure
    Why not?  There's no issue with marking a TABLES interface parameter with 'Optional' and publishing the function module or function group as a web service...

  • Error while passing a table to a function module

    Hi Iam passing a table g_tab of length 376 flat structure to the function module..under TABLES section parameter.
    Changedocument_read_headers.
    iam getting a complile time error like the below displayed thing. Can u tell me how to solve this ?
    In the function module interface, you can specify only
    fields of a specific type and length under "I_CDHDR".
    Although the currently specified field
    "G_CDHDR_TAB" is the correct type, its length is incorrect.
    Edited by: kiran kumar on Jul 7, 2008 8:53 AM

    probably u making a mistake while declaring the table
    declare it like this in the tables section:
    S_JOB     LIKE     RNGE_OBJID
    where s_job is the internal table name and RANGE_OBJID is a structure type and NOT an internal table type.

  • How do I read this "standard" table in my Function Module?

    I have a remote-enable Function Module (RFC).  I am receiving two tables as part of the parameters.  Table "A" is header information, and Table "B" is detail information.  So for every 1 "A" header record, I may have 1 to many "B" detail records.  I have a field we'll call "vendor_number" that is the common link between the two tables.
    Here's what I want to do:  I want to loop through table "A", and for each record, I want to do a READ on table "B", using the "ref_doc_no" from "A" as my key, to get the position of the first matching record.  I hold onto the value of the table index and then start looping table "B", adding 1 to the saved table index each time to process all of the detail records.
    Here's the problem:  This worked great as an ABAP program.  I had my "B" table declared with "ref_doc_no" as a non-unique key.  But when I ported my code over to the RFC, it told me that the RFC could only deal with standard tables.  I had to remove the "ref_doc_no" key declaration.  So now when I try to activate, I get an error similar to this:
    The declaration for the key field "another_field" is incomplete; however, "another_field" is contained in the key of table "B" and must be filled.
    I don't understand that.  I've not declared any keys for table "B".  I don't understand why it's thinking I need to populate "another_field" (I don't even know what the value would be).  My code to read the table (i.e. the line getting the error) is this:
    Priming read on table (sets the initial sy-tabix index value)
        READ TABLE it_incoming_invoice_line_item "table 'B'
          WITH TABLE KEY ref_doc_no =
                         wa_incoming_invoice_header-ref_doc_no
                    INTO wa_incoming_invoice_line_item.
    Is it possible for me to do some sort of direct read on a table in an RFC?  The only alternative I can think of would be to have to loop through table "B" until I find the first occurrence of a match.  Is that what I need to do?
    Thanks everyone.  Points, as always, awarded for helpful answers.

    Dave,
    1. You can fire SELECTS in an RFC as well, but in your case the data exists in SYSTEM A and the RFC is in System B, so you can't do that. You can fire SELECTS on tables in the same system.
    2. Quick example of two table loops - EKKO (HEADER) EKPO (ITEM).
    LOOP AT EKKO.
    LOOP AT EKPO WHERE EBELN = EKKO-EBELN.
    ENDLOOP.
    ENDLOOP.
    I hope this is clear now.
    Regards,
    Ravi

  • Table Types in Function Module

    Hi,
    How to use a table to capture the data from a file, in function module instead of using TABLES parameter.
    This parameter should exist in IMPORT parameters of Function Module
    Many Thanks in Advance

    hi
    you can check out this thread
    Re: Entering data into a dynamically created table.
    hope it helps
    regards
    Aakash Banga

Maybe you are looking for

  • How to restrict AS02 access to certain fields only

    How to restrict AS02 (Asset Master Record) access to certain fields only. Currently when you assigned AS02 to a certain user, this will enable the user to change all the fields in the asset master record. Suppose i want only the user to restrict the

  • Airport and a self-assigned IP address - can't access wireless net

    I have a strange issue with Airport picking up a wireless network. I'm not in my usual location using my MacBook Pro. There is a wireless network here. Airport sees it, and asks for the password (provided to me). Airport looks connected, but, I see t

  • Can a time switch damage time capsule

    Hi, during the night I don't use my time capsule and want to switch it off completely (safety and energy saving reasons). Does the sudden power loss of a time switch once a day pose a threat to time capsule? What's the worse that can happen? Has anyo

  • Media Upgrade Suggestions

    Im planning to do a home entertainment and network upgrade in the next few months.  I've done lots of research, but still find I have serveral unanswered questions.  First, let me say my employer uses Linksys products almost exclusively, and without

  • What are the known conflicts with Acrobat Pro & Quark 7.3

    Does anyone know what the conflicts are for Adobe Acrobat Pro & Leopard? What about Quark 7.3 & Leopard? Thanks!