2008 Dec 17 2:46 AM
I need update 15 ABAP dictionary tables.
I would like use PERFORM pass the table name with other value, then use FORM to UPDATE the different tables.
How do I code?
perform 6400_update_table using ztfkreg
lw_kreg
g_cnt_kreg_11.
FORM 6400_update_table X
lw_x
l-y TYPE c.
INSERT X FROM lw_x.
IF sy-subrc <> 0.
UPDATE X FROM lw_x.
ENDIF.
l_y = 'Y'.
ENDFORM.
*ztfkreg is the table name.
lw_kreg is the content going to update the table
I got syntax error.
Thanks,
Helen
2008 Dec 17 4:14 AM
Hi Helen,
The syntax for the Insert statement if you have a table name in the variable is
X = 'MARA'.
Insert into (X) value <Source>.
Similarly update also
Update (X) <Source>.
Or Make use of field symbols for capturing the table name and values to be inserted.
Also specify the syntax error.
Regards,
Ramesh
Edited by: Ramesh Babu Srikakollu on Dec 17, 2008 9:44 AM
I need update 15 ABAP dictionary tables.
I would like use PERFORM pass the table name with other value, then use FORM to UPDATE the different tables.
How do I code?
perform 6400_update_table using ztfkreg
lw_kreg
g_cnt_kreg_11.
FORM 6400_update_table X
lw_x
l-y TYPE c.
INSERT X FROM lw_x.
IF sy-subrc <> 0.
UPDATE X FROM lw_x.
ENDIF.
l_y = 'Y'.
ENDFORM.
*ztfkreg is the table name.
lw_kreg is the content going to update the table
I got syntax error.
Thanks,
Helen
2008 Dec 17 4:10 AM
You can use field-symbols to update certain fields of the tabe dynamically.
Thanks
Nidhi
2008 Dec 17 5:50 AM
Not sure how to use the field-symbol. How do you pass down to the subprogram?
Thanks,
Helen
2008 Dec 17 4:14 AM
Hi Helen,
The syntax for the Insert statement if you have a table name in the variable is
X = 'MARA'.
Insert into (X) value <Source>.
Similarly update also
Update (X) <Source>.
Or Make use of field symbols for capturing the table name and values to be inserted.
Also specify the syntax error.
Regards,
Ramesh
Edited by: Ramesh Babu Srikakollu on Dec 17, 2008 9:44 AM
2008 Dec 17 6:13 AM
It's great to know that I can pass the table name via variable name.
How about the <source>? How to pass the <source> structure?
For example: the the <source> => lw_kreg : each time is defferent.
Per your help, here is my new codes:
perform 6400_update_table using p_tname lw_kreg .
FORM 6400_update_table using p_tname lw_kreg.
DATA: l_count(6) TYPE n.
DELETE FROM (p_tname).
IF sy-subrc = 0.
WRITE:/ 'Empty ztfkreg successfully'.
COMMIT WORK.
ENDIF.
INSERT (p_tname) FROM lw_kreg.
IF sy-subrc <> 0.
UPDATE (p_tname) FROM lw_kreg.
g_success_lines = g_success_lines + 1.
ENDIF
ENDFORM. " 6400_update_table
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |