Smartforms - pass dynamic internal tables

Hello experts,
In my smartform print program, I have created a dynamic internal table using method CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE where in my dynamic internal table <DYN_TABLE> is declared as
FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
               <DYN_WA>.
I am populating <DYN_TABLE> and passing it on to my smartform. Now my question is, inside my smartform, how can I declare this dynamic table <DYN_TABLE> in form interface? Please let me know. Thanks.

This could be one of the solution.
1. Create table type using data element EDI_SDATA (char 1000) , say ZTTDYN .
2. Use this as importing paramter your smarform.
3. In print program transfer the content from dynamic internal table to internal table define using ZTTDYN. You can comma seperate then fields.
4. Pass this comma separated internal table to smartform.
5. And finally proces this data in smartform.

Similar Messages

  • Passing Dynamic Internal Table values to another program

    Hi,
    I have a program ZSAPNEW.
    In this I have created a Dynamic internal table <fs_emp>. The number of fields differ for each run. The values are passed into <fs_emp> in this program.  Now I need to submit thsi program from a main program ZHEAD and then display the values got from ZHEAD. For this I need to access the values retrieved from ZSAPNEW in <fs_emp> in ZHEAD. I cant figure out how to do this. I tried IMPORT ing the reference of teh field symbol too/ But its not allowing references in IMPORT/EXPORT. And since the table is of type ANY( as structure varies) I cant assign it to an internal table and then pass. Can some one suggest a solution please.
    Suzie

    Hi
    You need to know how the strcture of your table is generated In both programm:
    - Calling program:
    DATA: LR_VALUE_DESCR  TYPE REF TO CL_ABAP_ELEMDESCR,
          COMPONENT       TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
          LT_COMPONENTS   TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE.
    DATA: LT_STRUC        TYPE REF TO CL_ABAP_STRUCTDESCR,
          LT_TAB          TYPE REF TO CL_ABAP_TABLEDESCR.
    DATA: L_INDEX TYPE C.
    DATA: W_LINE          TYPE REF TO DATA,
          INT_TABLE       TYPE REF TO DATA.
    FIELD-SYMBOLS: <WA>    TYPE ANY,
                   <ITAB>  TYPE TABLE,
                   <VALUE> TYPE ANY.
    DO 4 TIMES.
      CLEAR COMPONENT.
      MOVE SY-INDEX TO L_INDEX.
      CONCATENATE 'FIELD' L_INDEX INTO COMPONENT-NAME.
      MOVE CL_ABAP_ELEMDESCR=>GET_C( P_LENGTH = 4 ) TO LR_VALUE_DESCR.
      COMPONENT-TYPE = LR_VALUE_DESCR.
      INSERT COMPONENT INTO TABLE LT_COMPONENTS.
    ENDDO.
    * Workarea
    LT_STRUC = CL_ABAP_STRUCTDESCR=>CREATE( P_COMPONENTS = LT_COMPONENTS
                                                       P_STRICT     = 'X' ).
    CREATE DATA W_LINE TYPE HANDLE LT_STRUC.
    ASSIGN W_LINE->* TO <WA>.
    * Table
    LT_TAB = CL_ABAP_TABLEDESCR=>CREATE( P_LINE_TYPE = LT_STRUC ).
    CREATE DATA INT_TABLE TYPE HANDLE LT_TAB.
    ASSIGN INT_TABLE->* TO <ITAB>.
    DO 3 TIMES.
      CLEAR <WA>.
      DO 4 TIMES.
        MOVE SY-INDEX TO L_INDEX.
        CONCATENATE 'FIELD' L_INDEX INTO COMPONENT-NAME.
        ASSIGN COMPONENT COMPONENT-NAME OF STRUCTURE <WA> TO <VALUE>.
        MOVE SY-INDEX TO <VALUE>.
      ENDDO.
      APPEND <WA> TO <ITAB>.
    ENDDO.
    DATA: WA_INDX TYPE INDX.
    WA_INDX-USERA = SY-UNAME.
    WA_INDX-PGMID = 'MAXMAX'.
    EXPORT TAB = <ITAB>
      TO DATABASE INDX(XY)
      FROM WA_INDX
      CLIENT SY-MANDT
      ID 'TABLE'.
    Called program:
    DATA: LR_VALUE_DESCR  TYPE REF TO CL_ABAP_ELEMDESCR,
          COMPONENT       TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
          LT_COMPONENTS   TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE.
    DATA: LT_STRUC        TYPE REF TO CL_ABAP_STRUCTDESCR,
          LT_TAB          TYPE REF TO CL_ABAP_TABLEDESCR.
    DATA: L_INDEX TYPE C.
    DATA: W_LINE          TYPE REF TO DATA,
          INT_TABLE       TYPE REF TO DATA.
    FIELD-SYMBOLS: <WA>    TYPE ANY,
                   <ITAB>  TYPE TABLE,
                   <VALUE> TYPE ANY.
    DO 4 TIMES.
      CLEAR COMPONENT.
      MOVE SY-INDEX TO L_INDEX.
      CONCATENATE 'FIELD' L_INDEX INTO COMPONENT-NAME.
      MOVE CL_ABAP_ELEMDESCR=>GET_C( P_LENGTH = 4 ) TO LR_VALUE_DESCR.
      COMPONENT-TYPE = LR_VALUE_DESCR.
      INSERT COMPONENT INTO TABLE LT_COMPONENTS.
    ENDDO.
    * Workarea
    LT_STRUC = CL_ABAP_STRUCTDESCR=>CREATE( P_COMPONENTS = LT_COMPONENTS
                                                       P_STRICT     = 'X' ).
    CREATE DATA W_LINE TYPE HANDLE LT_STRUC.
    ASSIGN W_LINE->* TO <WA>.
    * Table
    LT_TAB = CL_ABAP_TABLEDESCR=>CREATE( P_LINE_TYPE = LT_STRUC ).
    CREATE DATA INT_TABLE TYPE HANDLE LT_TAB.
    ASSIGN INT_TABLE->* TO <ITAB>.
    DATA: WA_INDX TYPE INDX.
    WA_INDX-USERA = SY-UNAME.
    WA_INDX-PGMID = 'MAXMAX'.
    IMPORT TAB = <ITAB>
      FROM DATABASE INDX(XY)
      TO WA_INDX
      CLIENT SY-MANDT
      ID 'TABLE'.
    LOOP AT <ITAB> ASSIGNING <WA>.
      WRITE: / <WA>.
    ENDLOOP.
    The sample above use IMPORT/EXPORT from database: if the called program can't know the structure of the dynaic table, you need to transfer it by the same way you transfer the data
    Max

  • Passing dynamic internal table into ALV

    I have made one ALV report where i had created one button 'GENERATE'.  ON CLICKING THIS BUTTON the data in the ALV report is downloaded to excel file.
    i have used this:-
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = l_title
          default_extension    = 'XLS'
          initial_directory    = 'C:\'
        CHANGING
          filename             = filename
          path                 = path
          fullpath             = fullpath
          user_action          = user_action
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
    Check which button is pressed
      IF user_action <> cl_gui_frontend_services=>action_ok.
        EXIT.
      ENDIF.
    Download error data collected from the internal table
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename                = fullpath
          filetype                = 'ASC'
          write_field_separator   = '#'
         codepage                = '4103'
         write_bom               = c_true
        CHANGING
          data_tab                = gi_final
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          not_supported_by_gui    = 22
          error_no_gui            = 23
          OTHERS                  = 24.
    If selection is successful
      IF sy-subrc EQ 0.
        MESSAGE s004 . " File  created successfully
      ELSE.
        MESSAGE i005 . " File is not created successfully
      ENDIF.
    In the table i have passed the internal table . this is working fine.
    <b>But,
    The problem is if i want to display the data in diferent layout based on selection screen criteria the data downloaded are same as default layout.
    how to pass a dynamic internal table in the
    CALL METHOD cl_gui_frontend_services=>gui_download</b>

    Hi    ,
    here is the Program for  Download  
    REPORT yrs_download_transport_request.
    PARAMETERS:
      p_reqest TYPE trkorr OBLIGATORY,
      p_folder(255) TYPE c LOWER CASE, p_sepr OBLIGATORY.
    DATA:
      folder TYPE string,
      retval LIKE TABLE OF ddshretval WITH HEADER LINE,
      fldvalue LIKE help_info-fldvalue,
      transdir TYPE text255,
      filename(255),
      trfile(20) TYPE c,
      datatab TYPE TABLE OF text8192 WITH HEADER LINE,
      len TYPE i,
      flen TYPE i.
    TYPE-POOLS: sabc, stms, trwbo.
    INITIALIZATION.
      CONCATENATE sy-sysid 'K*' INTO p_reqest.
      IF sy-opsys = 'Windows NT'.
        p_sepr = ''.
      ELSE.
        p_sepr = '/'.
      ENDIF.
    *  CALL FUNCTION 'WSAF_BUILD_SEPARATOR'
    *       IMPORTING
    *            separator                  = p_sepr
    *       EXCEPTIONS
    *            separator_not_maintained   = 1
    *            wrong_call                 = 2
    *            wsaf_config_not_maintained = 3
    *            OTHERS                     = 4.
    *  IF sy-subrc NE 0.
    *    MESSAGE s001(00)
    *      WITH
    *      'Unable to find out the separator symbol for the system.'(011).
    *  ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_reqest.
      DATA:
        tt_system TYPE TABLE OF tmscsys WITH HEADER LINE,
        es_selected_request TYPE trwbo_request_header,
        es_selected_task TYPE trwbo_request_header,
        iv_organizer_type TYPE trwbo_calling_organizer,
        is_selection TYPE trwbo_selection.
      iv_organizer_type = 'W'. is_selection-reqstatus = 'R'.
      CALL FUNCTION 'TR_PRESENT_REQUESTS_SEL_POPUP'
        EXPORTING
          iv_organizer_type   = iv_organizer_type
          is_selection        = is_selection
        IMPORTING
          es_selected_request = es_selected_request
          es_selected_task    = es_selected_task.
      p_reqest = es_selected_request-trkorr.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_folder.
      DATA: title TYPE string.
      title = 'Select target folder'(005).
      CALL METHOD cl_gui_frontend_services=>directory_browse
        EXPORTING
          window_title    = title
        CHANGING
          selected_folder = folder
        EXCEPTIONS
          cntl_error      = 1
          error_no_gui    = 2
          OTHERS          = 3.
      CALL FUNCTION 'CONTROL_FLUSH'
        EXCEPTIONS
          cntl_system_error = 1
          cntl_error        = 2
          OTHERS            = 3.
      p_folder = folder.
    AT SELECTION-SCREEN ON p_reqest.
      DATA: request_info TYPE stms_wbo_request,
            request_infos TYPE stms_wbo_requests.
      REFRESH request_infos.
      CALL FUNCTION 'TMS_MGR_READ_TRANSPORT_REQUEST'
        EXPORTING
          iv_request                 = p_reqest
          iv_header_only             = 'X'
        IMPORTING
          et_request_infos           = request_infos
        EXCEPTIONS
          read_config_failed         = 1
          table_of_requests_is_empty = 2
          system_not_available       = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CLEAR request_info.
      READ TABLE request_infos INTO request_info INDEX 1.
      IF sy-subrc NE 0
      OR request_info-e070-trkorr IS INITIAL.
        MESSAGE e398(00) WITH 'Request'(006) p_reqest 'not found'(007).
      ELSEIF request_info-e070-trstatus NE 'R'.
        MESSAGE e398(00)
        WITH 'You must release request'(008)
             request_info-e070-trkorr
             'before downloading'(009).
      ENDIF.
    START-OF-SELECTION.
      folder = p_folder.
      CONCATENATE p_reqest+3(7) '.' p_reqest(3) INTO trfile.
      CALL FUNCTION 'RSPO_R_SAPGPARAM'
        EXPORTING
          name   = 'DIR_TRANS'
        IMPORTING
          value  = transdir
        EXCEPTIONS
          error  = 0
          OTHERS = 0.
      PERFORM copy_file USING 'cofiles' trfile.
      trfile(1) = 'R'.
      PERFORM copy_file USING 'data' trfile.
      trfile(1) = 'D'.
      PERFORM copy_file USING 'data' trfile.
    * FORM copy_file *
    * --> SUBDIR * * --> FNAME *
    FORM copy_file USING subdir fname.
      DATA:
        auth_filename TYPE authb-filename,
        gui_filename TYPE string.
      CONCATENATE transdir subdir fname
        INTO filename
        SEPARATED BY p_sepr.
      REFRESH datatab.
      CLEAR flen.
      auth_filename = filename.
      CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
        EXPORTING
          activity         = sabc_act_read
          filename         = auth_filename
        EXCEPTIONS
          no_authority     = 1
          activity_unknown = 2
          OTHERS           = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_NEGATIVE.
        WRITE: / 'Read access denied. File'(001),
                  filename.
        FORMAT COLOR OFF. EXIT.
      ENDIF.
      OPEN DATASET filename FOR INPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        FORMAT COLOR COL_TOTAL.
        WRITE: / 'File open error'(010), filename.
        FORMAT COLOR OFF. EXIT.
      ENDIF.
      DO.
        CLEAR len.
        READ DATASET filename INTO datatab LENGTH len.
        flen = flen + len.
        IF len > 0. APPEND datatab. ENDIF.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET filename.
      CONCATENATE p_folder '' fname INTO gui_filename.
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          bin_filesize            = flen
          filename                = gui_filename
          filetype                = 'BIN'
        CHANGING
          data_tab                = datatab[]
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 24.
      IF sy-subrc = 0.
        WRITE: / 'File'(002), filename, 'downloaded. Length'(003), flen.
      ELSE.
        FORMAT COLOR COL_NEGATIVE.
        WRITE: / 'File download error. Filename:'(004), filename.
        FORMAT COLOR OFF.
      ENDIF.
    ENDFORM. "copy_file
    Reward  points if it is usefull....
    Girish

  • Passing Dynamic Internal Tables to Memory

    I have a bit of a conundrum right now that I can't seem to correct. I am working on adding an ALV report to an existing report program. I was able to write a simple helper program that builds a custom object that I defined that translates my raw data into two seperate dynamic tables, and then builds an ALV grid and outputs it. The reason I wrote this in a simple helper program was so that I could use SUBMIT ... EXPORTING LIST TO MEMORY from my primary report program and capture the input so I can later write it out under our company's standard ABAP list format as if I were using WRITE statements.
    The output of the report itself is working beautifully. We have included functionality to automatically take the output, produce an HTML file from it, and then FTP it directly to a webserver so our clients can get easy access to it. What I want to be able to do though is give the clients two tab-delimited files that contain the raw data that was used to build the report. We have an interface in place to do that, but I somehow need to be able to pass these two dynamic internal tables which I have field-symbols to reference back to my calling program.
    Here is what I am trying to do:
    CALL METHOD OBJ_ALV_MR_EST_REASONS->PRODUCE_ESTIMATION_REPORT
        IMPORTING
          RPT_DATA_BY_REASON   = ref_it_estreason
          RPT_DATA_BY_DISTRICT = ref_it_district.
    *   Assign the field symbols
      ASSIGN ref_it_estreason->* TO <it_estreason>.
      ASSIGN ref_it_district->* TO <it_district>.
    * Export the two internal tables to memory so they can be
    * retrieved by the calling program
      EXPORT reason = <it_estreason>[]
             district = <it_district>[]
      TO MEMORY ID 'ZCR_ESTIMATION_REASON_RPT'.
    As you can see, my method returns two references to dynamic internal tables. I have used the memory debugger to see that these tables are being correctly written to the ABAP memory.
    However, back in my parent program when I try to do the following,
    CREATE DATA ref_it_estreason TYPE REF TO DATA.
          CREATE DATA ref_it_district TYPE REF TO DATA.
          ASSIGN ref_it_estreason->* TO <it_estreason>.
          ASSIGN ref_it_district->* TO <it_district>.
          IMPORT reason = <it_estreason>
                 district = <it_district>
          FROM MEMORY ID 'ZCR_ESTIMATION_REASON_RPT'.
    I get the REFS_NOT_SUPPORTED_YET exception which says that "For the statement Export/Import ..." object references, interface references, and data references are currently not supported".
    I have tried multiple other ways of defining my field-symbols or my reference pointers but they all result in exceptions of some sort. Is there any way for me to get this data passed back? It seems like there must be a way to get the data from memory since I know it's being correctly stored there.
    Thanks in advance.

    Shortly after posting this, I had an idea which I was able to implement to actually get this to work.
    I decided that I would simply pass the FIELDCAT tables for each of my dynamic tables into the same memory ID as the tables themselves.
      EXPORT reason_fcat = it_estreason_fcat
             district_fcat = it_district_fcat
             reason = <it_estreason>[]
             district = <it_district>[]
      TO MEMORY ID 'ZCR_ESTIMATION_REASON_RPT'.
    Then, back in my calling program I execute the following code. This retrieves the FIELDCAT tables, builds two empty dynamic table type reference variables and then lets me create field-symbols to reference those components.
    *     Retrieve the fieldcat internal tables first
          IMPORT reason_fcat = it_estreason_fcat
                 district_fcat = it_district_fcat
          FROM MEMORY ID 'ZCR_ESTIMATION_REASON_RPT'.
    *     Generate an internal table type assigned to each
    *     reference variable based on the fieldcat listings we
    *     retrieve
          CALL METHOD cl_alv_table_create=>create_dynamic_table
            EXPORTING
              it_fieldcatalog = it_estreason_fcat
            IMPORTING
              ep_table        = ref_it_estreason.
          CALL METHOD cl_alv_table_create=>create_dynamic_table
            EXPORTING
              it_fieldcatalog = it_district_fcat
            IMPORTING
              ep_table        = ref_it_district.
    *     Assign the field symbols
          ASSIGN ref_it_estreason->* TO <it_estreason>.
          ASSIGN ref_it_district->* TO <it_district>.
          CREATE DATA ref_wa_estreason LIKE LINE OF <it_estreason>.
          CREATE DATA ref_wa_district LIKE LINE OF <it_district>.
          ASSIGN ref_wa_estreason->* TO <wa_estreason>.
          ASSIGN ref_wa_district->* TO <wa_district>.
    *     Finally, we can retrieve the data from memory and assign
    *     to the internal tables referenced by our field-symbols
          IMPORT reason = <it_estreason>[]
                 district = <it_district>[]
          FROM MEMORY ID 'ZCR_ESTIMATION_REASON_RPT'.
    This worked beautifully and saved me from having to do a major redesign. I don't know how helpful it would be for ABAP Objects to be passed to memory (I believe some type of serialization would need to be in order there), but for dynamically typed internal tables it worked like a dream with little overhead.

  • Passing dynamic internal table to FM using RFC

    Dear All,
    Is it possible to pass a dynamic internal table to a function module using RFC?
    If it is possible than how do i achive this?

    Basically not, RFC enabled FM parameters must be defined by a LIKE or TYPE clause. so you may try to use a prededined SAP type wide enough (e.g. TAB512 ) and map the data in the FM and caller program (in Unicode try to use tools like class CL_ABAP_CONTAINER_UTILITIES to map data between actual internal table record and RFC used itab "container" type)
    For examples look at RFC enabled RFC_GET_TABLE_ENTRIES FM, and look for where-used program.
    Regards,
    Raymond

  • How to do parallel processing with dynamic internal table

    Hi All,
    I need to implement parallel processing that involves dynamically created internal tables. I tried doing so using RFC function modules (using starting new task and other such methods) but didn't get success this requires RFC enabled function modules and at the same time RFC enabled function modules do not allow generic data type (STANDARD TABLE) which is needed for passing dynamic internal tables. My exact requirement is as follows:
    1. I've large chunk of data in two internal tables, one of them is formed dynamically and hence it's structure is not known at the time of coding.
    2. This data has to be processed together to generate another internal table, whose structure is pre-defined. But this data processing is taking very long time as the number of records are close to a million.
    3. I need to divide the dynamic internal table into (say) 1000 records each and pass to a function module and submit it to run in another task. Many such tasks will be executed in parallel.
    4. The function module running in parallel can insert the processed data into a database table and the main program can access it from there.
    Unfortunately, due to the limitation of not allowing generic data types in RFC, I'm unable to do this. Does anyone has any idea how to implement parallel processing using dynamic internal tables in these type of conditions.
    Any help will be highly appreciated.
    Thanks and regards,
    Ashin

    try the below code...
      DATA: w_subrc TYPE sy-subrc.
      DATA: w_infty(5) TYPE  c.
      data: w_string type string.
      FIELD-SYMBOLS: <f1> TYPE table.
      FIELD-SYMBOLS: <f1_wa> TYPE ANY.
      DATA: ref_tab TYPE REF TO data.
      CONCATENATE 'P' infty INTO w_infty.
      CREATE DATA ref_tab TYPE STANDARD TABLE OF (w_infty).
      ASSIGN ref_tab->* TO <f1>.
    * Create dynamic work area
      CREATE DATA ref_tab TYPE (w_infty).
      ASSIGN ref_tab->* TO <f1_wa>.
      IF begda IS INITIAL.
        begda = '18000101'.
      ENDIF.
      IF endda IS INITIAL.
        endda = '99991231'.
      ENDIF.
      CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
          pernr           = pernr
          infty           = infty
          begda           = '18000101'
          endda           = '99991231'
        IMPORTING
          subrc           = w_subrc
        TABLES
          infty_tab       = <f1>
        EXCEPTIONS
          infty_not_found = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        subrc = w_subrc.
      ELSE.
      ENDIF.

  • Dynamic internal table in Subroutines

    Can we pass Dynamic internal table in subroutine.
    I tried doing this. but it is not working
    perform xyz tables <DYN_tab>.
    form xyz tables <DYN_tab> type standard table
    endform
    Kindly provide me some solution for this.
    Moderator Message: Read the F1 documentation on USING & CHANGING additions and figure it out yourself
    Edited by: Suhas Saha on Nov 7, 2011 5:11 PM

    Hi
    Don't use TABLE, but USING:
    form xyz USING P_ITAB TYPE TABLE
    endform .
    PERFORM XYZ USING <DYN_TAB>.
    Max

  • To pass internal table data(including subtotal) to dynamic internal table

    here i am displaying the dynamic internal table in alv grid.
    i followed like this but i am unable to get the subtotal form the internal table.
    LOOP AT ITAB1. " assigning <fs_itab1>.
        ASSIGN COMPONENT 'RACCT' OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
        <DYN_FIELD> = ITAB1-RACCT.
        ASSIGN COMPONENT 'ERGSL' OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
        <DYN_FIELD> = ITAB1-ERGSL.
        ASSIGN COMPONENT 'TEXT' OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
        <DYN_FIELD> = ITAB1-TEXT.
        I = 4.
        CLEAR COMP_ITAB.
        LOOP AT COMP_ITAB.
          ASSIGN COMPONENT I OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
         LOOP AT ITAB WHERE RACCT = ITAB1-RACCT.
           IF ITAB-RBUKRS EQ COMP_ITAB-RBUKRS.
          IF ITAB1-RBUKRS EQ COMP_ITAB-RBUKRS.
            <DYN_FIELD> = ITAB1-REPVAL.
            SUB_TOT = ITAB1-REPVAL.
          ELSE.
            <DYN_FIELD> = 0.
            SUB_TOT = 0.
          ENDIF.
         ENDLOOP.
          I = I + 1.
          TOTAL = TOTAL + SUB_TOT.
        ENDLOOP.
        ASSIGN COMPONENT I OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
        <DYN_FIELD> = TOTAL.
        APPEND <DYN_WA> TO <DYN_TABLE>.
        CLEAR <DYN_WA>.
        TOTAL = 0.
      ENDLOOP.
    Thanks,
    sridhar.

    Hi Rakesh,
    We pass internal tables for the smartform are shown in bold in below code,
    CALL FUNCTION LF_FM_NAME
        EXPORTING
          ARCHIVE_INDEX      = TOA_DARA
          ARCHIVE_PARAMETERS = ARC_PARAMS
          CONTROL_PARAMETERS = LS_CONTROL_PARAM
          MAIL_RECIPIENT     = LS_RECIPIENT
          MAIL_SENDER        = LS_SENDER
          OUTPUT_OPTIONS     = LS_COMPOSER_PARAM
          USER_SETTINGS      = ' '               
          ZXEKKO             = L_DOC-XEKKO
          ZXPEKKO            = L_DOC-XPEKKO
          ZNAST              = NAST
        IMPORTING
          DOCUMENT_OUTPUT_INFO = IT_DOCUMENT
          JOB_OUTPUT_INFO      = IT_OUTPUT_INFO
          JOB_OUTPUT_OPTIONS   = IT_JOB_OUTPUT
        <b>TABLES
          L_XEKPO            = L_DOC-XEKPO[]
          L_XEKPA            = L_DOC-XEKPA[]
          L_XPEKPO           = L_DOC-XPEKPO[]
          L_XEKET            = L_DOC-XEKET[]
          L_XTKOMV           = L_DOC-XTKOMV[]
          L_XEKKN            = L_DOC-XEKKN[]
          L_XEKEK            = L_DOC-XEKEK[]
          L_XKOMK            = L_XKOMK</b>  
    EXCEPTIONS
          FORMATTING_ERROR   = 1
          INTERNAL_ERROR     = 2
          SEND_ERROR         = 3
          USER_CANCELED      = 4
          OTHERS             = 5.
    Regards,
    Azaz Ali.

  • How to pass the internal table data to smartforms

    Hi Gurus,
    I have a problem in passing the internal table data to the smartforms. In the print program
    I get the data into one internal table "LT_PRDLBL1". I am passing this internal table to the other in print program by calling the FM_NAME.
    CALL FUNCTION fm_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = T_SSFCTRLOP
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
        OUTPUT_OPTIONS             = T_SSFCOMPOP
        USER_SETTINGS              = ' '
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
      TABLES
        LT_PRDLBL                 = LT_PRDLBL1
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
    In the print program I had defined the internal tables like
    Data: lt_prdlbl  type standard table of zprdlbl.
    Data: Begin of lt_prdlbl1 occurs 0.
            include structure zprdlbl.
    Data: End of lt_prdlbl1.
    How do I define the internal table in the smartform to get the values printed in the smartform?.
    <REMOVED BY MODERATOR>
    Thanks,
    Edited by: Alvaro Tejada Galindo on Apr 21, 2008 1:01 PM

    Nehal,
    Thanks for quick response.
    In the smartform under the Form Interface->Tables tab
    I had defined
    LT_PRDLBL LIKE ZPRDLBL. If I define TYPE instead of LIKE I get the error message saying "FLAT TYPES may only be referenced using LIKE for table parameters".
    In the main window I have created LOOP, in which I have ticked the internal table and
    LT_PRDLBL INTO LT_PRDLBL. In the text node I am passing the values of this internal table
    &LT_PRDLBL-XXXX&.
    I am able to get the print but the data is not printing.
    Please help me with this.
    Thanks,

  • How to pass an internal table to a SmartForm?

    Hi there!
    I have a program that calls a SmartForm.
    I have a internal table wich I want to print.
    This internal table is based on a custom structure with NO standard includes (e.g., with custom fields).
    How do I declare this internal table in the transaction SMARTFORMS?
    Best Regards,
    Luís.

    Refer below thread..
    How to pass an internal table to smartform.
    hope it will solve ur problem
    Thanks & Regards
    ilesh 24x7

  • Passing the Dynamic Internal Table as the Output Parameter of the FM...

    Hi,
    How can we pass the internal table as the output from the Function Module TABLES parameter.
        SELECT * FROM TVRO BYPASSING BUFFER INTO TABLE <ltable>.
    Now I need to pass the dynamic internal table <ltable> as the output in the function module.
    Thanks!
    Puneet.

    I can't use TVRO as the table type. The Table name is as the Input. This program will download the contents of the table and create an app server file. It can be for any database table.
    so i want the output of this FM should be the data from that table. So what should be the TABLE type.
    like in  a program i will use:::
      FIELD-SYMBOLS: <ltable> TYPE ANY TABLE,
                     <l_line> TYPE ANY,
                     <l_field> TYPE ANY.
        SELECT * FROM (p_table) BYPASSING BUFFER INTO TABLE <ltable>.
    That is my requirement.

  • Passing an Internal table to the Smartform

    Hi Experts,
    I have build an internal table in the driver program with some (20 fields) now I need to pass the same internal table to Smartform as importing parameter or Tables Parameter so that I can use the table data for my further processing.
    I have searched the forums and its look like I can't pass an Internal table to the smartform unless and until it is defined in the DDIC with the table types.
    FYI...
    I can't create the DDIC table type as it needs lot of approvals to get it created.
    Please help me on how to proceed further.
    Thanks in advance.
    Regards,
    Srinivas

    I can't create the DDIC table type as it needs lot of approvals to get it created.
    It's a shame you need approval for this.
    Anyway can you overcome this with field symbols:
    - type parameter in Smartform FM with TYPE STANDARD TABLE (or INDEX/SORTED/HASHED - depending which one you use)
    - pass your locally typed table
    - in SF create the same data type
    - declare field symbol with this type
    - assign the table from the parameter to this field symbol - this way you can work with the table via field symbol as it would be of the table type
    "in SF
      TYPES: tt_my_type TYPE TABLE OF my_type..
      FIELD-SYMBOLS <tab> TYPE tt_my_type .
      "itab is parameter table
      ASSIGN itab TO <tab>.
      "now you can even address its components
       <wa_tab>-field1 = ...
    Although FM parameters in general should be typed with DDIC types only, this way you can cheat the system a little bit;)
    Regards
    Marcin

  • Regarding Passing two internal Tables from Driver Program to Smartform

    hi all,
              I am Passing Two Internal Tables from Driver Program to Smartform it is going to dump and message is showing like this " one of the parameters eded according to the interface description was not specified ".
              When i am passing one Internal Table Output is coming Perfectly. Is there any restriction for passing of internal tables.
    Regards
    Rami

    HI,
    Check the names specified in the smartfrom and FM whcih you are calling in the driver program. Both might be different....

  • Regarding passing an internal table from print program to smartform....

    Hi All,
    can any body let me how to pass an internal table to the smartform, i have processed the data in the print program then i want to pass the final internal table from the print program to smartform and with that data in the internal table i have to process it in the smartform (i want to get some more data based on the internal table data from the print program) and then i will display finally.
    for example: i have it_qals which contains all the lot numbers which is processed in teh printprogram, now i want to pass all these (it_qals) lotnumbers to smartform , and in the smartform i will use the lotnumbers in the it_qals table and will process other data accordingly 
    can any body help me plzz.. its very urgent

    Chek this code i am coping my whole program here.
    REPORT ZDP_SMARTFORMS_REPORT3 .
    TABLES: MARA,
    MAKT.
    DATA: FNAME TYPE RS38L_FNAM.
    DATA: BEGIN OF ITJOIN OCCURS 0.
    INCLUDE STRUCTURE ZDP_JOIN__IN_SMARTFORM.
    INCLUDE STRUCTURE MARA.
    INCLUDE STRUCTURE MAKT.
    data: END OF ITJOIN.
    *DATA: BEGIN OF ITJOIN OCCURS 0,
    MATNR LIKE MARA-MATNR,
    END OF ITJOIN.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: MAT FOR MARA-MATNR.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECT MARA~MATNR MAKTX "UP TO 5 ROWS
    FROM MARA JOIN MAKT ON MARAMATNR = MAKTMATNR
    INTO TABLE ITJOIN
    WHERE MARAMATNR IN MAT and maktspras eq 'EN'.
    into corresponding fields of table it
    *SELECT MATNR UP TO 5 ROWS FROM MARA INTO TABLE ITJOIN
    WHERE MATNR IN MAT.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    FORMNAME = 'ZDP_SMARTFORMS_3'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FNAME
    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.
    not necessar y above function if u copy function name from
    **- smartforms>environment>function name
    CALL FUNCTION '/1BCDWB/SF00000037'
    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
    ITJ = ITJOIN
    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.
    Also check these links
    Check out this link,
    http://www.erpgenie.com/abap/smartforms.htm
    and also refer these threads,
    Passing table to smartform
    PASSING INTERNAL TABLE IN SMARTFORM
    Hope this helps.
    ashish

  • How to pass data from dynamic internal table to standard internal table

    hi experts,
    below is the piece of code which i have used in my requirement but the data is not moved.
    LOOP AT <tab> ASSIGNING <tab1>.
      MOVE-CORRESPONDING <tab1> TO wa.
      append wa TO  gt_outtab.
    ENDLOOP.
    here
    <tab> - dynamic internal table.
    <tab1>-dynamic internal table work area.
    gt_outtab - standard internal table.
    wa- standard internal table work area.
    i am not getting what additional thing i have to write.
    pls help me in this regard.
    thankx in advance.
    soham.p.

    Hello soham p ,
    I am also using the same logic but in my program it is working fine so you declare the fieldsymols like this and try and also check the dynamic internal contain the data or not.
    FIELD-SYMBOLS : <y_i_table>  TYPE STANDARD TABLE,
                                 <y_wa_table> TYPE ANY.
      LOOP AT <y_i_table> ASSIGNING <y_wa_table>.
        MOVE-CORRESPONDING <y_wa_table> TO y_wa_vfscaid.
        APPEND y_wa_vfscaid TO y_i_vfscaid.
        CLEAR y_wa_vfscaid.
      ENDLOOP.

Maybe you are looking for