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

ADRC updation in Creation of Sales order ( VA01)

Former Member
0 Kudos
4,908

Hi All,

I would like to update the Transportation zone(TRANSPZONE) of table ADRC

while creating Sales order.

I need to change this programatically. (Validation & change as per requirment)

Please let me know the user-exit and internal table i should used for the same.

I dont want to change any STD sap programs.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

anilnal
Explorer
0 Kudos
2,612

Hi,

I'm not sure if you need to update ADRC table - the address number is usually the the customer's address and is picked automatically.

Also the transport zone is picked automatically based on the customers address or on the shipping conditions in the Sales Order.

Transportation Zone (LZONE) also exists in the partner function (VBPA) and the shipping partner (VTPA) - in case you need to suggest a different route for shipping other than the one determined automatically.

To change this - change both the internal tables table xvbpa and xvtpa (after reading with sales order and item from structures vbak and xvbap) in USER_SAVE_DOCUMENT_PREPARE in the include MV45AFZZ.

But, I'm not sure if the Address Number (determining the shipping point) would be independent of the Transp Zone, though it's changed in the exit.

Regards,

Anil.

18 REPLIES 18
Read only

Former Member
0 Kudos
2,612

Hi!

Check out program MV45AFZZ.

Regards

Tamá

Read only

0 Kudos
2,612

I have checked the all userexit in MV45AFZZ, still i didnt got any solution.

Please let me know the correct userexit name & <b>Internal table</b> should i used

for updates.

Regards.

Read only

anilnal
Explorer
0 Kudos
2,613

Hi,

I'm not sure if you need to update ADRC table - the address number is usually the the customer's address and is picked automatically.

Also the transport zone is picked automatically based on the customers address or on the shipping conditions in the Sales Order.

Transportation Zone (LZONE) also exists in the partner function (VBPA) and the shipping partner (VTPA) - in case you need to suggest a different route for shipping other than the one determined automatically.

To change this - change both the internal tables table xvbpa and xvtpa (after reading with sales order and item from structures vbak and xvbap) in USER_SAVE_DOCUMENT_PREPARE in the include MV45AFZZ.

But, I'm not sure if the Address Number (determining the shipping point) would be independent of the Transp Zone, though it's changed in the exit.

Regards,

Anil.

Read only

Former Member
0 Kudos
2,612

hi Anil,

I wanted to change the Transpzone as per requirement. Now by default the

Transportation zone is coming. In some case i would like to change the same.

I have checked the userexit which u have given, there i m not finding the XVTPA table in the same.

I have checked this earlier also by changing the TRANSPZONE(Lzone) of

table XVBPA & XVBADR, but its not getting change in ADRC. its changing the VBPA table only.

The records getting inserted in ADRC table by some FM. I would like to

know the userexit for the same or any other way i can do. without changing the

SAP STD programs.

Thank you.

Read only

Former Member
0 Kudos
2,612

Hi Umesh,

ADRC table is the central Address table and not at transactional level.

It will get changed only when the Partner adress(Vneodr or Customer) is changed at master level(Like in XD02 transaction or XK02 transaction).

YOu cannot update a master data table at a transaction level.

Regards,

Ravi

Read only

0 Kudos
2,612

Hi Ravi,

If we changed the Transportation Zone while creating Order (VA01) . the same

is get stored in ADRC table. I dont think this is a Master table.

Its having a ADDRNUMBER - key based on VBPA table.

Regards.

Read only

Former Member
0 Kudos
2,612

I have got the solution myself.

Thank you for your help.

Regards,

Umesh Sawant.

Read only

0 Kudos
2,612

Hi,

I have the same problem. How did you solve it?

Regards,

Armands

Read only

0 Kudos
2,612

Hi Umesh,

I am having a similar problem where I need to update the transportation zone in both the XVBPA and XVBADR tables. I am redetermining the transportation zone in EXIT_SAL0VRF_001 which is an enhancement for route determination. It uses the new transportation zone for route determination properly, but does not update the XVBPA or XVBADR tables so I need to do this manually. I am having issues because it is stored in memory and I am not sure the proper SAP functions to use. I would prefer to do this during processing rather than on save document prepare so if the user drills back into the address in VA01 or VA02, they can see the modified transporation zone. Can you tell me how you resolved this? Any information would be helpful.

Regards,

Marcy Woods

Read only

0 Kudos
2,612

Hi Umesh,

I have same issue. Can you share it how u resolved? its very urgent..pls

Regards

Srini

Read only

0 Kudos
2,612

Hi Guys,

I have the same requirement, can you please share the solution ?

Regards,

Vishal

Read only

0 Kudos
2,612

