Skip to Content
author's profile photo Former Member
Former Member

Help on Modify.

Hi friends,

i am updating the following internal table XE1EDPT2.

this is having the following fields,

posex

posnr

tdid

tsspras

tdline

tdformat.

already its having one record,

now in my program i want to add some more records to it,

even if i give Append, the first record got over written,

how to add more records to this with out over writting the already existing records ?

Thanks & Regards,

Joseph.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jun 13, 2006 at 10:52 AM

    Hi Joseph,

    can you show your code?

    Looks like you are extending an idoc.

    check this link to know more.

    http://help.sap.com/saphelp_erp2005/helpdata/en/dc/6b7d6243d711d1893e0000e8323c4f/frameset.htm

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 13, 2006 at 10:55 AM

    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.

    If a line is found, the contents of the non-key fields of the work area are copied into the corresponding fields of the line, and SY-SUBRC is set to 0. Otherwise, SY-SUBRC is set to 4. If the table has a non-unique key and the system finds duplicate entries, it changes the first entry.

    You can specify the non-key fields that you want to assign to the table line in the TRANSPORTING addition. You can also specify a field <f i > dynamically as the contents of a field <n i > in the form (<n i >). If <n i > is empty when the statement is executed, it is ignored. You can restrict the search to partial fields by specifying offset and length.

    For tables with a complex line structure, the usage of the transporting option results in better performance, if the system must not transport unnecessary table-like components.

    Changing Several Lines Using a Condition

    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.

    The work area <wa>, which must be compatible with the line type of the internal table, contains the new contents, which will be assigned to the relevant table line using the TRANSPORTING addition. Unlike the above MODIFY statement, the TRANSPORTING addition is not optional here. Furthermore, you can only modify the key fields of the internal table if it is a standard table. If at least one line is changed, the system sets SY-SUBRC to 0, otherwise to 4.

    regards

    vinod

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 13, 2006 at 11:02 AM

    Hi,

    You can use:

    MODIFY itab [FROM wa] TRANSPORTING f1 ... fn WHERE cond.

    Ex:

    DATA: BEGIN OF TAB OCCURS 500,

    FLAG TYPE C,

    COMP(20) TYPE C,

    END OF TAB.

    CLEAR TAB-FLAG.

    MODIFY TAB TRANSPORTING FLAG WHERE FLAG = 'X'.

    When you use the WHERE condition with a STANDARD or HASHED table, a full table scan is always required.

    If you are working with a SORTED TABLE, the partial sequential processing can be optimized so that only the entries that actually satisfy the WHERE condition are processed. This optimization requires that each sub-condition is linked with AND; that no parentheses are used; that at least one sub-condition is in the form k = v; and that the conditions in the form k1 = v1 ... kn = vn cover at least the first part of the table key.

    If you use the TRANSPORTING addition together with an explicitly-specified work area, the work area must be compatible with the line type of the internal table.

    The counter for table entries begins at 1.

    A unique or summarized dataset built up using an internal table and COLLECT can be modified while you are constructing it using the "MODIFY ... TRANSPORTING ..." statement, as long as the components selected with TRANSPORTING are not contained in the key of the internal table. This method does not cause significant performance impairment.

    <b>Reward if helpful.</b>

    Regards,

    Shakuntala

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 13, 2006 at 11:06 AM

    When you are appending ,

    Give the same values for the folowing fields.

    posex

    posnr

    tdid

    tsspras

    tdformat.

    GIve the additional text in the tdline field.

    Regards,

    ravi

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.