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

MODIFY TABLE <itab> FROM <wa> [TRANSPORTING <f1> <f 2> ...].

Hi Freinds,

I know about Modify Table, but what is Transporting and what is the need of this Transporting, Can any Expain me the concept and give simple program using Transport

Thanks and Regards

Srini

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 24, 2008 at 05:14 AM

    Hi,

    ... TRANSPORTING comp1 comp2 ...

    Effect

    The TRANSPORTING addition has the effect that only the specified comp1 comp2 ... components of the work area are assigned to the corresponding components of the line(s) to be changed. For sorted tables and hashed tables, no table key components may be specified after TRANSPORTING.

    The comp1 comp2 ... component specifications are made in accordance with the rules specified in Component specification, with the constraint that after TRANSPORTING, no attributes of classes can be addressed using the object component selector.

    Example.

    
    PARAMETERS p_carrid TYPE scarr-carrid. 
    
    DATA scarr_tab TYPE SORTED TABLE OF scarr 
                   WITH UNIQUE KEY carrid. 
    
    DATA: idx      TYPE sy-tabix, 
          scarr_wa TYPE scarr. 
    
    SELECT * 
           FROM scarr 
           INTO TABLE scarr_tab. 
    
    READ TABLE scarr_tab 
         WITH TABLE KEY carrid   = p_carrid 
         TRANSPORTING NO FIELDS. 
    
    idx = sy-tabix. 
    
    scarr_wa-currcode = 'EUR'. 
    
    MODIFY scarr_tab INDEX idx FROM scarr_wa 
           TRANSPORTING currcode. 
    
    

    ... itab FROM wa TRANSPORTING comp1 comp2 ... WHERE log_exp.

    Effect

    With these additions the MODIFY statement assigns the content of the comp1 comp2 ... components of the wa work area specified after TRANSPORTING to all lines in the itab table that meet the logical condition log_exp. The wa work area must be compatible with the line type of the internal table.

    The TRANSPORTING addition has the same effect as changing individual lines. The WHERE addition can only be specified together with the TRANSPORTING addition. After WHERE, any logical expression can be specified in which the first operand of each individual comparison is a component of the internal table. All logical expressions are therefore possible, with the exception of IS ASSIGNED, , and IS SUPPLIED. It is not possible to dynamically specify a component using bracketed character-type data objects.

    Note

    While for standard tables all lines in the internal table are checked for the logical expression of the WHERE addition, optimized access can be achieved for sorted tables and (as of Release 7.0) hashed tables by checking at least an initial part of the table key, in the case of sorted tables, or the entire table key, in the case of hashed tables, for AND-linked equality queries in the logical expression. The optimization also works if the logical expression contains further AND-linked queries with any operator.

    Example.

    
    PARAMETERS: p_carrid TYPE sflight-carrid, 
                p_connid TYPE sflight-connid, 
                p_plane1 TYPE sflight-planetype, 
                p_plane2 TYPE sflight-planetype. 
    
    DATA sflight_tab TYPE SORTED TABLE OF sflight 
                     WITH UNIQUE KEY carrid connid fldate. 
    
    DATA sflight_wa TYPE sflight. 
    
    SELECT * 
           FROM sflight 
           INTO TABLE sflight_tab 
           WHERE carrid = p_carrid AND 
                 connid = p_connid. 
    
    sflight_wa-planetype = p_plane2. 
    
    MODIFY sflight_tab FROM sflight_wa 
           TRANSPORTING planetype WHERE planetype = p_plane1. 
    
    

    Hope it will helps

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 24, 2008 at 05:14 AM

    Hello Srinivas

    Consider the following eg where I would try to describe 1 use-case for MODIFY TABLE from wa transporting fields...

    There is a work area ls_addr defined as follows:

    DATA : BEGIN OF ls_addr,

    ls_street type string,

    ls_hnum type i

    END OF ls_addr.

    DATA : lt_adr like table of ls_addr.

    <<Logic>>

    append ls_addr to lt_addr.

    <<Based on some condition in your logic, say ls_street alone is modified for ls_hnum = '123' >>

    Then you now want to modify the record in lt_addr with the new ls_street. You could use:

    MODIFY TABLE lt_addr from ls_addr transporting ls_street where ls_hnum = '123'.

    When the internal table is modified, only the field(s) following 'transporting' get modified. The other fields remain unaffected.

    Hope this example helps.

    Regards

    Nisha

    Edited by: Nisha NC on Sep 24, 2008 7:22 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 24, 2008 at 05:15 AM

    TRANSPORTING tells that only specific fields will be modified which are given after the TRANSPORTING clause.

    For ex: modify it_tab from is_tab transporting <field1>.

    where it_tab is the internal table, is_tab is the work area

    and <field1> is the field that is being modified from work area into the internal table it_tab.

    Hope this clarifies.

    Regards

    Gopi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 24, 2008 at 05:16 AM

    Simple program for transporting

    Data: begin of itab occurs 0,

    c1,

    c2 type i,

    end of itab.

    itab-c1 = 'a'.

    itab-c2 = 10.

    collect itab.

    itab-c1 = 'b'.

    itab-c2 = 10.

    collect itab.

    itab-c1 = 'X'.

    modify itab transporting c1 where c1 = 'a'.

    loop at itab.

    write:/ itab-c1,

    itab-c2.

    endloop.

    Hope this program will give you clear picture

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 24, 2008 at 05:24 AM

    Hi,

    Syntax :

    ... {TABLE itab}|{itab INDEX idx} FROM wa

    [TRANSPORTING comp1 comp2 ... ]

    With these additions, the MODIFY statement assigns a line specified by itab_line to the content of the wa work area. The line can be specified using the table key or the table index. For the variant with the TABLE addition, the line is specified using the table key. For the variant with the INDEX addition, it is specified using the table index. The latter is only possible for index tables.

    TRANSPORTING can be used to restrict the comp components to be modified. result can be used when you change an individual line after Release 6.10 to set a reference in the form of a field symbol or a data reference to the changed line.

    In the case of access using the table key, index access to sorted tables and when the TRANSPORTING addition is used, the wa work area must be compatible with the line type of the internal table. Only in the case of insertion using the table index in standard tables without the TRANSPORTING addition can wa be incompatible with the line type of the internal table, and is converted to the line type according to the conversion rules.

    The TRANSPORTING addition has the effect that only the specified comp1 comp2 ... components of the work area are assigned to the corresponding components of the line(s) to be changed. For sorted tables and hashed tables, no table key components may be specified after TRANSPORTING.

    The comp1 comp2 ... component specifications are made in accordance with the rules specified in Component specification, with the constraint that after TRANSPORTING, no attributes of classes can be addressed using the object component selector.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 24, 2008 at 05:24 AM

    Hi srini,

    Following program Changes the contents of the planetype component for all lines in the sflight_tab internal table in which this component contains the value p_plane1 to the value p_plane2.

    PARAMETERS: p_carrid TYPE sflight-carrid,

    p_connid TYPE sflight-connid,

    p_plane1 TYPE sflight-planetype,

    p_plane2 TYPE sflight-planetype.

    DATA sflight_tab TYPE SORTED TABLE OF sflight

    WITH UNIQUE KEY carrid connid fldate.

    DATA sflight_wa TYPE sflight.

    SELECT *

    FROM sflight

    INTO TABLE sflight_tab

    WHERE carrid = p_carrid AND

    connid = p_connid.

    sflight_wa-planetype = p_plane2.

    MODIFY sflight_tab FROM sflight_wa

    TRANSPORTING planetype WHERE planetype = p_plane1.

    Thanks,

    Naveen kumar.

    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.