Update shipment partner address E1ADRM4 & BADI_LE_SHIPMENT

Hi,
We want to update an existing shipment with updated detailed address information from an incoming Idoc from the forwarding agent. The idea is to replace the generic phone, email, name etc. with the specific clerk handling this shipment.
We are on release 6.02, so OSS note 982041 is in. Still, I can not get the data on the E1ADRM4 segment to do any updates.
As an alternative plan, I am looking into BADI_LE_SHIPMENT. By setting a breakpoint in FM SD_PARTNER_ADDRESSES_TO_DB, I have studied how a manual change in VT02N affects the address update. When the shipment is created, the adress number from the Vendor master is copied to the shipment. When I change the address, a new 90* number is created. I replicated the update flag (UPDKZ) in both VBPA and VBADR level, but to no avail. This is the current code. A new 90* address number is assigned, but it does not contain any address data ...
method if_ex_badi_le_shipment~at_save.
  data : ld_e_mail(70) type c.
  data : ld_name_co(40) type c.
  data : ld_telephone1(30) type c.
  data : ls_vbpa type vbpavb.
  data : ls_vbadr type sadrvb.
  clear : ld_e_mail, ld_name_co , ld_telephone1.
import from memory id. EXPORT done in edi program zxtrku09
  import e_mail to ld_e_mail from memory id 'Z_E1ADRM4'.
  import name_co to ld_name_co from memory id 'Z_E1ADRM4'.
  import telephone1 to ld_telephone1 from memory id 'Z_E1ADRM4'.
ld_e_mail = 'Email'.
ld_name_co = 'Ole Elmose'.
ld_telephone1 = '555.555 1111'.
  if not ( ld_e_mail is initial
  and ld_name_co is initial
  and ld_telephone1 is initial ).
    cha_shipments_at_save-old_vbpa[] = im_shipments_at_save-old_vbpa[].
    cha_shipments_at_save-new_vbpa[] = im_shipments_at_save-new_vbpa[].
    cha_shipments_at_save-old_sadr[] = im_shipments_at_save-old_sadr[].
    cha_shipments_at_save-new_sadr[] = im_shipments_at_save-new_sadr[].
Get shipment partner data
    read table cha_shipments_at_save-new_vbpa
    with key parvw = 'SP'
    posnr = '000000'
    into ls_vbpa.
Get shipment address data
    read table cha_shipments_at_save-new_sadr
    index 1
    into ls_vbadr.
    case ls_vbpa-adrda.
      when 'D'.
First change from Vendor master adress
        ls_vbadr-telf1 = ld_telephone1.
        ls_vbadr-email_addr = ld_e_mail.
        ls_vbadr-updkz = 'I'.
       ls_vbadr-addr_renumbered = 'X'.
        ls_vbadr-adrnr = 'SP  $00000'.
        append ls_vbadr to cha_shipments_at_save-new_sadr.
        loop at cha_shipments_at_save-new_vbpa
        into ls_vbpa.
          ls_vbpa-updkz = 'U'.
          ls_vbpa-adrnr = 'SP  $00000'.
          ls_vbpa-adrda = 'E'.
          modify cha_shipments_at_save-new_vbpa
          from ls_vbpa index sy-tabix.
        endloop.
      when 'E'.
Change an already changed (90*) address number
        ls_vbadr-telf1 = ld_telephone1.
        ls_vbadr-email_addr = ld_e_mail.
        ls_vbadr-updkz = 'U'.
        modify cha_shipments_at_save-new_sadr
        from ls_vbadr index 1.
        ls_vbpa-updkz = 'U'.
        modify cha_shipments_at_save-new_vbpa
        from ls_vbpa index 1.
      when others.
    endcase.
  endif.
endmethod.                    "if_ex_badi_le_shipment~before_update
Anyone who have succeeded in updating shipment address either from Idoc or BADI ?

