‎2008 Jan 31 9:26 AM
Hi All,
could any one help me regarding table control in modulepool programing. i need to update one table(maintain) .
‎2008 Jan 31 9:59 AM
Hi,
If we want update to a Z table using table control, We have to follow these steps.
Create a screen (130) in SE51 for ur program with the following.
1) Create a table control with 2 columns.
2) Create a button called 'Update'. On clicking this button, the values present in the table control will be inserted into the Z table.
3) Then under the Flow Logic, write the following.
PROCESS BEFORE OUTPUT.
module status.
LOOP WITH CONTROL MATERIAL.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE exit.
LOOP WITH CONTROL MATERIAL.
MODULE V1.
ENDLOOP.
write the following coding in SE38.
REPORT Y_DB_TABLECONTROL.
TABLES: MARA.
CONTROLS MATERIAL TYPE TABLEVIEW USING SCREEN 130.
MATERIAL is the name of the TABLE CONTROL.
TYPES: BEGIN OF ST_MARA,
MATNR TYPE MARA-MATNR,
ERNAM TYPE MARA-ERNAM,
END OF ST_MARA.
DATA: IT_ST TYPE TABLE OF ST_MARA,
WA_ST TYPE ST_MARA,
IT_MARA TYPE MARA,
WA_MARA TYPE MARA,
MATNR TYPE MARA-MATNR,
ERNAM TYPE MARA-ERNAM.
CALL SCREEN 130.
Here 'SAVE' , 'DELETE', 'MODIFY' are the Function codes assigned for these buttons.
MODULE V1 INPUT.
CASE sy-ucomm.
WHEN 'SAVE'.
WA_ST-MATNR = MATNR.
WA_ST-ERNAM = ERNAM.
MOVE-CORRESPONDING WA_ST TO WA_MARA.
INSERT INTO MARA VALUES WA_MARA.
if sy-subrc = 0.
MESSAGE s001(ZKAAR).
endif.
WHEN 'DELETE'.
WA_ST-MATNR = MATNR.
WA_ST-ERNAM = ERNAM.
MOVE-CORRESPONDING WA_ST TO WA_MARA.
DELETE MARA FROM WA_MARA.
WHEN 'MODIFY'.
WA_ST-MATNR = MATNR.
WA_ST-ERNAM = ERNAM.
MOVE-CORRESPONDING WA_ST TO WA_MARA.
MODIFY MARA FROM WA_MARA.
ENDCASE.
ENDMODULE. " V1 INPUT
MODULE EXIT INPUT.
IF sy-ucomm = 'EXIT' or sy-ucomm = 'BACK'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " EXIT INPUT
&----
*& Module status OUTPUT
&----
text
----
module status output.
set pf-status 'STAT'.
endmodule. " status OUTPUT
Hope it will help u.
Reward points if useful
Cheers,
Shanthi
‎2008 Jan 31 9:59 AM
Hi,
If we want update to a Z table using table control, We have to follow these steps.
Create a screen (130) in SE51 for ur program with the following.
1) Create a table control with 2 columns.
2) Create a button called 'Update'. On clicking this button, the values present in the table control will be inserted into the Z table.
3) Then under the Flow Logic, write the following.
PROCESS BEFORE OUTPUT.
module status.
LOOP WITH CONTROL MATERIAL.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE exit.
LOOP WITH CONTROL MATERIAL.
MODULE V1.
ENDLOOP.
write the following coding in SE38.
REPORT Y_DB_TABLECONTROL.
TABLES: MARA.
CONTROLS MATERIAL TYPE TABLEVIEW USING SCREEN 130.
MATERIAL is the name of the TABLE CONTROL.
TYPES: BEGIN OF ST_MARA,
MATNR TYPE MARA-MATNR,
ERNAM TYPE MARA-ERNAM,
END OF ST_MARA.
DATA: IT_ST TYPE TABLE OF ST_MARA,
WA_ST TYPE ST_MARA,
IT_MARA TYPE MARA,
WA_MARA TYPE MARA,
MATNR TYPE MARA-MATNR,
ERNAM TYPE MARA-ERNAM.
CALL SCREEN 130.
Here 'SAVE' , 'DELETE', 'MODIFY' are the Function codes assigned for these buttons.
MODULE V1 INPUT.
CASE sy-ucomm.
WHEN 'SAVE'.
WA_ST-MATNR = MATNR.
WA_ST-ERNAM = ERNAM.
MOVE-CORRESPONDING WA_ST TO WA_MARA.
INSERT INTO MARA VALUES WA_MARA.
if sy-subrc = 0.
MESSAGE s001(ZKAAR).
endif.
WHEN 'DELETE'.
WA_ST-MATNR = MATNR.
WA_ST-ERNAM = ERNAM.
MOVE-CORRESPONDING WA_ST TO WA_MARA.
DELETE MARA FROM WA_MARA.
WHEN 'MODIFY'.
WA_ST-MATNR = MATNR.
WA_ST-ERNAM = ERNAM.
MOVE-CORRESPONDING WA_ST TO WA_MARA.
MODIFY MARA FROM WA_MARA.
ENDCASE.
ENDMODULE. " V1 INPUT
MODULE EXIT INPUT.
IF sy-ucomm = 'EXIT' or sy-ucomm = 'BACK'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " EXIT INPUT
&----
*& Module status OUTPUT
&----
text
----
module status output.
set pf-status 'STAT'.
endmodule. " status OUTPUT
Hope it will help u.
Reward points if useful
Cheers,
Shanthi
‎2008 Jan 31 11:10 AM
Hi Shanthi,
the information u have given seems relavent,but my requirement is like..
in the first screen i need to have one field and iam having push buttons like CREATE,MAINTAIN,DISPLAY.
If i click on CREATE It should take me to the table control screen..in that screen u should not have the field u entered in the first screen and rest of the fields i should able to enter..
please give me needful..!1
‎2008 Feb 08 5:14 AM
‎2008 Feb 08 5:16 AM
‎2008 Feb 08 10:53 AM
Hi rajesh
On layout after placing a Push Button with FCT Code 'Back'
Write the following in PAI
Case SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 'SCREEN NO.'
ENDCASE.
Reward Points, If helpful
Thanks
RK Nimma
‎2008 Jan 31 10:12 AM
Hi,
Pls refer to the sample program:
RSDEMO02
Regards,
Renjith Michael.
‎2008 Feb 08 5:14 AM