Application Development 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: 

Modify statement

Former Member
0 Kudos
423

Hi,

1.       Translate statement wont work in ABAP OO context.  What is the alternative  for Translate <f>  using ‘0’ & how to use?.

2.       Write  <f1>  TO <f2>. wont work in ABAP OO context. So how to write the below statement in ABAP OO

            Write itab-f1 To itab2-f2

                                     ROUND -2

                                 DECIMALS 0

                                NO-GROUPING

                                LEFT-JUSTIFIED.

3.       Normal write statement & Subroutines will work in ABAP OO?

4.       Modify statement is not working. My  Declaration

TYPES: BEGIN OF it_tab,

               F1(3) TYPE c,

               F2(15) TYPE c,           

            END OF it_hdr.

DATA : itab TYPE STANDARD TABLE OF it_tab,

wa like line of itab.

       Select * from <db> into wa.

                    move wa_marc-werks to wa-werks.

           Check sy-subrc eq 0.

Modify itab from wa. “But here modify statement is not working

Please help me to do these statement in ABAP OO. As i have release 4.7 only.

8 REPLIES 8

mahesh_madhavan
Participant
0 Kudos
146

Hi,

  1. TRANSLATE USING will work in OO.
  2. MODIFY TABLE itab FROM wa is the correct syntax. The present syntax that you're using will work only if you are using it in a loop or by specifying the index.

Cheers,

Mahesh

Former Member
0 Kudos
146

please reply as soon as possible.

Moderator Message: Please don't expect members to react ASAP to your problems.

Message was edited by: Suhas Saha

0 Kudos
146

I think you didnt read my reply.

Cheers,

Mahesh

0 Kudos
146

Hi Mahesh,

    I read in ABAP Obsolete statement. In that they mentioned "Translate " statement also obsolete.  If you are using ECC 6, then check this Translate statement works are not.

   I am using Modify statement inside the loop. But still it gives sy-subrc is 4. please check whether i need to change the declaration?

0 Kudos
146

Kelvin,

Why can't you use a Select * from <Database table> into TABLE ITAB ?

Then you can Loop or Read and move the required WERKS to your other internal table lines.

Also, try using a Field symbol, it would save you some time over the Modify.

For example:

DATA: ITABA type table of TABLEA,
          ITABB type table of TABLEB.

FIELD-SYMBOLS: <f_a> type TABLEA,
                            <f_b> type TABLEB.

Select * from TABLEA into table ITABA.

if sy-subrc = 0.

    Select * from TABLEB into table ITABB
            for all entries in ITABA
             where SOMEFIELD = ITABA-SOMEFIELD.

endif.

LOOP at ITABA assigning <F_A>.

READ TABLE ITABB assigning <F_B> with KEY SOMEFIELD = ITABA-SOMEFIELD.
    IF SY_SUBRC = 0.

     <F_A>-WERKS = <F_B>-WERKS.

   ENDIF.

ENDLOOP.

At line 14 above, the value of WERKS field of your table line would be changed and you would not need to write the MODIFY statement.

0 Kudos
146

Hi,

MODIFY TABLE itab FROM wa will work in ABAP OO.

First you have to use correct syntax. Both work area's werks field should have same type.

Follow the following steps.

1) you have to use either loop or read statement.

2) use move statement or wa-werkswa_marc-werks.

3)Modify that table with work area with index.

I hope it will solve your problem.

Thanks,

Mamta Kumari

VijayCR
Active Contributor
0 Kudos
146

Hello Kelvin ,

Always a modify internal statement should be inside a loop for a internal tab without header line.

Best way to avoid confusion is

loop at it_tab into w_itab1

modify w_itab into it_itab.

clear w_itab1.

endloop.

matt
Active Contributor
0 Kudos
146

Vijay Simha wrote:

Hello Kelvin ,

Always a modify internal statement should be inside a loop for a internal tab without header line.

Er.... no. This is not correct. You can modify an internal table outside a loop by specifying the correct syntax, and using a key or index, depending on the type of the table.