Hi,
Yes and no.
I tried hard with several alternatives, but never got the partner update to work. The workaround was to write the updated information in a new dedicated shipment text field in ZXTRUKU11. Specific qualifiers are used if just part of the updated address is avaialble. The E-mail is checked as in the Vendor master.
Then this text is read in similar way in ZXTRKU02 for the EDI output.
CLEAR ls_idoc_data.  CLEAR gs_emaildata.
gs_emaildata-type = 'INT'. " Address type is E-mail
LOOP AT all_idoc_data INTO ls_idoc_data
WHERE segnam = 'E1ADRM4'.
  gd_tabix = sy-tabix.
  MOVE ls_idoc_data-sdata TO str_e1adrm4.
  CHECK str_e1adrm4-partner_q = 'SP'. " Forwarding agent
* Validate mail formatting
  IF NOT str_e1adrm4-e_mail IS INITIAL.
    MOVE str_e1adrm4-e_mail TO gs_emaildata-address.
* Use same validation as in partner maintenace
    CALL FUNCTION 'SX_INTERNET_ADDRESS_TO_NORMAL'
      EXPORTING
        address_unstruct    = gs_emaildata
      EXCEPTIONS
        error_address_type  = 1
        error_address       = 2
        error_group_address = 3
        OTHERS              = 4.
    IF NOT sy-subrc IS INITIAL.
      CLEAR str_e1adrm4-e_mail.
      MOVE str_e1adrm4 TO ls_idoc_data-sdata.
      MODIFY all_idoc_data FROM ls_idoc_data INDEX gd_tabix .
    ENDIF.
  ENDIF.
* Save updated address data in text object ( Ignore existing)
  CLEAR ls_lines.  CLEAR lt_lines.
* Add name to text ID with qualifier QN
  IF NOT str_e1adrm4-name_text IS INITIAL.
    CONCATENATE gc_qual_name   " Qualifier for name: QN:
    str_e1adrm4-name_text
    INTO  ls_lines-tdline
    SEPARATED BY space.
    ls_lines-tdformat = gc_star_format.
    APPEND ls_lines TO lt_lines.
    CLEAR ls_lines.
  ENDIF.
* Add Telephone to text ID with qualifier QT
  IF NOT str_e1adrm4-telephone1 IS INITIAL.
    CONCATENATE gc_qual_phone   " Qualifier for telephone: QT:
    str_e1adrm4-telephone1
    INTO  ls_lines-tdline
    SEPARATED BY space.
    ls_lines-tdformat = gc_star_format.
    APPEND ls_lines TO lt_lines.
    CLEAR ls_lines.
  ENDIF.
* Add E-mail to text ID with qualifier QM
  IF NOT str_e1adrm4-e_mail IS INITIAL.
    CONCATENATE gc_qual_email   " Qualifier for mail: QM:
    str_e1adrm4-e_mail INTO  ls_lines-tdline
    SEPARATED BY space.
    ls_lines-tdformat = gc_star_format.
    APPEND ls_lines TO lt_lines.
    CLEAR ls_lines.
  ENDIF.
  CLEAR  ls_header.
* Get shipment number
  READ TABLE all_idoc_data INTO ls_idoc_data
                      WITH KEY segnam = 'E1EDT20'.
  MOVE ls_idoc_data-sdata TO str_e1edt20.
  ls_header-tdobject  = 'VTTK'.              " Shipment
  ls_header-tdname    = str_e1edt20-tknum.   " Shipment #
  ls_header-tdid      = gc_address_tdid.     " Z016 - Text for DSP address details
  ls_header-tdspras   = 'EN'.
  CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
      client          = sy-mandt
      header          = ls_header
      insert          = 'X'
      savemode_direct = 'X'
    TABLES
      lines           = lt_lines
    EXCEPTIONS
      id              = 1
      language        = 2
      name            = 3
      object          = 4
      OTHERS          = 5.
ENDLOOP.
- Sorry for the mess, but can't get any markup to work ....

