100% found this document useful (1 vote)
229 views8 pages

Moduleprog 090311165111 Phpapp01

The document describes an ABAP program that contains various modules for managing a table containing student records. The program allows users to display, add, insert, delete, update and refresh records in the table. It also includes modules for controlling screen fields and getting user input.

Uploaded by

muralisrt
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
229 views8 pages

Moduleprog 090311165111 Phpapp01

The document describes an ABAP program that contains various modules for managing a table containing student records. The program allows users to display, add, insert, delete, update and refresh records in the table. It also includes modules for controlling screen fields and getting user input.

Uploaded by

muralisrt
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

Se51

process before output.


module status_8000.

loop with control control.


module fill_table_control.
endloop.

process after input.

loop with control control.


module read_table_control.
endloop.

module user_command_8000.

process on value-request.

field wk_sno module valuerequest_help.

Se38

program ycoe_module29 message-id zmsg.

tables : ysrtmm.

controls : control type tableview using screen 8000.

data : wk_f1(20) type c.

data : begin of i_ysrtmm occurs 0,


sno type ysrtmm-sno,
sname type ysrtmm-sname,
scity type ysrtmm-scity,
sedu type ysrtmm-sedu,
spercent type ysrtmm-spercent,
select(1),
end of i_ysrtmm.

data : i_ysrtmm1 like i_ysrtmm occurs 0 with header line.

data : i_final like ysrtmm occurs 0 with header line.

data : begin of i_check occurs 0,


sno type ysrtmm-sno,
sname type ysrtmm-sname,
scity type ysrtmm-scity,
sedu type ysrtmm-sedu,
spercent type ysrtmm-spercent,
end of i_check.

data : lines type i.


data : wk_init type i.
data : n type i.
data : wk_answer.
data : wk_sno(30).
data : flag.
data : cols like line of control-cols.

data : begin of i_tmp occurs 0,


sname type ysrtmm-sname,
scity type ysrtmm-scity,
sedu type ysrtmm-sedu,
spercent type ysrtmm-spercent,
end of i_tmp.

*&---------------------------------------------------------------------*
*& Module STATUS_8000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_8000 output.

set pf-status 'STAT29'.


set titlebar 'TITLE'.

describe table i_ysrtmm1 lines lines.


control-lines = lines + 10.

endmodule. " STATUS_8000 OUTPUT


*&---------------------------------------------------------------------*
*& Module USER_COMMAND_8000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module user_command_8000 input.

case sy-ucomm.

when 'DISP'.
select sno sname scity sedu spercent
from ysrtmm into corresponding fields of table i_ysrtmm1.

* LOOP AT control-cols INTO cols WHERE index EQ 1.


* IF cols-screen-input = '0'.
* cols-screen-input = '1'.
* ELSEIF cols-screen-input = '1'.
* cols-screen-input = '0'.
* ENDIF.
* MODIFY control-cols FROM cols INDEX sy-tabix.
* ENDLOOP.

when 'ADD'.

flag = 'Y'.

when 'INSE'.

if i_ysrtmm1-sname is initial and i_ysrtmm1-select = 'X'.


refresh i_ysrtmm1.
endif.

clear i_ysrtmm1.
loop at i_ysrtmm1.
i_final-mandt = sy-mandt.
i_final-sno = i_ysrtmm1-sno.
i_final-sname = i_ysrtmm1-sname.
i_final-scity = i_ysrtmm1-scity.
i_final-sedu = i_ysrtmm1-sedu.
i_final-spercent = i_ysrtmm1-spercent.
append i_final.
clear : i_final.
endloop.

select sno sname scity sedu spercent


from ysrtmm into table i_check for all
entries in i_final where sno = i_final-sno.

if sy-subrc ne 0.
if i_final[] is not initial.
insert ysrtmm from table i_final.
if sy-subrc eq 0.
commit work.
message i010.
clear : i_ysrtmm,i_ysrtmm1,i_final.
refresh : i_ysrtmm,i_ysrtmm1,i_final.
leave screen.
else.
rollback work.
endif.
endif.
else.
message i012.
endif.

clear : i_check.
refresh i_check.

when 'DELE'.

delete i_ysrtmm1 where select = 'X'.


clear i_ysrtmm1.
* IF sy-subrc EQ 0.
* COMMIT WORK.
* MESSAGE i011.
* ELSE.
* ROLLBACK WORK.
* ENDIF.

when 'UPDA'.

loop at i_ysrtmm1.
i_final-mandt = sy-mandt.
i_final-sno = i_ysrtmm1-sno.
i_final-sname = i_ysrtmm1-sname.
i_final-scity = i_ysrtmm1-scity.
i_final-sedu = i_ysrtmm1-sedu.
i_final-spercent = i_ysrtmm1-spercent.
append i_final.
clear : i_final.
endloop.

