Structure of Dynamic Table in Function Module

Hi,
I'm trying to find a way to get as OUTPUT a dynamic Table from a Function Module.
I declared a table called T_DATA without a type.
And this table should have a dynamic table back.
The problem that I get the data back but, I only found a data without any field-elements.
The data is there but there's no structure, no table.
Is there any way that I can send the Data in a proper structure?

Hi
   Try using the following code
type-pools:slis.
data:it_fcat type lvc_t_fcat,
     wa_fcat type lvc_s_fcat,
     itab type ref to data.
data:it_fcat1 type slis_t_fieldcat_alv,
     wa_fcat1 like line of it_fcat1.
data:cl_tab type ref to cl_alv_table_create,
     wa_ref type ref to data.
field-symbols:<itab> type table,
              <wa> type any,
              <comp>.
create object cl_tab.
refresh:it_fcat.
wa_fcat-fieldname = 'NAME'.
wa_fcat-inttype  = 'C'.
wa_fcat-intlen = '10'.
wa_fcat1-fieldname = 'NAME'.
wa_fcat1-inttype  = 'C'.
wa_fcat1-intlen = '10'.
append wa_fcat to it_fcat.
append wa_fcat1 to it_fcat1.
wa_fcat-fieldname = 'NAME2'.
wa_fcat-datatype  = 'CHAR10'.
wa_fcat1-fieldname = 'NAME2'.
wa_fcat1-datatype  = 'CHAR10'.
append wa_fcat to it_fcat.
append wa_fcat1 to it_fcat1.
cl_alv_table_create=>create_dynamic_table(
  exporting
   I_STYLE_TABLE             = I_STYLE_TABLE
    it_fieldcatalog           = it_fcat
   I_LENGTH_IN_BYTE          = I_LENGTH_IN_BYTE
  importing
    ep_table                  = itab
   E_STYLE_FNAME             = E_STYLE_FNAME
EXCEPTIONS
   GENERATE_SUBPOOL_DIR_FULL = 1
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
assign itab->* to <itab>.
create data wa_ref like line of <itab>.
assign wa_ref->* to <wa>.
do.
  assign component 'NAME' of structure <wa> to <comp>.
  <comp> = 'AA'.
  unassign <comp>.
  assign component 'NAME2' of structure <wa> to <comp>.
  <comp> = 'AB'.
  insert <wa> into table <itab>.
  exit.
enddo.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
  I_INTERFACE_CHECK                 = ' '
  I_BYPASSING_BUFFER                = ' '
  I_BUFFER_ACTIVE                   = ' '
   i_callback_program                = sy-repid
  I_CALLBACK_PF_STATUS_SET          = ' '
  I_CALLBACK_USER_COMMAND           = ' '
  I_CALLBACK_TOP_OF_PAGE            = ' '
  I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
  I_CALLBACK_HTML_END_OF_LIST       = ' '
  I_STRUCTURE_NAME                  = I_STRUCTURE_NAME
  I_BACKGROUND_ID                   = ' '
  I_GRID_TITLE                      = I_GRID_TITLE
  I_GRID_SETTINGS                   = I_GRID_SETTINGS
  IS_LAYOUT                         = IS_LAYOUT
   it_fieldcat                       = it_fcat1
  IT_EXCLUDING                      = IT_EXCLUDING
  IT_SPECIAL_GROUPS                 = IT_SPECIAL_GROUPS
  IT_SORT                           = IT_SORT
  IT_FILTER                         = IT_FILTER
  IS_SEL_HIDE                       = IS_SEL_HIDE
  I_DEFAULT                         = 'X'
  I_SAVE                            = ' '
  IS_VARIANT                        = IS_VARIANT
  IT_EVENTS                         = IT_EVENTS
  IT_EVENT_EXIT                     = IT_EVENT_EXIT
  IS_PRINT                          = IS_PRINT
  IS_REPREP_ID                      = IS_REPREP_ID
  I_SCREEN_START_COLUMN             = 0
  I_SCREEN_START_LINE               = 0
  I_SCREEN_END_COLUMN               = 0
  I_SCREEN_END_LINE                 = 0
  I_HTML_HEIGHT_TOP                 = 0
  I_HTML_HEIGHT_END                 = 0
  IT_ALV_GRAPHICS                   = IT_ALV_GRAPHICS
  IT_HYPERLINK                      = IT_HYPERLINK
  IT_ADD_FIELDCAT                   = IT_ADD_FIELDCAT
  IT_EXCEPT_QINFO                   = IT_EXCEPT_QINFO
  IR_SALV_FULLSCREEN_ADAPTER        = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
  E_EXIT_CAUSED_BY_CALLER           = E_EXIT_CAUSED_BY_CALLER
  ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER
  tables
    t_outtab                          = <itab>
EXCEPTIONS
  PROGRAM_ERROR                     = 1
Regards

Similar Messages

  • Passing dynamic table to function module

    Hi all,
    actully i have to pass dynamic internal table from function module.
    for that i use syntax
    move <dyn_table> to data_tab.
    but now my question is that in fm parameters what is the  type spec & associated type for data_tab in fm parameters.
    regards,
    anuj

    Hi
    Good
    Here is a simple example of passing an internal table "itab" to a function module "REUSE_ALV_LIST_DISPALY".
    It displays the internal table data into a list format.
    data : itab like ztest213 occurs 0 with header line.
    tables : ztest213 .
    select * from ztest213 into table itab.
    loop at itab.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = ' '
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    i_structure_name = 'ztest213'
    IS_LAYOUT =
    IT_FIELDCAT =
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IR_SALV_LIST_ADAPTER =
    IT_EXCEPT_QINFO =
    I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    tables
    t_outtab = itab
    exceptions
    program_error = 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.
    endloop.
    Thanks
    mrutyun^

  • Dynamic Table Selection function module

    Dear Friends,
      We have got critical requirement on Custom BAPI function module :
         we have to pass one field name of table and table name : Eg (Matnr and MARC).
         we have to get table contents w.r.t field name of table and table : Has to display MARC based on Matnr.
    (It is something like we display table contents in SE11 and SE16, Our requirement is to get the data by giving  random field name of table and table name ).
    My View : Imports Tab of F.M of is static
                   Tables Tab of F.M could be dynamic....if so how to achieve or any other approach?
    Note :  Eg1 : Matnr and MARA  (Input to F.M) -
    > Get MARA contents (Table from F.M)
               Eg2 : Matnr and MARC (Input to F.M) -
    > Get MARC contents (Table from F.M)
               Eg3 : Lifnr and LFA1 (Input to F.M)  -
    > Get LFA1 contents (Table from F.M)       
               Eg1 : Ebeln and EKKO (Input to F.M)  -
    > Get EKKO contents (Table from F.M)
    Awaiting for positive and quick views.
    Regards
    Sekhar

    Dear Sarcevic,
       I have created zfunction module with imports and tables.
      I'm able to manage import parameters as dynamical, but tables declaration gives fuzzy.
      How do we make tables tab declaration in function module as dynamic? any other views?
    Regards
    Sekhar

  • Dynamic Actions with Function Module

    Hai all,
    I got a problem while doing Dynamic Actions. I want to delete a record from 0105 infotype and it is through dynamic actions using function module. All things going correct but in the database table the entry was not deleted. While debugging it was giving as deleted but actually it is not deleting in database table. I hope u help me out.
    Thanks,
    Tara.

    Hai Srimantra,
    Thanks for ur response and here iam sending the code where i used the function module. and i called the subroutine from sm30.
    I should not use any sql statements or commands to delete the records from database tabels. hope u will help me out.
    Thank u,
    Tara.
    TABLES p0105.
    *data: lw_0105 type p0105.
    TABLES: pspar.
    *&      Form  HR_INFOTYPE_OPERATION
          text
    FORM hr_infotype_operation.
      DATA: l_it_pa0105 TYPE STANDARD TABLE OF pa0105.
      DATA: l_it_p0105 TYPE STANDARD TABLE OF p0105.
      DATA: l_p0105 TYPE p0105.
      DATA: wa_pa0105 TYPE pa0105.
      DATA: l_return TYPE bapireturn1.
      break developer.
      SELECT SINGLE * FROM pa0105 INTO CORRESPONDING FIELDS OF l_p0105
      WHERE pernr EQ p0105-pernr AND
            subty EQ p0105-subty AND
            begda EQ p0105-begda AND
            endda EQ p0105-endda AND
            seqnr EQ p0105-seqnr AND
            objps EQ p0105-objps AND
            sprps EQ p0105-sprps.
      CHECK sy-subrc EQ 0.
      CALL FUNCTION 'HR_INFOTYPE_OPERATION'
         EXPORTING
           infty                  = '0105'
           number                 = l_p0105-pernr
           subtype                = l_p0105-subty
           objectid               = l_p0105-objps
           lockindicator          = l_p0105-sprps
           validityend            = l_p0105-endda
           validitybegin          = l_p0105-begda
           recordnumber           = l_p0105-seqnr
           record                 = l_p0105
           operation              = 'DEL'
          TCLAS                  = 'A'
          NOCOMMIT               =
          VIEW_IDENTIFIER        =
          SECONDARY_RECORD       =
        IMPORTING
          return                 = l_return.
          KEY                    =
      MESSAGE l_return-message TYPE 'S'.
    ENDFORM.                    "HR_INFOTYPE_OPERATION

  • Table or Function module to get Internal order planning and Cost element pl

    Dear All,
    Table or Function module to get Internal order planning and Cost element planning.
    Internal order planning from T-code KO13.
    Thanks in advance.
    Regards,
    Ravi
    Edited by: Ravi Chandra on Sep 13, 2011 8:08 AM

    BPEJ, BPEG, BPEP

  • Which table contains function module program name

    Hi,
    Which table contains function module program name.
    Regards,
    raj

    Hi,
    We have one function module called 'FUNCTION_INCLUDE_INFO'.
    Where u ll get the program name to which it belongs to, function group and the include number. (e.g if the function group program name contains 9 function modules and ur function module  is in 3rd include then it will return the include name to which it belongs )

  • CRM Tables or Function Module in SAP CRM related Contract Account ot MPAN no.

    Hi Team,
    Could you please tell me  Any table or Function Module in CRM which is related to Contract Accont or MPAN Number( ISU).
    My Query is- Just I want to confirm that Data are exist in CRM system on the  basis of Contract Account or MPAN Number.
    Regards,
    Arif 

    Hi Mohd,
    Table for Contract Account in CRM is Business Agreement Table CRMM_BUAG & CRMM_BUAG_H
    To get the BP linkage CRMV_BUAG_ATTR
    Regards,
    Naresh

  • Populate final table in Function module

    hi,
    please tell me the way to populate the final intenal table in function module, form four of the other tables with the corresponding data. i'd like to know how to move fileds of one table to other with maximum performance, can i user move-corresponding for the same.........

    hi,
    There are two ways to move the data ....
    1. You can loop through the table data and move the corresponding field on to your final internal table .
    2. You can directly assign the table value ...but remember the stucture of both the tables should be same.
    i.e,
    itab1[] = itab[].
    Regards,
    Santosh

  • Tables in Function Module

    Hi,
    Tables in function module are only export parameters or import parameter also?
    THANKS

    Hello,
    Tables in function module  are both import and export parameters.
    That means you can pass data to Function module through internal table (import parameter) and after
    some calculation in the function module you can update the same internal table and this internal table can also be passed to your calling program( export parameter).
    Regards
    Arindam

  • Any docs regarding Table/View,Function Module for Generic Extraction

    Hello All
    I need to do Generic Extraction,for that if anyone has docs., I need docs on how to create table,view,Function module and infoset query ,on that pl forward to my id
    [email protected]
    Many Thanks
    balaji

    hi Amit
    Thanks for your docs,but this docs i have already,do u have any thing different one,if so please forward?
    Facing a Problem
    Iam trying to create view(database view)for <b>vbak</b> and <b>vbap</b> and given in Tables in <b>Table/Join Conditions</b> tab and clicked in <b>Relationship</b> and the relantionship has been generated automatically,now when i tried to activate this view its saying like "<b>No tables and/or fields are defined for view xxxxx</b>(xxxx-> name of a view)
    what will be the problem?pl let me know how to create a view?
    And also I need to know the diffference between database view,Manintenance view,Projection view and help view?
    Pl let me know on this?
    Many Thanks
    balaji

  • Exporting Custom table through function module

    <b>How can i Export Custom table through function module.</b> when we add some table in the function module table tab it asks for a ref. table which is some table in database .. but i want to add some custom table with some user defined column names..how can i do this
    <b>n plz tell me how to loop thru select options</b>
    i have to loop thru select option and assign all the values to a variable.
    plz help me out
    Message was edited by:
            Karan Chopra

    Hi Karan,
    Do one thing, Just in the tables tab give the name of the table and don't write anything else. no TYPE and no ANY.
    Hope it will resolve issue.
    reward points if useful.
    Regards,
    Atish

  • Table for Function modules - Changed date & Changed by.

    Hi Experts,
    Help me to get Function module changed date & changed by.
    For programs we can get the mentained information in TABLE : TADIR.

    Function Modules change history can be retrieved from table TRDIR.
    Function Module stores a program Include in table TRDIR.
    The details of the Function Module can be found in Attributes-->general data tab in the Function Module.
    You need to pass the Include which correponds the FM.
    Hence you can find the Log changes.
    Hope this helps.
    Regards
    Vinayak

  • Searchung tables or function module

    hi experts,
    I want to write a report  on variance in production order
    what r the tables or function module should i use
    please help.

    Hi Mohd,
    Table for Contract Account in CRM is Business Agreement Table CRMM_BUAG & CRMM_BUAG_H
    To get the BP linkage CRMV_BUAG_ATTR
    Regards,
    Naresh

  • What is the table contains Function module include program name

    Hi,
    What is the table contains Function module include program name
    Regards,
    Raja

    Try this FUNCTION_INCLUDE_INFO to get the include number to which function module belongs to.From this u ll get only the particular include name.
    or
    if u need the all the includes used in the function group u have use INNER JOIN on TFDIR and D010INC table
    <b>Select binclude into itab from trdir as a inner join d010inc as b on apname = bmaster where apname = fmodname.</b>
    I hope this will help u.
    Thanks & Regards
    Santhosh
    Message was edited by:
            santhosh ds

  • ConfigurableVariant materialclassification values-Tables or Function module

    Hi All,
    We have a configurable material (say M01) with Class type 300 and have various characteristics assigned to the class.  We have a variant material (say 234567) assigned to the configurable material M01. In the Characteristic values assignment screen we assign a value (say 123) to the characteristic Paper material.
    Now my question is how to get the link between characteristic Paper material (123) and variant material (234567). We have a transaction CL31 where you can get variant material if you give the paper material characteristic. I want to know if there is any table or Function module available to get the link.
    Appreciate your reply.
    Thanks,
    Srinivas

    this type of setting is in the item category settings from sales order.
    if your selction criteria (values ) matches with the exiting material code which got same charectristic valeus as that of selection in Sales order, that material will be replace by exiting material code.
    you can see that setting in spro>Sales and Distribution>Sales>Sales Documents>Sales Document Item-->Define Item Categories  here indicator variant maching should be ticked and Mat. Variant Action as 2 or 4.
    Regards,
    Pravin Mukkawar

Maybe you are looking for

  • New Mac Mini won't connect with new Dell Monitor

    I connected the power cord and then the HDMI from Mini to Monitor, but it said it needed a DVI-D cable. or it would in 5 minutes go into power save mode, which it did, so there's no picture from Mini Where would that connect on the Mini? Where can I

  • Add years to a given date

    I've two colunms in one of my tables: date & term I want to calculate the end date now. but column date is of formate date and column term is of type int. How can I calculate the sum of these two? If I have f.i. date = 02/11/2008 and term = 6. then I

  • Why do I get "Time Machine completed a verification of your backups on..."

    Any idea why I keep getting 'Time Machine completed a verification of your backups on "MyBookLiveDuo". To improve reliability, Time Machine must create a new backup for you." ?  It's just started happening.  Running 10.8.2 on two laptops.  One is fin

  • Java.lang.IllegalArgumentException findComponent error solution

    Hi Everyone: I am posting this to hopefully save someone else the week's worth of work. I was trying to fix up a few things before deploying an application to our development server for further testing. I was mainly trying to apply our templates that

  • How to print a numbers spreadsheet so column numbers show

    I'm writing this with zero experience so please be nice   I am trying to print a numbers spreadsheet and I want the Column numbers to show (1,2,3 down the side and A, B,C up top)  How can I do this?  Thanks.