03-17-2008 5:50 AM
Hi,
Any body please tell me where can be found demo programs for module pool programs?
thanks
venkat
03-17-2008 5:51 AM
Run T-Code 'ABAPDOCU'.
Follow the path:
ABAP Documentations & Examples -> BC-ABAP Programming -> ABAP User Dialoges.
03-17-2008 5:52 AM
Hi,
Go to tcode ABAPDOCU and then select ABAP User Dialogs ->Screens there u can see the programs.
rgds,
bharat.
03-17-2008 5:53 AM
here is a sample code for module pool, reward if useful
&----
*& Include ZTEAM4_F01 *
&----
&----
*& Module check_ebeln INPUT
&----
text
----
MODULE check_ebeln INPUT.
----
Checking if the Purchase order number exists or Not.
----
SELECT SINGLE ebeln FROM zteam4_ekko INTO zteam4_ekko
WHERE ebeln = zteam4_ekko-ebeln.
----
To give E-msg if it exists for Create using Ok_code.
----
IF sy-subrc = 0.
IF ok_code = 'CREATE'.
MESSAGE 'PURCHASE ORDER ALREADY EXISTS' TYPE 'E'.
ENDIF.
----
To give E-msg if does not exist for Display using Ok_code.
----
ELSEIF sy-subrc <> 0.
IF ok_code = 'CHANGE' OR ok_code = 'DISPLAY'.
MESSAGE 'PURCHASE ORDER DOES NOT EXIST' TYPE 'E'.
ENDIF.
ENDIF.
ENDMODULE. " check_ebeln INPUT
&----
*& Module exit INPUT
&----
text
----
MODULE exit INPUT.
----
This is the Ok_code to Exit ONLY when the Exit button is pressed.
----
IF ok_code1 EQ 'EXIT' OR ok_code EQ 'EXIT'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " exit INPUT
&----
*& Module cancel INPUT
&----
text
----
MODULE cancel INPUT.
flag_cancel_yes = '1'.
CASE ok_code1.
WHEN 'CANCEL'.
----
If the user presses the cancel button in screen 2 and if it is not
display mode, a Pop-Up-Message is popped up to ask the user to
save or cancel.
----
IF sy-tcode <> 'ZT4_DISPLAY' AND datar_flag = '1'.
----
Calling a function for the Pop up message and storing the
user answer to ch.
----
CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'
IMPORTING
e_answer = ch.
----
If the input is N then leave the program.
----
IF ch = 'N'.
LEAVE PROGRAM.
----
If the input is J then initiate the Ok_code SAVE and set the flag to 0.
----
ELSEIF ch = 'J'.
ok_code1 = 'SAVE'.
flag_cancel_yes = '0'.
ENDIF.
ELSE.
LEAVE PROGRAM.
ENDIF.
CLEAR ok_code1.
ENDCASE.
ENDMODULE. " cancel INPUT
&----
*& Module check_for_change INPUT
&----
text
----
MODULE check_for_change INPUT.
----
If there is any change made by the user in any one of the feilds then
the sy-datar will be set to 1 else it will be 0.
----
IF sy-datar = 'X'.
datar_flag = '1'.
ENDIF.
ENDMODULE. " check_for_change INPUT
&----
*& Module check_bukrs INPUT
&----
text
----
MODULE check_bukrs INPUT.
----
Checking if the Comany Code is already present in the EKKO Table.
----
SELECT SINGLE bukrs FROM t001 INTO zteam4_ekko-bukrs WHERE bukrs =
zteam4_ekko-bukrs.
IF sy-subrc <> 0.
MESSAGE e000(e) WITH 'INVALID COMPANY CODE INPUT'.
ENDIF.
ENDMODULE. " check_bukrs INPUT
&----
*& Module check_lifnr INPUT
&----
text
----
MODULE check_lifnr INPUT.
----
Checking if the Vendor is already present in the EKKO Table.
----
SELECT SINGLE lifnr FROM lfa1 INTO zteam4_ekko-lifnr WHERE lifnr =
zteam4_ekko-lifnr.
IF sy-subrc <> 0.
MESSAGE e000(e) WITH 'INVALID VENDOR INPUT'.
ENDIF.
ENDMODULE. " check_lifnr INPUT
&----
*& Module check_waers INPUT
&----
text
----
MODULE check_waers INPUT.
----
Checking if the Currency is already present in the EKKO Table.
----
SELECT SINGLE waers FROM tcurc INTO zteam4_ekko-waers WHERE waers =
zteam4_ekko-waers.
IF sy-subrc <> 0.
MESSAGE e000(e) WITH 'INVALID CURRENCY INPUT'.
ENDIF.
ENDMODULE. " check_waers INPUT
&----
*& Module ctrl_tcl1 OUTPUT
&----
text
----
MODULE ctrl_tcl1 OUTPUT.
CASE sy-tcode.
----
We are disabling all the columns in all rows of the Item table for the
Create Transaction so that the Add button (which is pressed later)
will activate the single required line.
----
WHEN 'ZT4_CREATE'.
IF iline <> 0.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_ITEM' AND screen-name NE
'ITAB_ITEM-EBELP' AND
screen-name NE 'ITAB_ITEM-MATNR' AND screen-name NE
'ITAB_ITEM-MENGE' AND
screen-name NE 'ITAB_ITEM-EK_WAERS' AND screen-name NE
'ITAB_ITEM-MARK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
IF itab_item IS INITIAL.
screen-input = 1.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_ITEM'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
----
We are disabling all the columns in all rows of the Item table for the
Change Transaction so that the Add button (which is pressed later)
will activate the single required line.
----
WHEN 'ZT4_CHANGE'.
IF iline <> 0.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_ITEM' AND screen-name NE
'ITAB_ITEM-EBELP' AND
screen-name NE 'ITAB_ITEM-MATNR' AND screen-name NE
'ITAB_ITEM-MENGE' AND
screen-name NE 'ITAB_ITEM-EK_WAERS' AND screen-name NE
'ITAB_ITEM-MARK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
IF itab_item IS INITIAL.
screen-input = 1.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_ITEM'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
----
We are letting all the Colums and Rows of the Item table intact
so that they can be displayed for all the values that are present
in it.
----
WHEN 'ZT4_DISPLAY'.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_ITEM'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " ctrl_tcl1 OUTPUT
&----
*& Module check_matnr INPUT
&----
text
----
MODULE check_matnr INPUT.
----
We are validating if the Material Number entered in the table control
is the same as the material Number present in the MARA table.
----
DATA : itab_item1 LIKE itab_item.
SELECT SINGLE matnr FROM mara INTO itab_item1 WHERE matnr EQ
itab_item-matnr.
IF sy-subrc <> 0.
MESSAGE 'Invalid material Number' TYPE 'E'.
ENDIF.
----
Now we are checking if the Material Number in the Price Table is the
same as the Material number that we have just checked in the previous
select statement.
----
SELECT SINGLE netpr FROM zteam4_price INTO itab_item-price WHERE
matnr = itab_item-matnr.
IF sy-subrc <> 0.
MESSAGE 'ENTER VALUES IN ZPRICE TABLE FOR THIS' &
'MATERIAL NO' type 'E'.
ENDIF.
ENDMODULE. " check_matnr INPUT
&----
*& Module process_0022 INPUT
&----
text
----
MODULE process_0022 INPUT.
----
Selecting the single Quantity from Price table as per the
Material Number given in the Item's table.
----
SELECT SINGLE meins FROM zteam4_price INTO itab_item-meins WHERE
matnr = itab_item-matnr.
----
Selecting the single Price from Price table as per the Material Number
given in the Item's table.
----
SELECT SINGLE netpr FROM zteam4_price INTO itab_item-price WHERE
matnr = itab_item-matnr.
----
Selecting the single Currenct from Price table as per the
Material Number given in the Item's table.
----
SELECT SINGLE waers FROM zteam4_price INTO itab_item-waers WHERE
matnr = itab_item-matnr.
----
Selecting the single Material Description from Price table as per
the Material Number given in the Item's table.
----
SELECT SINGLE maktx FROM makt INTO itab_item-maktx WHERE matnr =
itab_item-matnr.
----
Transferring the same currency from ITEM table to EKKO table.
----
itab_item-ek_waers = zteam4_ekko-waers.
----
If the price entered is not zero or initial.
----
IF itab_item-price IS NOT INITIAL.
DATA actual_price LIKE zteam4_ekko-netpr.
----
Converting The currency entered to the local currency
----
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
date = sy-datum
foreign_amount = itab_item-price
foreign_currency = zteam4_ekko-waers
local_currency = itab_item-waers
RATE = 0
TYPE_OF_RATE = 'M'
READ_TCURR = 'X'
IMPORTING
EXCHANGE_RATE =
FOREIGN_FACTOR =
local_amount = actual_price
LOCAL_FACTOR =
EXCHANGE_RATEX =
FIXED_RATE =
DERIVED_RATE_TYPE =
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
itab_item-netpr = itab_item-menge * actual_price.
ENDIF.
ENDMODULE. " process_0022 INPUT
&----
*& Module ctrl1_tcl1 INPUT
&----
text
----
MODULE ctrl1_tcl1 INPUT.
----
We are not appending the values in the Table control to the current
line from the Internal Table Itab_Item.
----
MODIFY itab_item INDEX tcl1-current_line.
ENDMODULE. " ctrl1_tcl1 INPUT
&----
*& Module ctrl_tcl2 OUTPUT
&----
text
----
MODULE ctrl_tcl2 OUTPUT.
CASE sy-tcode.
----
When the transaction code is create we will be deactivating all the
Rows in the Table control of the Schedule table.
----
WHEN 'ZT4_CREATE'.
IF iline2 <> 0.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_SCHEDULE' AND screen-name NE
'ITAB_SCHEDULE-EBELP' AND
screen-name NE 'ITAB_SCHEDULE-ETENR' AND screen-name NE
'ITAB_SCHEDULE-MENGE' AND
screen-name NE 'ITAB_SCHEDULE-EINDT' AND screen-name NE
'ITAB_SCHEDULE-MARK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
IF itab_schedule IS INITIAL.
screen-input = 1.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_SCHEDULE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
----
When the transaction code is Change we will be deactivating all the
Rows in the Table control of the Schedule table.
----
WHEN 'ZT4_CHANGE'.
IF iline2 <> 0.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_SCHEDULE' AND screen-name NE
'ITAB_SCHEDULE-EBELP' AND
screen-name NE 'ITAB_SCHEDULE-ETENR' AND screen-name NE
'ITAB_SCHEDULE-MENGE' AND
screen-name NE 'ITAB_SCHEDULE-EINDT' AND screen-name NE
'ITAB_SCHEDULE-MARK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
IF itab_schedule IS INITIAL.
screen-input = 1.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_SCHEDULE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
----
When the transaction code is Display we will be selecting the line
to display only the values for that particular line.
----
WHEN 'ZT4_DISPLAY'.
LOOP AT SCREEN.
IF screen-name CS 'ITAB_SCHEDULE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " ctrl_tcl2 OUTPUT
&----
*& Module ctrl1_tcl2 INPUT
&----
text
----
MODULE ctrl1_tcl2 INPUT.
----
We are going to modify the values into the current line in the table
control of the schedule table.
----
MODIFY itab_schedule INDEX tcl2-current_line.
ENDMODULE. " ctrl1_tcl2 INPUT
&----
*& Module itemno_check INPUT
&----
text
----
MODULE itemno_check INPUT.
----
We are going to check the Item number entered is valid or not.
----
IF tabstrip1-activetab = 'SCHEDULE_LINES'
OR tabstrip1-activetab = 'LINE_ITEMS'
OR tabstrip1-activetab = 'HEADER_DETAILS'.
IF ok_code1 <> 'ADD1' AND ok_code1 <> 'ADD' AND
ok_code1 <> 'DELETE1' AND ok_code1 <> 'DELETE'
AND ok_code1 <> 'SELECT_ALL1' AND ok_code1 <> 'SELECT_ALL'
AND ok_code1 <> 'DESELECT_ALL1' AND ok_code1 <> 'DESELECT_ALL'
AND ok_code1 <> 'CANCEL'.
DATA: count TYPE i.
----
Here we are counting the total number of rows present in the
Internal table itab_item.
----
LOOP AT itab_item.
count = 0.
LOOP AT itab_schedule WHERE ebelp = itab_item-ebelp .
count = count + 1.
ENDLOOP.
----
If there are no lines present then display the following message.
----
IF count = 0.
MESSAGE 'Item Number does not exists in Schedule Line'
TYPE 'I'.
CLEAR ok_code1.
ENDIF.
ENDLOOP.
----
Here we are counting the total number of rows present in the
Internal table itab_shedule for the condition item number is
the same in the Itab_item internal table.
----
LOOP AT itab_schedule.
count = 0.
LOOP AT itab_item WHERE ebelp = itab_schedule-ebelp .
count = count + 1.
ENDLOOP.
----
If there are no lines present then display the following message.
----
IF count = 0.
MESSAGE 'Item Number does not exists in Line Item' TYPE 'I'.
CLEAR ok_code1.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
CLEAR ok_code1.
ENDMODULE. " itemno_check INPUT
&----
*& Include ZTEAM4_I01 *
&----
&----
*& Module USER_COMMAND_0001 INPUT
&----
text
----
MODULE user_command_0001 INPUT.
----
Using Ok_Code to go to the correct screen using the pressed button.
----
CASE ok_code.
----
When Create Call the screen with the Tabs and Subscreens to get input.
----
WHEN 'CREATE'.
CALL SCREEN 0002.
WHEN 'CHANGE'.
----
When Change Select all the respective fields from the database and
Store them into the corresponding internal table and work area, for
the User Input (that is EBELN).
----
SELECT SINGLE * FROM zteam4_ekko INTO
CORRESPONDING FIELDS OF zteam4_ekko
WHERE ebeln = zteam4_ekko-ebeln.
SELECT * FROM zteam4_ekpo INTO CORRESPONDING FIELDS OF TABLE
itab_item WHERE ebeln = zteam4_ekko-ebeln.
LOOP AT itab_item WHERE ebeln = zteam4_ekko-ebeln.
SELECT SINGLE maktx FROM makt
INTO itab_item-maktx WHERE matnr = itab_item-matnr
AND spras = sy-langu.
SELECT SINGLE netpr meins FROM zteam4_price
INTO CORRESPONDING FIELDS OF itab_item
WHERE matnr = itab_item-matnr.
SELECT SINGLE waers FROM zteam4_ekko
INTO itab_item-ek_waers WHERE ebeln = itab_item-ebeln.
MODIFY itab_item.
ENDLOOP.
SELECT * FROM zteam4_eket
INTO CORRESPONDING FIELDS OF TABLE itab_schedule
WHERE ebeln = zteam4_ekko-ebeln.
----
After collecting all the data from all the table with User Inout EBELN
as the main feild, we are calling the next screen.
----
LEAVE TO SCREEN 0002.
----
When DISPLAY Select all the respective fields from the database and
Store them into the corresponding internal table and work area,
so that they can be displayed in all the feilds of the next screen..
----
WHEN 'DISPLAY'.
SELECT SINGLE * FROM zteam4_ekko INTO
CORRESPONDING FIELDS OF zteam4_ekko
WHERE ebeln = zteam4_ekko-ebeln.
SELECT * FROM zteam4_ekpo INTO CORRESPONDING FIELDS OF TABLE
itab_item WHERE ebeln = zteam4_ekko-ebeln.
LOOP AT itab_item. "WHERE ebeln = zteam4_ekko-ebeln.
SELECT SINGLE maktx FROM makt
INTO itab_item-maktx WHERE matnr = itab_item-matnr
AND spras = sy-langu.
SELECT SINGLE netpr meins FROM zteam4_price
INTO CORRESPONDING FIELDS OF itab_item
WHERE matnr = itab_item-matnr.
SELECT SINGLE waers FROM zteam4_ekko
INTO itab_item-ek_waers WHERE ebeln = itab_item-ebeln.
MODIFY itab_item.
ENDLOOP.
SELECT * FROM zteam4_eket
INTO CORRESPONDING FIELDS OF TABLE itab_schedule
WHERE ebeln = zteam4_ekko-ebeln.
----
After selecting all the feilds using the user input we are navigating
to the next screen to display all the values.
----
LEAVE TO SCREEN 0002.
ENDCASE.
ENDMODULE. " USER_COMMAND_0001 INPUT
&----
*& Module USER_COMMAND_0002 INPUT
&----
text
----
MODULE user_command_0002 INPUT.
CASE ok_code1.
WHEN 'SAVE'.
----
To Sum up the quantity in schedule lines to check with the quantity
in Line Items table.
----
DATA flag_sum TYPE i.
flag_sum = 0.
IF tabstrip1-activetab = 'SCHEDULE_LINES'
OR tabstrip1-activetab = 'LINE_ITEMS'
OR tabstrip1-activetab = 'HEADER_DETAILS'.
DATA sum TYPE i.
----
We are looping at the number of Itab_item contents and as many
Quantity is present for the same Item Number we are adding it to Sum.
----
LOOP AT itab_item.
sum = 0.
LOOP AT itab_schedule WHERE ebelp = itab_item-ebelp.
sum = sum + itab_schedule-menge.
ENDLOOP.
----
If the Sum of the quantity does not match a error message is displayed
----
IF sum <> itab_item-menge.
MESSAGE 'Sum of the corresponding item no.' &
'quantity not matched with line ite' & 'ms '
type 'I'.
flag_sum = 1.
ENDIF.
ENDLOOP.
ENDIF.
----
if the sum is the same then we are saving the data.
----
IF flag_sum = 0.
MODIFY zteam4_ekko.
MESSAGE 'SAVED SUCCESSFULLY' TYPE 'I'.
DELETE FROM zteam4_ekpo WHERE ebeln = zteam4_ekko-ebeln.
LOOP AT itab_item.
zteam4_ekpo-ebeln = zteam4_ekko-ebeln.
zteam4_ekpo-ebelp = itab_item-ebelp.
zteam4_ekpo-matnr = itab_item-matnr.
zteam4_ekpo-menge = itab_item-menge.
zteam4_ekpo-meins = itab_item-meins.
zteam4_ekpo-netpr = itab_item-netpr.
zteam4_ekpo-waers = itab_item-waers.
MODIFY zteam4_ekpo.
ENDLOOP.
DELETE FROM zteam4_eket WHERE ebeln = zteam4_ekko-ebeln.
LOOP AT itab_schedule.
zteam4_eket-ebeln = zteam4_ekko-ebeln.
zteam4_eket-ebelp = itab_schedule-ebelp.
zteam4_eket-etenr = itab_schedule-etenr.
zteam4_eket-menge = itab_schedule-menge.
zteam4_eket-eindt = itab_schedule-eindt.
MODIFY zteam4_eket.
ENDLOOP.
ENDIF.
CLEAR ok_code1.
----
Setting all the user made changes (inside the program) to blank.
----
sy-datar = ' '.
IF flag_cancel_yes = '0'.
LEAVE PROGRAM.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0002 INPUT
&----
*& Module USER_COMMAND_0021 INPUT
&----
text
----
MODULE user_command_0021 INPUT.
ENDMODULE. " USER_COMMAND_0021 INPUT
&----
*& Module USER_COMMAND_0022 INPUT
&----
text
----
MODULE user_command_0022 INPUT.
----
Here we are writing the code for the Add, Dell and other buttons.
----
IF tabstrip1-activetab = 'LINE_ITEMS'.
flag = '0'.
CASE ok_code1.
----
When Add Button is pressed we are going to add a new line to the
Table control.
----
WHEN 'ADD'.
LOOP AT itab_item.
IF itab_item-mark = 'X'.
INSERT initial line INTO itab_item.
flag = '1'.
ENDIF.
ENDLOOP.
----
If the flag value is one then we will be appending a initial line
That is the line will be added to the top of the table.
----
IF flag <> '1'.
APPEND INITIAL LINE TO itab_item.
ENDIF.
CLEAR ok_code1.
----
When Delete is pressed we are going to delete the selected line
from the table control.
----
WHEN 'DELETE'.
LOOP AT itab_item.
IF itab_item-mark = 'X'.
MOVE-CORRESPONDING itab_item TO item_delete.
APPEND item_delete.
CLEAR item_delete.
CLEAR itab_item.
DELETE itab_item.
ENDIF.
ENDLOOP.
CLEAR ok_code1.
----
When the Select button is pressed the rows are selected.
----
WHEN 'SELECT_ALL'.
LOOP AT itab_item.
itab_item-mark = 'X'.
MODIFY itab_item.
ENDLOOP.
CLEAR ok_code1.
----
When the Deselect button is pressed all the rows are deselected.
----
WHEN 'DESELECT_ALL'.
LOOP AT itab_item.
itab_item-mark = ' '.
MODIFY itab_item.
ENDLOOP.
CLEAR ok_code1.
ENDCASE.
ENDIF.
ENDMODULE. " USER_COMMAND_0022 INPUT
&----
*& Module USER_COMMAND_0023 INPUT
&----
text
----
MODULE user_command_0023 INPUT.
flag = '0'.
----
Here we are writing the code for the Add, Dell and other buttons.
----
CASE ok_code1.
----
When Add Button is pressed we are going to add a new line to the
Table control.
----
WHEN 'ADD1'.
LOOP AT itab_schedule.
IF itab_schedule-mark = 'X'.
INSERT initial line INTO itab_schedule.
flag = '1'.
ENDIF.
ENDLOOP.
----
If the flag value is one then we will be appending a initial line
That is the line will be added to the top of the table.
----
IF flag <> '1'.
APPEND INITIAL LINE TO itab_schedule.
ENDIF.
CLEAR ok_code1.
----
When Delete is pressed we are going to delete the selected line
from the table control.
----
WHEN 'DELETE1'.
LOOP AT itab_schedule.
IF itab_schedule-mark = 'X'.
CLEAR itab_schedule.
DELETE itab_schedule.
ENDIF.
ENDLOOP.
CLEAR ok_code1.
----
When the Select button is pressed the rows are selected.
----
WHEN 'SELECT_ALL1'.
LOOP AT itab_schedule.
itab_schedule-mark = 'X'.
MODIFY itab_schedule.
ENDLOOP.
CLEAR ok_code1.
----
When the Deselect button is pressed all the rows are deselected.
----
WHEN 'DESELECT_ALL1'.
LOOP AT itab_schedule.
itab_schedule-mark = ' '.
MODIFY itab_schedule.
ENDLOOP.
CLEAR ok_code1.
ENDCASE.
ENDMODULE. " USER_COMMAND_0023 INPUT
&----
*& Include ZTEAM4_O01 *
&----
&----
*& Module STATUS_0001 OUTPUT
&----
text
----
MODULE status_0001 OUTPUT.
SET PF-STATUS 'PF1'.
SET TITLEBAR 'T1'.
----
As per the transaction that is called we are disabling the buttons.
----
CASE sy-tcode.
WHEN 'ZT4_CREATE'.
SET TITLEBAR 'T1' WITH 'CREATE'.
LOOP AT SCREEN.
IF screen-name = 'DISPLAY' OR screen-name = 'CHANGE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN 'ZT4_CHANGE'.
SET TITLEBAR 'T1' WITH 'CHANGE'.
LOOP AT SCREEN.
IF screen-name = 'DISPLAY' OR screen-name = 'CREATE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN 'ZT4_DISPLAY'.
SET TITLEBAR 'T1' WITH 'DISPLAY'.
SET PF-STATUS 'PF2'.
LOOP AT SCREEN.
IF screen-name = 'CREATE' OR screen-name = 'CHANGE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " STATUS_0001 OUTPUT
&----
*& Module STATUS_0002 OUTPUT
&----
text
----
MODULE status_0002 OUTPUT.
SET PF-STATUS 'PF1'.
CASE ok_code.
WHEN 'CREATE'.
SET TITLEBAR 'T1' WITH 'CREATE'.
WHEN 'CHANGE'.
SET TITLEBAR 'T1' WITH 'CHANGE'.
WHEN 'DISPLAY'.
SET TITLEBAR 'T1' WITH 'DISPLAY'.
SET PF-STATUS 'PF2'.
ENDCASE.
LOOP AT SCREEN.
IF screen-name = 'ZTEAM4_EKKO-EBELN'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
DATA iline TYPE i.
----
Returns the number of lines in the itab_item.
----
DESCRIBE TABLE itab_item LINES iline.
tcl1-lines = iline.
DATA iline2 TYPE i.
----
Returns the number of lines in the itab_schedule.
----
DESCRIBE TABLE itab_schedule LINES iline2.
tcl2-lines = iline2.
LOOP AT itab_item.
IF itab_item-price IS NOT INITIAL.
SUM.
zteam4_ekko-netpr = itab_item-netpr.
ENDIF.
ENDLOOP.
ENDMODULE. " STATUS_0002 OUTPUT
&----
*& Module STATUS_0021 OUTPUT
&----
text
----
MODULE status_0021 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
----
Selecting the corresponding values when Display button is pressed.
----
CASE ok_code.
WHEN 'DISPLAY'.
SELECT SINGLE * FROM zteam4_ekko INTO zteam4_ekko WHERE ebeln =
zteam4_ekko-ebeln.
LOOP AT SCREEN.
IF screen-name CS 'ZTEAM4_EKKO'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
----
Selecting the corresponding values when Change button is pressed.
----
WHEN 'CHANGE'.
SELECT SINGLE * FROM zteam4_ekko INTO zteam4_ekko WHERE ebeln =
zteam4_ekko-ebeln.
ENDCASE.
ENDMODULE. " STATUS_0021 OUTPUT
&----
*& Module STATUS_0022 OUTPUT
&----
text
----
MODULE status_0022 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
CASE sy-tcode.
----
When transaction code is Display we are disabling the Select all and
Deselect All buttons.
----
WHEN 'ZT4_DISPLAY'.
LOOP AT SCREEN.
IF screen-name EQ 'SELECT_ALL' OR screen-name EQ 'DESELECT_ALL'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
----
When transaction code is Display we are disabling the Add and
Delete buttons.
----
LOOP AT SCREEN.
IF screen-name EQ 'ADD' OR screen-name EQ 'DELETE'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " STATUS_0022 OUTPUT
&----
*& Module STATUS_0023 OUTPUT
&----
text
----
MODULE status_0023 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
----
Changes the attributes belonging to the current screen field whilst
processing with LOOP AT SCREEN .
----
CASE sy-tcode.
----
When transaction code is Display we are disabling the Select all and
Deselect All buttons.
----
WHEN 'ZT4_DISPLAY'.
LOOP AT SCREEN.
IF screen-name EQ 'SELECT_ALL' OR screen-name EQ 'DESELECT_ALL'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
----
When transaction code is Display we are disabling the Add and
Delete buttons.
----
LOOP AT SCREEN.
IF screen-name EQ 'ADD' OR screen-name EQ 'DELETE'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " STATUS_0023 OUTPUT
&----
*& Include ZTEAM4_TOP *
&----
*PROGRAM zteam4_2_proj.
DATA : flag_cancel_yes(1) TYPE c.
************************************************************************
INCLUDING THE TABLES *
************************************************************************
TABLES: zteam4_ekko,zteam4_ekpo,zteam4_eket,zteam4_price,makt.
DATA: ok_code TYPE sy-ucomm.
DATA: ok_code1 TYPE sy-ucomm.
************************************************************************
DEFINING THE TABSTRIP *
************************************************************************
CONTROLS tabstrip1 TYPE TABSTRIP.
DATA: subscreen1(4) TYPE c VALUE '0021',
subscreen2(4) TYPE c VALUE '0022',
subscreen3(4) TYPE c VALUE '0023'.
************************************************************************
DEFINING THE INTERNAL TABLE *
************************************************************************
DATA: BEGIN OF itab_item OCCURS 0,
mark TYPE c,
ebeln LIKE zteam4_ekko-ebeln,
ebelp LIKE zteam4_ekpo-ebelp,
matnr LIKE zteam4_ekpo-matnr,
menge LIKE zteam4_ekpo-menge,
maktx LIKE makt-maktx,
price LIKE zteam4_price-netpr,
waers LIKE zteam4_price-waers,
meins LIKE zteam4_price-meins,
netpr LIKE zteam4_ekko-netpr,
ek_waers LIKE zteam4_ekko-waers,
END OF itab_item.
DATA: BEGIN OF itab_schedule OCCURS 0,
mark TYPE c,
ebeln LIKE zteam4_ekpo-ebeln,
ebelp LIKE zteam4_ekpo-ebelp,
etenr LIKE zteam4_eket-etenr,
menge LIKE zteam4_eket-menge,
eindt LIKE zteam4_eket-eindt,
END OF itab_schedule.
DATA : BEGIN OF item_delete OCCURS 0,
ebeln LIKE zteam4_ekko-ebeln,
ebelp LIKE zteam4_ekpo-ebelp,
matnr LIKE mara-matnr,
menge LIKE zteam4_ekpo-menge,
meins LIKE zteam4_price-meins,
netpr LIKE zteam4_ekpo-netpr,
waers LIKE zteam4_ekko-waers,
END OF item_delete.
DATA: itab_schedule1 LIKE itab_schedule.
************************************************************************
TABLE CONTROL DECLARATION *
************************************************************************
CONTROLS tcl1 TYPE TABLEVIEW USING SCREEN '0022'.
CONTROLS tcl2 TYPE TABLEVIEW USING SCREEN '0023'.
DATA: ch TYPE c.
DATA : flag TYPE c.
DATA : datar_flag TYPE c VALUE '0'.
03-17-2008 5:55 AM
Hi,
ABAPDOCU is the best source for those things and u will find things from simple to complex.
03-17-2008 5:57 AM
03-17-2008 6:07 AM
Hi friend,
Go to SE38 and enter in program name,
Demo_dynpro_*.
Here u will find lots of MPP examples.
Here i am sending u the link that will come to great help.
http://help.sap.com/saphelp_nw70/helpdata/en/17/5bf1b52ba211d2954f0000e8353423/frameset.htm
Please go through this link as i have send u almost the tutorial.
Please reward me with the maximum because i checked that no body except me has posted u with the appropriate answer.
I am also new to Sap Abap. So kindly reward
thanx
take care. Good day.
03-17-2008 6:21 AM
Hi,
Use the following transcation.
ABAP DOCU
BIBS
LIBS
dwdm
Regards,
Niyaz
03-17-2008 10:16 AM
hI,
YOU CAN FIND Demo programs in the tcode ABAPDOCU.
regards,
vineela.