Hi Vishal,

I also have this requirement. Do you know how to realize this requirement.

Regards

Jay

Read only

0 Kudos
2,612

Hi Srini,

Did you solve this issue last year. Can you share it? Thank you.

Regards

Jay

Read only

c_c2
Participant
0 Kudos
2,612

Hi All,

I have a similar need. Update the partner/customer name, for the exporadic customer (9999999) during VA01 (in MV45AFZZ document_save_prepare).

Anyone managed to do it?

Read only

Former Member
2,612

Hello all,

I am also one among many, searching for a solution to this requirement, Finally I achieved after debugging standard programs.

Please find details about how I managed to achieve the functionality/requirement.

I had requirement to update a name3/name2 for a custom partner function(Z<X>) which is kind of a contact person address.

I have written enhancement in 'USEREXIT_SAVE_DOCUMENT_PREPARE' to update the address field.

CALL FUNCTION 'ADDR_COPY_COMPLETE_3_TO_1'

          EXPORTING

*           OLD_ADDRESS_HANDLE     =

            old_address_number     = <lfs_vbpa_upd>-adrnr

*           OLD_PERSON_HANDLE      =

            old_person_number      = <lfs_vbpa_upd>-adrnp

            address_handle         = lvf_addr_handle

            address_group          = lvc_addr_group_manual_sd_addr

            address_reference      = lvs_addr_ref

            numberrange_number     = fif_number_range

          IMPORTING

            returncode             = lvf_returncode

            returncode_numberrange = lvf_returncode_numberrange

            addr1_complete         = lvs_copied_address

          TABLES

            error_table            = lvt_error_table

          EXCEPTIONS

            parameter_error        = 1

            old_address_not_exist  = 2

            old_person_not_exist   = 3

            address_handle_exist   = 4

            internal_error         = 5

            OTHERS                 = 6.

        IF sy-subrc = 0 AND lvt_error_table[] IS INITIAL.

          lvs_addr_sel_type1-addrhandle = lvf_addr_handle.

*          lvs_addr_sel_type1-addrnumber = <lfs_vbpa_upd>-adrnr.

*          lvs_addr_sel_type1-date = '00000000'.

          CALL FUNCTION 'ADDR_GET'

            EXPORTING

              address_selection = lvs_addr_sel_type1

            IMPORTING

              address_value     = lvs_address_to_update

            EXCEPTIONS

              parameter_error   = 1

              address_not_exist = 2

              version_not_exist = 3

              internal_error    = 4

              OTHERS            = 5.

          IF sy-subrc = 0.

            MOVE-CORRESPONDING lvs_address_to_update TO

                               lvs_address_addr1_data.

            CALL FUNCTION 'SD_ADDRESS_GET'

              EXPORTING

*               FIF_ADDRESS_NUMBER      = ' '

                fif_address_handle      = lvf_addr_handle

                fif_address_indicator   = gcf_addr_ind_man_adrc

                fif_reload_entry        = 'X'

              IMPORTING

                fes_address             = l_wa_vbadr_chg

              EXCEPTIONS

                address_not_found       = 1

                address_type_not_exists = 2

                no_person_number        = 3

                OTHERS                  = 4.

*            MOVE-CORRESPONDING lvs_address_addr1_data TO l_wa_vbadrvb_adr_chg.

            MOVE-CORRESPONDING l_wa_vbadr_chg TO l_wa_vbadrvb_adr_chg.

            l_wa_vbadrvb_adr_chg-adrnr = lv_adrnr.

            lvs_address_addr1_data-name3 = '123'.

            l_wa_vbadrvb_adr_chg-name3 = '123'.

            l_wa_vbadrvb_adr_chg-updkz = 'I'.

            <lfs_vbpa_upd>-updkz = 'I'.

            APPEND l_wa_vbadrvb_adr_chg TO xvbadr.

            CLEAR l_wa_vbadrvb_adr_chg.

            lv_adr_handle = lv_adrnr.

            CALL FUNCTION 'ADDR_UPDATE'

              EXPORTING

                address_data        = lvs_address_addr1_data

                address_handle      = lv_adr_handle

                check_empty_address = 'X'

                check_address       = 'X'

              IMPORTING

                address_data        = lvs_address_addr1_data                    "*161i

                returncode          = lvf_returncode

              EXCEPTIONS

                address_not_exist   = 1

                parameter_error     = 2

                version_not_exist   = 3

                internal_error      = 4

                OTHERS              = 5.

            IF sy-subrc = 0.

              <lfs_vbpa_upd>-adrnr = lv_adrnr.

              CALL FUNCTION 'SD_PARTNER_DATA_PUT'

                EXPORTING

                  fic_objecttype              = 'BUS2032'

                  fic_objectkey               = ' '

                TABLES

                  frt_xvbpa                   = xvbpa

                  frt_xvbadr                  = xvbadr

                EXCEPTIONS

                  no_object_specified         = 1

                  no_object_creation_possible = 2

                  OTHERS                      = 3.

            ENDIF.

          ENDIF.

        ENDIF.

