2006 Dec 05 11:56 AM
HELLO,
Placing table controls and transferring data from one table control to other. ( Add, Insert, remove)
a. Make all matnr from MARA to display in the first table control.
b. Place three push buttons ADD, INSERT, And REMOVE.
c. If Add is pressed the selected row in the first table control should be displayed in second table control and that should be deleted in the first table control.
d. If Insert is pressed the selected row in the first table control should be inserted after the selected row in the second table control.
e. If Remove is pressed it is reverse to Add.
THIS IS THE REQUIREMENT..CAN SOME ONE HELP ME HOW TO DO THAT...........I AM NEW TO MODULE POOL PROGRAMMING.
THANKING U IN ANTICIPATION.
REGARDS,
SUPRIYA MANIK.
2006 Dec 05 12:20 PM
In this program the Functioncode Arrow is used to move a row from one table control to another table control
Check this.
<b>Flow Logic.</b>
PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.
LOOP AT ITAB WITH CONTROL TC.
ENDLOOP.
LOOP AT ITAB1 WITH CONTROL TC1.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9000.
LOOP AT ITAB.
MODULE SC.
MODULE LIST_9000.
ENDLOOP.
LOOP AT ITAB1.
ENDLOOP.
<b>Main Program</b>
REPORT ZTCONTROL .
TABLES : ZSALESITEM.
DATA : ITAB LIKE TABLE OF ZSALESITEM WITH HEADER LINE,
ITAB1 LIKE TABLE OF ZSALESITEM WITH HEADER LINE,
ITAB2 LIKE TABLE OF ZSALESITEM WITH HEADER LINE.
DATA : FLAG TYPE I, SC TYPE C, LINES TYPE I.
CONTROLS TC TYPE TABLEVIEW USING SCREEN 9000.
CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 9000.
TYPE-POOLS VRM.
DATA LIST TYPE VRM_VALUES.
CALL SCREEN 9000.
&----
*& Module USER_COMMAND_9000 INPUT
&----
text
----
MODULE USER_COMMAND_9000 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
FORM MOVETC.
ITAB1-ITEMNO = ITAB-ITEMNO.
ITAB1-MATERIALNO = ITAB-MATERIALNO.
ITAB1-QUANTITY = ITAB-QUANTITY.
ITAB1-PRICE = ITAB-PRICE.
ITAB1-AMOUNT = ITAB-AMOUNT.
*MODIFY ITAB1 INDEX TC1-CURRENT_LINE.
*IF SY-SUBRC <> 0.
APPEND ITAB1.
*ENDIF.
ENDFORM.
&----
*& Module LIST_9000 INPUT
&----
text
----
MODULE LIST_9000 INPUT.
SELECT SALESORDERNO FROM ZSALESITEM INTO TABLE LIST.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'ITAB-SALESORDERNO'
VALUES = LIST.
ITAB-ITEMNO = SY-STEPL.
SELECT SINGLE MATERIALNO PRICE FROM ZSALESITEM INTO
(ITAB-MATERIALNO,ITAB-PRICE)
WHERE SALESORDERNO = ITAB-SALESORDERNO.
ITAB-AMOUNT = ITAB-QUANTITY * ITAB-PRICE.
MODIFY ITAB INDEX TC-CURRENT_LINE.
IF SY-SUBRC <> 0.
APPEND ITAB.
ENDIF.
ENDMODULE. " LIST_9000 INPUT
&----
*& Module STATUS_9000 OUTPUT
&----
text
----
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
PERFORM SCROLL.
ENDMODULE. " STATUS_9000 OUTPUT
FORM SCROLL.
DESCRIBE TABLE ITAB LINES LINES.
IF LINES IS INITIAL.
TC-LINES = LINES + 1.
ELSE.
TC-LINES = LINES + 1.
ENDIF.
ENDFORM.
&----
*& Module SC INPUT
&----
text
----
MODULE SC INPUT.
CASE SY-UCOMM.
WHEN 'ARROW'.
IF SC = 'X'.
PERFORM MOVETC.
ENDIF.
ENDCASE.
ENDMODULE. " SC INPUT
2006 Dec 05 12:20 PM
In this program the Functioncode Arrow is used to move a row from one table control to another table control
Check this.
<b>Flow Logic.</b>
PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.
LOOP AT ITAB WITH CONTROL TC.
ENDLOOP.
LOOP AT ITAB1 WITH CONTROL TC1.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9000.
LOOP AT ITAB.
MODULE SC.
MODULE LIST_9000.
ENDLOOP.
LOOP AT ITAB1.
ENDLOOP.
<b>Main Program</b>
REPORT ZTCONTROL .
TABLES : ZSALESITEM.
DATA : ITAB LIKE TABLE OF ZSALESITEM WITH HEADER LINE,
ITAB1 LIKE TABLE OF ZSALESITEM WITH HEADER LINE,
ITAB2 LIKE TABLE OF ZSALESITEM WITH HEADER LINE.
DATA : FLAG TYPE I, SC TYPE C, LINES TYPE I.
CONTROLS TC TYPE TABLEVIEW USING SCREEN 9000.
CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 9000.
TYPE-POOLS VRM.
DATA LIST TYPE VRM_VALUES.
CALL SCREEN 9000.
&----
*& Module USER_COMMAND_9000 INPUT
&----
text
----
MODULE USER_COMMAND_9000 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
FORM MOVETC.
ITAB1-ITEMNO = ITAB-ITEMNO.
ITAB1-MATERIALNO = ITAB-MATERIALNO.
ITAB1-QUANTITY = ITAB-QUANTITY.
ITAB1-PRICE = ITAB-PRICE.
ITAB1-AMOUNT = ITAB-AMOUNT.
*MODIFY ITAB1 INDEX TC1-CURRENT_LINE.
*IF SY-SUBRC <> 0.
APPEND ITAB1.
*ENDIF.
ENDFORM.
&----
*& Module LIST_9000 INPUT
&----
text
----
MODULE LIST_9000 INPUT.
SELECT SALESORDERNO FROM ZSALESITEM INTO TABLE LIST.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'ITAB-SALESORDERNO'
VALUES = LIST.
ITAB-ITEMNO = SY-STEPL.
SELECT SINGLE MATERIALNO PRICE FROM ZSALESITEM INTO
(ITAB-MATERIALNO,ITAB-PRICE)
WHERE SALESORDERNO = ITAB-SALESORDERNO.
ITAB-AMOUNT = ITAB-QUANTITY * ITAB-PRICE.
MODIFY ITAB INDEX TC-CURRENT_LINE.
IF SY-SUBRC <> 0.
APPEND ITAB.
ENDIF.
ENDMODULE. " LIST_9000 INPUT
&----
*& Module STATUS_9000 OUTPUT
&----
text
----
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
PERFORM SCROLL.
ENDMODULE. " STATUS_9000 OUTPUT
FORM SCROLL.
DESCRIBE TABLE ITAB LINES LINES.
IF LINES IS INITIAL.
TC-LINES = LINES + 1.
ELSE.
TC-LINES = LINES + 1.
ENDIF.
ENDFORM.
&----
*& Module SC INPUT
&----
text
----
MODULE SC INPUT.
CASE SY-UCOMM.
WHEN 'ARROW'.
IF SC = 'X'.
PERFORM MOVETC.
ENDIF.
ENDCASE.
ENDMODULE. " SC INPUT
2006 Dec 05 12:29 PM
hi,
Goto SE81. create a new program.
Define two internal tables itab1 and itab2.
in first internal table get all the material master data.
create a new screen.
drag the table control wizard and associate the table itab1 with this table control. Include the button add, insert and delete.
drag another table control wizard and associate the table itab2 with this table control.
the code gets generated for the buttons as well as the table control.
you need to make some changes in the code as per your requirement.
for first table control chck out the code for insert/add/delete button and comment the code used in this. Instead, add the record(that is selected in itab1) in table itab2 and delete this record from itab1.
Do this as per your requirement.
Hope this helps
Regards,
Richa