Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Transpoting

Former Member
0 Likes
783

Hi,

Can anybody explain what is the use of trasporting statement in move

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
709

Murali,

i would suggest you as you should always use SAP help first before throwing thread.

Press F1 on transporting keyword you will get help docs by SAP.

Because may we somtimes miss concept but SAP would't.

Amit.

4 REPLIES 4
Read only

Former Member
0 Likes
709

hi

this is from SAP help

You can write the table entry read from the table into a work area by specifying <result> as follows:

READ TABLE <itab> <key> INTO <wa> [COMPARING <f1> <f 2> ...

|ALL FIELDS]

[TRANSPORTING <f1> <f 2> ...

|ALL FIELDS

|NO FIELDS].

If you do not use the additions COMPARING or TRANSPORTING, the contents of the table line must be convertible into the data type of the work area <wa>. If you specify COMPARING or TRANSPORTING, the line type and work area must be compatible. You should always use a work area that is compatible with the line type of the relevant internal table.

If you use the COMPARING addition, the specified table fields <f i > of the structured line type are compared with the corresponding fields of the work area before being transported. If you use the ALL FIELDS option, the system compares all components. If the system finds an entry with the specified key <key> and if the contents of the compared fields are the same, SY-SUBRC is set to 0. If the contents of the compared fields are not the same, it returns the value 2. If the system cannot find an entry, SY-SUBRC is set to 4. If the system finds an entry, it copies it into the target work area regardless of the result of the comparison.

If you use the TRANSPORTING addition, you can specify the table fields of the structured line type that you want to transport into the work area. If you specify ALL FIELDS without TRANSPORTING, the contents of all of the fields are transported. If you specify NO FIELDS, no fields are transported. In the latter case, the READ statement only fills the system fields SY-SUBRC and SY-TABIX. Specifying the work area <wa> with TRANSPORTING NO FIELDS is unnecessary, and should be omitted.

In both additions, you can 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.

example program:

DATA:BEGIN OF fs_purchase,
      pno(5) TYPE  c,
      custno(5) TYPE c,
      quantity TYPE i,
      custname(20) TYPE c,
      END OF fs_purchase.

DATA:t_purchase LIKE TABLE OF fs_purchase,
     w_wapur   LIKE fs_purchase.

**************************************************
DATA:BEGIN OF fs_cust,
      custno(5) TYPE c,
      custname(20) TYPE c,
      city(10) TYPE c,
      END OF fs_cust.
*****************Declaring internal table and work area*******

DATA:t_customer LIKE TABLE OF fs_cust,
      w_wacust LIKE fs_cust.

*******************Appending values into table********
******************************************************
w_wacust-custno = 'C001'.
w_wacust-custname = 'john'.
w_wacust-city = 'NewYork'.

APPEND w_wacust TO t_customer.

CLEAR w_wacust.
*---------------------------------------------------
w_wacust-custno = 'C002'.
w_wacust-custname = 'mike'.
w_wacust-city = 'London'.

APPEND w_wacust TO t_customer.

CLEAR w_wacust.
*--------------------------------------------------
w_wacust-custno = 'C003'.
w_wacust-custname = 'Arnold'.
w_wacust-city = 'Minnestoa'.

APPEND w_wacust TO t_customer.

CLEAR w_wacust.
*-------------------------------------------------
w_wapur-pno = '6001'.
w_wapur-custno = 'C001'.
w_wapur-quantity = 10.

APPEND w_wapur TO t_purchase.

CLEAR w_wapur.
**************************************************
w_wapur-pno = '6002'.
w_wapur-custno = 'C002'.
w_wapur-quantity = 20.

APPEND w_wapur TO t_purchase.

CLEAR w_wapur.
**********************************************
w_wapur-pno = '6003'.
w_wapur-custno = 'C003'.
w_wapur-quantity = 15.

APPEND w_wapur TO t_purchase.

CLEAR w_wapur.
***********************************************************************
*Transporting customer name from one internal table to other with help
*of move and modify
***********************************************************************
LOOP AT t_customer INTO w_wacust.

  MOVE-CORRESPONDING w_wacust TO w_wapur.

  MODIFY t_purchase FROM w_wapur TRANSPORTING custname WHERE custno =
  w_wacust-custno.

  CLEAR w_wapur.

ENDLOOP.

CLEAR w_wapur.

**********************Displaying the output********************
LOOP AT t_purchase INTO w_wapur.

  WRITE:/ w_wapur-pno,w_wapur-custno,w_wapur-quantity,w_wapur-custname.

ENDLOOP.

Regards,

priya

Read only

Former Member
0 Likes
709

You can do several actions with internal tables / work areas and the like but not include all its components buy few specific fields.

TRANSPORTING is exactly for that use, It make the performance more effective and save problems.

Reward if helpfull,

Rebeka

Read only

Former Member
0 Likes
709

ok thanks

Read only

Former Member
0 Likes
710

Murali,

i would suggest you as you should always use SAP help first before throwing thread.

Press F1 on transporting keyword you will get help docs by SAP.

Because may we somtimes miss concept but SAP would't.

Amit.