Internal table refreshing

Hi Experts,
   I  copyed the me2k(RM06EK00) program to Zprogram and doing some
modification.
My problem is I declared the internal table and some values are populating to
the internal table in the subroute PERFORM ekpo_ausgabe(sapfm06l).
(This is last perform statement before END-OF-Selection),
when it comes out of the perform statement and before End-of- selection my internal table values are refreshed automatically, I didn't refreshed the internal table.
Pls help me to get the values without refreshing my IT.
Thanks in advance
karthik

For example,  lets look at program ZRICH_0001, here  I am calling a PERFORM which is in program ZRICH_0002 and then pulling that internal table out of the memory stack.
report  zrich_0001.
types: tt001 type table of t001.
field-symbols: <it001> type tt001.
data: pointer_string type string.
data: xt001 like line of <it001>.
start-of-selection.
* Call the perform in other program
  perform fill_up_it001 in program zrich_0002.
* Assign an internal table
  pointer_string = '(ZRICH_0002)IT001[]'.
  assign (pointer_string) to <it001>.
  loop at <it001> into xt001.
    write: / xt001-bukrs, xt001-butxt..
  endloop.
And the code for the second program.
report zrich_0002 .
data: it001 type table of t001.
*       FORM fill_up_it001                                            *
form fill_up_it001.
  select * into table it001 from t001.
endform.
Now I think this will work for you, but the internal table from the PERFORM must be global variable in the main program, not local to the FORM, if it is local to the FORM, then this will not work.
Regards,
Rich Heilman

