Can we pass Internal tables to workflow container?

workflow container has a size limitation, we need to pass any infotype to the workflow container, so can we pass internal tables to workflow container or is there any alternate solution?
Thanks in Advance
Hari

Hi,
Check the <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/a6/9bac935f2c11d194a40000e82dec10/frameset.htm">Multiline Container Element Definition.</a>
Regards
<i><b>Raja Sekhar</b></i>

Similar Messages

  • Passing Internal tables to Workflow

    Hello all,
    I learning workflow and have a small doubt related to passing internal table as parameter to workflow when it is triggered by a report program explicitely.
    I wrote a prog to upload data from flat file into internal table and by passing this ITAB to the workflow for futher processing. <b>Actually i succeeded in this with only one field in my flat file (lfa1-lifnr).</b>
    <b>what if my flat file contains more than one field? (i.e., lifnr, name1, city, county) how should i declare the parameters for my EVENT (triggering event) and same with my container declaration?</b>
    Any inputs in this regards are welcome.
    Thank you in advance,
    Lakshmi Narayana

    Hi Lakshmi,
    Create Workflow container
      swc_container        lt_container.
      swc_create_container lt_container.
    Fill internal table with data
    The container type and the internal table type should be same, U can use a structure to define both.
    Declare a structure with all the fields.
    Define a conatiner of same type of structure in worklow and set it in <b>wait for event</b> setp.
    swc_set_table lt_container '<container_name>' lit_int_data.
    CALL FUNCTION 'SWE_EVENT_CREATE'
        EXPORTING
          objtype           = lc_objtyp
          objkey            = lv_objkey
          event             = lc_event
        IMPORTING
          event_id          = lv_eventid
        TABLES
          event_container   = lt_container
        EXCEPTIONS
          objtype_not_found = 1
          OTHERS            = 2.
    Rgds,
    Prakash
    Message was edited by: Prakashsingh Mehra

  • Transfer tables between workflow container and BSP

    Hi experts,
    I've a BSP which I call from a workflow. I connected the workflow with the BSP through the use of transaction wf_extsrv. This all works perfect, only I can't transfer internal tables, multiline container elements or strings that are longer than the max. CHAR255. This raises a problem:
    In my BSP I've a text box where a user can fill in a rejection reason. I want this filled textbox transferred back and forward bewteen my workflow and my BSP.
    Does anyone have a solution to this problem?
    Thanks in advance.
    Kind regards,
    Joost van Poppel

    Hi Martin,
    Tanks for you reply. I was already thinking this would be the easiest solution, so I applied it like you suggested.
    The transferal is done by connecting the BSP via wf_extsrv through characterstrings. From this transaction I generated a task and connected my wf container to the container of the generated task.
    I suppose there are also other options like Karri suggested. Haven't tried it yet to use SAP_WAPI_WRITE_CONTAINER, but will take it into account the next time I run in to the same situation. So Karri I also want to thank you for answering. It probably will be very useful in the future.
    For now it is just one text box, so it is managable to give the text box back as seperate lines.
    Kind regards,
    Joost van Poppel

  • How to pass internal table to form routine..?

    Gurus,
    I am creating a custom Function module in which i have declared few perform statements and passing internal table to it..but when i declare the form it gives me error that the internal table is unknown...Can u please suggest me what am i doing wrong...
      DATA: Begin of tb_set_values occurs 0.
            include structure rgsb4.
      DATA: End of tb_set_values.
    PERFORM read_sets_with_values USING wa_setheader CHANGING tb_set_values[].
    FORM read_sets_with_values USING value(rwa_setheader) LIKE setheader
                               CHANGING rtb_set_values LIKE tb_set_values[].
    DATA: v_setid TYPE setid.
    *DATA: Begin of rtb_set_values occurs 0.
         include structure rgsb4.
    *DATA: End of rtb_set_values.
      CALL FUNCTION 'G_SET_GET_ID_FROM_NAME'
        EXPORTING
          SHORTNAME = rwa_setheader-setname
        IMPORTING
          NEW_SETID = v_setid.
      CALL FUNCTION 'G_SET_GET_ALL_VALUES'
        EXPORTING
          SETNR      = v_setid
        TABLES
          SET_VALUES = rtb_set_values.
    ENDFORM.
    What can be the error..please help

    Well actually, I just tested it and it works fine as you have written it in my test program, so not sure what you are doing wrong. This was tested in NW 7.0
    REPORT rich_0001.
    DATA: setheader TYPE string.
    DATA: wa_setheader TYPE string.
    DATA: BEGIN OF tb_set_values OCCURS 0.
            INCLUDE STRUCTURE t000. "<<-- Test with T000 instead    "rgsb4.
    DATA: END OF tb_set_values.
    SELECT * INTO TABLE tb_set_values  FROM t000.
    PERFORM read_sets_with_values USING wa_setheader
                                  CHANGING tb_set_values[].
    *&      Form  read_sets_with_values
    *       text
    *      -->VALUE(RWA_SETHEADER)  text
    *      -->RTB_SET_VALUES        text
    FORM read_sets_with_values USING value(rwa_setheader) LIKE setheader
                               CHANGING rtb_set_values LIKE tb_set_values[].
      DATA: ls_set_values LIKE LINE OF rtb_set_values.
      LOOP AT rtb_set_values INTO ls_set_values.
        WRITE:/ ls_set_values.
      ENDLOOP.
    ENDFORM.                    "read_sets_with_values
    Regards,
    RIch Heilman

  • Pass Internal Table to Memory

    Dear Experts.
    I have the following problem.
    I am using a User-Exit for Travel  that is called from a program standard with use the T.Code TRIP. The program standard use a structure that when entry in the user exit not is. I need use this structure in the user exit. (p_t_req_head).
    I had read abour SAP and ABAP Memory but from the program standar How can Pass Internal Table to Memory SAP or ABAP from the program standard to user-exit?
    When I am doing debugging in the program Standard and this call to the user exit, I use ()namestructure for example ()p_t_req_head  and I get the datas of the structure, But In the Source Code ABAP, How can do this with instructions?
    Regards

    Hi,
    You try with Import & Export Statements as follows ---
    DATA : t_itab LIKE TABLE OF spfli.
    EXPORT t_itab TO MEMORY ID 'ABCD'.
    After sending the internal table to ABAP memory you need to get that by IMPORT in the called session.
    IMPORT t_itab FROM MEMORY ID 'ABCD'.

  • Passing internal tables as parameters to subroutines

    Hi,
    This was going to be a question but I just had it answered by someone. Hopefully, this piece of information is going to be useful to other people as well.
    I had a subroutine in my code which looks like this.
    form fr_sub_get_data USING uf_file
                                    TABLES ct_int_log STRUCTURE zinterface_log.
    endform.
    I was told by someone at work to change it as follows: -
    form fr_sub_get_data USING uf_file
                                    CHANGING ct_int_log type ty_tab_int_log.
    endform.
    The reason is that when using the tables' clause to pass internal tables as parameters, a header line is automatically created in the subroutine which lasts for as long as the subroutine is being excecuted. Its considered to be a bad practise to use header lines (Work-Areas are preferable).
    Another important point to remember is that the 'tables' clause can only be used to pass <b>standard</b> internal tables as parameters. It can not be used for internal tables of other types.
    Cheers!

    HI
    GOOD
    GO THROUGH THIS LINK
    http://www.abapforum.com/forum/viewtopic.php?t=1962&language=english
    THANKS
    MRUTYUN

  • Client proxy.. passing internal table to output.

    Hi friends,
    I have created a proxy-JDBC scnario..
    For this i created a datatype with 2 fields..
    DT_Proxy_Outbound as complex type and 2 elements..and after that i have created a proxy class
    ZCO_MI_PROXY_OUTBOUND (Proxy class)
      ZMT_PROXY_OUTBOUND(structure)
    and i have writen a code in abap report to pass data to output parameter..
    but output parameter is of line type not a table type...
    so it is taking onley one value but not entire internal table to output parameter.
    i am including mycode here.
    REPORT  ZTEST_ABAP_PROXY.
    DATA PRXY TYPE REF TO ZCO_MI_PROXY_OUTBOUND.
    DATA: BEGIN OF I_MARA OCCURS 0,
      MATNR LIKE MARA-MATNR,
      ERNAM LIKE MARA-ERNAM,
      END OF I_MARA.
    CREATE OBJECT PRXY.
    DATA IT TYPE  ZMT_PROXY_OUTBOUND OCCURS 0 WITH HEADER LINE.
    TRY.
        SELECT MATNR ERNAM INTO TABLE I_MARA FROM MARA UP TO 10 ROWS.
        LOOP AT I_MARA.
          IT-MT_PROXY_OUTBOUND-MATNR = I_MARA-MATNR.
          IT-MT_PROXY_OUTBOUND-ERNAM = I_MARA-ERNAM.
          APPEND IT.
        ENDLOOP.
        CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
          EXPORTING
            OUTPUT = IT.
        COMMIT WORK.
      CATCH CX_AI_SYSTEM_FAULT .
        DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
        CREATE OBJECT FAULT.
        WRITE :/ FAULT->ERRORTEXT.
    ENDTRY.
    where should i change structure so that output can accept total internal table rather than line item.
    Thnaks and Regards
    Vijay

    Hi Vijay,
    Try using the following code. I have used the variable ZDT_PROXY_OUTBOUND_TAB , which should appear in the zproxy transaction. The name may not be exactly correct, so please check and change accordingly. Check parameters of execute- asynchronous method. double click on associated type of output (ZMT..). You will get controller and Message type MT...Click on component type - ZDT.., you will get controller and a recordset( the name you have mentioned in your data type sender side). The corresponding component type would be the table ZDT_PROXY_OUTBOUND_TAB. Hope you understand and change accordingly.
    REPORT  ZTEST_ABAP_PROXY.
    TABLES : MARA.
    DATA PRXY TYPE REF TO ZCO_MI_PROXY_OUTBOUND.
    DATA: BEGIN OF I_MARA OCCURS 0,
      MATNR LIKE MARA-MATNR,
      ERNAM LIKE MARA-ERNAM,
      END OF I_MARA.
    DATA : REC_OUTPUT TYPE ZDT_PROXY_OUTBOUND_TAB,
         WA_REC_OUTPUT LIKE LINE OF REC_OUTPUT,
         MARA_OUTPUT TYPE ZMT_PROXY_OUTBOUND.
    CREATE OBJECT PRXY.
    TRY.
        SELECT MATNR ERNAM INTO TABLE I_MARA FROM MARA UP TO 10 ROWS.
        LOOP AT I_MARA.
          WA_REC_OUTPUT-MATNR = I_MARA-MATNR.
          WA_REC_OUTPUT-ERNAM = I_MARA-ERNAM.
          INSERT WA_REC_OUTPUT INTO TABLE REC_OUTPUT.
          CLEAR : WA_REC_OUTPUT, I_MARA.
        ENDLOOP.
         MARA_OUTPUT-MT_PROXY_OUTBOUND-RECORDSET = REC_OUTPUT.
        CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
          EXPORTING
            OUTPUT = MARA_OUTPUT.
        COMMIT WORK.
      CATCH CX_AI_SYSTEM_FAULT .
        DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
        CREATE OBJECT FAULT.
        WRITE :/ FAULT->ERRORTEXT.
    ENDTRY.
    -Regards,
    Shamly

  • Passing Internal tables between pages (in stateless appl.)

    hi BSP gurus,
    how do I pass internal tables from one BSP page to another. The problem is that the appl. is stateless and hence I am not able to use the appl. class.
    thanks in advance,
    Ashish Walke

    Hi Ashish,
    In the onInputProcessing event of the first page , write the following code...
    call method NAVIGATION->SET_PARAMETER exporting
    name = 'filled_table'
    value = filled_table.
    Here filled_table is internal table.
    NAVIGATION->GOTO_PAGE('second.htm').
    In the next page , you can make the internal table as auto in the attributes.
    Since you have made the itab as auto transfer , you can directly access the itab in the initialization event of the next page if it is stateless.
    Regards,
    Aashish Garg

  • PASSING INTERNAL TABLE

    I CREATED INTERNAL TABLE ITAB WITH 2 FIELDS EBELN , BUKRS.
    I WANT TO USE FUNCTION MODULE .
    I CAN PASS EBELN , BUKRS AS EXPORT PARAMETERS .
    HOW CAN I PASS ITAB TO FUNCTION MODULE . SHOULD I DECLARE OF TYPE ITAB IN EXPORT PARAMETER LIST IN FUNCTION MODULE .....
    I DECLARED JTAB TYPE ITAB IN EXPORT PARAMETER . BUT WHEN I AM WRITING QUERY IN THE SOURCE CODE OF FUNCTION MODULE , IT IS NOT IDENTIFYING JTAB AS THE INTERNAL TABLE .
    I WANT TO PROCESS SOME DATA AND EXPORT JTAB BACK TO ABAP PROGRAM .
    AM I GOING RIGHT...?

    hi Rajesh,
    While creating a FM and passing Table to it. u can not use Internal table as type. Instead u need to create a structure in Database and then give the type of table as the Structure type.
    Hope this helps u.
    <REMOVED BY MODERATOR>
    Regards,
    Preeti
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 4:37 PM

  • Pass internal tables in Export  Parameters of  Function Module

    Hi
    How to pass internal tables through export parametes of the calling function module. i
    think i can pass it by reference ....
    if so can anyone suggest how to do it?

    Hi,
    You can Export values of an Internal table in two ways, by :
    1) specifying in Tables tab
    (Not recommended since it's an obsolete in ECC 6.0)
    If used, will reduce the performance of the FM
    Tables are always passed by reference
    2) specifying in Exports tab.
    The parameter should be a Table type (created in se11)
    having a Line type that refers to the structure of the data.
    Pass by Value is not used for Normal Function modules.
    Used usually for RFC enabled FMs.
    Cheers,
    Remi

  • How to pass internal table to method of class

    Hi all,
    I am new to abap objects, i want to pass one internal table to class.
    i am trying in this way.
    class c1 definition.
    method get_material importing t_stpo  type any table
                                   exporting t_mast type any table.
    endmethod.
    endclass.
    class c1 implementation.
    method get_material.
    select f1 f2 f3 from <tab> into table t_mast
            for all entries in t_stpo
            where stlnr = t_stpo-stlnr.
    endmethod.
    endclass.
    ERROR:
    "stlnr" is not available
    if i use this way. its not giing error.
    class c1 definition.
    method get_material exporting t_mast type any table.
    endmethod.
    endclass.
    class c1 implementation.
    method get_material.
    select f1 f2 f3 from <tab> into table t_mast
            for all entries in it_stpo
            where stlnr = it_stpo-stlnr.
    endmethod.
    endclass.
    how to pass internal table with some specific reference may be using like or type <it_xxxx>
    thanks

    Try this.
    TYPES : BEGIN OF ty_stpo,
             stlnr TYPE stpo-stlnr,
             idnrk TYPE stpo-idnrk,
             menge TYPE stpo-menge,
            END OF ty_stpo,
            BEGIN OF ty_mast,
             matnr TYPE mast-matnr,
             werks TYPE mast-werks,
             stlnr TYPE mast-stlnr,
            END OF ty_mast,
            tt_stpo TYPE TABLE OF ty_stpo,
            tt_mast TYPE TABLE OF ty_mast.
    DATA : it_stpo TYPE tt_stpo,
           it_mast TYPE tt_mast.
    *       CLASS c1 DEFINITION
    CLASS c1 DEFINITION.
      PUBLIC SECTION.
        METHODS : get_bom_numbers EXPORTING ex_stpo type tt_stpo,
                  get_parent_material IMPORTING im_stpo TYPE tt_stpo
                                      EXPORTING ex_mast TYPE tt_mast.
        endclass.
    *       CLASS c1 IMPLEMENTATION
    CLASS c1 IMPLEMENTATION.
      METHOD get_bom_numbers.
      ENDMETHOD.                    "get_bom_numbers
      METHOD get_parent_material.
      ENDMETHOD.                    "get_parent_material
    START-OF-SELECTION.
      DATA : obj TYPE REF TO c1.
      CREATE OBJECT obj.
      CALL METHOD obj->get_bom_numbers
        IMPORTING
          t_stpo = it_stpo.
      CALL METHOD obj->get_parent_material
        EXPORTING
          im_stpo = it_stpo
        IMPORTING
          ex_mast = it_mast.
    Regards,
    Rich Heilman

  • ABAP OO - Passing Internal Tables from Method to Method

    I'm new to writing methods.
    I have a need to build an internal table in METHOD1 and pass the internal table to METHOD2. I'm confused how to declare the table in 'Parameter' section of the METHOD2. I have specified the following:
    Parameter = WTAB1
    Type = Import
    Pass value = blank
    Optonal = Blank
    Typing Method = Type
    Associated type =  ZSCIW and this is declared in DDIC as a data type with fields ZZLINE(72) and ZZPOS(4)
    Default value = blank
    METHOD1 (simplified example)
    method METHOD1.
    Table of individual words from source code
      types: begin of wline,
               WORD(72),
               POSN(4),
             end of wline,
             wlines     type standard table of wline  with default key.
      data:  wx          type wlines,
               wa          like line of wx.
    Clear past results
      REFRESH: Wx.
    Look through source code...
      LOOP AT ref_include->lines into wa.
        APPEND wa.
      ENDLOOP.
    Call METHOD2 and pass internal table wa
    METHOD2 ( ).
    1. How to you define the parameters in METHOD2.
    2. What is the coding in METHOD1 to call METHOD2.
    Your help will really be appreciated.
    Thanks.
    Soyab

    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    Check these links.
    http://www.henrikfrank.dk/abapuk.html
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Go through the below links,
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    OO ABAP links:
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    go through these links
    http://www.erpgenie.com/abap/index.htm
    http://sic.fh-lu.de/sic/bic.nsf/(vJobangebote)/EC8AD2AE0349CE92C12572200026FDB8/$File/Intern%20or%20Working%20Student%20as%20ABAB%20OO%20Developer.pdf?Open
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ABAP_OBJECTS_ENJOY_0 Template for Solutions of ABAP Object Enjoy Course
    ABAP_OBJECTS_ENJOY_1 Model Solution 1: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_2 Model Solution 2: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_3 Model Solution 3: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_4 Model Solution 4: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_5 Model Solution 5: ABAP Objects Enjoy Course
    DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
    DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
    DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
    DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
    DEMO_ABAP_OBJECTS_INTERFACES Demonstration of Interfaces in ABAP Objects
    DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
    DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    <b>good book on ABAP objects(OOPS)
    http://www.esnips.com/doc/bc475662-82d6-4412-9083-28a7e7f1ce09/Abap-Objects---An-Introduction-To-Programming-Sap-Applications</b>
    Rewards if useful..............
    Minal

  • Can we create internal table dynamically ? how?

    hi to all experts,
                           can we create internal table dynamically ? how?plz explain me with an example.Anybody with good example  will be rewarded.it was asked in an interview what the answer for it

    HI
    Yes you can create
    see this
    /people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
    JUST USE THIS CODE AND DO THE ESSENTIAL CHANGES ACCORDING TO YOU
    STEP: 1 - get backend field catalog (currently displayed alv)
    CLEAR: tl_fieldcatalog. REFRESH: tl_fieldcatalog.
    CALL METHOD w_grid->get_backend_fieldcatalog
    IMPORTING
    et_fieldcatalog = tl_fieldcatalog.
    STEP: 2 - create a new fieldcatalog for dynamic internal table
    CLEAR: sl_fieldcatalog.
    CLEAR: t_outtab_fieldname. REFRESH: t_outtab_fieldname.
    CLEAR: tl_fieldcatalog_new. REFRESH: tl_fieldcatalog_new.
    CLEAR: t_download_fieldname. REFRESH: t_download_fieldname.
    CLEAR: t_download_fieldheading. REFRESH: t_download_fieldheading.
    LOOP AT tl_fieldcatalog INTO sl_fieldcatalog.
    STEP: 2.1 - populate data in T_OUTTAB_FIELDNAME
    APPEND sl_fieldcatalog-fieldname TO t_outtab_fieldname.
    STEP: 2.2 - populate TL_FIELDCATALOG_NEW & T_DOWNLOAD_FIELDNAME
    IF sl_fieldcatalog-no_out EQ ''.
    IF sl_fieldcatalog-fieldname NE 'STATUS'
    OR sl_fieldcatalog-fieldname NE 'MESG_STATUS'
    OR sl_fieldcatalog-fieldname NE 'ZLOCK'
    OR sl_fieldcatalog-fieldname NE 'T_PLANT'
    OR sl_fieldcatalog-fieldname NE 'T_CSR'.
    If field is COMM_PLANT, change its length
    IF sl_fieldcatalog-fieldname EQ 'COMM_PLANT'.
    sl_fieldcatalog-outputlen = 1800.
    sl_fieldcatalog-intlen = 1800.
    sl_fieldcatalog-dd_outlen = 1800.
    ENDIF. "comm_plant
    sl_fieldcatalog_new = sl_fieldcatalog.
    APPEND sl_fieldcatalog_new TO tl_fieldcatalog_new.
    APPEND sl_fieldcatalog-fieldname TO t_download_fieldname.
    APPEND sl_fieldcatalog-scrtext_l TO t_download_fieldheading.
    CLEAR: sl_fieldcatalog, sl_fieldcatalog_new.
    ENDIF.
    ENDIF.
    ENDLOOP.
    STEP: 3 - create dynamic internal table
    FREE: ref_download.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    I_STYLE_TABLE =
    it_fieldcatalog = tl_fieldcatalog_new
    IMPORTING
    ep_table = ref_download
    E_STYLE_FNAME =
    EXCEPTIONS
    generate_subpool_dir_full = 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.
    ASSIGN ref_download->* TO <ft_download>.
    CREATE DATA ref_wa LIKE LINE OF <ft_download>.
    ASSIGN ref_wa->* TO <fs_download>.
    STEP: 4 - populate data in dynamic internal table
    LOOP AT t_outtab INTO wa_outtab.
    LOOP AT t_download_fieldname.
    ASSIGN COMPONENT t_download_fieldname OF STRUCTURE
    <fs_download> TO <fs_download_field>.
    IF t_download_fieldname-field EQ 'COMM_PLANT'.
    STEP: 4.1 - get long text from database table
    CLEAR: wal_table.
    SELECT SINGLE * FROM zshaven_plnt_txt
    INTO wal_table
    WHERE vbeln = wa_outtab-vbeln
    AND posnr = wa_outtab-posnr
    AND del_no = wa_outtab-del_no
    AND del_itm = wa_outtab-del_itm.
    IF sy-subrc EQ 0.
    STEP: 4.2 - break long-text into separate lines
    CLEAR: tl_text. REFRESH: tl_text.
    SPLIT wal_table-plant_comm
    AT '~'
    INTO TABLE tl_text.
    STEP: 4.3 - Combine these separate lines with space in
    between two lines
    CLEAR: wal_text, final_text.
    LOOP AT tl_text INTO wal_text.
    IF final_text IS INITIAL.
    final_text = wal_text.
    ELSE.
    CONCATENATE final_text '-' wal_text
    INTO final_text.
    REPLACE '-' WITH ' ' INTO final_text.
    ENDIF.
    ENDLOOP.
    STEP: 4.4 - move long text to work-area
    <fs_download_field> = final_text.
    ENDIF. "subrc
    ELSE. "t_download_fieldname
    READ TABLE t_outtab_fieldname
    WITH KEY field = t_download_fieldname-field.
    ASSIGN COMPONENT t_outtab_fieldname-field OF STRUCTURE
    wa_outtab TO <fs_outtab_field>.
    <fs_download_field> = <fs_outtab_field>.
    ENDIF.
    ENDLOOP.
    STEP: 4.5 - Move data from work-area to dynamic internal table
    APPEND <fs_download> TO <ft_download>.
    CLEAR: <fs_download>.
    ENDLOOP.
    STEP: 5 - download
    CALL FUNCTION 'DOWNLOAD'
    EXPORTING
    filename = 'C:\zshaven.xls'
    filetype = 'DAT'
    filetype_no_show = 'X'
    filetype_no_change = 'X'
    TABLES
    data_tab = <ft_download>
    fieldnames = t_download_fieldheading
    EXCEPTIONS
    invalid_filesize = 1
    invalid_table_width = 2
    invalid_type = 3
    no_batch = 4
    unknown_error = 5
    gui_refuse_filetransfer = 6
    customer_error = 7
    OTHERS = 8.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  • Problem in Passing internal table Function module

    Hi experts,
    I am new to creating function module and needed certain suggestions.
    I have created a type inside the FM
    types: begin of T1
    field A
    field  B
    end of T1.
    Now, i have populated the internal table of this type but how to send it through the tables tab of my FM.
    IN the parameter, i can write my internal table name but what should be associated type ...
    Please give some suggestions

    Hi,
      Not required.
    Table parameter will behave like type table of Z_sturcture. So just define the structure and use it in the TABLE parameter.It will convert that into internal table..
    Example :
    Parameter name         Typing                Associated type
    T_RETURN                  LIKE                   your Z_structure
    If you want to give table in the import parameter, then you need to create the table type for the structure.....

  • Passing internal tables dynamically to a subroutine

    Hi All,
    How to pass internal tables dynamically to a subroutine?
    In subroutine logic i'm fetching data from MARA table for all entries in the internal table passed to the subroutine. Based on some condition the internal table varies. I'm placing the code below
    Both GT_AUFM & GT_AUFM1 are of 2 different structures having MATNR.
    IF WA_AUFM1-BWART EQ '261'.
        PERFORM GET_IF_SEMIFINISHED USING GT_AUFM1.
    ELSE IF WA_AUFM1-BWART EQ '262'.
        PERFORM GET_IF_SEMIFINISHED TABLES GT_AUFM.
    ENDIF.
    FORM GET_IF_SEMIFINISHED  USING P_TABLE TYPE ANY TABLE.
      REFRESH GT_MARA.
      SELECT MATNR FROM MARA INTO TABLE GT_MARA
                     FOR ALL ENTRIES IN P_TABLE
                     WHERE MATNR EQ P_TABLE-MATNR
                       AND MTART IN R_MTART.
      ENDFORM.
    With this logic i'm getting an error that the specified type has no structure and therefore no component called MATNR.
    Thanks,
    Anil.

    refer this link
    dynamic internal table

Maybe you are looking for