Application Development and Automation 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: 
Read only

module pool prog code

Former Member
0 Likes
825

Hi, i need to update datas to database z table thru module pool screen (customized). any one can send the coding for four fieds and let me know where should i put the code(PBO or PAI)

Thanks Raja

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
801

hi,

get all the fields on the screeen, add the data in this screen, and also have a button (update) on that screen , and press it after entering the data,

write the code for Update at PAI.

For the code for Update, press F1 on Update and u will get the syntax for Update.

Hope this will meet ur purpose.

Thanks and Regards

Suraj

5 REPLIES 5
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
801

Hi,

Can you explain a bit more clear about the requirement.

Regards,

Tarun

Read only

Former Member
0 Likes
802

hi,

get all the fields on the screeen, add the data in this screen, and also have a button (update) on that screen , and press it after entering the data,

write the code for Update at PAI.

For the code for Update, press F1 on Update and u will get the syntax for Update.

Hope this will meet ur purpose.

Thanks and Regards

Suraj

Read only

Former Member
0 Likes
801

Hi,

Why do you want the ready made code???

try urself......yes approach can be told.

u want 4 fields...

(1) create a screen with 4 Input fields,create its GUI status,Title

(2) In the PAI of this screen you need to validate the valued entered by the user

(3) if some wrong or invalid input is eneterd prompt user to enter the correct value

(4) after all successful validation, press the save button and commit this in DB table.

this is done in PAI where you will check the USER_COMMAND.

if sy-ucomm = 'SAVE' " SAVE is the function code assigned to SAVE button in too bar

  • commit to DB

endif.

you can even refer to any maintenance program.

Regards,

Neha

Read only

Former Member
0 Likes
801

Hi,

If your requireemnt is simply update the values of the 4fields into the Z table from the screen then there are two ways

1.Simply add 4i/o buttons along with a push button on the screen

OR

1.Add a table control with the push button

Then

2.On click of the push button FN code "INSERT' capture the event in the PAI module and write the update code.

Code snippet below with table control.

PROCESS AFTER INPUT.

LOOP WITH CONTROL TABLE_MOVIE.
 * INSERTING A NEW DATA INTO THE TABLE
     MODULE PUT_DATA_INTO_TABLE.
ENDLOOP.


MODULE PUT_DATA_INTO_TABLE INPUT.

  DATA : TEMP(1).

  OKCODE = SY-UCOMM. "OKCODE of type SY-UCOMM

  CASE OKCODE.
    WHEN 'INSERT'. "2 intrenal table of type y00movies,itab1 used to fianlly insert into db table
      ITAB1-REL_YEAR = ITAB-REL_YEAR.
      ITAB1-CATEGORY = ITAB-CATEGORY.
      ITAB1-WINNER = ITAB-WINNER.
      ITAB1-NOMINEE1 = ITAB-NOMINEE1.
      ITAB1-NOMINEE2 = ITAB-NOMINEE2.
      ITAB1-NOMINEE3 = ITAB-NOMINEE3.
      ITAB1-NOMINEE4 = ITAB-NOMINEE4.
      ITAB1-NOMINEE5 = ITAB-NOMINEE5.
      ITAB1-NOTES = ITAB-NOTES.
      APPEND ITAB1.
      TEMP = 'X'.

  ENDCASE.

* INSERT INTO Y00MOVIES TABLE WITHOUT ANY DUPLICATE KEYS
* ACCEPTING DUPLICATE KEYS MEANS OPPOTISE AS IT NAME SPECIFY ,
* IT IGNORES ALL THE RECORDS WITH DUPLICATE PRIMARY KEYS
  IF ( TEMP EQ 'X' ).

      INSERT Y00MOVIES FROM TABLE ITAB1 ACCEPTING DUPLICATE KEYS.

      COMMIT WORK.
  ENDIF.

* THIS WONT WORK AS IT WILL FAIL INSERTING THE DUPLICATE RECORD AND SY-SUBRC VALUE IS ONLY SET TO ZERO
* IF ALL RECORDS ARE INSERTED SUCCESSFULLY
*IF SY-SUBRC <> 0.
*    MESSAGE I003(ZMSGID12).
*ENDIF.

ENDMODULE.                 " PUT_DATA_INTO_TABLE  INPUT

Hope this might help you out.

Pooja

Read only

Former Member
0 Likes
801

Dear ,

you need to keep the module in PAI but the thing the entry in the Ztable which you want to enter need to be unique for that try to put one more field such as SERIAL NUMBER then every time increase the serial number so that you would able to make unique combination for that .

updation code is already given above .

thanks

ankit

Edited by: Ankit Jain on Mar 9, 2009 10:19 AM