Application Development 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: 

Need Help for Module Pool

Former Member
0 Kudos

hello friends

i m new in ABAP

i had designed database and now i want to enter the data through module pool so please guide me about the module pool and insert condition how could i do that

Do post friends...................

Waiting for ure precious suggestions

With Best Regards

Ruby

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

This code is Addition and Subraction of two numbers stored in database table.

so this code will help you

**Main Program********

&----


*& Module pool ZADD *

*& *

&----


*& *

*& *

&----


PROGRAM ZADD.

TABLES ZADD.

DATA: OK_CODE LIKE SY-UCOMM.

INCLUDE ZADD_PBO.

INCLUDE ZADD_PAI.

**Main part is over***********

PROCESS BEFORE OUTPUT.

MODULE STATUS_1000.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1000.

----


***INCLUDE ZADD_PBO .

----


&----


*& Module STATUS_1000 OUTPUT

&----


  • text

----


MODULE STATUS_1000 OUTPUT.

SET PF-STATUS 'PF01'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_1000 OUTPUT

&----


*& Module USER_COMMAND_1000 INPUT

&----


  • text

----


MODULE USER_COMMAND_1000 INPUT.

CASE OK_CODE.

WHEN 'ADDITION'.

ZADD-ADD1 = ZADD-NUMBER1 + ZADD-NUMBER2.

WHEN 'SUBTRACT'.

ZADD-SUB = ZADD-NUMBER1 - ZADD-NUMBER2.

WHEN 'SAVE'.

INSERT ZADD.

ENDCASE.

ENDMODULE. " USER_COMMAND_1000 INPUT

IF HELPFULL REWARD

8 REPLIES 8

Former Member
0 Kudos

Hi,

screen programming is nothing but module pool programming,

please check out the below links it might help you

http://help.sap.com/saphelp_nw04/helpdata/en/e4/2adbef449911d1949c0000e8353423/frameset.htm

http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm

http://www.thespot4sap.com/articles/SAP_Design_Introduction.asp

http://help.sap.com/saphelp_46c/helpdata/en/fc/eb2d67358411d1829f0000e829fbfe/frameset.htm

HERE IS THE SAMPLE PROGRAM

PROGRAM DEMO_DYNPRO_INPUT_OUTPUT.

DATA: INPUT TYPE I,

OUTPUT TYPE I,

RADIO1, RADIO2, RADIO3, BOX1, BOX2, BOX3, EXIT.

CALL SCREEN 100.

MODULE INIT_SCREEN_100 OUTPUT.

CLEAR INPUT.

RADIO1 = 'X'.

CLEAR: RADIO2, RADIO3.

ENDMODULE.

MODULE USER_COMMAND_0100 INPUT.

OUTPUT = INPUT.

BOX1 = RADIO1.

BOX2 = RADIO2.

BOX3 = RADIO3.

IF EXIT NE SPACE.

LEAVE PROGRAM.

ENDIF.

ENDMODULE.

FOR MORE DETAILS PLEASE FOLLOW THE LINK BELOW

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dba9e735c111d1829f0000e829fbfe/content.htm

**********please reward points if the information is helpful to you***********

0 Kudos

please suggest me how to continue and the steps that will help me to save data in database through Module pool using text boxes

Hope u got my point

Former Member
0 Kudos

Hi Ruby,

There is lot of help available on SDN, please search.

1. In your case through SE51 create Screen to Enter a data, or in program write a statemetn call screen <srno> and double click , it will take you to SE51.

See help.sap.com to design a screen.

2. Go to flow logic of it and you wll find PBO and PAI modules. create your own module or double click on them

3. Above step will take you to your program or report. Write your code to insert data selected on screen to yur database.

Reward if useful!

0 Kudos

These steps i know i m using se80 and had make a progarm in that and set the PBO

actually i want wat steps or internal table or u can say code in PAI which will help me in inserting the data

i had made a module pool program but how to go further

Please provide me the link if u know that will help me out

step by step

With Best Regards

ruby

0 Kudos

hi ruby

can u give me your mail id?

please....

bhanu

Former Member
0 Kudos

Hi,

Check this thread:

Former Member
0 Kudos

Create Table Control screen in Module Pool



· Step 1 (Create new structure for table control)



Type is name of structure (ZTC_EKKO) and press create
· Step 2 (Create Program)

Goto transaction SE80(Object Navigator) -> Repository Browser -> Program.

Enter your program name, please ensure that is begins with SAPMZ…… as this is a module pool (dialog program).

Press enter to create, and press yes!
Ensure that you create a top include, and press Enter.

Accept the name created for the top include.

Press Enter.

Create Table Control



· Step 1 (Create new structure for table control)



Type is name of structure (ZTC_EKKO) and press create

Enter the fields that you want to display in the table control. Example uses fields from EKKO.


Now save and activate it!

· Step 2 (Create Program)


Goto transaction SE80(Object Navigator) -> Repository Browser -> Program.

Enter your program name, please ensure that is begins with SAPMZ…… as this is a module pool (dialog program).

Press enter to create, and press yes!

Ensure that you create a top include, and press Enter.

Accept the name created for the top include.

Press Enter.
Press Save

· Step 3 (Create TOP include)

Double click on the top include and enter following ABAP code:
Tables: ZTC_EKKO.

controls: tc100 type tableview using screen 100.



data: ok_code type sy-ucomm.

data: it_ekko type standard

table of ZTC_EKKO initial size 0,

wa_ekko type ZTC_EKKO.

data: ok_code type sy-ucomm.


· Step 4 (Create screen)

Right click the program to create a screen 100 for the dialog. Enter Short description, set screen type to Normal and enter 0 or blank into Next screen. Then move to Element List tab and enter the OK code as OK_CODE (i.e. the same as what you declared in the top include with data: ok_code type sy-ucomm).

