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

hi doubt in module pool

Former Member
0 Likes
852

i have got input output field if i press pushbutton save it should save in Ztable how to write in modulepool

i have got input output field if i press pushbutton save it should save in Ztable how to write in modulepool

6 REPLIES 6
Read only

Former Member
0 Likes
826

In a report Create a screen with i/o field.

In the PAI ... in USER_COMMAND capture the changes to the field and on SAVE command UPDATE the Z-table using the UPDATE statement....

Read only

Former Member
0 Likes
826

Hi shanker,

Yes it possible to do so........

Main program:

report yh625_tabstrip_control2.

data:

begin of fs_spfli.

data check type c.

include structure spfli.

data end of fs_spfli.

data:

w_ucomm like sy-ucomm,

w_flag type i,

w_tabname type dfies-tabname,

w_fieldname type dfies-fieldname,

w_program type sy-repid,

w_screenno type sy-dynnr,

dynpro_values type table of dynpread,

field_value like line of dynpro_values.

w_tabname = 'SPFLI'.

w_fieldname = 'CARRID'.

w_program = sy-repid.

w_screenno = 1110.

types: begin of values,

carrid type spfli-carrid,

connid type spfli-connid,

end of values.

data w_connid type spfli-connid.

data:

t_table type table of values,

ret_value type dfies-fieldname.

data :

t_spfli like

standard table

of fs_spfli.

controls:

t_tab type tabstrip,

t_control type tableview using screen 1100.

data cols like line of t_control-cols.

  • t_control2 TYPE TABLEVIEW USING SCREEN '1200'.

select *

from spfli

into corresponding fields of table t_spfli.

data spfli like fs_spfli.

***********************************************************************

  • Code for DISPLAY MODE

***********************************************************************

loop at t_control-cols into cols where index gt 2.

cols-screen-input = '0'.

modify t_control-cols from cols index sy-tabix.

endloop.

call screen 1110.

----


  • MODULE status_1110 OUTPUT

----


*

----


module status_1110 output.

set pf-status 'YH625_STATUS'.

endmodule. "status_1110 OUTPUT

----


  • MODULE user_command_1110 INPUT

----


*

----


module user_command_1110 input.

leave program.

endmodule. "user_command_1110 INPUT

----


  • MODULE call_subscreen INPUT

----


*

----


module call_subscreen input.

case w_ucomm.

when 'TAB1'.

t_tab-activetab = 'TAB1'.

when 'TAB2'.

t_tab-activetab = 'TAB2'.

when 'TAB3'.

t_tab-activetab = 'TAB3'.

endcase.

endmodule. " call_subscreen INPUT

----


  • MODULE change_display INPUT

----


*

----


module change_display input.

case w_ucomm.

when 'CD'.

if w_flag = 0.

loop at t_control-cols into cols where index gt 2.

cols-screen-input = '1'.

modify t_control-cols from cols index sy-tabix.

endloop.

w_flag = 1 .

else.

loop at t_control-cols into cols where index gt 2.

cols-screen-input = '0'.

modify t_control-cols from cols index sy-tabix.

endloop.

w_flag = 0 .

endif.

when 'SORT_UP'.

read table t_control-cols into cols with key selected = 'X'.

if sy-subrc eq 0.

sort t_spfli stable by (cols-screen-name+9) ascending.

cols-selected = ' '.

modify t_control-cols from cols index sy-tabix.

endif.

when 'SORT_DOWN'.

read table t_control-cols into cols with key selected = 'X'.

if sy-subrc eq 0.

sort t_spfli stable by (cols-screen-name+9) descending

.

cols-selected = ' '.

modify t_control-cols from cols index sy-tabix.

endif.

when 'DELETE'.

read table t_control-cols into cols with key screen-input = '1'.

if sy-subrc eq 0.

loop at t_spfli into spfli where check = 'X'.

delete t_spfli.

endloop.

endif.

endcase.

endmodule. "change_display INPUT

&----


*& Module modify_1100 INPUT

&----


    • text

*----


*module modify_1100 input.

*

  • MODIFY t_spfli FROM fs_spfli INDEX t_control-current_line.

*

*endmodule. " modify_1100 INPUT

&----


*& Module modify_1100 INPUT

&----


  • text

----


module modify_1100 input.

modify t_spfli from fs_spfli index t_control-current_line.

endmodule. " modify_1100 INPUT

&----


*& Module f4help_carrid INPUT

&----


  • text

----


module f4help_carrid input.

call function 'F4IF_FIELD_VALUE_REQUEST'

exporting

tabname = w_tabname