Please let me know if find any issues with achieving the address update functionality.

Thanks,

Narayan

Read only

Raphael_Sommer
Participant
2,612

Hello, I had to change region from ADRC in MV45AFZZ when sales order gets saved.

I tried it with changing xvbadr but i did not work.

The solution which worked for me is with function modules around ADDR_UPDATE in MV45AFZZ USER_SAVE_DOCUMENT_PREPARE:

*&---------------------------------------------------------------------*
*&      Form  UPDATE_WE_ADDRESS_REGION 
*&---------------------------------------------------------------------* 
*       Region der WE Adressen updaten 
*----------------------------------------------------------------------* 
FORM update_we_address_region USING p_region. 
 
  FIELD-SYMBOLS: <fs_badr> LIKE xvbadr, 
                 <fs_vbpa> LIKE xvbpa. 
 
  DATA: ls_addr1_sel   TYPE ADDR1_SEL, 
        ls_addr1_value TYPE ADDR1_VAL, 
        ls_addr1_data  TYPE ADDR1_DATA, 
        lt_return      TYPE TABLE OF ADDR_ERROR, 
        lv_return_code TYPE AD_RETCODE. 
 
  LOOP AT xvbpa[] ASSIGNING <fs_vbpa> WHERE parvw = 'WE'. 
    READ TABLE xvbadr[] ASSIGNING <fs_badr> WITH KEY adrnr = <fs_vbpa>-adrnr. 
    IF sy-subrc eq 0. 

   clear: ls_addr1_sel, ls_addr1_value, ls_addr1_data, lv_return_code. 
 
   ls_addr1_sel-addrnumber  =  <fs_badr>-adrnr. 
   ls_addr1_sel-nation      =  <fs_badr>-land1. 
 
   call function 'ADDR_GET' 
     exporting 
       address_selection = ls_addr1_sel 
     importing 
       address_value     = ls_addr1_value 
     exceptions 
       parameter_error   = 1 
       address_not_exist = 2 
       version_not_exist = 3 
       internal_error    = 4 
       others            = 5. 

   IF sy-subrc EQ 0. 
        MOVE-CORRESPONDING ls_addr1_value TO ls_addr1_data. 
        ls_addr1_data-region = p_region. 
        REFRESH lt_return. 
        CALL FUNCTION 'ADDR_UPDATE' 
          EXPORTING 
            address_data              = ls_addr1_data 
            address_number            = ls_addr1_value-addrnumber 
            nation                    = ls_addr1_value-nation 
            check_empty_address       = ' ' 
            check_address             = ' ' 
          IMPORTING 
            returncode                = lv_return_code 
          TABLES 
            error_table               = lt_return 
          EXCEPTIONS 
            address_not_exist         = 1 
            parameter_error           = 2 
            version_not_exist         = 3 
            internal_error            = 4 
            OTHERS                    = 5. 
        IF sy-subrc EQ 0 AND lv_return_code NE 'E'. 
          CALL FUNCTION 'ADDR_MEMORY_SAVE' 
            EXCEPTIONS 
              address_number_missing       = 1 
              person_number_missing        = 2 
              internal_error               = 3 
              database_error               = 4 
              reference_missing            = 5 
            OTHERS                         = 6. 
          IF sy-subrc EQ 0. 
            CALL FUNCTION 'ADDR_MEMORY_CLEAR' 
             EXCEPTIONS 
               unsaved_data_exist       = 1 
               internal_error           = 2 
               OTHERS                   = 3. 
            IF sy-subrc <> 0. 
            ENDIF. 
          ENDIF. 
        ENDIF. 
     ENDIF. 
   ENDIF. 
 
  ENDLOOP. 
 
ENDFORM.
Read only

0 Kudos
1,995

Hi Narayan,

When you call ADDR_UPDATE  ,  you set lv_adr_handle = lv_adrnr. where are you get lv_adrnr, as my understanding ,this should be a temp id such as 'WE  $00000', if pass this value will pop up error address_not_exist . but if use address_handle to update the address. no error happened. but one empty address number generated in sales order . Could you please give some advice here? thanks a lot.

Read only

gunnare
Explorer
0 Kudos
2,612

Thank you Raphael - Your example worked for my use case perfectly