· Step 5 (Create table control)



Press the Layout button to bring up the screen painter editor.
Press table control button and drag it on to the screen, enter the name of table control created in TOP include (TC100). Now press the yellow button for attributes and set the table control as below options


Create Table Control



· Step 1 (Create new structure for table control)

Type is name of structure (ZTC_EKKO) and press create









Enter the fields that you want to display in the table control. Example uses fields from EKKO.



Now save and activate it!






· Step 2 (Create Program)

Goto transaction SE80(Object Navigator) -> Repository Browser -> Program.

Enter your program name, please ensure that is begins with SAPMZ…… as this is a module pool (dialog program).

Press enter to create, and press yes!





Ensure that you create a top include, and press Enter.






Accept the name created for the top include.

Press Enter.




Press Save



· Step 3 (Create TOP include)

Double click on the top include and enter following ABAP code:


Tables: ZTC_EKKO.


controls: tc100 type tableview using

screen 100.

data: ok_code type sy-ucomm.

data: it_ekko type standard 

           table of ZTC_EKKO initial size 0,

        wa_ekko type ZTC_EKKO.

data: ok_code type sy-ucomm.

Press Save and Activate


· Step 4 (Create screen)



Right click the program to create a screen 100 for the dialog. Enter Short description, set screen type to Normal and enter 0 or blank into Next screen. Then move to Element List tab and enter the OK code as OK_CODE (i.e. the same as what you declared in the top include with data: ok_code type sy-ucomm).




· Step 5 (Create table control)





Press the Layout button to bring up the screen painter editor.


Press table control button and drag it on to the screen, enter the name of table control created in TOP include (TC100). Now press the yellow button for attributes and set the table control as below options


· Step 6 (Populate table control )



Press the orange button (Fields). On the next screen enter ZTC_EKKO and press the ‘Get from Dict’ button. Select the fields you want (all) and press enter. Now drag them onto your Table Control.

Below is the result, there will been syntax errors if we check now! So Save and go back
into the flow logic tab.

· Step 7 (Create flow control )

Within the flow logic of screen 100 and create two modules, one to select the data from the database and the other to move the selected fields into the table control. Also insert the two loop statements to populate and retrieve the lines of the table control.

PROCESS BEFORE OUTPUT.

  • MODULE STATUS_0100.

module data_retrieval.

loop at it_ekko into wa_ekko with control TC100.

module populate_screen.

endloop.

*

PROCESS AFTER INPUT.

loop at it_ekko.

endloop.

  • MODULE USER_COMMAND_0100.

Double click the module data_retrieval to create and click yes to get past the popup. Ensure that a new include is created to hold all the PBO modules (default). Press enter.

Select 10 rows of data from the EKKO table and load into the internal table it_ekko. Go back to the flow logic to load this data into the Table Control.

*----


*

***INCLUDE MZ_TCONTROL_DATA_RETRIEVALO01 .

*----


*

*&----


*

*& Module data_retrieval OUTPUT

*&----


*

  • text

*----


*

MODULE data_retrieval OUTPUT.

  • select data from ekko table

SELECT ebeln bukrs bstyp bsart

bsakz loekz statu aedat

UP TO 10 ROWS

FROM ekko

INTO CORRESPONDING FIELDS OF TABLE it_ekko.

ENDMODULE. " data_retrieval OUTPUT

Double click the module populate_screen to create. Now move the values in this loop from the wa_ekko into the Table Control with the move-corresponding statement.

MODULE populate_screen OUTPUT.

    DATA: ld_line TYPE i.
*   Set which line of table is a top of displayed table control

    IF sy-stepl = 1.

      tc100-lines =

        tc100-top_line + sy-loopc - 1.

    ENDIF.

*   move fields from work area to scrren fields

    MOVE-CORRESPONDING wa_ekko TO ztc_ekko.

  ENDMODULE.                 "

populate_screen OUTPUT


· Step 8 (Create transaction )



Now create a transaction to test the table control program. Right click the Program and select create-> transaction.


· Step 9 (Execute transaction )


Execute transaction ZTC


please see the link for screen shots of the dailog module

http://www.sapdevelopment.co.uk/dialog/tabcontrol/tc_basic.htm

reward points if it is usefull ....

Girish

Former Member
0 Kudos

Hi,

This code is Addition and Subraction of two numbers stored in database table.

so this code will help you

**Main Program********

&----


*& Module pool ZADD *

*& *

&----


*& *

*& *

&----


PROGRAM ZADD.

TABLES ZADD.

DATA: OK_CODE LIKE SY-UCOMM.

INCLUDE ZADD_PBO.

INCLUDE ZADD_PAI.

**Main part is over***********

PROCESS BEFORE OUTPUT.

MODULE STATUS_1000.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1000.

----


***INCLUDE ZADD_PBO .

----


&----


*& Module STATUS_1000 OUTPUT

&----


  • text

----


MODULE STATUS_1000 OUTPUT.

SET PF-STATUS 'PF01'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_1000 OUTPUT

&----


*& Module USER_COMMAND_1000 INPUT

&----


  • text

----


MODULE USER_COMMAND_1000 INPUT.

CASE OK_CODE.

WHEN 'ADDITION'.

ZADD-ADD1 = ZADD-NUMBER1 + ZADD-NUMBER2.

WHEN 'SUBTRACT'.

ZADD-SUB = ZADD-NUMBER1 - ZADD-NUMBER2.

WHEN 'SAVE'.

INSERT ZADD.

ENDCASE.

ENDMODULE. " USER_COMMAND_1000 INPUT

IF HELPFULL REWARD