fieldname = w_fieldname

  • SEARCHHELP = ' '

  • SHLPPARAM = ' '

dynpprog = w_program

dynpnr = w_screenno

  • DYNPROFIELD = 'CARRIER'

  • STEPL = 0

  • VALUE = ' '

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • SUPPRESS_RECORDLIST = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • SELECTION_SCREEN = ' '

  • IMPORTING

  • USER_RESET =

  • TABLES

  • RETURN_TAB =

  • EXCEPTIONS

  • FIELD_NOT_FOUND = 1

  • NO_HELP_FOR_FIELD = 2

  • INCONSISTENT_HELP = 3

  • NO_VALUES_FOUND = 4

  • OTHERS = 5

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

endmodule. " f4help_carrid INPUT

&----


*& Module f4_help_connid INPUT

&----


  • text

----


module f4_help_connid input.

  • call function 'DYNP_VALUES_READ'

  • exporting

  • dyname = w_program

  • dynumb = w_screenno

  • translate_to_upper = 'X'

  • tables

  • dynpfields = dynpro_values.

*

  • read table dynpro_values index 1 into field_value.

select carrid connid

from spfli

into corresponding fields of table t_table.

ret_value = 'CONNID'.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = ret_value

dynpprog = w_program

dynpnr = w_screenno

dynprofield = 'CONNECTION'

value_org = 'S'

  • IMPORTING

  • USER_RESET =

tables

value_tab = t_table

exceptions

parameter_error = 1

no_values_found = 2

others = 3

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

endmodule. " f4_help_connid INPUT

<b>Flow logic:</b>

PROCESS BEFORE OUTPUT.

*data w_ucomm LIKE SY-UCOMM.

MODULE init.

MODULE STATUS_1110.

call subscreen: area1 including sy-repid '1100',

area2 including sy-repid '1200',

area3 including sy-repid '1200'.

PROCESS AFTER INPUT.

call subscreen: area1,area2,area3.

MODULE call_subscreen.

MODULE change_display.

MODULE USER_COMMAND_1110 at exit-command.

PROCESS ON VALUE-REQUEST.

FIELD CARRID MODULE f4help_carrid.

FIELD CONNECTION MODULE f4_help_connid.

<b>

Subscreen 1100 Flow logic :</b>

PROCESS BEFORE OUTPUT.

  • MODULE STATUS_1100.

loop AT T_SPFLI INTO FS_SPFLI with control t_control.

endloop.

PROCESS AFTER INPUT.

  • MODULE USER_COMMAND_1100.

loop AT T_SPFLI .

module modify_1100.

endloop.

For more info. see " DEMO_DYNPRO_TABCONT_LOOP_AT " program.

<b>Shanker in PAI of the main screen,push the content in internal table to the database table using INSERT ....

statement.Because the changes made in table content on the screen is automatically updated in the internal table.</b>

Reward all helpful answers

Regards,

V.Raghavender.

Read only

Former Member
0 Likes
826

Why can't you have a table maintenance defined for your z table?

Refer this link for table maintenance.

Regards,

Ravi

Read only

Former Member
0 Likes
826

hi

<b>write in PAI</b>

if sy-ucomm = <function code of button>

insert....

modify <database table>

endif.

hope it will clear ur doubt

regards

ravish

<b>plz dont forget to reward points if helpful</b>

Read only

Former Member
0 Likes
826

Hi Shankar

For this u have to define an I/O element on ur screen of module pool. Also define a variable with same name in your top include of module pool. For eg DATA INPUT1(10) type c.

Also define a work area for ur database ztable.

eg data wa type database_ztable.

Also assign a function code to ur push button. For this double click on the push button in screen painter. It opens attribute window. Assign a function code in FctCode field.

Now go to the flow logic of your screen. In the PAI (Process After Input) block uncomment the statement MODULE USER_COMMAND_'screennumber'. Double click on this n it will ask you to create a new module. Click yes and save it in a separate include for PAI modules. Now write a case endcase statement in this module.

CASE SY-UCOMM.

WHEN 'Function code of submit button'.

clear wa.

wa-fieldname = INPUT1.

UPDATE database_ztable FROM wa

WHERE condition.

ENDCASE.

In update statement it is important to specify the where condition when you want to update a particular record.

I hope this would help you.

Read only

Former Member
0 Likes
826

Hello,

For this, first take an I/O element on your screen, and a pushbutton.

Then, in the PAI event of the screen(say your initial screen is 100), write this:-

UPDATE Ztab from wa_Ztab.

Declare a work area for your ztable.

Thanks and regards,

Prerna