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

to use modify

Former Member
0 Likes
1,523

Hi,

how to i use the stmt modify transproting,

my main internal table is it_equi and other internal table itab to get values...is itab how do i write the modify stmt...

pls, help

thanks,

CAPC

1 ACCEPTED SOLUTION
11 REPLIES 11
Read only

Former Member
0 Likes
1,241

Hi,

Check this sample stmt:

MODIFY i_open_item FROM ws_clsd_item

TRANSPORTING bcs_amount

bcs_balance

bcs_amount_gc

bcs_balance_gc

bcs_ukurs

difference

difference_gc

luname

ldatum

recon_reqd

status

WHERE cert_id = ws_cert_id.

Regards

Subramanian

Read only

Former Member
0 Likes
1,241

Hi,

Check this code :

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'.

-SatyaPriya

Read only

Former Member
0 Likes
1,241

Hi,

try this....

modify it_equi from itab index lv_index

transporting vbeln.

assuming that vbeln is the key field.

Read only

Former Member
0 Likes
1,241

it_equi-matnr = itab-matnr.

modify it_equi transporting matnr where equnr = itab-equnr.

Read only

Former Member
0 Likes
1,241

Variant 1

MODIFY itab [FROM wa] [INDEX idx] [ASSIGNING <fs>|REFERENCE INTO dref] [TRANSPORTING f1 ... fn].

Effect

Changes a single entry in the internal table itab, specifying the index explicitly or implicitly. You can only use this variant with index table (standard or sorted tables).

If you specify "FROM wa", the new values are taken from the work area wa. If you do not specify FROM, the header line of itab is used as the work area.

You can use "INDEX idx" to specify the table index of the line you want to change. This may be omitted within a LOOP at an internal table. In this case, the current table line is changed.

The INDEX specification can come before the FROM addition.

If you use the addition ASSIGNING <fs>, the field symbol <fs> is set to the modified line. If you use the addition REFERENCE INTO ref, the data reference dref is filled with the reference of the modified line. Both the field symbol and the reference are only set if the statement is processed successfully.

If you specify "TRANSPORTING f1 ... fn ", only components f1, f2, ... of the work area are copied into the table. You can also specify components dynamically in the form (name). The actual component name is then taken from the field name at runtime. If name contains an invalid component name, the system triggers a runtime error. In HASHED or SORTED tables, you cannot use a TRANSPORTING field as a key field.

The Return Code is set as follows:

When you specify the insertion point with INDEX idx:

SY-SUBRC = 0:

The entry was changed.

SY-SUBRC = 4:

Index position too large. No entry was changed, since the table contains less than idx entries.

If you do not specify an insertion point, Return Code is set to 0.

Variant 2

MODIFY TABLE itab [FROM wa] [ASSIGNING <fs>|REFERENCE INTO dref] [TRANSPORTING f1 ... fn].

Effect

Generic change to a single entry in the internal table itab with key. Unlike variant 1, you can use this variant for any table. All additions have the same meaning as for variant 1.

The key of the entry to be changed is taken from the work area. The procedure depends on the table type:

STANDARD TABLE:

The table is searched sequentially by its table key. The first entry found is changed. The runtime required for the search is in linear relation to the number of table entries.

SORTED TABLE:

The table is searched by its table key using a binary search. In tables with a non-unique key ( NON-UNIQUE) only the first entry in the list of duplicates is changed. The runtime required for the search is in logarithmic relation to the number of table entries.

HASHED TABLE:

The entry is found and changed by table key using the internal hash administration. The runtime required is essentially constant, since, unlike in standard or sorted tables, it does not depend on the number of table entries.

The Return Code is set as follows:

SY-SUBRC = 0:

The first entry with the specified key was changed.

SY-SUBRC = 4:

There was no entry with the specified key.

Variant 3

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

Effect

Changes several entries in the internal table itab. You can use this variant for any table.

You can use " FROM wa" and "TRANSPORTING f1 ... fn" as in variant 1. If the table has the type SORTED TABLE or HASHED TABLE, the TRANSPORTING list may not contain key fields.

In comparisons within the logical expression cond, the first operand must always be a subfield of the line structure of itab.

The Return Code is set as follows:

SY-SUBRC = 0:

At least one entry was changed.

SY-SUBRC = 4:

None of the entries was changed.

Read only

Former Member
0 Likes
1,241

Hi,

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

Effect

Changes several entries in the internal table itab. You can use this variant for any table.

You can use " FROM wa" and "TRANSPORTING f1 ... fn" as in variant 1. If the table has the type SORTED TABLE or HASHED TABLE, the TRANSPORTING list may not contain key fields.

In comparisons within the logical expression cond, the first operand must always be a subfield of the line structure of itab.

Regards,

Ram

Pls reward points if helpful

Read only

Former Member
0 Likes
1,241

loop the itab1 into wa_orders.

use the following

MODIFY itab2 FROM wa_orders TRANSPORTING field1 field2

WHERE condition.

MODIFY itab [FROM wa] [INDEX idx] [ASSIGNING <fs>|REFERENCE INTO dref] [TRANSPORTING f1 ... fn].

- MODIFY TABLE itab [FROM wa] [ASSIGNING <fs>|REFERENCE INTO dref] [TRANSPORTING f1 ... fn].

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

U can use the above syntaxes and i present u a example.

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'.

MODIFY i_aw9orders FROM wa_aw9orders TRANSPORTING daysofnoti

WHERE aufnr = wa_aw9orders-aufnr.

award points if helpful.

Read only

Former Member
0 Likes
1,241

THANKS EVERYONE FOR THE REPLY ITS BEEN SOLVED

Read only

Former Member
0 Likes
1,241

Execute the code .

data: begin of itab occurs 0 ,
      f1 type i ,
      f2 type i,
      end of itab.
data : sum type i.
data : cntr like sy-tabix.


      itab-f1 = '20'.
      append itab.

      itab-f1 = '30'.
      append itab.

      itab-f1 = '40'.
      append itab.



      loop at itab.

      sum = sum + itab-f1.
      cntr = cntr + 1.
      at last.
      itab-f2 = sum.
      clear sum.

      modify itab index cntr transporting f2.  "check this .
      endat.

      endloop.

     loop at itab .
      write:/ itab-f1,
              itab-f2.
      endloop.[/code

the o/p is 

[code]20
30
40   90 " ----> 90 gets displayed in the third row at 2 column .

90 = 203040 to calculate the sum and display at the end of field f1.

regards,

vijay

Read only

Former Member
0 Likes
1,241

thanks