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
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.
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?
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.
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.
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-werks = wa_marc-werks.
3)Modify that table with work area with index.
I hope it will solve your problem.
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.