Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module to update the Z-table

Former Member
0 Likes
3,215

Hi All,

Is there any function module to insert a new record in to the Z-table.I want to give the Z-table name and the specific fields to be inserted and the value for those firlds.Examples will be useful.

Thanks in Advance.

4 REPLIES 4
Read only

Former Member
0 Likes
979

I don't think there is any generic function that can be used to update any Z Table.

You might have to write one.

Regards,

Ravi

note - Please mark all the helpful answers

Read only

0 Likes
979

You need to write your logic to update it. Please check this....

DATA WF_TABLE_NAME LIKE DD02L-TABNAME.

DATA ITABREF TYPE REF TO DATA.

DATA WF_WHERE(100) TYPE C.

FIELD-SYMBOLS:

<DBTAB> TYPE STANDARD TABLE,

<FS_ITAB> TYPE ANY.

*

Get WF_TABLE_NAME value from user input.

SELECT SINGLE * FROM DD02L

WHERE TABNAME EQ WF_TABLE_NAME AND

AS4LOCAL EQ 'A'.

If sy-subrc eq 0.

CREATE DATA ITABREF TYPE STANDARD TABLE OF (WF_TABLE_NAME).

ASSIGN ITABREF->* TO <DBTAB>.

SELECT * FROM (WF_TABLE_NAME)

INTO TABLE INT_TABLE WHERE <fldname> = WF_WHERE.

IF SY-SUBRC EQ 0.

LOOP AT INT_TABLE ASSIGNING <FS_ITAB>.

******

Write your logic....

******

ENDLOOP.

ENDIF.

ENDIF.

Let me know, if you need any info.

Regards,

Ramki.

Read only

Former Member
0 Likes
979

1. Go to SE80.

2. Create a Z function group

3. Create a Z function module inside that group

4. Put all the input data as the import parametr of the FM. Can use a structure also

5. Inside the FM do the insert of the data into the Z table

6. Also do exception handling and documentation

Read only

Lakshmant1
Active Contributor
0 Likes
979

Hi Shri Ram,

Try FM COC2_TABLE_INSERT_DB.

Hope this helps

Thanks

Lakshman