Application Development 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: 

Update KNA1 in ZXVSVU02

maria_merino
Active Participant
0 Kudos
363

Hi experts,

I have an issue in user exit ZXVSVU02.

When creating a Z segment to idoc DEBMAS06 I find this code:

        ZAKNA1 = idoc_data-sdata.

        read table idoc_status

             with key msgty = 'S'

                      msgid = 'F2'

                      msgno = '171'.

        if sy-subrc = 0 and not idoc_status-msgv1 is initial.

          clear fs_kna1.

          select single *

          from kna1

          into fs_kna1

          where kunnr = idoc_status-msgv1.

          if sy-subrc eq 0.

            update kna1

            set name1 = kna1m-name1

                ZZNOMBRECL = ZAKNA1-ZZNOMBRECL

                ZZAPELLICL = ZAKNA1-ZZAPELLICL

                ZZNAME1 = ZAKNA1-ZZNAME1

                ZZSEXO = ZAKNA1-ZZSEXO

                ZZESTADO = ZAKNA1-ZZESTADO

                ZZMAYOR = ZAKNA1-ZZMAYOR

                ZZNACIONALIDAD = ZAKNA1-ZZNACIONALIDAD

                ZZREGIMENECO = ZAKNA1-ZZREGIMENECO

                ZZNOMBREECON = ZAKNA1-ZZNOMBREECON

                ZZAPELLECON = ZAKNA1-ZZAPELLECON

                ZZTIPODOCU = ZAKNA1-ZZTIPODOCU

                ZZDOCUM = ZAKNA1-ZZDOCUM

                ZZTIPODOCUCL = ZAKNA1-ZZTIPODOCUCL

                ZZDOCUMCL = ZAKNA1-ZZDOCUMCL

                ZLAND1 = ZAKNA1-ZLAND1

                ZORT01 = ZAKNA1-ZORT01

                ZPSTLZ = ZAKNA1-ZPSTLZ

                ZREGIO = ZAKNA1-ZREGIO

                ZSTRAS = ZAKNA1-ZSTRAS

                ZNUMCL = ZAKNA1-ZNUMCL

                ZPODER = ZAKNA1-ZPODER

            where kunnr = idoc_status-msgv1.

endif.

endif.

They update kna1. Until january it wa working fine, but now it doesn't. The consultant doesn't know if there has been any change in january in the system. We are in version SAP ECC 6.0.

Should I do a commit after the update ?

Thanks in advance,

María

1 ACCEPTED SOLUTION

nabheetscn
Active Contributor
0 Kudos
130

First of all directly updating standard tables is wrong. Basically what is happening you are creating customer before this exit and trying to read the value of return messages to get custom number. My question here is what is the status of IDOC where it is failing? Did you check in debugging what happens here via WE19..? Seconldy are these fields available on screen as i can see a call transaction happening if yes better approach will be to upload them by modifying bdc in another exit otherwise you can do it in a BADI which is called when customer is created and update thse fields

6 REPLIES 6

nabheetscn
Active Contributor
0 Kudos
131

First of all directly updating standard tables is wrong. Basically what is happening you are creating customer before this exit and trying to read the value of return messages to get custom number. My question here is what is the status of IDOC where it is failing? Did you check in debugging what happens here via WE19..? Seconldy are these fields available on screen as i can see a call transaction happening if yes better approach will be to upload them by modifying bdc in another exit otherwise you can do it in a BADI which is called when customer is created and update thse fields

0 Kudos
130

Hi,

Thanks for your answer.

The customer is already existing in sap. And the problem is that this development has been working fine from april 2011 until january 2013 and now it's not working. I know ding an update is not the best way to update the customer but my issue is to see why it's not working as before..

0 Kudos
130

Hi

Are you able to replicate the scenario in test system? If yes then in debugging what does the value MSGV1 has?

Thanks

Nabheet

0 Kudos
130

Yes, MSGV1 has the number of the customer.

Maybe I should use the bapi for customers in bakground ?

0 Kudos
130

I have changed to fm SD_CUSTOMER_MAINTAIN_ALL and now it works.

thanks !

0 Kudos
130

cool