cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to change telephone number in BAPI SD_SALESDOCUMENT_CREATE

priya_ramani
Participant
1,181

Hi Team,

I'M using bapi SD_SALESDOCUMENT_CREATE for creating sales order.

CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
sales_header_in = w_sales_head
sales_header_inx = w_sales_headx
status_buffer_refresh = abap_false
IMPORTING
salesdocument_ex = lv_vbeln
sales_header_status = w_sales_headstat
TABLES
return = lt_return
sales_items_in = lt_sales_itms
sales_items_inx = lt_sales_itmsx
sales_partners = lt_sales_parnrs
sales_schedules_in = lt_sales_schd

We are filling lt_sales_parns as below:
lw_parnrs-PARTN_ROLE = 'WE'

lw_parnrs-PARTN_NUMB = '12345'

lw_parnrs-ADDRESS = '1034452'

this ADRNR 1034452 is maintained in ADR2 table. The partner is maintained in IHPA table.

once the sales order is created it is fetching from ARD2 table for our passed adrnr and the same appearing in the partners tab in the sales order item.

Now my requirement is i need to change the telephone number.

I tried to give in like
lw_parnrs-telphone = '98021654454'.
But it is still picking up from ADR2 against the ADRN2 passed.

if i dont passed ADRNR value and pass all telephone etc , it is giving error : 'Specify either address number or address'.

Can you suggest me any exit or enhancement or any badi inside BAPI 'SD_SALESDOCUMENT_CREATE' , So that i can change the telephone or replace telephone number which is coming from ADR2 table for the provided ADRNR.

Thanks,

Priya Ramani.

Accepted Solutions (0)

Answers (3)

Answers (3)

manfred_reinart
Product and Topic Expert
Product and Topic Expert

Dear Priya,

please do not get me wrong, but please do the things that could simply be considered 'homework' yourself - this will improve your capabilities to find solutions also to other problems.
This forum is to help you find solutions / being put on the right path - not for doing your homework.

Address management APIs can easily be found via public search tools. - e.g. BAPI_ADDRESS* like BAPI_ADDRESSORG_CHANGE or similar.

Kind Regards
Manfred

JackGraus
Active Contributor

Hello

When creating a sales order then by default the sales order partner addresses do link to business partner addresses. You could use a different (part) of a sales order address. I guess that is what you want to achieve here by using a different phone number in the sales order only and not in the business partner master data itself.

We do so similar like you do and that works as expected. But we do not populate ADDRESS in the API call (1034452 in your test case). We only populate PARTN_NUMB (12345 in your test case). With a different phone number. Resulting in a new sales order address (table VBPA) being created with this phone number.

Regards

manfred_reinart
Product and Topic Expert
Product and Topic Expert

BAPI 'SD_SALESDOCUMENT_CREATE' is not exactly the place where you can change the phone number which is part of the address (sub-object).
You need to use either a rather complete address in the SD API or change the Phone number in the given adr(nr) via Address management APIs if you are not happy with the phone number as maintained in the address given.

priya_ramani
Participant
0 Kudos

manfred.reinart Thanks for your answer.
1) As SD_SALESDOCUMENT_CREATE is the one which is creating the sales order , i was thinking inside this only we can manipulate using ehancement or something.
2) Could you please let me know how we can use complete address as you mentioned as one of the solution.
3) Could you please suggest how we can change with Address management API ?

Thanks,

Priya.