Similar Messages

  • Dynamic ALV and internal table.

    Hi all,
    I have a requirement of creating a dynamic field catelog based on input values in selection screen.
    Example:
    1) When I enter date range, say  20/03/2008 to 25/03/2008 I should have 6 columns in the output for each date with column heading as date itself.
    2) For entering values for these date columns, i need to create an dynamic internal table.(values in the column will be some numbers like 10 on 20/03/2008, 15 on 21/03/2008  etc)
    A rough output format would look like this:
    Component |  20/03/2008  |  21/03/2008 | .....      |25/03/2008
    comp1        |    10            |      15         |             |      5
    comp2        |    20            |      10         |             |     10
    Please let me know how can i achieve this...
    Need it very urgently..
    Regards,
    Dhareppa

    Hi Dhareppa,
    Refer the code below. Its almost on the same line as your requirments.
    REPORT  zglo2fr_master_planing_sedul NO STANDARD PAGE HEADING.
              P  R  O  G  R  A  M    H  E  A  D  E  R                   *
                        ArthroCare Corporation                          *
    Program            : ZGLO2FR_MASTER_PLANING_SEDUL                   *
    Author             : Munvar Basha                                   *
    Creation Date      : 11Mar08                                        *
    Release            : SAP ECC 6.0                                    *
    Request            : D01K904032                                     *
    Description        : Master Schedule Planning                       *
    Change log (Revisions)                                              *
    Author     Date     Request    Description                          *
                             P  R  O  G  R  A  M                        *
                           DATA DECLARATION                             *
    **--Structure to hold matrial & plant combination records.
    TYPES : BEGIN OF ty_marc,
              matnr  TYPE matnr,
              werks  TYPE werks_d,
              dispo  TYPE dispo,
              beskz  TYPE beskz,
              mtart  TYPE mtart,
            END OF ty_marc.
    **--structure to hold MRP LIST Data.
    TYPES : BEGIN OF ty_mrp_list,
              matnr TYPE matnr,
              werks TYPE werks_d,
              maktx TYPE maktx,
              meins TYPE meins,
              mtart TYPE mtart,
              week  TYPE kweek,
              mng01 TYPE mng01,
              delkz TYPE delkz,
            END OF ty_mrp_list.
    **--structure to hold no of weeks.
    TYPES: BEGIN OF ty_week,
             week TYPE kweek,
           END OF ty_week.
    **--structure to hold output data.
    TYPES : BEGIN OF ty_final,
              matnr TYPE matnr,
              werks TYPE werks_d,
              maktx TYPE maktx,
              meins TYPE meins,
              mtart TYPE mtart,
              week  TYPE kweek,
              mng01 TYPE mng01,
            END OF ty_final.
    TYPES : BEGIN OF ty_range,
              sign   TYPE sign,
              option TYPE option,
              low    TYPE sy-datum,
              high   TYPE sy-datum,
            END OF ty_range.
              Definitions of Table types.                               *
    TYPES : ty_marctab TYPE STANDARD TABLE OF ty_marc.
               Definitions of Ranges                                    *
    *RANGES ran_delkz FOR mdez-delkz.
    DATA : i_ran_delkz TYPE RANGE OF  mdez-delkz,
           wa_ran_delkz LIKE LINE OF i_ran_delkz,
           wa_date type ty_range.
               Definitions of internal tables.                          *
    data : i_marc      type standard table of ty_marc,
           i_mrp_list  type standard table of ty_mrp_list,
           i_week      type standard table of ty_week,
           i_final     type standard table of ty_final,
           i_mdps      type standard table of mdps,
           i_mdez      type standard table of mdez,
           i_mdsu      type standard table of mdsu.
               Definitions of work areas for internal tables            *
    DATA : wa_marc     TYPE ty_marc,
           wa_mrp_list TYPE ty_mrp_list,
           wa_week     TYPE ty_week,
           wa_final    TYPE ty_final,
           wa_mt61d    TYPE mt61d,
           wa_mdez     TYPE mdez.
               Definitiions of General variables                        *
    DATA : v_matnr TYPE mara-matnr, " Material Number
           v_mtart TYPE mara-mtart, " Material Type
           v_beskz TYPE marc-beskz, " Procurement Type
           v_werks TYPE marc-werks, " Plant
           v_dispo TYPE marc-dispo. " MRP Controller (Materials Planner)
    DATA : v_mng01 TYPE mng01. "Requirement Quantity
    DATA : v_year  TYPE char4,
           v_week  TYPE char2,
           v_ok_code TYPE sy-ucomm.
               Definitiions of Constants                                *
    CONSTANTS : k_slash TYPE c     VALUE '/',
                k_6     TYPE char8 VALUE '6',
                k_x     TYPE c     VALUE 'X'.
               Definitiions of Field Catlog                             *
    DATA : wa_fieldcat        TYPE lvc_s_fcat,
           i_fieldcat         TYPE lvc_t_fcat,
           v_container        TYPE scrfname VALUE 'CONTAINER_OUTPUT',
           v_custom_container TYPE REF TO cl_gui_custom_container,
           v_grid             TYPE REF TO cl_gui_alv_grid,
           i_gp_table           TYPE REF TO data,
           wa_gp_line            TYPE REF TO data.
    FIELD-SYMBOLS: <gt_table>  TYPE STANDARD TABLE,
                   <gwa_table> TYPE ANY,
                   <l_field>   TYPE ANY,
                   <l_matnr>   TYPE ANY,
                   <l_werks>   TYPE ANY,
                   <l_maktx>   TYPE ANY,
                   <l_meins>   TYPE ANY,
                   <l_mtart>   TYPE ANY.
                 DECLERATIONS FOR SELECTION SCREEN                      *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_matnr FOR v_matnr,
                     s_mtart FOR v_mtart NO INTERVALS,
                     s_beskz FOR v_beskz NO INTERVALS NO-EXTENSION,
                     s_werks FOR v_werks NO INTERVALS NO-EXTENSION
                     OBLIGATORY,
                     s_dispo FOR v_dispo,
                     s_date  FOR sy-datum OBLIGATORY.
    PARAMETERS :     p_dattp   TYPE dattp OBLIGATORY DEFAULT '1'.
    SELECTION-SCREEN END OF BLOCK b1.
               INITIALIZATION EVENT                                     *
    INITIALIZATION.
      CALL FUNCTION '/BEV4/PLPS__ADD_MONTH_TO_DATE'
        EXPORTING
          months  = k_6
          olddate = sy-datum
        IMPORTING
          newdate = wa_date-high.
      wa_date-low = sy-datum.
      wa_date-option = 'EQ'.
      wa_date-sign = 'I'.
      APPEND wa_date to s_date.
               SELECTION SCREEN EVENT                                   *
    **--Validation for Material
    AT SELECTION-SCREEN ON s_matnr.
      PERFORM validate_material.
    **--Validation for Plant
    AT SELECTION-SCREEN ON s_werks.
      PERFORM validate_plant.
                AT SELECTION-SCREEN ENENT                               *
    AT SELECTION-SCREEN.
      IF s_matnr IS INITIAL AND s_dispo IS INITIAL.
        MESSAGE text-002 TYPE 'E'.
      ENDIF.
      IF s_date-low LT sy-datum.
        MESSAGE text-003 TYPE 'E'.
      ENDIF.
                           START-OF-SELECTION EVENT                     *
    START-OF-SELECTION.
    **--refreshing the internal tables
      REFRESH : i_marc,
                i_mrp_list,
                i_week,
                i_final,
                i_mdps,
                i_mdez,
                i_mdsu.
    **--clearing the work areas of internal tables.
      CLEAR : wa_marc,
              wa_mrp_list,
              wa_week,
              wa_final,
              wa_mt61d,
              wa_mdez.
    To get all the matrial(s) and plant combination records
      SELECT a~matnr
             a~werks
             a~dispo
             a~beskz
             b~mtart
             INTO TABLE i_marc
             FROM marc AS a INNER JOIN
                  mara AS b
                  ON a~matnr = b~matnr
             WHERE a~werks IN s_werks AND
                   a~matnr IN s_matnr AND
                   a~dispo IN s_dispo AND
                   a~beskz IN s_beskz AND
                   b~mtart IN s_mtart.
      IF sy-subrc <> 0.
        MESSAGE text-005 TYPE 'S'.
        LEAVE LIST-PROCESSING.
      ENDIF.
      SORT i_marc BY matnr werks.
    Ranges to Filter the MRP list only for the following MRP Elements.
    MRP Elements are : BA, BE, FE, LE and PA
      wa_ran_delkz-sign = 'I'.
      wa_ran_delkz-option = 'EQ'.
      wa_ran_delkz-low = 'BA'.
      APPEND wa_ran_delkz TO i_ran_delkz.
      CLEAR wa_ran_delkz-low.
      wa_ran_delkz-low = 'BE'.
      APPEND wa_ran_delkz TO i_ran_delkz.
      CLEAR wa_ran_delkz-low.
      wa_ran_delkz-low = 'FE'.
      APPEND wa_ran_delkz TO i_ran_delkz.
      CLEAR wa_ran_delkz-low.
      wa_ran_delkz-low = 'LE'.
      APPEND wa_ran_delkz TO i_ran_delkz.
      CLEAR wa_ran_delkz-low.
      wa_ran_delkz-low = 'PA'.
      APPEND wa_ran_delkz TO i_ran_delkz.
      CLEAR wa_ran_delkz-low.
      LOOP AT i_marc INTO wa_marc.
        CALL FUNCTION 'MD_MRP_LIST_API'
          EXPORTING
            matnr                    = wa_marc-matnr
            werks                    = wa_marc-werks
            sinfg                    = k_x
            inper                    = p_dattp
          IMPORTING
            e_mt61d                  = wa_mt61d
          TABLES
            mdpsx                    = i_mdps
            mdezx                    = i_mdez
            mdsux                    = i_mdsu
          EXCEPTIONS
            mrp_list_not_found       = 1
            material_plant_not_found = 2
            error                    = 3
            OTHERS                   = 4.
        IF sy-subrc = 0.
          LOOP AT i_mdez INTO wa_mdez WHERE dat00 IN s_date AND
                                            delkz IN i_ran_delkz.
            CALL FUNCTION 'DATE_GET_WEEK'
              EXPORTING
                date         = wa_mdez-dat00
              IMPORTING
                week         = wa_mrp_list-week
              EXCEPTIONS
                date_invalid = 1
                OTHERS       = 2.
            IF sy-subrc = 0.
              wa_mrp_list-matnr = wa_mt61d-matnr.
              wa_mrp_list-werks = wa_mt61d-werks.
              wa_mrp_list-maktx = wa_mt61d-maktx.
              wa_mrp_list-meins = wa_mt61d-meins.
              wa_mrp_list-mtart = wa_mt61d-mtart.
              wa_mrp_list-delkz = wa_mdez-delkz.
              wa_mrp_list-mng01 = wa_mdez-mng01.
              APPEND wa_mrp_list TO i_mrp_list.
              CLEAR : wa_mrp_list,
                      wa_mdez.
            ENDIF.
          ENDLOOP.
        ENDIF.
        CLEAR: wa_marc.
      ENDLOOP.
      IF i_mrp_list IS INITIAL.
        MESSAGE text-006 TYPE 'S'.
        LEAVE LIST-PROCESSING.
      ENDIF.
      CLEAR : v_mng01.
      LOOP AT i_mrp_list INTO wa_mrp_list.
        v_mng01 = v_mng01 + wa_mrp_list-mng01.
        AT END OF week.
          wa_final-matnr = wa_mrp_list-matnr.
          wa_final-werks = wa_mrp_list-werks.
          wa_final-maktx = wa_mrp_list-maktx.
          wa_final-meins = wa_mrp_list-meins.
          wa_final-mtart = wa_mrp_list-mtart.
          wa_final-week  = wa_mrp_list-week.
          wa_final-mng01 = v_mng01.
          wa_week-week =   wa_mrp_list-week.
          APPEND : wa_final TO i_final,
                   wa_week  TO i_week.
          CLEAR : v_mng01,
                  wa_final,
                  wa_week.
        ENDAT.
        CLEAR : wa_mrp_list.
      ENDLOOP.
    **-- Populate the Field catalog
      PERFORM populate_fieldcat.
    **--Create table dynamically
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = i_fieldcat
        IMPORTING
          ep_table        = i_gp_table.
      ASSIGN i_gp_table->* TO <gt_table>.
    **--fill table with final output data
      PERFORM fill_table.
      CALL SCREEN 100.
                              SUB ROUTINES                              *
    *&      Form  validate_material                                        *
          Validating Material Number(s)                                  *
    FORM validate_material .
      TYPES : BEGIN OF l_ty_matnr,
               matnr TYPE matnr,
              END OF l_ty_matnr.
      DATA : l_i_matnr TYPE STANDARD TABLE OF l_ty_matnr.
      SELECT matnr
             FROM mara
             INTO TABLE l_i_matnr
             WHERE matnr IN s_matnr.
      IF sy-subrc <> 0.
        MESSAGE text-004 TYPE 'E'.
      ENDIF.
    ENDFORM.                    " validate_material
    *&      Form  validate_plant                                           *
          Validating Plant Number                                        *
    FORM validate_plant .
      DATA : l_v_werks TYPE werks_d.
      SELECT SINGLE werks
                    FROM t001w
                    INTO l_v_werks
                    WHERE werks = s_werks-low.
      IF sy-subrc <> 0.
        MESSAGE e019(zartc) WITH s_werks-low.
      ENDIF.
    ENDFORM.                    " validate_plant
    *&      Form  populate_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM populate_fieldcat .
      DATA : l_v_colname TYPE char7.
      SORT i_week BY week.
      DELETE ADJACENT DUPLICATES FROM i_week COMPARING week.
      LOOP AT i_week INTO wa_week.
        AT FIRST.
          wa_fieldcat-row_pos     = 0.
          wa_fieldcat-col_pos     = 1.
          wa_fieldcat-fieldname   = 'MATNR'.
          wa_fieldcat-scrtext_l   = text-007.
          wa_fieldcat-scrtext_m   = text-007.
          wa_fieldcat-scrtext_s   = text-007.
          wa_fieldcat-fix_column  = 'X'.
          wa_fieldcat-outputlen   = 18.
          wa_fieldcat-tooltip     = text-007.
          APPEND wa_fieldcat TO i_fieldcat.
          CLEAR wa_fieldcat.
          wa_fieldcat-row_pos     = 0.
          wa_fieldcat-col_pos     = 2.
          wa_fieldcat-fieldname   = 'WERKS'.
          wa_fieldcat-scrtext_l   = text-008.
          wa_fieldcat-scrtext_m   = text-008.
          wa_fieldcat-scrtext_s   = text-008.
          wa_fieldcat-fix_column  = 'X'.
          wa_fieldcat-outputlen   = 4.
          wa_fieldcat-tooltip     = text-008.
          APPEND wa_fieldcat TO i_fieldcat.
          CLEAR wa_fieldcat.
          wa_fieldcat-row_pos     = 0.
          wa_fieldcat-col_pos     = 3.
          wa_fieldcat-fieldname   = 'MAKTX'.
          wa_fieldcat-scrtext_l   = text-009.
          wa_fieldcat-scrtext_m   = text-010.
          wa_fieldcat-scrtext_s   = text-011.
          wa_fieldcat-tooltip     = text-009.
          wa_fieldcat-outputlen   = 40.
          APPEND wa_fieldcat TO i_fieldcat.
          CLEAR wa_fieldcat.
          wa_fieldcat-row_pos     = 0.
          wa_fieldcat-col_pos     = 4.
          wa_fieldcat-fieldname   = 'MEINS'.
          wa_fieldcat-scrtext_l   = text-012.
          wa_fieldcat-scrtext_m   = text-013.
          wa_fieldcat-scrtext_s   = text-014.
          wa_fieldcat-outputlen   = 4.
          wa_fieldcat-tooltip     = text-012.
          APPEND wa_fieldcat TO i_fieldcat.
          CLEAR wa_fieldcat.
          wa_fieldcat-row_pos     = 0.
          wa_fieldcat-col_pos     = 5.
          wa_fieldcat-fieldname   = 'MTART'.
          wa_fieldcat-scrtext_l   = text-015.
          wa_fieldcat-scrtext_m   = text-015.
          wa_fieldcat-scrtext_s   = text-016.
          wa_fieldcat-tooltip     = text-015.
          APPEND wa_fieldcat TO i_fieldcat.
          CLEAR wa_fieldcat.
        ENDAT.
        v_year = wa_week-week+0(4).
        v_week = wa_week-week+4(2).
        CONCATENATE v_week k_slash v_year INTO l_v_colname.
        wa_fieldcat-row_pos     = 0.
        wa_fieldcat-col_pos     = 6 + sy-index.
        wa_fieldcat-fieldname   = wa_week-week.
        wa_fieldcat-quantity    = 'X'.
        wa_fieldcat-outputlen   = 18.
        wa_fieldcat-scrtext_l   = l_v_colname.
        wa_fieldcat-tooltip     = l_v_colname.
        APPEND wa_fieldcat TO i_fieldcat.
        CLEAR : wa_fieldcat,
                l_v_colname,
                wa_week.
      ENDLOOP.
    ENDFORM.                    " populate_fieldcat
    *&      Form  fill_table
          text
    -->  p1        text
    <--  p2        text
    FORM fill_table .
    **--Create Work Area Dynamically
      CREATE DATA wa_gp_line LIKE LINE OF <gt_table>.
      ASSIGN wa_gp_line->* TO <gwa_table>.
      DATA : l_v_col TYPE char25,
             l_v_val TYPE char25.
      LOOP AT i_final INTO wa_final.
        l_v_col = wa_final-week.
        ASSIGN COMPONENT l_v_col OF STRUCTURE <gwa_table>
                                           TO <l_field>.
        IF <l_field> IS ASSIGNED.
          l_v_val = wa_final-mng01.
          CONDENSE l_v_val.
          <l_field> = l_v_val.
          clear : l_v_val,
                  l_v_col.
        ENDIF.
        AT END OF matnr.
         READ TABLE   i_final INTO wa_final WITH KEY matnr = wa_final-matnr
                                                              BINARY SEARCH.
          IF sy-subrc = 0.
            ASSIGN COMPONENT 'MATNR' OF STRUCTURE <gwa_table>
                                             TO <l_matnr>.
            IF <l_matnr> IS ASSIGNED.
              <l_matnr> = wa_final-matnr.
            ENDIF.
            ASSIGN COMPONENT 'WERKS' OF STRUCTURE <gwa_table>
                                             TO <l_werks>.
            IF <l_werks> IS ASSIGNED.
              <l_werks> = wa_final-werks.
            ENDIF.
            ASSIGN COMPONENT 'MAKTX' OF STRUCTURE <gwa_table>
                                             TO <l_maktx>.
            IF <l_maktx> IS ASSIGNED.
              <l_maktx> = wa_final-maktx.
            ENDIF.
            ASSIGN COMPONENT 'MEINS' OF STRUCTURE <gwa_table>
                                             TO <l_meins>.
            IF <l_meins> IS ASSIGNED.
              <l_meins> = wa_final-meins.
            ENDIF.
            ASSIGN COMPONENT 'MTART' OF STRUCTURE <gwa_table>
                                             TO <l_mtart>.
            IF <l_mtart> IS ASSIGNED.
              <l_mtart> = wa_final-mtart.
            ENDIF.
            APPEND <gwa_table> TO <gt_table>.
            CLEAR <gwa_table>.
          ENDIF.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " fill_table
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZMUNNA'.
      SET TITLEBAR 'MRP'.
      IF v_custom_container IS INITIAL.
        CREATE OBJECT v_custom_container
          EXPORTING
            container_name = v_container.
        CREATE OBJECT v_grid
          EXPORTING
            i_parent = v_custom_container.
        CALL METHOD v_grid->set_table_for_first_display
          CHANGING
            it_outtab       = <gt_table>
            it_fieldcatalog = i_fieldcat.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      v_ok_code = sy-ucomm.
      CLEAR sy-ucomm.
      CASE v_ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
          SET SCREEN 000.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  exit_program
          text
    -->  p1        text
    <--  p2        text
    FORM exit_program .
      CALL METHOD v_custom_container->free.
      CALL METHOD cl_gui_cfw=>flush.
    ENDFORM.                    " exit_program
    Reward points if that helps.
    Manish

  • Header to internal table fields

    Hi All,
    How can I add header description to the internal table fields and download this internal table to desktop as EXCEL form.
    I want to show heading in the first line of the excel and then 2 - 3 blank lines and then next line should be populated with DATE and Exec. Time, then 2-3 blank lines , then the data with the header description to be displayed.
    My sample internal table data is as below,
    John         M         12          2344
    Thomas    M         17          8960
    Lin            F          10         8467
    Jan           M          12        4323
    I need to add, description as NAME above  John, Thomas, Lin etc.
                                             as GENDER above M,M,F etc.
                                             as CODE     above 12, 17,10 etc. and
                                             as EXTENTION above 2344, 8960,8467 etc
    final execl sheet should be as below,
    COMPANY DATA
    DATE   28 - 08 - 2009                   TIME      12:32
    NAME    GENDER   CODE   EXTENTION
    John           M             12         2344
    Thomas      M             17          8960
    Lin              F              10         8467
    Jan             M             12        4323
    Please let me know, how to do this.
    Thanks in advance ,
    Sabu

    Hi,
    Kindly go through this sample code below:
    "Create T_Head internal table with the required structure for the header
    *func mod to download header and contents to the given path
    call function 'GUI_DOWNLOAD'
    exporting
    write_field_separator = 'X'
    filename              = v_pathname      "path entered by the user
    tables
    data_tab              = t_head.             "Header Internal table
    refresh t_head.
    clear t_head.
    call function 'GUI_DOWNLOAD'
    exporting
    *   BIN_FILESIZE                    =
        filename                        = v_pathname
        filetype                        = 'ASC'
        append                          = 'X'                     "Here by giving 'X', header will be appended in the download int table
        write_field_separator           = 'X'
    *   HEADER                          = '00'
    *   TRUNC_TRAILING_BLANKS           = ' '
    *   WRITE_LF                        = 'X'
    *   COL_SELECT                      = ' '
    *   COL_SELECT_MASK                 = ' '
    *   DAT_MODE                        = ' '
    *   CONFIRM_OVERWRITE               = ' '
    *   NO_AUTH_CHECK                   = ' '
    *   CODEPAGE                        = ' '
    *   IGNORE_CERR                     = ABAP_TRUE
    *   REPLACEMENT                     = '#'
    *   WRITE_BOM                       = ' '
    *   TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *   WK1_N_FORMAT                    = ' '
    *   WK1_N_SIZE                      = ' '
    *   WK1_T_FORMAT                    = ' '
    *   WK1_T_SIZE                      = ' '
    * IMPORTING
    *   FILELENGTH                      =
        tables
        data_tab                        = itab
    *   FIELDNAMES                      =
      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                          = 22
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    endif.
    Hope it helps
    Regards
    Mansi

  • How to Refresh "Internal table values" in User EXIT.

    Dear All,
    My requirement is to place some checks in exit ZXQQMU20 in different tabs from the TCODE IW21 . IW22 etc.
    Now after placeing the checks towards the different tabs while doing "NOCO" from IW21 the conditions are fullfilled but
    when i go ahead to modify the created  "NOCO " from the TCODE IW22 by deleting the created values and saving in IW22 , the conditions written in the exit are still satisfied eventhough i have deleted the values in IW22.
    The reason for this is that the tables which are there in the exit ZXQQMU20 T_VIQMFE , T_VIQMUR , T_VIQMMA
    still contains the old values which were there at the time of creation of "NOCO"  in IW21 .
    How to refresh my " internal tables values" used in such that even at the time of modification of the NOCO through IW22 my table values should pick the current screen values and not the values which were there at the time of creation.
    Please help.
    The code i have written in the exit is as below:-
    ********************* Changed vide ******START
    *****IW21  IW22 also added in filter criteria of notification *************
    ******The purpose of this modification is that in the execution of IW21 or IW22 or IW24 or IW25 we have to give a check that if the
    ******notification type is M2 than inside the Transaction screen , if the Breakdown duration comes less than 15 min than there are
    ******no issues but if the breakdown duration is more than 15 min than the mandatory fields needs to be entered in the analysis tab.
    **    The user has to fill up either following mandatory fields in Analysis Data tab.
    **    A. Object Parts & Damages sub tab
    **    Code Group - Object Parts (OTGRP, VIQMFE)
    **                          AND
    **    Code Group - Problem / Damage (FEGRP, VIQMFE)
    **    Or
    **    Notification Item Short Text (FETXT, VIQMFE)
    **   B. Cause sub tab
    **    Code Group # Causes (URGRP, VIQMUR)
    **    Or
    **    Cause Text (URTXT, VIQMUR)
    **   C. Action Taken sub tab
    **    Code Group # Activities (MNGRP, VIQMMA)
    **    Or
    **    Activity Text (MATXT, VIQMMA)
    **            Then, allow user to complete notification (NOCO).
    CLEAR : L_VAR , L_COMP_TIME.
    IF ( SY-TCODE EQ 'IW21' OR SY-TCODE EQ 'IW22' OR SY-TCODE EQ 'IW24' OR
          SY-TCODE EQ 'IW25' ).
       IF ( E_VIQMEL-IWERK = '061' ) OR ( E_VIQMEL-IWERK = '062' ).
         IF E_VIQMEL-QMART = 'M2'.
           L_VAR = E_VIQMEL-AUSZT.
           L_COMP_TIME = L_VAR / 60.
           IF L_COMP_TIME < 15.
             EXIT.
           ELSEIF L_COMP_TIME > 15..
    *         IF ( T_VIQMFE-OTGRP IS INITIAL AND T_VIQMFE-FEGRP IS INITIAL )  OR  ( T_VIQMFE-FETXT IS INITIAL ) .
    *           MESSAGE 'Please fill the mandatory analysis data in Object Parts' TYPE 'E'.
    *         ENDIF.
             IF T_VIQMFE-OTGRP EQ '' OR T_VIQMFE-FEGRP EQ ''.
               IF T_VIQMFE-FETXT EQ ''.
                 MESSAGE 'Please fill the mandatory analysis data in Object Parts' TYPE 'E'.
               ENDIF.
             ENDIF.
             CLEAR L_TAG.
             IF T_VIQMUR[] IS INITIAL.
               MESSAGE 'Please fill the mandatory analysis data in Cause tab' TYPE 'E'.
             ELSE.
               LOOP AT T_VIQMUR.
                 IF  T_VIQMUR-URGRP IS INITIAL .
                   IF T_VIQMUR-URTXT IS INITIAL.
                     L_TAG = 'X'.
                   ENDIF.
                 ENDIF.
               ENDLOOP.
               IF L_TAG = 'X'.
                 MESSAGE 'Please fill the mandatory analysis data in Cause tab' TYPE 'E'.
               ENDIF.
             ENDIF.
             CLEAR L_TAG.
             IF T_VIQMMA[] IS INITIAL.
               MESSAGE 'Please fill the mandatory analysis data in Action' TYPE 'E'.
             ELSE.
               LOOP AT T_VIQMMA.
                 IF  T_VIQMMA-MNGRP IS INITIAL .
                   IF T_VIQMMA-MATXT IS INITIAL.
                     L_TAG = 'X'.
                   ENDIF.
                 ENDIF.
               ENDLOOP.
               IF L_TAG = 'X'.
                 MESSAGE 'Please fill the mandatory analysis data in Action' TYPE 'E'.
               ENDIF.
             ENDIF.
           ENDIF.
         ENDIF.
       ENDIF.
    ENDIF.
    <Added code tags>
    Thank you so much in advance..
    -Sudhish
    Please use the code tags when you're posting any code snippet
    Edited by: Suhas Saha on Jul 13, 2011 12:39 PM

    Hi, I was thinking just like XVBAP and YVBAP values in the USEREXIT_SAVE_DOCUMENT.
    Plz check u have x /y versions or tables like _old/ _new suffixes and then move the value accordingly.
    otherwise there may be inconsistency.
    Edited by: Prasenjit S. Bist on Jul 13, 2011 3:03 PM

  • Refresh internal table records in web dynpro

    Hi Guru's
    I am facing an issue in web dynpro abap.
    in my application there is a button called OPEN.
    when i click on open button internal table records should be refreshed.
    so i have written code like this
    DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
      lo_COMPONENTCONTROLLER =   wd_this->get_componentcontroller_ctr( ).
      lo_componentcontroller->clear_info_refresh_visible( ).
    but iam getting an error message Method "CLEAR_INFO_REFRESH_VISIBLE" is unknown or PROTECTED or PRIVATE
    Could you please help me to how do i activate and refresh the things.
    Thanks
    Rajue

    wd.rajue wrote:
    Hi Guru's
    >
    > I am facing an issue in web dynpro abap.
    > in my application there is a button called OPEN.
    > when i click on open button internal table records should be refreshed.
    > so i have written code like this
    >
    > DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
    >
    >   lo_COMPONENTCONTROLLER =   wd_this->get_componentcontroller_ctr( ).
    >
    >   lo_componentcontroller->clear_info_refresh_visible( ).
    >
    >
    >
    > but iam getting an error message Method "CLEAR_INFO_REFRESH_VISIBLE" is unknown or PROTECTED or PRIVATE
    >
    >
    > Could you please help me to how do i activate and refresh the things.
    >
    > Thanks
    > Rajue
    Raju,
    Please clarify this.
    Do you have a method clear_info_refresh_visible  in your component controller. I think not.
    I am not able to relate your request and coding.
    You can simply clear the internal table like this
    clear lt_intern_tab[].
    If it is a context node then you can bind a empty table to the node to make it empty.
      lo_nd_data->bind_table(
         new_items            =   lt_intern_tab
         set_initial_elements = abap_true ).

  • RFC - delay in internal table update/refresh

    Hello,
    We have an RFC call. The end of the function call returns an internal table with new rows appended to it.However, when we check at the invoking code, i could see that it takes a while for the newly appended rows to be refreshed in the internal table. In order to avoid this, i have introduced a 'Wait upto' statement. However, this is proving to be a performance overhead. Can you please suggest if there is any other alternative to achieve this?
    Thanks and regards,
    Deepthi.

    Hi,
    If you are using nested loops, the better way to use the internal table, is always use READ statement. When you use read statement, you will be mentioning all the key fields like READ table itab with key f1 = k1.....
    a) So first see in all your internal tables while comparing entries are you mentioning all the key fields in the read statements.
    b) While you compare data between 2 internal tables inside a loop. Always check whether entries exist in both the tables, like if the values are initial for a particular internal table.
    c) check sy-subrc = 0 for all the entries and internal tables.
    d) try using continue inside your loop .... endloop.
    Because, if there is no entry in the top level internal table, you can immediately give a continue statement there, so that system shall not check all the internal tables. It will exit from the current loop entry and the checking shall immediately start for the next table index.
    This shall drastically reduce your processing time logic.
    Lakshminarayanan
    P.S. Mark all helpful answers for points

  • Simple command to refresh data of all declared internal tables & variables!

    Hi All,
    I have declared many internal tables & variables in my program in declaration include.
    Is there any Simple command which can refresh data of all declared internal tables & variables!
    Instead of clearing & refreshing each i.table & variable i want to use single command to refresh data.
    Is this possible!
    Thanks in advance.
    Thanks,
    Deep.

    CLEAR: lv_field1,
                 lv_field2,
                 lt_itab1[],
                 lt_itab2[].
    ONE simple command (CLEAR), can initialize fields, workareas, field-symbols,.... and internal tables.

  • Refresh ALV ( Internal Table Will Be Change)

    Hi friends
    I am using 2 internal table. And they have their own field catalog. I can refresh alv grid.
    If my refresh data have stuation 1 I am using Inta another stuation I am using Intb.
    How can I refresh my ALV grid with different catalog and internal table?

    Hi,
    yes you can do that,
    Check this sample code, in your case you have to use two performs for display. with the help of SELFIELD-EXIT = 'X'. you can get what you want.
    REPORT  ZTEST_ALV.
    type-pools:slis.
    DATA: GT_SFLIGHT TYPE TABLE OF SFLIGHT.
    DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          FIELDCAT type SLIS_FIELDCAT_ALV.
    data: l_layout type SLIS_LAYOUT_ALV.
    SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        I_PROGRAM_NAME         = sy-repid
        I_STRUCTURE_NAME       = 'SFLIGHT'
        I_INCLNAME             = sy-repid
      CHANGING
        CT_FIELDCAT            = gt_fieldcat
      EXCEPTIONS
        INCONSISTENT_INTERFACE = 1
        PROGRAM_ERROR          = 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.
    perform alv_display.
    *&      Form  status
    *       text
    form status USING P_EXTAB TYPE SLIS_T_EXTAB  .
      set pf-status 'AAA' excluding p_extab.
    endform.                    "status
    *&      Form  USER_COMMAND
    *       text
    *      -->P_UCOMM    text
    *      -->P_SELFIELD text
    FORM USER_COMMAND USING    P_UCOMM    LIKE SY-UCOMM
          P_SELFIELD TYPE SLIS_SELFIELD.
      case p_ucomm.
        when 'TEST'.
            fieldcat-no_out = 'X'.
            modify gt_fieldcat from fieldcat
                   transporting no_out where fieldname = 'PRICE'.
    p_selfield-exit = 'X'.
    perform alv_display.
    endcase.
    ENDFORM.                    "USER_COMMAND
    *&      Form  alv_display
    *       text
    FORM alv_display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        IS_LAYOUT                = l_layout
        I_CALLBACK_PROGRAM       = sy-repid
        I_STRUCTURE_NAME         = 'SFLIGHT'
        I_CALLBACK_PF_STATUS_SET = 'STATUS'
        I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
        IT_FIELDCAT              = GT_FIELDCAT[]
      TABLES
        T_OUTTAB                 = GT_SFLIGHT.
    ENDFORM.                    " alv_display
    Regards
    vijay

  • ALV grid refresh while fcat and internal table change

    Hi,
       I am displaying an ALV output using OOPS ALV grid. It is displaying data from internal table t1.
    Later I am changing fieldcat table content and I want to display with internal table t2. how can I do this.
    It is not refreshing the fieldcat values in the ALV.
    Which method I should call to refresh the ALV.
    Thanks and regards,
    Venkat.

    hi,
    to refresh the alv display.
    you can use the method refresh_table_display
    of the class cl_gui_alv_grid.
    regards.

  • Regarding Exporting and Importing internal table

    Hello Experts,
    I have two programs:
    1) Main program: It create batch jobs through open_job,submit and close job.Giving sub program as SUBMIT.
    I am using Export IT to memory id 'MID' to export internal table data to sap memory in the subprogram.
    The data will be processed in the subprogram and exporting data to sap memory.I need this data in the main program(And using import to get the data,but it is not working).
    Importing IT1 from memory id 'MID' to import the table data in the main program after completing the job(SUBMIT SUBPROGRAM AND RETURN).
    Importing is not getting data to internal table.
    Can you please suggest something to solve this issue.
    Thank you.
    Regards,
    Anand.

    Hi,
    This is the code i am using.
    DO g_f_packets TIMES.
    * Start Immediately
           IF NOT p_imm IS INITIAL .
             g_flg_start = 'X'.
           ENDIF.
           g_f_jobname = 'KZDO_INHERIT'.
           g_f_jobno = g_f_jobno + '001'.
           CONCATENATE g_f_jobname g_f_strtdate g_f_jobno INTO g_f_jobname
                                                  SEPARATED BY '_'.
           CONDENSE g_f_jobname NO-GAPS.
           p_psize1 = p_psize1 + p_psize.
           p_psize2 = p_psize1 - p_psize + 1.
           IF p_psize2 IS INITIAL.
             p_psize2  = 1.
           ENDIF.
           g_f_spname = 'MID'.
           g_f_spid = g_f_spid + '001'.
           CONDENSE g_f_spid NO-GAPS.
           CONCATENATE g_f_spname  g_f_spid INTO g_f_spname.
           CONDENSE g_f_spname NO-GAPS.
    * ... (1) Job creating...
           CALL FUNCTION 'JOB_OPEN'
             EXPORTING
               jobname          = g_f_jobname
             IMPORTING
               jobcount         = g_f_jobcount
             EXCEPTIONS
               cant_create_job  = 1
               invalid_job_data = 2
               jobname_missing  = 3
               OTHERS           = 4.
           IF sy-subrc <> 0.
             MESSAGE e469(9j) WITH g_f_jobname.
           ENDIF.
    * (2)Report start under job name
           SUBMIT (g_c_prog_kzdo)
                  WITH p_lgreg EQ p_lgreg
                  WITH s_grvsy IN s_grvsy
                  WITH s_prvsy IN s_prvsy
                  WITH s_prdat IN s_prdat
                  WITH s_datab IN s_datab
                  WITH p1      EQ p1
                  WITH p3      EQ p3
                  WITH p4      EQ p4
                  WITH p_mailid EQ g_f_mailid
                  WITH p_psize EQ p_psize
                  WITH p_psize1 EQ p_psize1
                  WITH p_psize2 EQ p_psize2
                  WITH spid     EQ g_f_spid
                  TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                  VIA JOB g_f_jobname NUMBER g_f_jobcount AND RETURN.
    *(3)Job closed when starts Immediately
           IF NOT p_imm IS INITIAL.
             IF sy-index LE g_f_nojob.
               CALL FUNCTION 'JOB_CLOSE'
                 EXPORTING
                   jobcount             = g_f_jobcount
                   jobname              = g_f_jobname
                   strtimmed            = g_flg_start
                 EXCEPTIONS
                   cant_start_immediate = 1
                   invalid_startdate    = 2
                   jobname_missing      = 3
                   job_close_failed     = 4
                   job_nosteps          = 5
                   job_notex            = 6
                   lock_failed          = 7
                   OTHERS               = 8.
               gs_jobsts-jobcount = g_f_jobcount.
               gs_jobsts-jobname  = g_f_jobname.
               gs_jobsts-spname   = g_f_spname.
               APPEND gs_jobsts to gt_jobsts.
             ELSEIF sy-index GT g_f_nojob.
               CLEAR g_f_flg.
               DO.                         " Wiating untill any job completion
                 LOOP AT gt_jobsts into gs_jobsts.
                   CLEAR g_f_status.
                   CALL FUNCTION 'BP_JOB_STATUS_GET'
                     EXPORTING
                       JOBCOUNT                         = gs_jobsts-jobcount
                       JOBNAME                          = gs_jobsts-jobname
                    IMPORTING
                       STATUS                           = g_f_status
    *            HAS_CHILD                        =
    *          EXCEPTIONS
    *            JOB_DOESNT_EXIST                 = 1
    *            UNKNOWN_ERROR                    = 2
    *            PARENT_CHILD_INCONSISTENCY       = 3
    *            OTHERS                           = 4
                   g_f_mid = gs_jobsts-spname.
                   IF g_f_status = 'F'.
                     IMPORT gt_final FROM MEMORY ID g_f_mid .
                     FREE MEMORY ID gs_jobsts-spname.
                     APPEND LINES OF gt_final to gt_final1.
                     REFRESH gt_prlist.
                     CALL FUNCTION 'JOB_CLOSE'
                       EXPORTING
                         jobcount             = g_f_jobcount
                         jobname              = g_f_jobname
                         strtimmed            = g_flg_start
                       EXCEPTIONS
                         cant_start_immediate = 1
                         invalid_startdate    = 2
                         jobname_missing      = 3
                         job_close_failed     = 4
                         job_nosteps          = 5
                         job_notex            = 6
                         lock_failed          = 7
                         OTHERS               = 8.
                     IF sy-subrc = 0.
                       g_f_flg = 'X'.
                       gs_jobsts1-jobcount = g_f_jobcount.
                       gs_jobsts1-jobname  = g_f_jobname.
                       gs_jobsts1-spname   = g_f_spname.
                       APPEND gs_jobsts1 TO gt_jobsts.
                       DELETE TABLE gt_jobsts FROM gs_jobsts.
                       EXIT.
                     ENDIF.
                   ENDIF.
                 ENDLOOP.
                 IF g_f_flg = 'X'.
                   CLEAR g_f_flg.
                   EXIT.
                 ENDIF.
               ENDDO.
             ENDIF.
           ENDIF.
           IF sy-subrc <> 0.
             MESSAGE e539(scpr) WITH g_f_jobname.
           ENDIF.
           COMMIT WORK .
         ENDDO.

  • How to upload a file in application server to an internal table

    Hi,
          I am asked to upload a file from application server to internal table. Can you please suggest me the ways to do it or the function module which helps to browse the application server file names.
      I have done a program. But its giving problem in searching the files from application server. I am pasting my code for ur review. Please tell me which part i have to correct or suggest me some other ways to do it.
    *& Report  ZUPLOAD1
    REPORT  ZUPLOAD1.
    type-pools: truxs.
    parameters: p_upl_ps radiobutton group g1 default 'X', "upload from pres. server
                 p_path type rlgrap-filename, 
                 p_upl_as radiobutton group g1,   "upload from appln server
                 <b>p_dir LIKE filepath-pathintern DEFAULT 'Y_ABAP', 
                 p_file LIKE filepath-pathintern lower case,</b>      
                 p_test as checkbox.
    constants: c_x value 'X',
               c_tab type c value cl_abap_char_utilities=>horizontal_tab.
    types: ty_data(1000) type c.    "structure to hold legacy data
    data: i_data type standard table of ty_data. "internal table of ty_data
    types: begin of stritab,
          land1 type v_t604-land1,  "structure of legacy file.
          stawn type v_t604-stawn,
          bemeh type v_t604-bemeh,
          impma type v_t604-impma,
          minol type v_t604-minol,
          end of stritab.
    data: gi_itab type standard table of stritab, "internal table of legacy file
          gw_itab type stritab.  "work area
    data: i_raw type truxs_t_text_data,
          v_fullpath type string.
    at selection-screen on value-request for p_path.
    if p_upl_ps = c_x. "if presentation server is selected
    perform get_file.
    else.            "if application server is selected
    perform set_file_path.      
    perform upload_from_server.
    perform split_data.
    endif.
    form get_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = p_path.     "getting the file name of pres server
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
      EXPORTING
      I_FIELD_SEPERATOR          =
        I_LINE_HEADER              = 'X'              "converting excel to sap and filling in
        I_TAB_RAW_DATA             = i_raw      "internal table
        I_FILENAME                 = p_path
      TABLES
        I_TAB_CONVERTED_DATA       = gi_itab
    EXCEPTIONS
       CONVERSION_FAILED          = 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.
    endform.
    form set_file_path.                 "Getting the file path of application server
    data: lv_file type p_file.
          lv_file = p_file.
          CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
            EXPORTING
            CLIENT                           = SY-MANDT
              LOGICAL_PATH                     = p_dir
            OPERATING_SYSTEM                 = SY-OPSYS
            PARAMETER_1                      = ' '
            PARAMETER_2                      = ' '
            PARAMETER_3                      = ' '
            USE_BUFFER                       = ' '
              FILE_NAME                        = lv_file
            USE_PRESENTATION_SERVER          = ' '
            ELEMINATE_BLANKS                 = 'X'
           IMPORTING
             FILE_NAME_WITH_PATH              = v_fullpath
           EXCEPTIONS
             PATH_NOT_FOUND                   = 1
             MISSING_PARAMETER                = 2
             OPERATING_SYSTEM_NOT_FOUND       = 3
             FILE_SYSTEM_NOT_FOUND            = 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.
    endform.
    form upload_from_server.
    data: lv_msg type string,
          lw_data type ty_data.
    open dataset v_fullpath for input message lv_msg in text mode encoding default.
    if sy-subrc <> 0.
    message lv_msg type 'i'.
    stop.
    endif.
    do.
    read dataset v_fullpath into lw_data.
    if sy-subrc <> 0.
    write:/5 'Error in processign data set'.
    exit.
    endif.
    append lw_data to i_data.
    enddo.
    close dataset v_fullpath.
    if sy-subrc <> 0.
    write: /5 'Error closing dataset'.
    endif.
    endform.
    form split_data.
    data: lw_data type ty_data.
    data: lw_itab type stritab.
    data: begin of ty_itab,
          land1 type v_t604-land1,
          stawn type v_t604-stawn,
          bemeh type v_t604-bemeh,
          impma type v_t604-impma,
          minol type v_t604-minol,
          end of ty_itab.
    loop at i_data into lw_data.
    split lw_data at c_tab into
          ty_itab-land1
          ty_itab-stawn
          ty_itab-bemeh
          ty_itab-impma
          ty_itab-minol.
    lw_itab-land1 = ty_itab-land1.
    lw_itab-stawn = ty_itab-stawn.
    lw_itab-bemeh = ty_itab-bemeh.
    lw_itab-impma = ty_itab-impma.
    lw_itab-minol = ty_itab-minol.
    append lw_itab to gi_itab.
    endloop.
    endform.
    start-of-selection.
    loop at gi_itab into gw_itab.
    write: /5 'COUNTRY', 'IMPORT CODE', 'SUP UNIT', 'FIRST UOM', 'SECOND UOM',
           /5 gw_itab-land1, gw_itab-stawn,gw_itab-bemeh,gw_itab-impma,gw_itab-minol.
    endloop.
    end-of-selection.
    I hope problem must be in p_dir and p_file which are in bold.. Kindly help me out. Thanks in advance.

    see the following ex:
    *&      Form  SUB_GET_FILEPATH
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_GET_FILEPATH .
        GFILE = 'D:\SAP_INT\INBOUND\INBOX'.  "Path
    ENDFORM.                    " SUB_GET_FILEPATH
    *&      Form  SUB_GET_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_GET_FILE .
      DATA: P_FDIR(200) TYPE C.
      DATA: IT_FILEDIR1 TYPE STANDARD TABLE OF TY_FILEDIR WITH HEADER LINE.
      P_FDIR = GFILE.
      CALL FUNCTION 'RZL_READ_DIR_LOCAL'
        EXPORTING
          NAME     = P_FDIR
        TABLES
          FILE_TBL = IT_FILEDIR.
      REFRESH : IT_FILEDIR1.
      LOOP AT IT_FILEDIR.
        IF IT_FILEDIR-NAME(4) = 'ZINC' OR IT_FILEDIR-NAME(4) = 'zinc'.
          MOVE IT_FILEDIR-NAME TO IT_FILEDIR1-NAME.
          APPEND IT_FILEDIR1.
        ENDIF.
      ENDLOOP.
      IF IT_FILEDIR1[] IS INITIAL.
        STOP.
      ENDIF.
      LOOP AT IT_FILEDIR1.
        REFRESH: I_TAB.
        CLEAR: I_TAB.
        NAME = IT_FILEDIR1-NAME.
        CONCATENATE: GFILE '\' NAME INTO G_FILE.
        OPEN DATASET G_FILE FOR INPUT IN TEXT MODE
                                         ENCODING DEFAULT
                                         IGNORING CONVERSION ERRORS.
        IF SY-SUBRC EQ 0.
          CONCATENATE 'FILENAME  : ' G_FILE INTO I_MSG1.
          APPEND I_MSG1.
          DO.
            READ DATASET G_FILE INTO RECORD.
            IF SY-SUBRC = 0.
              SPLIT RECORD AT ',' INTO I_TAB-BUKRS  I_TAB-EBELN
                  I_TAB-BLDAT  I_TAB-XBLNR I_TAB-LIFNR I_TAB-AMOUNT
                  I_TAB-CURR  I_TAB-BUSAREA
                  I_TAB-BKTXT I_TAB-DMBTR I_TAB-MENGE I_TAB-SRNO.
              MOVE-CORRESPONDING I_TAB TO I_TAB1.
            ELSE.
              EXIT.
            ENDIF.
            APPEND I_TAB1.
            CLEAR: I_TAB, I_TAB1.
          ENDDO.
        ENDIF.
        CLOSE DATASET G_FILE.

  • Can not insert or update [TABLE] from internal table in method

    I've faced a problem with OO abap. I've tried to insert into [ TABLE ] from internal table, but i've got error msg after i compiled.
    "An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""
    After  i changed to loop in work area and INSERT INTO  [TABLE] VALUES gw_data., everything is fine, can compile and run.
    This is error code.
      METHOD set_data_to_table.
        REFRESH gi_data.
        CLEAR gi_data.
        IF gi_file[] IS NOT INITIAL.
    * Set data for modify table
          LOOP AT gi_file INTO gw_file.
            MOVE-CORRESPONDING gw_file TO gw_data.
            me->conversion_input( EXPORTING im_vendor = gw_data-vendor
                                  CHANGING  ch_vendor = gw_data-vendor ).
            APPEND gw_data TO gi_data.
          ENDLOOP.
          INSERT [TABLE] FROM TABLE gi_data.
    *      LOOP AT gi_data INTO gw_data.
    *        INSERT INTO  [TABLE] VALUES gw_data.
    *        IF sy-subrc = 0.
    *          COMMIT WORK.
    *        ELSE.
    *          ROLLBACK WORK.
    *        ENDIF.
    *      ENDLOOP.
        ELSE.
          MESSAGE 'No data found' TYPE 'I'.
        ENDIF.
      ENDMETHOD.                    "set_data_to_table

    Hi Matthew,
    I think there is no difference in database insert between OO and non-OO.
    The correct syntax according to ECC600 online documentation is
    [Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]
    To insert several lines into a database table, use the following:
    INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].
    This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.
    Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.
    I think the syntax
    INSERT my_dbtable FROM TABLE gi_data.
    should work, your suggestion may lead to syntax error.
    Regards,
    Clemens

  • Update internal table data from table control

    Hi GURUS,
    I need help regarding one of my requirement.
    I need to display data from the internal table on the screen and when the user selects a record/multiple records from screen and clicks on approve button i need to update one of the field from N to Y in the corresponding Ztable. Once the record is updated from Ztable , that should no longer be visible for the user on the screen.
    I am using table control wizard to display data. I am able to update the Ztable, but that record is not refreshing from the user screen. Any suggestions would be approved.
    Also please let me know if table control is the best way to do this/ alv grid control??

    hi
       REFRESH CONTROL Control-Name FROM SCREEN '0100'  -> use this command to refresh the table control
    to know more, read into
    https://forums.sdn.sap.com/click.jspa?searchID=2934287&messageID=673474
    Re: URGENT HELP REQ IN TABLE CONTROL WIZARD
    if helpful, reward
    Sathish. R

  • Internal table in OO

    I have a requirement to create and implement Badi.
    The following is code:
    method IF_EX_NOTIF_EVENT_SAVE~CHANGE_DATA_AT_SAVE.
    DATA: l_progname TYPE sy-repid,
          l_dynnum TYPE sy-dynnr.
    types: BEGIN of itab.
    INCLUDE dynpread.
    types: END of itab.
    data: dynpread_tab like table of itab.
    l_progname = sy-repid.
    l_dynnum = sy-dynnr.
    CLEAR dynpread_tab.
    REFRESH dynpread_tab.
    dynpread_tab-fieldname = 'ZZACNUM'.
    APPEND dynpread_tab.
    CALL FUNCTION 'DYNP_VALUES_READ'
      EXPORTING
        DYNAME                               = l_progname
        DYNUMB                               = l_dynnum
      TRANSLATE_TO_UPPER                   = ' '
      REQUEST                              = ' '
      PERFORM_CONVERSION_EXITS             = ' '
      PERFORM_INPUT_CONVERSION             = ' '
      DETERMINE_LOOP_INDEX                 = ' '
      START_SEARCH_IN_CURRENT_SCREEN       = ' '
      START_SEARCH_IN_MAIN_SCREEN          = ' '
      START_SEARCH_IN_STACKED_SCREEN       = ' '
      START_SEARCH_ON_SCR_STACKPOS         = ' '
      SEARCH_OWN_SUBSCREENS_FIRST          = ' '
      SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
      TABLES
        DYNPFIELDS                           = dynpread_tab
    EXCEPTIONS
      INVALID_ABAPWORKAREA                 = 1
      INVALID_DYNPROFIELD                  = 2
      INVALID_DYNPRONAME                   = 3
      INVALID_DYNPRONUMMER                 = 4
      INVALID_REQUEST                      = 5
      NO_FIELDDESCRIPTION                  = 6
      INVALID_PARAMETER                    = 7
      UNDEFIND_ERROR                       = 8
      DOUBLE_CONVERSION                    = 9
      STEPL_NOT_FOUND                      = 10
      OTHERS                               = 11
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF sy-subrc = 0.
      LOOP AT dynpread_tab.
      ENDLOOP.
    ENDIF.
    endmethod.
    It is giving me error: INCLUDE report "DYNPREAD" not found.
    Any idea?
    Thanks in advance.

    Hi
    U should remember the internal table is without header line:
    DATA: l_progname TYPE sy-repid,
              l_dynnum TYPE sy-dynnr.
    *types: BEGIN of itab.
    *INCLUDE dynpread.
    *types: END of itab.
    *data: dynpread_tab like table of itab.
    DATA: dynpread_tab TYPE TABLE OF DYNPREAD.
    DATA: dynpread_wa TYPE DYNPREAD.
    *dynpread_tab-fieldname = 'ZZACNUM'.
    *APPEND dynpread_tab.
    dynpread_wa-fieldname = 'ZZACNUM'.
    APPEND dynpread_wa to dynpread_tab.
    CALL FUNCTION 'DYNP_VALUES_READ'
    IF SY-SUBRC = 0.
    * LOOP AT dynpread_tab.
    *ENDLOOP.
    LOOP AT dynpread_tab into .
    ENDLOOP.

  • Internal table in OO method

    Hi,
    I am new to ABAP Objects, and I am trying to implement a Business Add-Inn. I have created a new method, where I define an internal table and then use a function to read data and store it.
    The problem is, the function ends correctly, and while debugging I can see that the internal table (i_1001) has data. But after the exception check, the program jumps the LOOP instruction and goes directly to the next instruction. What can the problem be?
    I am writing the code in case it helps:
    DATA :    d_evento TYPE HRTEM_INTEZW-eveid,
              d_fecha TYPE HRTEM_INTEZW-adate,
              d_linea_1001 TYPE p1001,
              d_tipo_evento TYPE objec-objid,
              t_l_objeto TYPE STANDARD TABLE OF HROBJECT INITIAL SIZE 1,
              t_objeto TYPE HROBJECT.
    TYPES :   i_tabla_1001 TYPE STANDARD TABLE OF P1001 INITIAL SIZE 0.
    DATA:     i_1001 TYPE i_tabla_1001.
    Inicialización de variables locales.
    CLEAR :   d_linea , d_num_lineas , d_evento, d_fecha , d_linea_1001, d_tipo_evento.
    REFRESH : i_1001 .  CLEAR : i_1001.
    break-point.
    Se busca el tipo de evento al que está vinculado el evento, para
    obtener la tipología del evento (que hereda del tipo evento).
    REFRESH t_l_objeto.
    CLEAR t_objeto.
    t_objeto-plvar = '01'.
    t_objeto-otype = 'E'.
    t_objeto-objid = me->evento.
    APPEND t_objeto TO t_l_objeto.
    CALL FUNCTION 'RH_READ_INFTY'
         EXPORTING
            AUTHORITY                  = 'DISP'
            WITH_STRU_AUTH             = 'X'
            INFTY                      = '1001'
            ISTAT                      = '1'
            BEGDA                      = d_fecha
            ENDDA                      = '99991231'
         TABLES
            INNNN                      = i_1001
            OBJECTS                    = t_l_objeto
         EXCEPTIONS
            ALL_INFTY_WITH_SUBTY       = 1
            NOTHING_FOUND              = 2
            NO_OBJECTS                 = 3
            WRONG_CONDITION            = 4
            WRONG_PARAMETERS           = 5
            OTHERS                     = 6
    IF SY-SUBRC <> 0.
       CASE SY-SUBRC.
            WHEN '1'.
                MESSAGE 'Infotipos con subtipo especificado al leer inf1001'
                         TYPE 'E'.
            WHEN '2'.
                MESSAGE 'No hay datos para la selección del inf 1001'
                         TYPE 'E'.
            WHEN '3'.
                MESSAGE 'La tabla de objetos está vacía al leer el inf 1001'
                        TYPE 'E'.
            WHEN '4'.
                MESSAGE 'Condición errónea el leer el inf 1001' TYPE 'E'.
            WHEN '5'.
                MESSAGE 'Parámetros erróneos el leer el inf 1001' TYPE 'E'.
            WHEN OTHERS.
                MESSAGE 'Error al leer el inf 1001' TYPE 'E'.
       ENDCASE.
    ENDIF.
    LOOP AT i_1001 INTO d_linea_1001 WHERE  RSIGN = 'A' AND RELAT = '20' .
       d_tipo_evento = d_linea_1001-sobid.
       CLEAR d_linea_1001.
    ENDLOOP.
    me->tipo_evento = d_tipo_evento.
    REFRESH t_l_objeto.
    It jumps from the IF control of exceptions to the   last instruction (REFRESH t_l_objeto). sy-subrc gets the value 4 while it jumps.
    Any idea about what can the problem be?
    Thanks in advance.
    Nerea.

    Hi,
    In ur code, just try the following in the loop..endloop.
    LOOP AT i_1001 INTO d_linea_1001.
    d_tipo_evento = d_linea_1001-sobid.
    CLEAR d_linea_1001.
    ENDLOOP.
    me->tipo_evento = d_tipo_evento.
    Now, if the loop block works and subrc value is zero, the problem is with the WHERE condition in your loop statement.
    Try and revert back.
    Reward if helpful.
    Regards

