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

update key fields of database table

Hi all,

How to update key fields of database table through ABAP code?

rgds,

Avijit

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Dec 04, 2007 at 08:38 AM

    Hi,

    Try like this

    &----


    *& Form SUB_READ_UPDATE_BSEG

    &----


    • text

    ----


    FORM sub_read_update_bseg.

    IF NOT it_final[] IS INITIAL.

    LOOP AT it_final INTO wa_final.

    UPDATE bseg SET zuonr = wa_final-ccnum

    WHERE bukrs EQ wa_final-bukrs

    AND belnr EQ wa_final-vbeln

    AND rfzei EQ wa_final-rfzei

    AND saknr NE ' '.

    ENDLOOP.

    *--Message data updated successfully

    MESSAGE i888 WITH text-002.

    LEAVE LIST-PROCESSING.

    ELSE.

    *--Message No data found

    MESSAGE i888 WITH text-003.

    LEAVE LIST-PROCESSING.

    ENDIF.

    ENDFORM. " SUB_READ_UPDATE_BSEG

    Regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 04, 2007 at 09:11 AM

    Hi Avijit,

    here's an example:

    data: zekko_temp like zekko.

    TABLES: ZEKKO, ZEKKO_TEMP.

    zekko_temp = zekko.

    zekko_temp-ebeln = '0010000002'.

    delete zekko where ebeln = '0010000001'.

    insert into zekko from zekko_temp.

    Kind regards,

    John.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 09:17 AM

    hi avinjit

    check it 1ce

    LOOP AT i_mat_alter1 INTO wa_mat_alter1.

    SELECT SINGLE zmatgp werks zmatnr1 zmatnr2

    INTO wa_mat_alter1

    FROM zsamp_alter

    WHERE zmatgp = wa_mat_alter1-matgp

    AND werks = wa_mat_alter1-werks

    AND zmatnr1 = wa_mat_alter1-matnr1

    AND zmatnr2 = wa_mat_alter1-matnr2.

    IF sy-subrc = 0.

    CONCATENATE wa_upload_file-werks wa_upload_file-matgp

    wa_upload_file-matnr1 wa_upload_file-matnr2

    'THE UPLOAD DATA ALREADY EXISTS IN THE TABLE'

    INTO wa_data_err-errorlog SEPARATED BY space.

    APPEND wa_data_err TO i_data_err .

    CLEAR wa_data_err.

    ELSE.

    MODIFY zsamp_alter FROM wa_mat_alter1.

    see zsamp_alter is db table.

    regards

    kk.

    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.