2007 Jun 04 3:34 PM
Hi,
why does this not work. I want to set Fields to be updated dynamically. Sometimes I want to update Field 1, another time Field 2 or 3.
In the F1 HELP is written that an initial dynamic Field will be ignored. But in the SAP HELP is written that an invalid name triggers a dump.
I get a dump. Any ideas how i can get this Code to ignore initial dynamic Fields?
DATA lt_table TYPE HASHED TABLE OF EORD WITH UNIQUE KEY MANDT MATNR WERKS ZEORD.
DATA lt_table2 TYPE HASHED TABLE OF EORD WITH UNIQUE KEY MANDT MATNR WERKS ZEORD.
DATA l_ERDAT TYPE fieldname .
DATA l_ERNAM TYPE fieldname .
DATA l_VDATU TYPE fieldname .
LOOP AT lt_table INTO ls_table.
IF NOT ls_table-ERDAT IS INITIAL.
l_ERDAT = 'ERDAT' .
ENDIF.
IF NOT ls_table-ERNAM IS INITIAL.
l_ERNAM = 'ERNAM' .
ENDIF.
IF NOT ls_table-VDATU IS INITIAL.
l_VDATU = 'VDATU' .
ENDIF.
MODIFY TABLE lt_table2 FROM ls_table TRANSPORTING
(l_ERDAT)
(l_ERNAM)
(l_VDATU)
.
ENDLOOP.
Sinan
2007 Jun 04 3:37 PM
The dump could be because you have omitted the INDEX addition for the MODIFY statement, and the program does not know which line is to be updated.
An F1 on the MODIFY statement should tell you about the WHERE and the INDEX additions.
Hope this helps.
Sudha
2007 Jun 04 3:44 PM
In the dump is written that the table with the type eord has no " " Component. I use HASHED TABLES. Index operations are forbidden with HASHED Tables.
Sinan
2007 Jun 04 3:52 PM
> LOOP AT lt_table INTO ls_table.
> IF NOT ls_table-ERDAT IS INITIAL.
> l_ERDAT = 'ERDAT' .
> ENDIF.
>
> IF NOT ls_table-ERNAM IS INITIAL.
> l_ERNAM = 'ERNAM' .
> ENDIF.
>
> IF NOT ls_table-VDATU IS INITIAL.
> l_VDATU = 'VDATU' .
> ENDIF.
>
> MODIFY TABLE lt_table2 FROM ls_table TRANSPORTING
> (l_ERDAT)
> (l_ERNAM)
> (l_VDATU)
> .
> ENDLOOP.
If ERDAT, ERNAM or VDATU are empty, you not passing values to the variables....So, in that case, you going to do something like...
MODIFY TABLE lt_table2 FROM ls_table TRANSPORTING
ERDAT SPACE VDATU
And of course....SPACE is not a valid field.....You need to pass all fields no matter is they're empty or not....
Greetings,
Blag.
2007 Jun 04 3:56 PM
Thanks for the answers.
Any idea how I can handle this without to write for each case a MODIFY.
Sinan