12-05-2007 7:41 AM
Hello ,
I have a loop like this
LOOP AT t_marm INTO p_mattab FROM sy-tabix.
IF p_mattab-matnr NE p_matnr.
CLEAR p_mattab.
EXIT.
ENDIF.
ENDLOOP.
t_marm is of type marm and p_mattab is of type meinh
If we are modifying marm with an include, error is thrown in this loop becoz of unicode.
I want to use field symbols for this .Could anyone please help me in this.
Thanks in advance
Sudha
12-05-2007 8:12 AM
Hi Sudha,
if you use loop at itab .. assigning <fs> you will save time because nothing is ever copied into a header line but you are working on the table line directly. For this reason you will never use a MODIFY itab. I don't know why it is syntactically allowed although it has no effect and no sense at all.
You will not solve any unicode issues by just replacing the header line/work area with a field-symbol. You must analyze the error reason and resolve it. Field-symbols might help you when they are assigned to components of structure, but I really don't know what the unicode issue is in your case.
Regards,
Clemens
12-05-2007 7:46 AM
hi,
Field-symbols: <fs-name> as a modified internal tbale type.
LOOP AT t_marm INTO p_mattab FROM sy-tabix asssigning <fs_name>
IF p_mattab-matnr NE p_matnr.
<fs-name>-field = modifiing table field
modify itable.
CLEAR p_mattab.
EXIT.
ENDIF.
ENDLOOP.
I will give you example code. after 10mins
sekhar
12-05-2007 7:52 AM
hi,
Again Sekar here
you can observe the following code, you might be get some idea........
Data: BEGIN OF i_easte OCCURS 0,
perverbr LIKE easte-perverbr,
logikzw LIKE easts-logikzw,
END OF i_easte.
FIELD-SYMBOLS:
<f_easts> LIKE i_easts.
IF sy-subrc EQ 0.
SELECT perverbr
logikzw
FROM easte
INTO TABLE i_easte
FOR ALL ENTRIES IN i_easts
WHERE logikzw EQ i_easts-logikzw.
ENDIF.
IF NOT i_easte[] IS INITIAL.
LOOP AT i_easts ASSIGNING <f_easts>.
READ TABLE i_easte WITH KEY logikzw = <f_easts>-logikzw.
IF sy-subrc EQ 0.
<f_easts>-perverbr = i_easte-perverbr.
ENDIF.
ENDLOOP.
ENDIF.
12-05-2007 8:12 AM
Hi Sudha,
if you use loop at itab .. assigning <fs> you will save time because nothing is ever copied into a header line but you are working on the table line directly. For this reason you will never use a MODIFY itab. I don't know why it is syntactically allowed although it has no effect and no sense at all.
You will not solve any unicode issues by just replacing the header line/work area with a field-symbol. You must analyze the error reason and resolve it. Field-symbols might help you when they are assigned to components of structure, but I really don't know what the unicode issue is in your case.
Regards,
Clemens
12-05-2007 9:56 AM
Hi Clemens.
There is still a use for MODIFY. I frequently process tables where I don't know until runtime the structure. So I have to use ASSIGN COMPONENT. If I loop at ASSIGNING, then I have to do the component assignment inside the loop. If I instead create a work area, and loop INTO, I can do the component assignment outside the loop. This latter approach is more efficient.
Matt
12-05-2007 8:26 AM
You can not solve your unicode problem just by using fieldsysombols. Even fieldsymbols have a type and what you get is a typeconflict. Typeconflicts cant be solved this way.
12-05-2007 10:12 AM
> t_marm is of type marm and p_mattab is of type meinh
That's your problem right there. Whether you're using a field symbol or a work area the type should be the same (unless you're trying to do the equivalent of a C union, which doesn't appear to make sense here).