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 programing

Former Member
0 Likes
436

hai,

   I have write the code for insert and modifications in modulepool. But the data was not inserted row by row only updated that row  , in this the data comes to work area but sy-subrc eq 4. And also I wrote insert but the reselt is same . please give me solution.

the code is

CASE ok_code.

    WHEN 'SAVE'.

      MODIFY  zcust_master FROM wa_master.

      IF sy-subrc EQ 0.

        MESSAGE 'Saved Sucessfully' TYPE 'S'.

      ENDIF.

      CLEAR wa_master.

   WHEN 'UPDATE'.

     MODIFY zcust_master FROM wa_master.

      IF sy-subrc EQ 0.

        MESSAGE 'Saved Sucessfully' TYPE 'S'.

      ENDIF.

      CLEAR wa_master.

2 REPLIES 2
Read only

Former Member
0 Likes
411

hi,

May be with the same key fields values a record already exist in the table. Please check.

Shravan

Read only

PeterJonker
Active Contributor
0 Likes
411

What do you mean. I only see wa_master in your code, so from your code it is only possible to update or modify one record.

Also modify statement already takes care of this. If key exists it will update the record and if it does not exist it will insert.

So your code could also be written as follows and would do the same thing:

CASE ok_code.

    WHEN 'SAVE' or 'UPDATE'.

      MODIFY  zcust_master FROM wa_master.

      IF sy-subrc EQ 0.

        MESSAGE 'Saved Sucessfully' TYPE 'S'.

      ELSE.
        MESSAGE 'Not Saved' TYPE 'E'.

      ENDIF.

      CLEAR wa_master.

ENDCASE.