How to append  row in internal table for perticular condition

Hi,
I have 4 records in my internal table and i want to append row
after second row when condition will match.
please guide me.
thanks in advancs
regards
SND

hi,
using key word INDEX u can insert a record in aspecified position as
if internal table is with header line.
INSERT <internaltable> index SY_INDEX [or index no if u  know where to insert]
with out header line.
INSERT <internaltable> FROM <workarea> index SY_INDEX [or index no if u  know where to insert]
if condition is true.
insert itab index 2.
endif.
if helpful reward some points.
with regards,
Suresh.A

Similar Messages

  • To count number of records in an internal table for a condition

    Hello All,
            I want to count number of records in an internal table for a condition.
    For e.g. -- I have one internal table IT which having fields F1, F2, F3, F4, F5.
                     Now, I want number of records in itnternal table IT where F1 = 'ABC'.
    Is it possible to do..?? If yes, then how.??
    Thanks in advance...!!
    Regards,
    Poonam.

    Hi,
    If you mean an internal table, there are a few ways to do this.
    1 One would be to loop over the table with a WHERE clause and increment a counter.
    data: lv_counter type i.
    clear lv_counter.
    loop at itab where fld1 = 'ABC'.
    lv_counter = lv_counter + 1.
    endloop.
    lv_counter now has the number of rows per the condiction.
    2  Well, you may want to try this as well, and compare to the LOOP way. Not sure what kind of overhead you may get doing this way. Here ITAB is our main internal table, and ITAB_TMP is a copy of it. Again I think there may be some overhead in doing the copy. Next, delete out all records which are the reverse of your condition. Then whatever is left is the rows that you want to count. Then simply do a LINES operator on the internal table, passing the number of lines to LV_COUNT.
    data: itab type table of ttab.
    data: itab_tmp type table of ttab.
    itab_tmp[] = itab[].
    delete table itab_tmp where fld1  'ABC'.
    lv_count = lines( itab_tmp ).
    Thanks & Regards,
    ShreeMohan

  • Number of entries in the internal table for perticular field value

    hi All,
    Is this possible to get the count of records from the internal table for a perticular field value.
    currently my requirement is to get the entries from the internal table which does not have two records for perticular field value (say a = 123) whose status is active (say b = 'X').
    also suggets should use LOOP or DELETE or DESCRIBE for a internal table to ful fill this requirement.
    Thanks in advance.
    Pradeep

    Try like this..
    Create another table itab2 with same structure as itab1 & move the contents of itab1 to itab2
    ITAB2[] = ITAB1[].
    Then delete entries from itab2
    Delete itab2 whete a = '123' and b = 'X'
    Then use Describe statement to get the no of entries
    Describe table itab2 lines v_lines.
    Hope this helps...

  • How to convert rows of internal table to columns of another internal table?

    Hi,
    Experts,
    test_data.xls:
    one two three four five
    one two three four
    one two three
    one two
    one
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        FILENAME                      = 'c:/test_data.xls'
        I_BEGIN_COL                   = '1'
        I_BEGIN_ROW                   = '1'
        I_END_COL                     = '10'
        I_END_ROW                     = '10'
      TABLES
        INTERN                        = it_tab
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 2
       OTHERS                        = 3
    output:
    0001 0001 one
    0001 0002 two
    0001 0003 three
    0001 0004 four
    0001 0005 five
    0002 0001 one
    0002 0002 two
    0002 0003 three
    0002 0004 four
    0003 0001 one
    0003 0002 two
    0003 0003 three
    0004 0001 one
    0004 0002 two
    0005 0001 one
    but i want this format:
      one two three four five
    one two three four
    one two three
    one two
    one
    i don't want this type of output display i want to display in ABAP report as in file format how can i achieve this post some ideas on it.
    Thank U,
    Shabeer ahmed.

    Hi,
    Use this piece of code :
    parameters:  p_flname type rlgrap-filename.
      data:
             li_filecontent  type standard table of alsmex_tabline ,
             lwa_filecontent type  alsmex_tabline ,
             lv_begin_col    type i value 1,
             lv_begin_row    type i value 1,
             lv_end_col      type i value 17,
             lv_end_row      type i value 65000,
             li_fieldlist    type lvc_t_fcat,
             li_data         type ref to data,
             dy_line         type ref to data.
      field-symbols:<dyntable> type standard table,
                    <fs_data> type ref to data,
                    <fs_1>,
                    <dyn_wa>,
                    <dyn_field>.
    *Transfer excel file contents to internal table
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        exporting
          filename                = p_flname
          i_begin_col             = lv_begin_col
          i_begin_row             = lv_begin_row
          i_end_col               = lv_end_col
          i_end_row               = lv_end_row
        tables
          intern                  = li_filecontent
        exceptions
          inconsistent_parameters = 1
          upload_ole              = 2
          error_message           = 3
          others                  = 4.
      if sy-subrc = 0.
    *Creating the list of fields in the table
        perform f_create_tab_field tables li_fieldlist using 'BUKRS'      4 .
        perform f_create_tab_field tables li_fieldlist using 'ZPOC_KUNNR' 10 .
        perform f_create_tab_field tables li_fieldlist using 'RANL'       13.
        perform f_create_tab_field tables li_fieldlist using 'ZPEDAT'     10 .
        perform f_create_tab_field tables li_fieldlist using 'KWERT'      15 .
        perform f_create_tab_field tables li_fieldlist using 'BONUS'      2 .
        perform f_create_tab_field tables li_fieldlist using 'WAERS'      5 .
        perform f_create_tab_field tables li_fieldlist using 'ZVAL'       15 .
        perform f_create_tab_field tables li_fieldlist using 'ZQTY'       15 .
        perform f_create_tab_field tables li_fieldlist using 'KMEIN'      3 .
        assign li_data to <fs_data>.
    *CREATING INTERNAL TABLE TO store data
        call method cl_alv_table_create=>create_dynamic_table
          exporting
            it_fieldcatalog           = li_fieldlist
          importing
            ep_table                  = <fs_data>
          exceptions
            generate_subpool_dir_full = 1
            others                    = 2.
        if sy-subrc = 0.
          assign <fs_data>->* to <fs_1>.
          assign <fs_1> to <dyntable>.
    Create dynamic work area and assign to FS
          create data dy_line like line of <dyntable>.   " creating a line type of the table just created above
          assign dy_line->* to <dyn_wa>.                 " creating the work area with reference to the line type
          loop at li_filecontent into lwa_filecontent.
            assign component  lwa_filecontent-col     "accessing corresponding field in the field catalog
                of structure <dyn_wa> to <dyn_field>. "and assigning this field to a field symbol
            if sy-subrc = 0.
              <dyn_field> = lwa_filecontent-value.     " filling value for this field
            endif.
            at end of row.
              append  <dyn_wa> to <dyntable>.
              clear <dyn_wa>.
            endat.
            clear lwa_filecontent.
          endloop.
          i_input_file[] =  <dyntable>.
        endif.
      elseif sy-subrc <> 0.
        message s027 display like c_error with text-001.
        stop.
      endif.
    form f_create_tab_field  tables   p_li_fieldlist structure lvc_s_fcat
                         using    p_fname
                                  p_lenght.
      data:lwa_fieldlist   type lvc_s_fcat.
      lwa_fieldlist-fieldname = p_fname.
      lwa_fieldlist-intlen = p_lenght.
      append lwa_fieldlist to  p_li_fieldlist.
      clear lwa_fieldlist.
    endform.                    " F_CREATE_TAB_FIELD
    Regards,
    Dev.

  • No. of Rows in Internal Table for Particular Record

    Hi all,
        I'm having an Internal Table with the Following Datas,
    Date                Value
    12.03.2008        8
    13.03.2008        7
    13.03.2008        4
    14.03.2008        5
    14.03.2008        6
    I want to find out how many records are there for the Paricular Date.And i have to add those values.The Result should be
    Date                Value
    12.03.2008        8
    13.03.2008        11
    14.03.2008        11
    In that Internal Table,Date is not the Key Field.So we cant go for Collect Statement.
    Regards,
    Padmam.

    hi,
    pls check this code . in this code i ristic the multiple entries in a single day for Diesel Consumed Diesel add in genset.
    follow the code and apply in your program ............
    sort it by swerk idate equnr ascending vlcod descending recdv ascending . "cntrr ascending.
    loop at it.
      at new idate.
       check = it-idate.
       flag = 0.
      endat.
    or
    send the whole code.............
    reward point if helpful...........
    regards,
    pankaj
      on change of it-equnr.
        flag = 0.
      endon.
      if check = it-idate.
          if it-vlcod = 'OPEN' and flag = 0.
            it2 = it.
            append it2.
            flag = 1.
            count = count + 1.
         elseif flag = 0 and count = 0.
           count = 1.
          elseif it-vlcod = 'CLOS'.
           if flag = 0 and count = 0.
             count = 1.
           endif.
            it2-vlcod_cl = it-vlcod.
            it2-itime_cl = it-itime.
            it2-recdv_cl = it-recdv.
            if count = 0.
            else.
              modify it2 index count transporting vlcod_cl itime_cl recdv_cl.
            endif.
         elseif it-vlcod = ''.
           it2 = it.
           append it2.
           count = count + 1.
          elseif it-atinn = '0000000151'.  " Diesel Consumed
             it2-di_con = it-recdv.
             it2-sum_con = it2-sum_con + it2-di_con.
             if count = 0.
            else.
               modify it2 index count transporting di_con sum_con.
            endif.
            modify it2 index count transporting di_con sum_con.
          elseif it-atinn = '0000000152'.  " Diesel added
             it2-di_add = it-recdv.
             it2-sum_add = it2-sum_add + it2-di_add.
            if count = 0.
            else.
                 modify it2  index count transporting di_add sum_add.
            endif.
            modify it2  index count transporting di_add sum_add.
          endif.
      endif.
    endloop.
    clear it.
    clear it[].
    it[] = it2[].

  • How to create internal table for a structure in BSP

    hi ,
    I have created a Structure in BSP.I want to create an internal table for that Structure. But in my coding ie.
    <% data: begin of itab_1 .
                     include type zuvendstr.
                     data:end of itab_1.
                     data wa_str like line of itab_1.
                     loop at itab_1 into wa_str. %>
                    <tr>
                     <td><%=wa_str-name%> </td>
                           <%endloop.%>
    In this zuvendstr is Structure ,wa_str is workarea and itab_1 is an Internal table.But it is showinng an error that itab_1 is unknown.But we cannot define internal tables for an Structure in Page Attributes.So,please resolve how to create internal table for Structure in BSPS

    Hi,
    You can define itab_1 like this (assuming zuvendstr is a structure type):
    DATA: itab_1 TYPE TABLE OF zuvendstr.
    Regards,
    Tanguy

  • How to Read the internal table for the data download from the spool

    HI all,
    I have one issue regarding the spool ,we are getting the correct output as per requirement of  user but when we send the same to the user in pdf format they did notget the same.
    they are telling that the due date is missing from the pdf.
    Please advice me how to track the internal  table for the spool data converted intopdf in a readable format.
    the FM used for the above task is : 
    call function 'CONVERT_OTFSPOOLJOB_2_PDF'
    Please reply if any one worked on the same.
    Thanks in advance.
    Gaurav,

    Hi Wang,
    Please let me know how you solved your question.
    Points will be rewarded.
    Thanks,
    Arun.

  • How to create an dynamic internal table with the structure of a ddic table

    Hi all,
    I want to fill ddic-tables (which I already created) in my abap dictionary with data out of CSV-files (which are located on the CRM-Server).  The ddic tables have different amount of fields.
    I started with creating a table which contains the name of the tables and the path to the matching CSV-file.
    At the beginning I'm filling an internal table with part of this data (the name of the ddic-tables) - after that I am looping at this internal table.
    LOOP AT lt_struc ASSIGNING <lfs_struc>.
         LOOP AT lv_itab1 INTO lv_wa1 WHERE ztab_name = <lfs_struc>.
         lv_feld = lv_wa1-zdat_name.
        ENDLOOP.
        CONCATENATE 'C:\-tmp\Exportierte Tabellen\' lv_feld INTO lv_pfad.
        Do.
        OPEN DATASET lv_pfad FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
        READ DATASET lv_pfad INTO lv_rec.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        enddo.
        REPLACE ALL OCCURRENCES OF '"' IN lv_rec WITH ''.
        SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
        INSERT into (<lfs_struc>) values lr_str_value.
        CLOSE DATASET lv_pfad.
    endloop.
    This is not the whole code, but it's working until
    SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
    I want to split all the data of lv_rec into an internal table which has the structure of the current ddic-table, but I didn't find out how to do give the internal table the structure of the ddic-table. In the code I used an internal tyble type string but I should be the structure of the matching tabel.
    If I try to create an internal table by using a fiel symbol, I am told, that the data types are not matching.
    Has anyone an idea?

    Hi Mayari,
    though you were successfull with
    METHOD cl_alv_table_create=>create_dynamic_table
    I must warn you not to use it. The reason is that the number of tables created is limited, the method uses GENERATE SUBROUTINE statement and this triggers an unwanted database commit.
    If you know the DDIC structure, it is (starting with ECC6.0) much easier:
    field-symbols:
      <table> type standard table.
    data:
      lr_data type ref to data.
    Create data lr_data type table of (<DDIC structure>).
    assign lr_data->* to <table>.
    The split code can be simplified gaining speed loosing complexity not loosing functionality.
    field-symbols:<fs_s> type any.
    field-symbols:<fs_t> type any.
    SPLIT lv_rec AT ';' INTO table it_string.
    loop at it_string assigning <fs_s>.
      assign component sy-tabix of wa_string to <fs_t>.
    if sy-subrc = 0.
      <fs_t> = <fs_s>.
    endif.
    at last.
      append <fs_itwa3> to <ft_itab3>.
    endat.
    endloop.
    Though it may work as Keshav.T suggested, there is no need to do that way.     
    Regards,
    Clemens

  • Grouping of two rows of internal table

    Hi all,
    I am having a requirement in which I want to group two rows of an internal table and assign a pointer to the two rows.
    This pointer variable will then be passed to ALV.
    Help reqd.
    regards.

    Hi Gaurav,
    Hope the below code helps:
    TYPES :BEGIN OF TY_ITAB2,
    DATA(400),
    END OF TY_ITAB2.
    DATA: ITAB3 TYPE TY_ITAB2 OCCURS 0 WITH HEADER LINE
    Loop at itab1.
    ITAB3-DATA = ITAB1-LABEL.
    APPEND ITAB3.
    ITAB3-DATA = ITAB1-MATNR.
    APPEND ITAB3.
    endloop.
                        or
    You can create a deep internal table. You can declare one Column as an internal table and store the NOTES in that Internal table for each row.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
    you can check the example in the link
    Kindly Reward Points If You Find The Reply Helpful.
    Cheers,
    Chaitanya.

  • Append data to internal table

    i m calling one FM inside the loop, this FM will return data in internal table. for each loop count i want to save this data to same other internal table, how to do that?
    i want to append the one internal tables data to another internal table how to do that?
    Thanks

    Hi Lucky,
                  Refer this code :
    LOOP AT I_TAB1.
      CALL FUNCTION <FUNCTION NAME>
          EXPORTING
          IMPORTING
          TABLES = I_TAB2.
      APEEND LINES OF I_TAB2 to I_TAB3.
      REFRESH I_TAB2.
    ENDLOOP.
    REWARD POINTS IF HELPFUL.
    Regards,
    Hemant

  • Determine Number of  rows in Internal Table

    Hi,
      I have defined my internal table as follows:
         TYPES : BEGIN OF ABC_KEY,
                  FIELD1(2)   TYPE C,
                  FIELD2(1)   TYPE C,
                  FIELD3(8)   TYPE N,
                  END OF ABC_KEY.
    DATA: itab1 TYPE TABLE OF ABC_KEY
                      WITH KEY FIELD1,
           wa_lines_1 LIKE LINE OF itab1.
    How can I retrieve the number of rows in Internal Table?
    Thanks.
    Regards,
    bw_newbie

    You can define the number of rows of the internal table using the DESCRIBE itab command .
    As the rest have already stated a sample code snippet .
    For more info type in DESCRIBE in your prgram and click on (F1) by placing the cursor on DESCRIBE .
    You will find more options as to how you can use the DESCRIBE command according to your requirement .
    Thanks ,
    Hari

  • Edit Internal Table for Sales Order Smartform (Y640_SDORC_A)

    I want to modify SmartForm Y640_SDORC_A so I always print the net value and discount percentage.
    I have an access sequence and my discount can be created by a discount percentage condition (ZD00) or by Special Price (PR01) condition.
    My problem is that if I use the Special Price Condition the Internal Table where the smartform loops to get the price only gets the Net Value amount, and it wont print the discount percentage, but if I dont use the Special Price condition the internal value has 2 rows the first one is for Discount Condition and the second for Net Value and it prints correctly.
    This is how my access secuence is arranged, the X are the print id column:
    PR00 Price
    ZD00 Discount      (X)
    PR01 Special Price
    --- Net Value    (X)
    How can I fix the internal table creation so when there is a Special Price Condition (PR01) the internal table also gets the Discount percentage value.
    Here is my Forms Code:
    *&      Form  GET_ITM_PRICE_TABLE
    FORM get_itm_price_table
    USING
    is_vbdpa             TYPE vbdpa
    is_vbdka             TYPE vbdka
    iv_price_print_mode  TYPE c
    iv_spras             TYPE spras
    CHANGING
    ct_komv              TYPE t_komv_tab
    ct_komvd             TYPE t_komvd_tab
    cs_komk              TYPE komk.
      DATA ls_komp TYPE komp.
      DATA ls_komk TYPE komk.
    *  DATA lt_tkomv  TYPE STANDARD TABLE OF komv.
      IF ls_komk-knumv NE is_vbdka-knumv OR
      ls_komk-knumv IS INITIAL.
        CLEAR ls_komk.
        ls_komk-mandt = sy-mandt.
        ls_komk-kalsm = is_vbdka-kalsm.
        ls_komk-kappl = 'V'.
        ls_komk-waerk = is_vbdka-waerk.
        ls_komk-knumv = is_vbdka-knumv.
        ls_komk-knuma = is_vbdka-knuma.
        ls_komk-vbtyp = is_vbdka-vbtyp.
        ls_komk-land1 = is_vbdka-land1.
        ls_komk-vkorg = is_vbdka-vkorg.
        ls_komk-vtweg = is_vbdka-vtweg.
        ls_komk-spart = is_vbdka-spart.
        ls_komk-bukrs = is_vbdka-bukrs_vf.
        ls_komk-hwaer = is_vbdka-waers.
        ls_komk-prsdt = is_vbdka-erdat.
        ls_komk-kurst = is_vbdka-kurst.
        ls_komk-kurrf = is_vbdka-kurrf.
        ls_komk-kurrf_dat = is_vbdka-kurrf_dat.
      ENDIF.
      ls_komp-kposn = is_vbdpa-posnr.
      ls_komp-kursk = is_vbdpa-kursk.
      ls_komp-kursk_dat = is_vbdpa-kursk_dat.
      IF is_vbdka-vbtyp CA 'HKNOT6'.
        IF is_vbdpa-shkzg CA ' A'.
          ls_komp-shkzg = 'X'.
        ENDIF.
      ELSE.
        IF is_vbdpa-shkzg CA 'BX'.
          ls_komp-shkzg = 'X'.
        ENDIF.
      ENDIF.
      IF iv_price_print_mode EQ 'A'.
        CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
          EXPORTING
            comm_head_i = ls_komk
            comm_item_i = ls_komp
            language    = iv_spras
          IMPORTING
            comm_head_e = ls_komk
            comm_item_e = ls_komp
          TABLES
            tkomv       = ct_komv
            tkomvd      = ct_komvd.
      ELSE.
        CALL FUNCTION 'RV_PRICE_PRINT_ITEM_BUFFER'
          EXPORTING
            comm_head_i = ls_komk
            comm_item_i = ls_komp
            language    = iv_spras
          IMPORTING
            comm_head_e = ls_komk
            comm_item_e = ls_komp
          TABLES
            tkomv       = ct_komv
            tkomvd      = ct_komvd.
      ENDIF.
      cs_komk = ls_komk.
    ENDFORM.                    "get_itm_price_table
    Regards,
    Carlos

    Turns out this can be done modifiying access sequence.
    Carlos

  • How to create dynamic nested internal table

    Hi Experts,
    Pleae tell me or give sample code, how to create dynamic nested internal table ?
    I have seen threads saying creation of dynamic internal tables using some table structure only. But now the requirement is to create dynamic nested internal table.
    For example the internal table contains two fields viz., one is field1 of dynamic internal table and other is normal field2 and values as shown below:
    Nested internal table:
    field1                     |     field2 ...
    <table content1>     |     value2..
    <table content1>     |     value2..
    Here the [table content] should also a dynamic internal table.
    Let me know if you need any other info.
    regards
    Saravanan R

    see the complete code..i am currently working in ECC6.0 EHP4. just check which version you are using..
    REPORT  yst_test_000.
    DATA:
          lt_comptab         TYPE cl_abap_structdescr=>component_table,
          ls_comp            LIKE LINE OF lt_comptab,
          lref_newstr        TYPE REF TO cl_abap_structdescr,
          lref_tab_type      TYPE REF TO cl_abap_tabledescr,
          lt_fcat            TYPE lvc_t_fcat,
          ls_fcat            TYPE lvc_s_fcat,
          ls_dd03p           TYPE dd03p,
          lt_data            type ref to data.
    field-symbols: <fs_table> type standard table.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
        i_structure_name       = 'SCARR'
      CHANGING
        ct_fieldcat            = lt_fcat
      EXCEPTIONS
        inconsistent_interface = 1
        program_error          = 2
        OTHERS                 = 3.
    IF sy-subrc NE 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    LOOP AT lt_fcat INTO ls_fcat.
      IF ls_fcat-ref_table IS NOT INITIAL.
        CLEAR ls_dd03p.
        CALL FUNCTION 'BUS_DDFIELD_GET'
          EXPORTING
            i_tabnm         = ls_fcat-ref_table
            i_fldnm         = ls_fcat-fieldname
          IMPORTING
            e_dd03p         = ls_dd03p
          EXCEPTIONS
            field_not_found = 1
            OTHERS          = 2.
        IF sy-subrc EQ 0.
          ls_comp-name = ls_fcat-fieldname.
          ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_dd03p-rollname ).
          APPEND ls_comp TO lt_comptab.
          CLEAR ls_comp.
        ENDIF.
      ELSE.
        ls_comp-name = ls_fcat-fieldname.
        ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_fcat-rollname ).
        APPEND ls_comp TO lt_comptab.
        CLEAR ls_comp.
      ENDIF.
    ENDLOOP.
    *Now for the Field which you want deep table then you can do like this
    ls_fcat-fieldname  = 'NESTED_TABLE'.
    ls_fcat-inttype    = 'C'.
    ls_fcat-intlen     = '000006'.
    ls_fcat-rollname   = 'SFLIGHT_TAB1'. "For SFLIGHT
    APPEND ls_fcat TO lt_fcat.
    ls_comp-name = ls_fcat-fieldname.
    ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_fcat-rollname ).
    APPEND ls_comp TO lt_comptab.
    CLEAR ls_comp.
    lref_newstr = cl_abap_structdescr=>create( lt_comptab ).
    lref_tab_type = cl_abap_tabledescr=>create( lref_newstr ).
    create data lt_data type handle lref_tab_type.
    assign lt_data->* to <fs_table>.
    break-point.
    Edited by: Vijay Babu Dudla on Apr 28, 2009 8:05 AM

  • *How can we use the internal table in module pool programming? Clarify plz*

    If we creating a screen using the table having four fields(for e.g.). The screen has the functions of display, modify, delete, save, exit etc for the fields. The front-end of the screen having I/O fields of the table using internal table. How can we declare the internal table in the screen?

    HI,
    Create one WA for your Internal table and then map it to your fields.
    For Example,
    Data : begin of wa,
              name(10),
              age type i,
               end of wa.
    data : it like table of wa with header line.
    Then in screen create input fields with the name, age and ***.
    Then the user entered values are stored in name age and ***.
    then you can manipulate with that values using wa.
    Thanks.

  • Urgent - Append data to internal table from Application server

    Hi All,
    I encountered the problem while read the input file from Application server...then append it to internal table. I manage to read the input file from presentation and append the data to internal table.
    Below are my coding which cause me not able the append data from Application server. Please kindly help me to solving/correct my coding. Thanks in advance .
    PARAMETERS : p_inpfl LIKE rlgrap-filename.  "Material Input File
    SELECTION-SCREEN BEGIN OF LINE.
    Application Server
    SELECTION-SCREEN COMMENT 1(19) text-002 FOR FIELD rb_ux.
    SELECTION-SCREEN POSITION 33.
    PARAMETERS: rb_ux RADIOBUTTON GROUP g1.
    Presentation Server
    SELECTION-SCREEN COMMENT 40(21) text-003 FOR FIELD rb_pc.
    SELECTION-SCREEN POSITION 65.
    PARAMETERS: rb_pc RADIOBUTTON GROUP g1 DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN  SKIP.
    SELECTION-SCREEN END OF BLOCK b01.
    FORM f_Input_file.
      CLEAR: v_f_exists.
      CHECK NOT p_inpfl IS INITIAL.  "input file exist
      IF NOT rb_pc IS INITIAL.  " Pc check
        PERFORM f_read_tab_delimited_file TABLES i_input
                               USING    c_09
                                        p_inpfl
                                        rb_ux
                               CHANGING v_ifile_str_with_tab
                                        v_f_exists
                                        v_ifile_record_count
                                        v_message.
        IF v_f_exists EQ '1' .
      UPLOAD FILE could not be read
          MESSAGE e546 .
        ENDIF .
        IF v_ifile_record_count EQ 0 .
      Zero records in upload file
          MESSAGE e547 .
        ENDIF.
      ELSE.
        OPEN DATASET p_inpfl FOR INPUT IN TEXT MODE.
        DO.
          READ DATASET p_inpfl INTO i_input.
          IF sy-subrc EQ 0.
            APPEND i_input.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
        CLOSE DATASET p_inpfl.
      ENDIF.

    Hi,
    Refere the following code for the poulating internal from the application server.
    PARAMETERS :  pr_sfile TYPE  filename-fileintern,
    Here give the logical file name from the application serevr.
    data :        w_param_1 LIKE  filename-fileintern,
                   x_file(500),
                   w_move_file LIKE  epsf-epsfilnam,
                   w_from_dir  LIKE epsf-epsdirnam,
                   w_path LIKE rlgrap-filename,
                  input_line(1000),
                  w_path LIKE rlgrap-filename,
                  w_file LIKE rlgrap-filename,
                  w_dir LIKE  rlgrap-filename,
                  w_dir1 LIKE epsf-epsdirnam,
                  w_file1 LIKE  epsf-epsfilnam,
    **************Start of the code***************
      MOVE '*' TO w_param_1.
      PERFORM get_file_name USING pr_sfile w_param_1.
        LOOP AT it_file WHERE name CP w_file1.
          CLEAR : x_file, w_path,
                  w_move_file, w_from_dir.
          REFRESH : it_input,
                    it_input_err.
       IF w_flag IS INITIAL.
          CONCATENATE w_dir it_file-name INTO x_file.
          CONDENSE  x_file.
    TO Move file from sever for backup storing the file name and path
          w_path = x_file.
          CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'
            EXPORTING
              full_name     = x_file
            IMPORTING
              stripped_name = w_move_file
              file_path     = w_from_dir
            EXCEPTIONS
              x_error       = 1
              OTHERS        = 2.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    ********here it_input will be the structure of the file present on the application server
          PERFORM read_file TABLES it_input
                            USING  x_file.
          CLEAR it_input_err.
          REFRESH it_input.
        ENDLOOP.
    *******************end of the code****************
    *&      Form  read_file
          text
         -->P_X_FILE  text
    FORM read_file  TABLES it_tab
                    USING  x_file.
      OPEN DATASET x_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE 0.
        WRITE : / text-006.
      ELSE.
        DO.
          READ DATASET x_file INTO input_line.
          IF sy-subrc = 0.
            CLEAR: it_input, count.
            DO.
              ADD 1 TO count.
              ASSIGN COMPONENT count OF STRUCTURE it_tab TO <fs>.
              IF sy-subrc = 0.
                SPLIT input_line AT separator INTO <fs> input_line.
              ELSE.
                EXIT.
              ENDIF.
            ENDDO.
            APPEND it_tab.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
      ENDIF.
      CLOSE DATASET x_file.
    *&      Form  get_file_name
          text
         -->P_P_SFILE  text
         -->P_W_PARAM_1  text
    FORM get_file_name USING    p_sfile
                                w_param_1.
                               CHANGING x_file.
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          client           = sy-mandt
          logical_filename = p_sfile
          parameter_1      = w_param_1
        IMPORTING
          file_name        = x_file
        EXCEPTIONS
          file_not_found   = 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.
      w_path = x_file.
      CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'
        EXPORTING
          full_name     = w_path
        IMPORTING
          stripped_name = w_file
          file_path     = w_dir
        EXCEPTIONS
          x_error       = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      w_dir1 = w_dir.
      w_file1 = w_file.
      CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
        EXPORTING
          dir_name               = w_dir1
          file_mask              = w_file1
        TABLES
          dir_list               = it_file
        EXCEPTIONS
          invalid_eps_subdir     = 1
          sapgparam_failed       = 2
          build_directory_failed = 3
          no_authorization       = 4
          read_directory_failed  = 5
          too_many_read_errors   = 6
          empty_directory_list   = 7
          OTHERS                 = 8.
      IF sy-subrc <> 0.
        WRITE : / text-006.
      ENDIF.
    Hope this will help you.

Maybe you are looking for