Similar Messages

  • Updating business partner addresses in CRM

    Hi,
    I Need to build a interface to update business partner addresses in CRM and assign it to a address usage. I can not find a suitable FM/BAPI for this purpose. Please advise me how to accomplish this.

    Hi,
    Where do you start to activate or configure Business Address Services in R/3 Business partners. Any links to user guides or startup documents will be greatly helpful.
    Thanks very much
    Cheers!
    Padi

  • Updation of partner address data in sales order

    Hi,
       I am trying to create a sales order using an Idoc of the message type ORDERS.
       Within this Idoc, the street number for the Sold-to partner is blank.
       However, by the time the Idoc is processed and the order is created, the street address
       for the Sold-to partner gets picked up from the customer master where this field is not
       blank for the partner.
       Is there any way to avoid this so that the sales order reflects the partner address
       details as it is in the IDoc and this street address remains blank.
    Regards,
    Sudeep

    Hi Sudeep,
    You could try the below solution(as i cant think of a straight forward solution) to this.
    Export the value of street in one of the customer exits in IDOC_INPUT_ORDERS, and then implement the implicit enhancement option in the FM "SD_PARTNER_READ", in this enhancement import the value that you earlier exported, if the import succeeds then the call is via "IDOC_INPUT_ORDERS"(hence this enhancement will not affect dialog users/other interfaces), then check if the imported value is blank, if so then clear the value in I_XVBPA.
    Note: If the program doesnt get into SD_PARTNER_READ, the you can try with user exit for VBAP/save_document_prepare.
    Regards,
    Chen

  • Updating email address in Sales order header partner address -VA01/VA02

    I got the requirement to update the email address in Sales order-> header-> partner address.
    The mail address will be picked from ZTABLE and updated in header partner address through user exit
    I cannot find any field for updating email address in partner address in user exit "MV45AFZZ"
    Is there any other user exit/option to update email address in header partner address of sales order?
    Thank You,
    GM

    Hi Rajesh,
    I agree with you but this Scenario is different.
    Just as you have mentioned the address change will not reflect in the Old Sales orders but it should in the new Sales orders right??
    But that is not happening..The Address was changed say two months back and the new address is not appearing in the Sales orders created these days say yesterday or today..
    In such a case,what is should I check to get the address updated??
    Please advice.
    Regards,
    Sophia Xavier

  • Business Partner Address not populating

    Hi,
    The Business partner address field is not getting populated properly. We did a full load last week and still we could not see those addresses for certain business partners. However we were able to see the addresses in RSA3 and PSA too but not in the InfoObject. Can anyone throw a light on this issue. Anything will be highly appreciated.
    Thank You,
    Kishore
    Edited by: Mayank Agrawal on May 11, 2010 10:41 PM

    Hi,
    As the data is getting populated successfully till PSA there should be no problem with the datasource.
    Now, if you are using 3.X, then check for the transfer rules and update rules also check whether
    any routines have been implemented and check the routine for any logic implemented in filtering/hiding/removing the address data. Try to debug the same using "simulate update" option over any datapackage.
    If you are using 7.0 then check in the transformation for the mapping of fields or any routines implemented in
    filtering/hiding/removing the address.
    Regards,
    Lakshminaraasimhan.N

  • Restricting the partner address change in both VA01 & VA02

    Hi All,
    In Sales Order Creation / Change i need to make the partner address fields editable but want a restriction on save.
    For that i am doing the following:
    Change:
    This is possible by restricting the update comparing YVBPA & XVBPA table using parameter UPDKZ.
    Create:
    In the create scenario YVBPA table remains empty.Are there any other tables I should look at to restrict this address data change?
    However, there is a table XVBADR , changes to which do not influence the final display address.
    Alternatively , do we have an alternative approach to restrict the partner address change in both VA01 & VA02?
    Thanks in advance!!!
    Regards,
    AP

    Resolved by using YVBPA & XVBPA tables.

  • How to Remove Business Partner Address using DI Server

    Hello,
    I need to remove Business Partner Addresses using DI Server, the example in the SDK only mentions the remove of the entire business partner, but I need to delete only one of the business partner addresses, how can it be done?

    Hi,
    the usage of the "UpdateWithSubDeletion" method of B1 object atom might be an option.
    You need to update the complete business Partner with the changed amount of addresses.
    The usage is tricky, you need to retrieve the BP, which you want to update, first via synchronous retrieval method using import/export mode.
    From the retrieval result you should start to update every segment with all fields including the BPAddresses segment in exactly the same sorting order as displayed from the synchronous retrieval.
    Best regards
    Bastian

  • VA01 user exit at line item with partner address

    I need a user exit for VA01 that is at the line item level.  The catch is I also need access to the partner address data.  I have found userexit_pricing_prepare_tkomk (include MV45AFZZ) but that doesn't give you the "instance" address information (the address data that is specific to that order, after being changed).  It only gives you the address number for the partner's default address.
    Does anybody know if such an exit exists?
    Regards,
    Aaron

    Hi Aaron,
    I had a similar requirement Long back & This was my code I written. Hope this helps you.
    *  Extract and Update field for partner-id - Goods Supplying vendor
      CLEAR TKOMK-Y_GSVN.
      PERFORM XVBPA_LESEN(SAPFV45K) USING 'WL'  VBAP-POSNR SY-TABIX.
      IF XVBPA-UPDKZ <> 'D'.
        TKOMK-Y_GSVN = XVBPA-LIFNR.
      ENDIF.
      PERFORM XVBPA_LESEN(SAPFV45K) USING 'ZP'  VBAP-POSNR SY-TABIX.
      IF XVBPA-UPDKZ <> 'D'.
        TKOMK-BSART = 'ZIN'.
        SELECT SINGLE LAND1 FROM LFA1 INTO TKOMK-Y_COMM_CTY  WHERE LIFNR = XVBPA-LIFNR.
      ENDIF.
    FORM XVBPA_LESEN USING US_PARVW US_POSNR US_TABIX.
    DATA: DA_VBADR   TYPE   VBADR.
    DATA: DA_VBPA    LIKE   XVBPA.
    CLEAR DA_VBPA.
    READ TABLE XVBPA INDEX 1 INTO DA_VBPA TRANSPORTING VBELN.
    XVBPAKEY-MANDT = VBAK-MANDT.
    XVBPAKEY-VBELN = DA_VBPA-VBELN.
    XVBPAKEY-PARVW = US_PARVW.
    XVBPAKEY-POSNR = US_POSNR.
    READ TABLE XVBPA WITH KEY XVBPAKEY.
    IF SY-SUBRC > 0.
       XVBPAKEY-POSNR = POSNR_LOW.
       READ TABLE XVBPA WITH KEY XVBPAKEY.
    ENDIF.
    IF SY-SUBRC > 0.
      CLEAR XVBPA.
      IF  US_PARVW = 'WE'.
        CLEAR KUWEV.
      ENDIF.
      IF  US_PARVW = 'RG'.
        CLEAR KURGV.
      ENDIF.
    ENDIF.
    US_TABIX = SY-TABIX.
    * CAM is not activated
    IF ZAV_FLAG IS INITIAL.
      IF NOT XVBPA-ADRNR IS INITIAL.
        CLEAR XVBADR.
        XVBADR-ADRNR = XVBPA-ADRNR.
        READ TABLE XVBADR.
        IF SY-SUBRC > 0.
          CLEAR XVBADR.
        ENDIF.
      ENDIF.
    * CAM is activated
      ELSE.
    *if there is an address
        IF NOT XVBPA-ADRNR IS INITIAL.
    *clear address data
          CLEAR XVBADR.
    *try to read address in internal table XVBADR
          READ TABLE XVBADR WITH KEY ADRNR = XVBPA-ADRNR  ADRNP = XVBPA-ADRNP.
    *if address is not in internal table XVBADR
          IF SY-SUBRC NE 0.
    *read address in CAM tables
       CALL FUNCTION 'SD_ADDRESS_GET'
          EXPORTING
            FIF_ADDRESS_NUMBER    = XVBPA-ADRNR
            FIF_PERSONAL_NUMBER   = XVBPA-ADRNP
            FIF_ADDRESS_INDICATOR = XVBPA-ADRDA
          IMPORTING
            FES_ADDRESS           = DA_VBADR
          EXCEPTIONS
            OTHERS                = 4.
            IF SY-SUBRC EQ 0.
              MOVE-CORRESPONDING DA_VBADR TO XVBADR.
              APPEND XVBADR.
            ELSE.
              CLEAR XVBADR.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.
    Thanks & Regards,
    Dileep .C

  • Updating business partner hierarchy in CRM

    Hi,
    I Need to build a interface to update business partner hierarchy (Transaction BPH) in CRM. I can not find a suitable FM/BAPI for this purpose. Please advise me how to accomplish this.

    Hi,
    Where do you start to activate or configure Business Address Services in R/3 Business partners. Any links to user guides or startup documents will be greatly helpful.
    Thanks very much
    Cheers!
    Padi

  • Find the SetCurrentLine in Business Partner /Addresses/ billing address

    I am using B1 2004.2 B
    In this below example:
                oBp.Addresses.SetCurrentLine(0)
                oBp.Addresses.AddressType = BoAddressType.bo_BillTo
                oBp.Addresses.AddressName = "Test1"
                oBp.Addresses.Add()
                oBp.Addresses.SetCurrentLine(1)
                oBp.Addresses.AddressType = BoAddressType.bo_BillTo
                oBp.Addresses.AddressName = "abc"
    My requirement is to synchronies the BP master with another database.
    I have some issues in Business Partner /Addresses/ billing address.
    How to find the SetCurrentLine in  oBp.Addresses.SetCurrentLine(XYZ)?
    I see a Line number in CRD1 table, is that refers to the line number which I can use in oBp.Addresses.SetCurrentLine(xyz) ?
    I tried it but it fails, the line number is based on the order in which the records are displayed in the BP/Addresses/ billing address Screen.
    For example:
    Address          Linenum
    Abc               1
    Test1               0
    In the above example “Test1” is added first and “Abc” is added second.
    So the line number is 0 and 1.
    When the records are displayed in BP/Addresses/ billing address Screen,
    it displayes “Abc” first and “Test1”as second record.
    So according to the screen display the “Abc” is line 0 and “test1” is line 1.
    But in the database the values are vice versa. So when I want to update the
    Values using the DIAPI , I need to know the value for SetCurrentLine(XYZ)
    How can I find it?

    Line number in CRD1 table has nothing to do with SetCurrentLine.
    SetCurrentLine index depends on the order of
    the records displayed in BP/Addresses/ billing address Screen, which is sort by
    Name.

  • Updation of email address in the sales document

    Hello People,
    I have a requirement to update the mail adress for a certain partner function in a sales document in the user exit.
    As in for e,g i would have to update the email address for the ship to party in a sales document header,
    This is required because the address details in a sales document is independent of the customer master data. So any changes made here does not over write the master data.
    But i am not able to find a structure with the mail address field in the user exit .
    Could you suggest how this could be done ?
    Suggestion would be appreciated and rewarded
    Thankyou

    Hi Brijesh,
    Proceed as follows.
    You can use the SELECT SINGLE <field> ..... stmt to retrieve the address number of the customer (ship to party).
    or
    1. Execute SE37 and input the FM KNA1_SINGLE_READER
    2. execute this fumction module and input the customer number.. again execute.
    3. This function module will return the details of the customer in the O_KNA1 output parameter. Take a note of the address number KNA1-ADRNR
    4. Now pass this address number to the FM ADDR_GET_COMPLETE input parameter ADDRNUMBER.
    5. Now run the FM and you can check that this one returns you the email info as well.
    Try the following code in SE38 and then implement to your requirement.
    REPORT  ZSDN_CUST_ADDRESS.
    TYPE-POOLS: szadr.
    data: i_kunnr TYPE kna1-kunnr VALUE '66',
          addrnr  TYPE ADDR1_SEL-ADDRNUMBER.
    data: o_kna1  type kna1,
          i_addr  type SZADR_ADDR1_COMPLETE,
          wa_smtp LIKE LINE OF i_addr-ADSMTP_TAB.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = i_kunnr
      IMPORTING
        OUTPUT        = i_kunnr.
    CALL FUNCTION 'KNA1_SINGLE_READER'
      EXPORTING
        I_KUNNR                  = i_kunnr
        I_BYPASSING_BUFFER       = 'X'
      IMPORTING
        O_KNA1                   = o_kna1
      EXCEPTIONS
        NOT_FOUND                = 1
        PARAMETER_ERROR          = 2
        INTERNAL_ERROR           = 3
        OTHERS                   = 4.
    IF sy-subrc IS INITIAL.
      move o_kna1-adrnr to addrnr.
      CALL FUNCTION 'ADDR_GET_COMPLETE'
        EXPORTING
          ADDRNUMBER                    = addrnr
          IV_CURRENT_COMM_DATA          = 'X'
        IMPORTING
         ADDR1_COMPLETE                = i_addr
        EXCEPTIONS
          PARAMETER_ERROR               = 1
          ADDRESS_NOT_EXIST             = 2
          INTERNAL_ERROR                = 3
          WRONG_ACCESS_TO_ARCHIVE       = 4
          OTHERS                        = 5.
    ENDIF.
    LOOP AT i_addr-ADSMTP_TAB INTO wa_smtp.
       WRITE:/ wa_smtp-ADSMTP-SMTP_ADDR.
    ENDLOOP.

  • HT1918 I keep getting an error message when I try to update my billing address. I can not figure out how to fix it.

    Help me, It wont let me update my billing address. It says to contact itunes support but it just led me here.

    If you are getting a message to contact iTunes Support then you can do so via this link and ask them for help (we are fellow users, we won't know why you are getting the message) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • New users are not updated in Outlook address book (Offline)

    Hi All,
    We are having an Exchange 2010 environment. from few weeks we are experiencing this issue. When we create new user or change the name of a existing user, it is not updated in outlook address book. Can anyone help me to sort this issue?.
    Regs,
    Sachitha.

    What is the Outlook client you are using? Is it 2003 or 2007+
    You are right, you don;t have to update the OAB manually, the kind of issue you are facing is very know (As far as I experienced). After you update the OAB manually, check the issue and it should be fine.
    After that create a Test User and check in Outlook if you see it populated.
    Cheers,
    Gulab Prasad
    Technology Consultant
    Blog:
    http://www.exchangeranger.com    Twitter:
      LinkedIn:
       Check out CodeTwo’s tools for Exchange admins
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  • DTW problem when updating business partner

    Hi Experts,
    I want to update business partner master data via DTW.
    I only want to update the Remarks.
    In my import file only the fields RecordKey, CardCode and FreeText are filled.
    Example:
    RecordKey: 1
    CardCode: C20000
    FreeText: My Remarks
    The import is successful and the remarks were filled but the DTW has also updated other fields in the business partner master data.
    Before update via DTW the business partner has no payment methods included on the payment system tab but after update via DTW the payment method is included and is defined as Standard.
    Any idea?
    Thanks for help.
    Jacqueline

    Hi,
    yes, the existing payment methods were defined manually before update.
    But the payment method was not included for that business partner.
    Here are some hardcopys before update and after update.
    [BP Master Data Before Update DTW|http://www.sap-potsdam.de/BoneUpload/BP_before_Update.JPG]
    [BP Master Data After Update DTW|http://www.sap-potsdam.de/BoneUpload/BP_after_Update.JPG]
    Jacqueline

  • I am a resident of Canada. I cannot purchase any items from ITunes Store because I cannot update my billing address correctly. It is always default to US address. Why?

    I am a resident of Canada. I cannot purchase any items from ITunes Store because I cannot update my billing address correctly. It is always default to US address. Why?

    iTunes Store: Changing Account Information
    http://support.apple.com/kb/HT1918
    iTunes Store: Associating a device or computer to your Apple ID
    http://support.apple.com/kb/ht4627
    Apple ID Support - Manage Account
    http://www.apple.com/support/appleid/manage/
    Switching an iTunes Store account to a different country
    http://www.ilounge.com/index.php/articles/comments/switching-an-itunes-store-acc ount-to-a-different-country/
     Cheers, Tom

Maybe you are looking for