Wednesday 12 June 2013

Steps to work on Table control in module pool

Step1: create a module pool progream in SE80 with TOP include.

Step2: create the screen by right clicking the program and enter the mandatory parameters.

  Here to place the table on the table control we have two ways.

1) Click on the Dictionary symbol on the screen top right corner with red light(middle)

2) One window will open and here you can give the standard structure neme, click on get from dictonary and select the required fields and click on OK and place the same in table control created.

It may give some problems is displaying the data.

OR

2) in window Give the structure created in the Table/Field name and and click on get from program, it will show all the fields declared in that structure. select the required fields to display.

Here you wont get the headers defaultly, you have to drage and drop a TEXT on top of the corresponding column and give the name over there for that column.

Step3: Now Drag and drop the table control icon in tool bar to the screen and specfy some name( ex:TC) to the table control and select the chek boxes of RESIZING and SEPARATORS.

step4: Come back to the TOP include and declere the internal table and you have to write control ststement.

PROGRAM  SAPMZ_TABLE_CONTROLS1.
TABLES mara.
CONTROLS tc TYPE TABLEVIEW USING SCREEN 9001.
data : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.


Here 'TC' is the etable control name.(here dont copy the code just write it other wise in you will face dumps)

Step5: Now Double click on the screen(9001) and Enable the PF status in PBO
Step6: In PBO write the select statement to select the data into internal table.

  MODULE fetch_data.
  module FETCH_DATA output.
 select * from mara into TABLE it_mara UP TO 30  ROWS.
endmodule. 


Step7: After fetching the data write the loop ststement like below.
   LOOP AT it_mara WITH CONTROL tc CURSOR tc-current_line.
  ENDLOOP.

*Here TC is the table control(in screen) name.

Step8: Now come to the PAI module.
write the below statements and write the modify ststement in the module.
    LOOP AT it_mara.
    MODULE modify_tc.
  ENDLOOP.


  module MODIFY_TC input.
MODIFY it_mara INDEX tc-current_line.
endmodule.                 " MODIFY_TC  INPUT


Step9: Activate the Program globally.
Step10: Cretate Transaction for the same program amd execute.





No comments:

Post a Comment