cancel
Showing results for 
Search instead for 
Did you mean: 

Change ship to address in sales order

former_member184555
Active Contributor
0 Kudos

Hi Friends,

I have a requirement regarding changes to the ship to address in the sales order header.

While creating the sales order, the user changes the address of the ship to in the order - header - partner tab. The user deletes the name1 of the ship to party and keeps the name1 of the sold to party here. This is our business requirement. When doing manually, it is perfectly saving the changes. But, the client requires to handle it through program because sometimes the users are forgetting to change the ship to address(only name1) and it is creating problems at field level. Our technical team is finding it difficult to handle the process and I would like to take the suggestions of experts here.

In brief, my requirement is,

when the user creates a sales order, system should take the name1 details of the sold to party partner and keep it in the name1 of the ship to party address.

Please let me know if any more details are required.

Thanks,

Ravi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI ravi,

U said ur req is :

when the user creates a sales order, system should take the name1 details of the sold to party partner and keep it in the name1 of the ship to party address.

I am not an ABAPER but u can try this:

In the USEREXIT_SAVE_DOCUMENT_PREPARE, write a code which will take the name1 details of the sold to party partner and keep it in the name1 of the ship to party address.

This will ensure that ur requirement is fulfilled every time an Order is saved & data will be consistent also.

But technically it could be challenging for the ABAPER to do it. Maybe they can call transaction or BAPI or some FM.

regards

Answers (4)

Answers (4)

former_member288415
Discoverer
0 Kudos

Hi all,

After lot of digging, I found function module to call in the user-exit.

First of all, modify XVBPA-ADRNR line item containing 'WE' as the PARVW. Here in the ADRNR field put the value as 'WE $00001'.

Now it's time to call the FM : 'ADDR_INSERT'. Just change the field LV_HANDLE to 'WE $00001'.

Hope it helps.

-P.Kar

LV_HANDLE = 'RE  $00001'.
* New changes
  ls_addr1_data-date_from = '00010101'.
  ls_addr1_data-date_to = '99991231'.
  ls_addr1_data-name1 = 'koala'.
  ls_addr1_data-city1 = 'Austin'.
  ls_addr1_data-transpzone = '0000000001'.
  ls_addr1_data-street = '33 Rue de La Tannerie'.
  ls_addr1_data-country = 'US'.
  ls_addr1_data-langu = 'E'.
  ls_addr1_data-region = 'TX'.
  ls_addr1_data-extension2 = '1455 145500'.
  ls_addr1_data-time_zone = 'CST'.
  ls_addr1_data-LANGU_CREA = 'E'.
 
 CALL FUNCTION 'ADDR_INSERT'
    EXPORTING
      address_data              = ls_addr1_data
      address_group             = 'SD01'
      address_handle            = lv_handle
*     DATE_FROM                 = '00010101'
     LANGUAGE                  = SY-LANGU
*     CHECK_EMPTY_ADDRESS       = 'X'
     CHECK_ADDRESS             = ' '
   IMPORTING
*     ADDRESS_DATA              =
     RETURNCODE                = LV_RETURNCODE
   TABLES
     ERROR_TABLE               = ERROR_TABLE
   EXCEPTIONS
     ADDRESS_EXISTS            = 1
     PARAMETER_ERROR           = 2
     INTERNAL_ERROR            = 3
     OTHERS                    = 4.

  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF. 
Former Member
0 Kudos

Hi Ravi,

Did you got the solution for this? am facing the same kind of problem now. Please do let me know if you have any solution for this.

former_member184555
Active Contributor
0 Kudos

Hi Anil,

As we couldn't find an exit that can handle the requirement, we have done it through the program that extracts and send data to the logistics partner.

amrendra_tiwari
Explorer
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi there,

Is this process only for a few orders or for all orders? If for all orders, then change the details in master data itself.

If it is only for a few orders, then I guess you will have to write a code in sales order prog MV45AFZZ, CALL FUNCTION 'SD_PARTNER_ADDRESSES_TO_DB'

Here, when you send the details of the ship-to party then change the Name 1. But I believe this is a very tedious process & not advisible. Master data change is best suggested.

Regards,

Sivanand

former_member184555
Active Contributor
0 Kudos

Hi Sivanand,

Thanks for your reply.

This is for all orders with respect to few sales document types. The ship to is the company locations and there are many sold Tos (technicians doing telecom installations) ordering materials with this same Ship To. Hence the business wants to do this at sales order level. We cannot change this in master data because there are many Sold Tos and the name1 of the Ship To should be as that of Sold To.

Regards,

Ravi

Former Member
0 Kudos

Hi there,

Are you trying to print the address of ship-to somewhere? I guess so. Orelse I feel there is no other need to change the name 1. If yes, then change the code in print prog of that output. When printing the Name 1, put a logic that if the sales order type is ZSOR for eg, then instead of ship-to, pickup the Name 1 in sold-to. Pickup address num from VBPA-ADRNR of PARVW = WE. Then pass the address num into ADRC-ADRNR. Then instead of ADRC-NAME1 of WE partner, pickup NAME1 of AG partner.

Regards,

Sivanand

former_member184555
Active Contributor
0 Kudos

Hi Sivanand,

You are 100% correct. This is to be printed on a packing list. But, our system is a bit complex and the deliveries are handled in a separate R/3 system. The information goes to the other system and after creating the delivery, the data will be updated in our system. Though it is possible to change the data while sending to the other system, I am not preferring that becasue, any time there should not be any descrepancy in the data. Normally user changes the name1 for ship to. If we donot handle it in sales order level, there will be descrepancy in the sales order level data.

Regards,

Ravi

Shiva_Ram
Active Contributor
0 Kudos

Hi,

If this applies to all customers, then in user exit USEREXIT_SAVE_DOCUMENT_PREPARE, just compare the NAME1 fields of both sold-to and ship-to and if it differs, provide a hard error. This will force the user, to make the changes.

Or check with exit USEREXIT_REFRESH_DOCUMENT, to change the NAME1 value of ship-to with sold-to.

On both the approach, if this is only for specific customers, then you may need to add the customer numbers in a Z-table or you can check customer master data fields to store specific data for this verification.

Regards

former_member184555
Active Contributor
0 Kudos

We have tried that option also. The system has to generate the address number and our people are facing difficulty to handle it through the above user exits.

Regards,

Ravi

PS: Unfortunately I am not getting the option of assigning points. I sent the request to moderaotors also. Thanks to all who are trying to help me out.

Former Member
0 Kudos

You can only assign po1nts to threads marked as questions. But you unassigned this as a question.

Rob

Former Member
0 Kudos

There is no way to retro-fit the question attribute of a thread.

Give everyone a special thanks who helped and I am sure they will appreciate it equally, or perhaps more..

Cheers,

Julius