‎2005 May 11 7:03 PM
Hi everybody,
small question: We take a
transparant
table. This table has the following fields:internal
table:matnr - atnam - atwrt
internal
table of field atnam,ánd
it is a field in our transparant table in which we would like to place the value 5.
The main point is that I'd like to fill the values 5, 7 and bla into the corresponding fieldnames of the batchcharacteristics in our transparant table.
Any ideas?
Cheers and thanks
Laurens
ps: because of the large amount of fields of the batchcharacteristics, a hardcoded definition of the transparant table fields isn't really an option.
‎2005 May 11 7:25 PM
Here is a small piece of code.
<b>TABLES: zzzz. "transparent table
DATA: t_matnr TYPE zzzz OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_values OCCURS 0, "Batch Characteristics
matnr TYPE ausp-objek,
atnam TYPE cabn-atnam,
atwrt TYPE ausp-atwrt,
END OF t_values.
DATA: w_field(60) TYPE c.
FIELD-SYMBOLS: <tablefield>.
Insert logic for populating t_values here
SORT t_values BY matnr.
LOOP AT t_values.
AT NEW matnr.
CLEAR t_matnr.
t_matnr-matnr = t_values-matnr.
ENDAT.
CONCATENATE 'T_VALUES-' t_values-atnam INTO w_field.
TRANSLATE w_field TO UPPER CASE.
ASSIGN (w_field) TO <tablefield>.
<tablefield> = t_values-atwrt.
AT END OF matnr.
APPEND t_matnr.
ENDAT.
ENDLOOP.
MODIFY zzzz FROM TABLE t_matnr.</b>
Rishi
replace ZZZZ with your transparent table
‎2005 May 11 7:24 PM
Hi Laurens
You can use field symbols for this purpose.
e.g.
FIELD-SYMBOLS <field> .
ASSIGN (itab-atnam) TO <field> .
IF sy-subrc = 0 .
<field> = itab-atwrt .
ENDIF .Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>
‎2005 May 11 7:25 PM
Here is a small piece of code.
<b>TABLES: zzzz. "transparent table
DATA: t_matnr TYPE zzzz OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_values OCCURS 0, "Batch Characteristics
matnr TYPE ausp-objek,
atnam TYPE cabn-atnam,
atwrt TYPE ausp-atwrt,
END OF t_values.
DATA: w_field(60) TYPE c.
FIELD-SYMBOLS: <tablefield>.
Insert logic for populating t_values here
SORT t_values BY matnr.
LOOP AT t_values.
AT NEW matnr.
CLEAR t_matnr.
t_matnr-matnr = t_values-matnr.
ENDAT.
CONCATENATE 'T_VALUES-' t_values-atnam INTO w_field.
TRANSLATE w_field TO UPPER CASE.
ASSIGN (w_field) TO <tablefield>.
<tablefield> = t_values-atwrt.
AT END OF matnr.
APPEND t_matnr.
ENDAT.
ENDLOOP.
MODIFY zzzz FROM TABLE t_matnr.</b>
Rishi
replace ZZZZ with your transparent table
‎2005 May 11 7:32 PM
I've used field symbols for this purpose but I think I did a few things wrong. I'll try this first thing in the morning!
Cheers and thanks!
Laurens