Modify internal table embedded in internal table as field

Hi Experts,
I am using function module CRM_DNO_READ_ORDER_TEXT.
One of the output table of this fm is  ET_ALLTEXTS whixh is of structure COMT_TEXT_TEXTDATA_T.
This structure has two fields one is GUI and other is LINES which itself contains the table in it.
I want to delete one row from the data of this LINES table in main table ET_ALLTEXTS .
Actually, this LINES table contains the texts entered by user from some application. So i want to edit the text.
Pls help me..this is very complicated.
thnx
DIvya

I guess Nilesh is right, there is something wrong with your declaration. Me for one, I've tried to reproduce your problem and I don't see any problem here. How did you declare your internal table for example?
When you want to delete a line from table LINES you can't just say:
delete et_alltexts-lines index 1.
Because this will give you the error message with 'table without header line....". Instead you first have to loop at this ET_ALLTEXTS internal table and only then you have access to the individual lines, which is an internal table as well. The following is only an example, but it should be helpful:
DATA: gv_header_guid TYPE crmt_object_guid.
DATA: gt_textdata    TYPE comt_text_textdata_t ,
      gt_alltexts    TYPE comt_text_textdata_t.
FIELD-SYMBOLS: <alltext>     LIKE LINE OF gt_alltexts.
CALL FUNCTION 'CRM_DNO_READ_ORDER_TEXT'
  EXPORTING
    iv_header_guid = gv_header_guid
  IMPORTING
    et_textdata    = gt_textdata
    et_alltexts    = gt_alltexts.
LOOP AT gt_alltexts ASSIGNING <alltext>.
  DELETE <alltext>-lines INDEX 1.
ENDLOOP.

