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

Problem in Inserting records

Former Member
0 Likes
703

Hi All

In my program i need to save some records. But when i click on submit, records are not getting saved

Regards

Richa

4 REPLIES 4
Read only

Former Member
0 Likes
677

Hi,

check if the screen element name is same what you are checking with okcode or sy-ucomm.

Hope it works.

Regards,

Nidhi Kothiyal

Read only

sridhar_meesala
Active Contributor
0 Likes
677

Hi,

What do you mean by save records in program ?

Do you want your records to be saved in Ztable through dialog program using some screen.

Then you can do like this:

CASE sy-ucomm.
 WHEN 'F_SUBMIT'.
  MOVE Ztable-field1 TO wa_table-field1.
  MOVE Ztable-field2 TO wa_table-field2.
  MOVE Ztable-field3 TO wa_table-field3.

  INSERT Ztable FROM wa_table.
  IF sy-subrc = 0.
    MESSAGE 'Successfully saved' TYPE 'I'.
  ENDIF.
ENDCASE.

Thanks,

Sri.

Read only

Former Member
0 Likes
677

Hi,

Write this in the PAI


module save_data.
if sy-ucomm eq 'SUBMIT'.
  screen-field1 = wa_table-field1.
  screen-field2 = wa_table-field2.
  insert dbtable from wa_table.
endif.
endmodule.

Read only

Former Member
0 Likes
677

Hi Richa ,

Create an work area of the type Z table.

then use the following code :

IF ( SY-UCOMM = 'F_SUBMIT').
wa-field=screenname .
Modify ztable from wa .
if sy-subrc = 4 .
mesasge "successful " type i .
else .
message "unsuccesful" type w.
endif.
endif.

If you have written the same code and still facing the problem then :

check whether screen names are correct .

Debug the program and see whether the values are coming in the internal table or not .

This will surely help .

Hope this helps you .

Thanks and Regards

Aditi Wason