Maybe you are looking for

  • Not able to open pdf file ( smart form from webdynpro )

    Dear friends, while trying to download pdf file from webdynpro i am getting the following error ( pls check the screen shot and also my  code ) could any one please let me know what's the issue Thanks Vijaya data    v_bin_filesize           TYPE i,  

  • Is there an option or app to enable a "touch indicator"?

    Hi all, I am looking for a way to visualize the touch gestures on my iphone. But I can't find any option or app to enable such a feature. Any help/idea would be greatly appreciated. Thanks.

  • What's wrong with the HTML Editor?

    When editing the HTML of my project, when I put the cursor into position the text at that point partially disappears - notice the 'd' in 'bold' above. It's also slow and generally just difficult to use because the text gets so messed up when you edit

  • Cairngorm close and background disable

    So after trying to write a custom class for TitleWindow popups for two weeks, I just couldn't invest any more time in getting them to work. So as an alternative I am using Cairngorm popup 1.7. Everything involving creating the popup works great, but

  • EVDRE Format Range More than one Criteria

    I have found a problem when combining two Criterias in the Format Range Criteria section: CATEGORY.ID="FORECAST" AND ACCOUNT.CALC="Y" I expext a formatting as when ACCOUNT is a calculated member and the CATEGORY is forecast, then do a special formatt