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

regarding table control in modulepool

Former Member
0 Likes
911

Hi All,

could any one help me regarding table control in modulepool programing. i need to update one table(maintain) .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
893

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

7 REPLIES 7
Read only

Former Member
0 Likes
894

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

Read only

0 Likes
893

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

Read only

0 Likes
893

Thanks alot..

Read only

0 Likes
893

could u tell me how to define a back button to my screen..??

Read only

0 Likes
893

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

Read only

Former Member
0 Likes
893

Hi,

Pls refer to the sample program:

RSDEMO02

Regards,

Renjith Michael.

Read only

Former Member
0 Likes
893

thanks all..