Skip to Content

When creating sales order with BAPI_SALESORDER_CREATEFROMDAT2, we normally use the structure PARTNERADDRESSES to change the partner address data if needed. However, the “mobile phone” field is not contained in structure PARTNERADDRESSES. Means, in standard, the BAPI doesn’t support maintaining the mobile phone number. It sometimes cause inconvenience in the project. 😕

With this blog post, I would like to share some information about how to enhance the structure PARTNERADDRESSES to make the maintaining of mobile phone possible.


1. Enhance structure BAPIADDR1.

Firstly, we need to check the enhancement category and change it if necessary. Follow the below path to check the Enhancement category of structure.

SE11 to change structure BAPIADDR1.

Then execute MENU  >EXTRAS  >ENHANCEMENT CATEGORY

/wp-content/uploads/2016/05/11111_957118.png

Change it to: Can Be Enhanced (Deep).

Save and activate.



Secondly, create structure APPEND_BAPIADDR1_2 in the System and append this structure to structure BAPIADDR1.

For this purpose, proceed as follows:

Use Transaction SE11 to display structure BAPIADDR1. Via ‘Goto’ -> ‘Append structure’ the system issues a dialog box.

If you have no append structure, the dialog box will be like below. Enter ‘APPEND_BAPIADDR1_2’ into the input field.

/wp-content/uploads/2016/05/22222_957131.png

If you have already an append structure for the structure BAPIADDR1, the pop-up will be like below. You can use the existing one, or click on the create button to create a new one like above.

/wp-content/uploads/2016/05/44444_957132.jpg


After entering the Append Name and pressing enter, we come to the append structure creation screen as below. Enter the text and the field as below.

As a short text, enter ‘APPEND for mobile phone number in structure BAPIADDR1’. You can enter any other text if you want.

For the “Component”, I use “MOB_NUMBER” here. You can enter any value you want. It is the name of the field. You will see this name in the BAPI structure. And you need use the same field name when enhancing the interface. (I will show later.)

For the “Component type”, please enter “AD_MBNMBR1”.

/wp-content/uploads/2016/05/33333_957133.png

Save and activate the append structure.


Now, you will be able to see the MOB_NUMBER already in structure PARTNERADDRESSES as below, when executing BAPI_SALESORDER_CREATEFROMDAT2 in SE37. But it will not work, because the interface program has not been enhanced.

/wp-content/uploads/2016/05/55555_957152.png


2. Enhance interface program: FM ADDR_CONVERT_FROM_BAPIADDR1.

The sample code is:

* pass mobile phone number to sales order address.

   CLEAR ADTEL_WA.

   ADTEL_WAADTELTEL_NUMBER = ADDR1_COMPLETE_BAPIMOB_NUMBER.

   IF NOT ADTEL_WAADTEL IS INITIAL.

     ADTEL_WAADTELFLGDEFAULT = ‘X’.

     ADTEL_WAADTELR3_USER    = ‘3’.

     APPEND  ADTEL_WA TO ADDR1_COMPLETEADTEL_TAB  .

   ENDIF.


Here, you can see that I am passing the ADDR1_COMPLETE_BAPIMOB_NUMBER value to ADTEL_WAADTELTEL_NUMBER. If you use other field name than MOB_NUMBER, then you will need to adjust the coding part accordingly.

ADTEL_WAADTELR3_USER = ‘3’ is to tell the system that this number is the mobile phone number.


As for the place where to put the code, it is actually not important, only if you don’t interrupt the existing code. The easiest way is to insert the code at the end of the FM.

I would suggest putting the coding here as below. Because it is just after the code for Telephone field. It looks beautiful. 😆

/wp-content/uploads/2016/05/666666_957153.png


Activate the code.

Enhancement finished. 😎


Now, you will be able to maintain the mobile phone number when creating sales order with BAPI_SALESORDER_CREATEFROMDAT2.

By the way, don’t forget to link the address with ORDER_PARTNERS-ADDRESS = PARTNERADDRESSES-ADDR_NO. 😉

Hope it is helpful.

Best regards,

Hualin Zhang



To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Azael Ortega

    Hi Hualin, it’s a good guide, I have a question, when I tried to change the enhancement category in the BAPIADDR1 and activate it, the system gave me some errors, e.g. “tabl wlf_addresses is inconsistent in active version”, did you have a similar issues?

    Azael.

    (0) 

Leave a Reply