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

BAPI-"BAPI_SALESORDER_CREATEFROMDAT2" Partner issue

Former Member
0 Likes
4,491

Dear,

I was trying to create SO using BAPI "BAPI_SALESORDER_CREATEFROMDAT2". When I assign value for Partner internal table ORDER_PARTNERS, I encounter a trouble. I want to add an new address record in table ADRC for my Parter(Such as Ship-to party), but I don't know how to assign value for ORDER_PARTNERS. As default, when I leave blank in fields of ORDER_PARTNERS except PARTN_ROLE and PARTN_NUMB, the system will automatically adopt the address of Customer for partner. But I don't need it, I hope I can create a new address record for the partner. Anyone who has the experience, please give me some tips and thank you.

Regards,

Xincheng Liu

ABeam Consulting

Dear,

I was trying to create SO using BAPI "BAPI_SALESORDER_CREATEFROMDAT2". When I assign value for Partner internal table ORDER_PARTNERS, I encounter a trouble. I want to add an new address record in table ADRC for my Parter(Such as Ship-to party), but I don't know how to assign value for ORDER_PARTNERS. As default, when I leave blank in fields of ORDER_PARTNERS except PARTN_ROLE and PARTN_NUMB, the system will automatically adopt the address of Customer for partner. But I don't need it, I hope I can create a new address record for the partner. Anyone who has the experience, please give me some tips and thank you.

Regards,

Xincheng Liu

ABeam Consulting

4 REPLIES 4
Read only

Former Member
0 Likes
2,206

Hi,

Check interface repository to know more about this BAPI.

http://ifr.sap.com

Regards,

Sameej T.K.

Read only

Former Member
0 Likes
2,206

I'm not sure if it will create a new address for the partner but there is another bapi parameter table called PARTNERADDRESSES. You can specify an address for a partner in this table and then leave the address blank in ORDER_PARTNERS. The two records are linked together by a field in ORDER_PARTNERS (ADDR_LINK). This field would contain the address number from the record in PARTNERADDRESSES.

In other words ORDER_PARTNERS-ADDR_LINK will equal

PARTNERADDRESSES-ADDR_NO.

I don't know if you can create a new address this way but you can point a partner to any existing address with an address number.

Give it a try, you might be able to make it work

Regards,

Brent

Read only

brad_bohn
Active Contributor
2,206

Brent has put you on the right track, but you can use either table to add a new address for the ship-to party. I use the PARTNERADDRESSES table so that I can add an e-mail address with the new ship-to info. Here's a portion of my code:


* Ship-to
  I_ORDER_PARTNERS-PARTN_ROLE    = 'WE'.
  I_ORDER_PARTNERS-PARTN_NUMB    = '0000241269'.
  I_ORDER_PARTNERS-ITM_NUMBER    = '000000'.
  I_ORDER_PARTNERS-ADDR_LINK     = '0000000001'.

  APPEND I_ORDER_PARTNERS.

* Partner address
* To enter e-mail, must use CAM table
  IF WA_CUSTOMER-COUNTRY EQ SPACE.
    WA_CUSTOMER-COUNTRY = 'US'.
  ENDIF.

  I_PARTNERADDRESSES-ADDR_NO     = '0000000001'.
  I_PARTNERADDRESSES-NAME        = WA_CUSTOMER-NAME.
  I_PARTNERADDRESSES-NAME_2      = WA_CUSTOMER-NAME2.
  I_PARTNERADDRESSES-STREET_LNG  = WA_CUSTOMER-STREET.
  I_PARTNERADDRESSES-CITY        = WA_CUSTOMER-CITY.
  I_PARTNERADDRESSES-REGION      = WA_CUSTOMER-STATE.
  I_PARTNERADDRESSES-POSTL_COD1  = WA_CUSTOMER-ZIPCODE.
  I_PARTNERADDRESSES-COUNTRY     = WA_CUSTOMER-COUNTRY.
  I_PARTNERADDRESSES-TEL1_NUMBR  = WA_CUSTOMER-PHONE.
  I_PARTNERADDRESSES-E_MAIL      = WA_CUSTOMER-EMAIL.
  I_PARTNERADDRESSES-LANGU       = SY-LANGU.

  ...(some tax code handling)

  APPEND I_PARTNERADDRESSES.

Read only

Former Member
0 Likes
2,206

I have the same requirement as stated above. My implementation of the code appears to be correct however the SD_DOCUMENT_CREATE function ignores what I have placed in the PARTNERADDRESSES table. Can you help me discover what is missing here?

" Attach SOLD-TO partner

ORDER_PARTNERS-partn_role = 'AG'.

ORDER_PARTNERS-partn_numb = i_ohdr-sold_to.

ORDER_PARTNERS-addr_link = '0000000001'.

append ORDER_PARTNERS.

" Override any fields that we need using the PARTNERADDRESSES structure.

ORDER_ADDRESSES-addr_no = '0000000001'.

ORDER_ADDRESSES-NAME = ADRC-NAME1.

ORDER_ADDRESSES-NAME_2 = 'CREW REYNOLDS'.

ORDER_ADDRESSES-NAME_3 = ADRC-NAME3.

ORDER_ADDRESSES-NAME_4 = ADRC-NAME4.

ORDER_ADDRESSES-CITY = ADRC-CITY1.

ORDER_ADDRESSES-PO_BOX = ADRC-PO_BOX.

ORDER_ADDRESSES-STREET = ADRC-STREET.

ORDER_ADDRESSES-COUNTRY = ADRC-COUNTRY.

ORDER_ADDRESSES-REGION = ADRC-REGION.

ORDER_ADDRESSES-TEL1_NUMBR = ADRC-TEL_NUMBER.

ORDER_ADDRESSES-TEL1_EXT = ADRC-TEL_EXTENS.

ORDER_ADDRESSES-FAX_NUMBER = ADRC-FAX_NUMBER.

ORDER_ADDRESSES-TAXJURCODE = ADRC-TAXJURCODE.

ORDER_ADDRESSES-LANGU = SY-LANGU.

append ORDER_ADDRESSES.

Thank you,

Crew Reynolds