Skip to Content
author's profile photo Former Member
Former Member

Sytax for EDIT Pushbutton in Module Pool

Hi Experts,

I am new to ABAP.

I have a Ztable and with F4 help and pushbutton syntax I am pulling the data from Ztable on my screen (Created by Screen painter) in MPP:

I have 4 pushbuttons: Get_Data, Edit, Delete and Save.

If I want to edit a pulled data from Ztable, then what sud be the syntax for Edit pushbutton in sy-ucomm.

My code on Mod Poll (Main progg) Screen in:

module USER_COMMAND_9000 input.

Case sy-ucomm.

****************************************************************************

*To Populate Data into Mitarbeiter through Pushbuttons

****************************************************************************

When 'OK_GETM'.

IF ZLT_MITA-M1 is NOT INITIAL.

SELECT SINGLE *

FROM ZLT_MITA

Where M1 = ZLT_MITA-M1.

ENDIF.

When 'OK_DELETEM'.

IF ZLT_MITA-M1 is NOT INITIAL.

DELETE

FROM ZLT_MITA

Where M1 = ZLT_MITA-M1.

IF sy-subrc = 0.

MESSAGE S000(8i) With 'Data deleted'.

ENDIF.

ENDIF.

When 'OK_EDITM'.

Update ZLT_MITA. ------------------------------> This doesn#t Edits the existing data in Ztable

IF sy-subrc = 0.

MESSAGE s000(8i) With 'Data Updated'.

ENDIF.

When 'OK_SAVEM'.

Modify ZLT_MITA.

IF sy-subrc = 0.

MESSAGE s000(8i) With 'Data Saved'.

ENDIF.

Can nay one please help me out.

Regards

Deepika

Doubt MPP Edit.jpg (14.7 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 02, 2014 at 11:42 AM

    Hi Deepika,

    Can you please tell what is the difference in the functionality of your Edit and Save buttoons with respect to the database changes ?

    Regards,

    Rachna

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Both the fileds are Key fields of the table. So you will not be able to edit the values.

      Instead new values will be inserted in the table.

      Use a new field like number, which will be your key field and use it to change the values.

      MANDT key field

      NUMBER key field

      M1

      M2

      Regards

      Sree

  • author's profile photo Former Member
    Former Member
    Posted on Jun 02, 2014 at 11:35 AM

    Hi Deepika,

    Use this code:

    When 'OK_EDITM'.

    IF ZLT_MITA-M1 is NOT INITIAL.

    Modify ZLT_MITA from table <Internal Table>.

    IF sy-subrc = 0.

    Commit Work.

    MESSAGE S000(8i) With 'Data Updated'.

    ENDIF.

    ENDIF.

    Hope this will Help You

    Regards,

    RM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 02, 2014 at 11:19 AM

    Hi Deepika,

    Use the statement

    Update ZLT_MITA from wa(workarea)

    Or Modify ZLT_MITA from wa(workarea)

    Regards,

    VJ

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Vijay,

      Thanks for replying.

      I defined in the mod Poll ( mian progg) as : but it still doesn't edit's the Ztable

      TABLES: ZLT_MITA, ZLT_kunde, ZLT_auftrag1.

      TYPES: Begin of ty_mita.

      Include Structure ZLT_mita.

      TYPES: END of ty_mita.

      DATA: it_mita TYPE TABLE OF ty_mita,

      wa_mita TYPE ty_mita.

      And then for user command as:

      module USER_COMMAND_9000 input.

      Case sy-ucomm.

      ****************************************************************************

      *To Populate Data into Mitarbeiter through Pushbuttons

      ****************************************************************************

      When 'OK_GETM'.

      IF ZLT_MITA-M1 is NOT INITIAL.

      SELECT SINGLE *

      FROM ZLT_MITA

      Where M1 = ZLT_MITA-M1.

      ENDIF.

      When 'OK_DELETEM'.

      IF ZLT_MITA-M1 is NOT INITIAL.

      DELETE

      FROM ZLT_MITA

      Where M1 = ZLT_MITA-M1

      AND M2 = ZLT_MITA-M2.

      IF sy-subrc = 0.

      MESSAGE S000(8i) With 'Data deleted'.

      ENDIF.

      ENDIF.

      When 'OK_EDITM'.

      LOOP at it_mita into wa_mita.

      Update ZLT_MITA from wa_mita.

      IF sy-subrc = 0.

      MESSAGE s000(8i) With 'Data Updated'.

      ENDIF.

      ENDLOOP.

      When 'OK_SAVEM'.

      Modify ZLT_MITA.

      IF sy-subrc = 0.

      MESSAGE s000(8i) With 'Data Saved'.

      ENDIF.

      Regards

      Deepika

  • author's profile photo Former Member
    Former Member
    Posted on Jun 02, 2014 at 01:22 PM

    Hi all,

    Thanks for your inputs.

    Although as I am populating the ztable through another code and hence that restricts me to remove the primary KEYS. So I think under such restriction, I should remove the EDIT pushbutton and then work with a combination of DELETE and SAVE button to update the data in the Ztable.

    Regards

    Deepika

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.