select sno sname scity sedu spercent


from ysrtmm into table i_check for all
entries in i_final where sno = i_final-sno.
if sy-subrc eq 0.
if i_final[] is not initial.
update ysrtmm from table i_final.
if sy-subrc eq 0.
commit work.
message i013.
* CLEAR : i_ysrtmm,i_ysrtmm1,i_final.
* REFRESH : i_ysrtmm,i_ysrtmm1,i_final.
leave screen.
else.
rollback work.
endif.
endif.
else.
message i014.
endif.

clear : i_check.
refresh i_check.

when 'REFR'.

refresh i_ysrtmm1.

when 'EXIT'.

leave program.

when 'BACK' or 'CANCEL'.

call function 'POPUP_TO_CONFIRM_STEP'


exporting
defaultoption = 'Y'
textline1 = 'Do you wish to exit'(004)
textline2 = 'Confirm?'(005)
titel = 'Exit Processing'(006)
start_column = 25
start_row =6
cancel_display = 'X'
importing
answer = wk_answer.

case wk_answer.

when 'J'.

leave program.
endcase.

endcase.

endmodule. " USER_COMMAND_8000 INPUT


*&---------------------------------------------------------------------*
*& Module READ_TABLE_CONTROL INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module read_table_control input.

lines = sy-loopc.

if sy-ucomm eq 'ENTER'.
select single sname scity sedu spercent from ysrtmm
into i_tmp
where sno = i_ysrtmm-sno.
if sy-subrc = 0.
i_ysrtmm-sname = i_tmp-sname.
i_ysrtmm-scity = i_tmp-scity.
i_ysrtmm-sedu = i_tmp-sedu.
i_ysrtmm-spercent = i_tmp-spercent.
endif.
endif.

read table i_ysrtmm1 index control-current_line.


if sy-subrc eq 0.
modify i_ysrtmm1 from i_ysrtmm index control-current_line.
else.

move-corresponding i_ysrtmm to i_ysrtmm1.


append i_ysrtmm1.
clear i_ysrtmm.
endif.

endmodule. " READ_TABLE_CONTROL INPUT


*&---------------------------------------------------------------------*
*& Module FILL_TABLE_CONTROL OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module fill_table_control output.

loop at screen.
if screen-name = 'I_YSRTMM-SNO'.
screen-input = '0'.
modify screen.
endif.
if screen-name = 'I_YSRTMM-SNAME'.
screen-input = '0'.
modify screen.
endif.
if screen-name = 'I_YSRTMM-SCITY'.
screen-input = '0'.
modify screen.
endif.
if screen-name = 'I_YSRTMM-SEDU'.
screen-input = '0'.
modify screen.
endif.
if screen-name = 'I_YSRTMM-SPERCENT'.
screen-input = '0'.
modify screen.
endif.
endloop.

describe table i_ysrtmm1 lines wk_init.

if wk_init is not initial.


read table i_ysrtmm1 into i_ysrtmm index control-current_line.
endif.

if sy-ucomm = 'ADD'.
loop at screen.
if flag is initial.
screen-input = 0.
elseif ( flag eq 'Y' ).
if ( ( screen-name = 'I_YSRTMM-SNO' or
screen-name = 'I_YSRTMM-SNAME' or
screen-name = 'I_YSRTMM-SCITY' or
screen-name = 'I_YSRTMM-SEDU' or
screen-name = 'I_YSRTMM-SPERCENT' )
and control-current_line le lines ).
screen-input = 1.
else.
endif.
endif.
modify screen.
endloop.
endif.

endmodule. " FILL_TABLE_CONTROL OUTPUT


*&---------------------------------------------------------------------*
*& Module VALUEREQUEST_HELP INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module valuerequest_help input.

data : begin of it_tmp occurs 0,


sno like ysrtmm-sno,
end of it_tmp.

data: progname like sy-repid,

dynnum like sy-dynnr.

data : t_return like ddshretval occurs 0 with header line.

refresh it_tmp.

select sno from ysrtmm client specified into it_tmp

where mandt = sy-mandt.

append it_tmp.

endselect.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'


exporting
retfield = 'YSRTMM-SNO'
dynpprog = progname
dynpnr = dynnum
dynprofield = 'WK_SNO'
value = 'YSRTMM-SNO'
value_org = 'S'
tables
value_tab = it_tmp
return_tab = t_return.

if sy-subrc = 0.

read table t_return index 1.

condense t_return-fieldval.

wk_sno = t_return-fieldval.

endif.

endmodule. " VALUEREQUEST_HELP INPUT

You might also like