Similar Messages

  • Modify database table from internal table

    Hi All,
    I need to update database table from internal table which is having around 30000 records.
    I am using MODIFY tabname FROM TABLE int_tabname...
    Using this statement, I can modify the databse records very well. But user has some additional requirement.
    He wants that the table should be modified from the internal table and after modification we should have the erroneous records to be displayed if any.
    e.g. if 1500 records out of 30000 are erroneous then only 28500 records should be updated and 1500 records should be displayed as erroneous records so that the user can correct them and use them again for executing the program.
    Is there any FM which imports the database table name and internal table, modifies the database and exports an internal tanle with erroneous records?
    Any help will be appriciated,
    Regards,
    Neha

    Hi
    modifying datbase table useing internal table
    <b>advises</b> before updating this datbase table plz lock that table to avoid incosistency
    write the logic for modifying
    Modify the database table as per new dunning procedure
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    and finally unlock the table
    <b>example</b>
    *To lock table for further operations
      constants: lc_tabname TYPE  rstable-tabname  VALUE 'FKKVKP'  . "FKKVKP
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          tabname        = lc_tabname
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc EQ 0.
      To fetch all the contract accounts for customers of the segment
      Households/SME.
        PERFORM fetch_contract_accounts using lc_tabname .
      ENDIF.                    " IF sy-subrc EQ 0.
    *wrote the logic
    Modify the database table as per new dunning procedure from internal table
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    *unlock the tbale
      CALL FUNCTION 'DEQUEUE_E_TABLE'
       EXPORTING
         TABNAME   =  uc_tabname .
    <b>Reward if usefull</b>

  • How to modify DataBase Table with an internal Table

    Hi, Friends.
    I am coping Data from a Database table to an internal table after modifying data in the internal table I want to modify the db table according to the modification in the internal table. can some one help me out in this way, i am doing this modification in Table Control in Screen programing.
    My Code is as follow.
    MODULE zfsl_stinf_tc_init OUTPUT.
      IF tc_copy IS INITIAL.
        SELECT * INTO CORRESPONDING FIELDS OF TABLE it_zfsl_stinf FROM zfsl_stinf.
        tc_copy = 'X'.
        REFRESH CONTROL 'TC_FOR_ZFSL_STINF' FROM SCREEN '0001'.
      ENDIF.
    ENDMODULE.                 " zfsl_stinf_init  OUTPUT
    *&      Module  zfsl_stinf_tc_move  OUTPUT
          text
    MODULE zfsl_stinf_tc_move OUTPUT.
      MOVE-CORRESPONDING wa_it_zfsl_stinf TO zfsl_stinf.
    ENDMODULE.                 " zfsl_stinf_tc_move  OUTPUT
    *&      Module  STATUS_0001  OUTPUT
          text
    MODULE status_0001 OUTPUT.
      SET PF-STATUS 'ZFSL_SCREEN_1ONLY'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0001  OUTPUT
    *&      Module  zfsl_stinf_tc_modify  INPUT
          text
    MODULE zfsl_stinf_tc_modify INPUT.
      MOVE-CORRESPONDING zfsl_stinf TO wa_it_zfsl_stinf.
      MODIFY it_zfsl_stinf FROM wa_it_zfsl_stinf INDEX tc_for_zfsl_stinf-current_line.
    _*"" here i have the modified internal table  " it_zfsl_stinf "*_
    ENDMODULE.                 " zfsl_stinf_tc_modify  INPUT
    Kind regards,
    Faisal

    Hi
    Here you are modifying your dbtable in module pool programming
    so  better to use work area to modify the database table
    example:
    data: itab type table of zfsl_stinf .
    data: wa_itab type itab.
    select single * from zfsl_stinf INTO itab WHERE <condition>
    (pass your values to wa_itab.)
    modify zfsl_stinf from values of wa_itab.
    Regards
    Srinivasu

  • How to pass the values from internal table to field groups

    hi all,
    how can i pass the internal  table values to field groups?
    already field groups are holding some values.. INSERT STATEMENT IS NOT WORKING as it is ovewriting the existing values..
    Use full answers will be rewared.
    Thanks.
    Moderator message - duplicate post locked
    Edited by: Rob Burbank on Jun 23, 2009 9:51 AM

    Hi,
    You can use INSERT statement to put a work area of an Internal table in Field-group
    and use Extract to get info out of it.
    Hope it helps,
    Raj

  • Delete row from internal table using field symbol.

    Hi friends,
      I created dynamic internal table using field symbol. I want to delete some data using where clause.
    for example. i want to use like,
        DELETE <FS> WHERE KUNNR = WA_KNA1-KUNNR.
    Like the above statment it won't work. How i can use delete with where clause in field symbols.
    Hope any one can help me.
    Thanks and regards
    Srikanth. S

    hi Srikanth,
    I think you have to LOOP through the whole internal table and check each line and decide to delete or not:
    LOOP at <itab> INTO <wa>.
    ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <wa> TO <field>.
    CHECK <field> IS ASSIGNED.
    IF <field> EQ WA_KNA1-KUNNR.
    DELETE ...
    ENDIF.
    UNASSIGN <field>.
    ENDLOOP.
    hope this helps
    ec

  • Internal table to field symbol

    hi all,
    type-pools : abap.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: dy_table type ref to data,
    dy_line type ref to data,
    xfc type lvc_s_fcat,
    ifc type lvc_t_fcat.
    *data : dyn_itab2 type ANY table.
    selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c.
    selection-screen end of block b1.
    start-of-selection.
    BREAK-POINT.
    perform get_structure.
    perform create_dynamic_itab.
    perform get_data.
    PERFORM OUTPUT.
    *perform write_out.
    form get_structure.
    data : idetails type abap_compdescr_tab,
    xdetails type abap_compdescr.
    data : ref_table_des type ref to cl_abap_structdescr.
    Get the structure of the table.
    ref_table_des ?=
    cl_abap_typedescr=>describe_by_name( p_table ).
    idetails = ref_table_des->components.
    *idetails] = ref_table_des->components[.
    loop at idetails into xdetails.
    clear xfc.
    xfc-fieldname = xdetails-name .
    xfc-datatype = xdetails-type_kind.
    xfc-inttype = xdetails-type_kind.
    xfc-intlen = xdetails-length.
    xfc-decimals = xdetails-decimals.
    append xfc to ifc.
    endloop.
    endform.
    form create_dynamic_itab.
    Create dynamic internal table and assign to FS
    call method cl_alv_table_create=>create_dynamic_table
    exporting
    it_fieldcatalog = ifc
    importing
    ep_table = dy_table.
    here i want  to assighn the structure of dy_table to internal atble.
    assign dy_table->* to <dyn_table>.
    Create dynamic work area and assign to FS
    create data dy_line like line of <dyn_table>.
    assign dy_line->* to <dyn_wa>.
    endform.
    form get_data.
    Select Data from table.
    select * into table <dyN_table> UP TO 10 ROWS
    from (p_table).
    endform.
    Write out data from table.
    FORM OUTPUT.
    loop at <dyn_table> into <dyn_wa>.
    do.
    assign component sy-index
    of structure <dyn_wa> to <dyn_field>.
    if sy-subrc = 0.
    exit.
    endif.
    if sy-index = 1.
    write:/ <dyn_field>.
    else.
    write: <dyn_field>.
    endif.
    enddo.
    endloop.
    ENDFORM.
    how can i achieve this one.
    regards
    siva

    Hi,
    Check this Code ...
    LOOP AT <dyn_table> INTO <dyn_wa>.
        DO.
          ASSIGN COMPONENT sy-index
          OF STRUCTURE <dyn_wa> TO <fs_field> .
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.
          IF sy-index = 1.
            WRITE:/ <fs_field>.
          ELSE.
            WRITE: <fs_field>.
          ENDIF.
        ENDDO.
      ENDLOOP.
    For reference check below code
    DATA: it_fieldcat        TYPE lvc_t_fcat                         . " Field catalog
    DATA: wa_fieldcat  LIKE LINE OF it_fieldcat. " Field catalog
    DATA: it_dyn_table      TYPE REF TO data,     " Dynamic table
          it_wa_dyn_table   TYPE REF TO data.     " Dynamic table
    *       Field sysmbols           Begin with <fs>                      *
    FIELD-SYMBOLS:  <fs_dyn_table>       TYPE STANDARD TABLE, " Dynamic tbale
                    <fs_dyn_table_temp>  TYPE ANY           , " Dynamic tbale
                    <fs_field>           TYPE ANY           , " Temp field for data assignment
                    <fs_field_temp>      TYPE ANY           . " Temp field for data assignment
    *       Macro                                                         *
    * Macro Defination
    * Building field catalog using macro defination
    DEFINE m_fieldcat.
      wa_fieldcat-fieldname   = &1.
      wa_fieldcat-scrtext_l   = &2.
      wa_fieldcat-coltext     = &2.
      wa_fieldcat-no_zero     = &3.
      wa_fieldcat-hotspot     = &4.
      wa_fieldcat-outputlen   = &5.
      wa_fieldcat-emphasize   = &6.
    * Appending workarea to internal table
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
    END-OF-DEFINITION.
    *&      Form  f005_prepare_field_catalog
    *       text
    form f005_prepare_field_catalog .
      REFRESH: it_fieldcat.
    * Build the field catalog
      m_fieldcat text-007 text-008 c_blank  c_blank c_30 c_blank.
      m_fieldcat text-009 text-010 c_blank  c_blank c_30 c_blank.
      SORT it_final_temp BY equnr point.
      SORT it_final BY equnr point psort idate.
      w_date1 = so_date-low.
    * Loop to generate grid column at run time
    * Loop - Till the lower date not equal to higer date
      WHILE so_date-high GE w_date1.
    * Changing date into actual date format using edit mask
        WRITE w_date1 TO w_var4 USING EDIT MASK '__-__-____'.
        m_fieldcat w_var4 w_var4 c_flag c_blank c_12 c_blank.
        w_date1 = w_date1 + c_count.
        CLEAR w_var4.
      ENDWHILE.
    *&      Form  f007_create_dynamic_table
    *       text: Create dynamic table
    form f007_create_dynamic_table .
    * Call method to create dynamic internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = it_fieldcat
        IMPORTING
          ep_table                  = it_dyn_table
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      SORT it_final_temp BY equnr point.
      SORT it_final BY equnr point psort idate.
      ASSIGN it_dyn_table->* TO <fs_dyn_table>.
      CREATE DATA it_wa_dyn_table LIKE LINE OF <fs_dyn_table>.
      ASSIGN it_wa_dyn_table->* TO <fs_dyn_table_temp>.
      IF it_final_temp IS NOT INITIAL.
        LOOP AT it_final_temp INTO wa_final_temp.
    * Assign equipment number and it's field data to field symbols (Dynamic table)
    * Assign field name to field symbol
          ASSIGN text-007 TO <fs_field_temp>.
    * Assign component name and it's value to dynamic table
          ASSIGN COMPONENT <fs_field_temp> OF STRUCTURE <fs_dyn_table_temp> TO <fs_field>.
    * Assign equipment number value to field symbol
          <fs_field> = wa_final_temp-equnr.
    * Assign Short Description and it's field data to field symbols (Dynamic table)
    * Assign field name to field symbol
          ASSIGN text-009 TO <fs_field_temp>.
    * Assign component name and it's value to dynamic table
          ASSIGN COMPONENT <fs_field_temp> OF STRUCTURE <fs_dyn_table_temp> TO <fs_field>.
    * Assign short description value to field symbol
          <fs_field> = wa_final_temp-psort.
    * Loop to assign value of run time generated column.
          IF it_final IS NOT INITIAL.
            LOOP AT it_final INTO wa_final WHERE equnr = wa_final_temp-equnr
                                            AND point = wa_final_temp-point.
              w_date1 = wa_final-idate.
              WRITE w_date1 TO w_var4 USING EDIT MASK '__-__-____'.
              ASSIGN w_var4 TO <fs_field_temp>.
              ASSIGN COMPONENT <fs_field_temp> OF STRUCTURE <fs_dyn_table_temp> TO <fs_field>.
              <fs_field> = wa_final-cdiff.
              CLEAR: wa_final, w_var4, w_date1.
            ENDLOOP.
          ENDIF.
          CLEAR: wa_final_temp.
    * Assign field symbol temporary table to final dynamic table
          APPEND <fs_dyn_table_temp> TO <fs_dyn_table>.
          CLEAR: <fs_dyn_table_temp>.
        ENDLOOP.
      ENDIF.
    endform.                    " f007_create_dynamic_table

  • Creating dynamic internal table(Not field symbol table)

    Hi Experts,
    I am facing problem creating Intarnal table
    I have fieldcatalog, I want create dynamic internal table(Not field symbol table).
    I have written----
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
       i_style_table             =
         it_fieldcatalog           = it_fldcat
          it_fieldcatalog           = me->gt_fieldcat
       i_length_in_byte          =
        IMPORTING
          ep_table                  = lt_new_table
       e_style_fname             =
        EXCEPTIONS
         generate_subpool_dir_full = 1
         OTHERS                    = 2.
        ASSIGN lt_new_table->* TO <gt_dyn_repdata>.
        CREATE DATA ls_new_line LIKE LINE OF <gt_dyn_repdata>.
        ASSIGN ls_new_line->* TO <gs_dyn_repdata>.
    above logic creating dynamic field symbol table.... But I want create normal internal table.
    Thanks,
    Rajasekhar

    Hi
    What do you mean?
    It needs to use the field-symbol, this is the price to pay if it wants a dynamic object
    Max

  • Issue in Modifying custom table

    Hi Experts
    Program Y00_MM modifying custom table Y00_IFS074 using internal table.
    we have a sales company code field in table.
    Internal table company code value is 00021345 .
    But in custom table it updated as 21345. It should be 00021345.
    few days back no problem with table updation. Now only i'am getting this issue. There is no changes in Report.
    Kindly help me.

    Hi,
    Please use the below FM for the field BUKRS.
    FM : CONVERSION_EXIT_ALPHA_OUTPUT.
    This FM will add the leading zeros according to the field length.
    Hope this will resolve your problem...

  • How to modify a table?

    hi
    i want to modify a table
    how do i write the command if i want to modify it according to the table's keys ????
    thanks

    Hi,
    To change a single line, use the following statement:
    MODIFY TABLE <itab> FROM <wa> [TRANSPORTING <f1> <f 2> ...].
    The work area <wa>, which must be compatible with the line type of the internal table, plays a double role in this statement. Not only it is used to find the line that you want to change, but it also contains the new contents. The system searches the internal table for the line whose table key corresponds to the key fields in <wa>.
    The system searches for the relevant lines as follows:
    Standard tables
    Linear search, where the runtime is in linear relation to the number of table entries. The first entry found is changed.
    Sorted tables
    Binary search, where the runtime is in logarithmic relation to the number of table entries. The first entry found is changed.
    Hashed tables
    The entry is found using the hash algorithm of the internal table. The runtime is independent of the number of table entries.
    To change one or more lines using a condition, use the following statement:
    MODIFY <itab> FROM <wa> TRANSPORTING <f1> <f 2> ... WHERE <cond>.
    This processes all of the lines that meet the logical condition <cond>. The logical condition can consist of more than one comparison. In each comparison, the first operand must be a component of the line structure. If the table lines are not structured, the first operand can also be the expression TABLE LINE. The comparison then applies to the entire line.
    Regards,
    Swapna.

  • Problem in modifying a table through modify statement

    Hi,
    I am trying to update a 'Z' table in which there are 5 fields comprising of primary key. Out of them 2 key fields are defined as a part of seconadry index with 'Unique' option selected.
    As per the requirement, I am trying to update the table using modify statement so whenever this statement occurs it will check the primary keys and accordingly try to modify a record or insert a new record.
    But as there is Unique Index defined on 2 of the key fields the Modify query is

    Hi,
    Your syntax for MODIFY is not correct.
    As other friends suggested you can have index and you can modify the internal table.
    Whenever we are modifying internal table inside LOOP, we can omit index as system will take current row by default. So MODIFY statement should be written as follows:
    MODIFY T_ITPO5 from W_ITPO5 transporting AUFNR
    You can LOOP FROM INDEX also for the same to improve performance.
    data: wv_index like sy-tabix.
    sort T_ITPO5 by aufnr.
    sort T_ITPO4 by aufnr.
    wv_index = 1.
    LOOP AT T_ITPO5 INTO W_ITPO5.
         LOOP AT T_ITPO4 INTO W_ITPO4 from wv_index.
         if W_ITPO4-aufnr eq W_ITPO5-aufnr.
              IF ITPO4-NTGEW 0 .
                  CALL FUNCTION 'ZGET_ITEM_WEIGHT'
                    EXPORTING
                       P_BUID = W_ITPO4-WERKS
                       P_ITEMID = W_ITPO4-MATNR
                       P_QTY = 1
                       P_UOM = W_ITPO4-MEINS
                       P_UOM1 = 'KG'
                   IMPORTING
                      P_RETVAL = W_ITPO4-WTKG.
    TOTWT1 = W_ITPO4-WTKG * W_ITPO4-MENGE.
    IF W_ITPO4-BWART = '261'.
    W_ITPO5-I_QTY = W_ITPO5-I_QTY + TOTWT1.
    ELSEIF W_ITPO4-BWART = '101' OR W_ITPO4-BWART = '531'.
    W_ITPO5-I_QTY = W_ITPO5-I_QTY - TOTWT1.
    ENDIF.                    " IF W_ITPO4-BWART = '261'.
    endif.
    elseif W_ITPO4-aufnr gt W_ITPO5-aufnr.
       move sy-tabix to wv_index.
       exit.
    endif.                      " if W_ITPO4-aufnr eq W_ITPO5-aufnr.
    ENDLOOP.
    MODIFY T_ITPO5 FROM W_ITPO5 transporting aufnr.
    ENDLOOP.

  • Updating a view after modifying a table...

    Hello,
    Here is the scenario.
    I have a a table in HANA with 50+ columns of data.  I have created both Attribute and Analytical views of that data.  These views have been activated and deployed.  Now I need to modify my table to add two new columns that I will want to included in my existing Attribute and Analytical views.  How can I accomplish this?  It seems that when I modify my table, the views in HANA studio do not have the ability to be updated.  It seems I have to re-create my voews from scratch to now include my two new columns.  Hopefully I am missing something simple.
    Thanks in advance!

    Hi Matt, no way you need to recreate your views after a DDL change on the underlying tables.
    When the table structure changes, you usually need to close any information view editors on the model in question and then reopen the model for editing after the change, but otherwise should be fine. I have done this many times.
    What revision are you working on? Can you give the exact sequence of steps?
    Regards,
    Justin

  • How to modify  a table without  setting system to modifiable

    Hi All
    Is there a way to modify a table without setting the system to modifiable either in SCC4 or SE06.
    We locked SCC4 in our system , however one tables are not able to modify.
    table name YAUTM
    Is there a way to bypass this?
    Edited by: Shou Woon Wee on Jan 11, 2008 3:09 AM

    Hi Shou......
    if it gives you a message....."the client is not modifiable"/ ALIAS "table not modifiable"  ...then from a security perspective....you cant, and you might not want to bypass it!
    SCC4 settings are meant to be for that!  Contact your Basis team for this.
    The only way to bypass this is thru ....sending changes through a transport request.
    Curiosity: what environment are you trying this out ? cant be sandbox or DEV!
    Regards
    Abhishek

  • How to modify a table column name

    Hi all,
    How to modify a table column name...
    Thanks

    could type the command here... but will not do that..because you are supposed to read the docs.
    You can find the command here..
    http://www.faqs.org/docs/ppbook/r22871.htm
    Regards,
    G.

  • Another User Modified the table

    Hi,
    I have a user defined form, which is bound to Master-Data UDO.
    I have matrices in the form which is bound to its child objects.
    Following problem happens once in a while:
    When I press update button, I get the error message 'Another User Modified the table'.
    This is not consistent, but happens once in a while.
    My SBO version is 2007.
    In what situations you will get the error - "Another User Modified the table" ?
    Please help me with this.
    I'll appreciate your help.
    Thanks.
    -Geetha

    Hi Mahendra,
    Thanks for your reply.
    In my case, I take back-up of the database from client site and bringing into our in-house.
    If clients complained about record# 25, then the same record# has the 'Another user' issue in in-house also. (By record# I mean the Master UDO DocEntry#).
    So, I think the locking is stored in the database, rather than in a PC specific place.
    Please tell me any ideas you get in this angle.
    Regards,
    Geetha

  • Transaction to modify a table

    Hi,
    What is the transaction to modify a table  (oracle) ?
    Thanks in advance

    Dear Jean,
    Sometime,Changes to the Table data without analyzing its data dependency may lead to Data Inconsistency. So, be careful.
    Changes to the production system always require comprehensible documentation.
    If you are changing your Table Data using SE16N, the accompanying changes are logged as well as the responsible users are logged. The data changes are stored in the table SE16N_CD_DATA. And The responsible user is listed in the table SE16N_CD_KEY, together with the modification date and time.
    Regards,
    Bhavik G. Shroff

  • How to modify the table control?

    Hi all,
    How to modify the table control after setting the lines  = 1. ie tbl_ctr-lines = 1.(tbl_ctr is the table control).
    Can anyone explain this with an example?
    Thanks.

    hi
    http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac5e35c111d1829f0000e829fbfe/content.htm
    Regards
    pavan

Maybe you are looking for