Application Development 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: 

Serial Number on Sales Order Function Module/BAPi

Former Member
0 Kudos

Hi Guys,

Does anyone know how to add serial numbers to a Sales order using a BAPI/FM. The serial numbers can be seen under extras-->technical objects on a sales order.

Please let me know if anyone has an idea of how to do this.

thanks

19 REPLIES 19

Former Member
0 Kudos

If you can't find a FM, you can always use a CALL TRANSACTION.

0 Kudos

That option always stays but since that is the most unreliable solution, I would like to try and find a FM first...Thanks for your quick reply though

0 Kudos

What's unrealiable about call trans? Most of SAP's inbound IDoc processing is built on this technique including the inbound sales order creation.

I'll keep checking on a FM.

uwe_schieferstein
Active Contributor
0 Kudos

Hello

Can you tell me in which table field the serial number is stored if such a material is used in a sales order?

Regards

Uwe

0 Kudos

Hi,

The serial number can be seen in the table SER02. in that table if you put the sales order number in the SDAUFNR field and the line item number in POSNR field,it will give u a OBKNR...then you go to table OBJK and put that OBKNR and u will get a entry where u will see the serial number in the SERNR field.

Hope this helps

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please check this FM.

SERNR_ADD_TO_AU

SERNR_ADD_TO_DOCUMENT

IWOL_WV_ADD_OBJECTS

Regards,

Ferry Lianto

0 Kudos

Hi Ferry,

Can you please provide me with a sample code for using this FM.i used the standard SAP code and am not able to successfully update the serial number. it gives me a success but the serial number doesnt show up on the order...

ferry_lianto
Active Contributor
0 Kudos

Hi,

Check this sample codes.


      LOOP AT DA_SERIKOM.
        MOVE DA_SERIKOM-SERNR TO DA_RIWOL1-SERNR.
        MOVE US_MATNR         TO DA_RIWOL1-MATNR.
        APPEND DA_RIWOL1.
      ENDLOOP.

      CALL FUNCTION 'IWOL_WV_ADD_OBJECTS'
        EXPORTING
          I_SDAUFNR           = VBAP-VBELN
          I_SDPOSNR           = VBAP-POSNR
          TO_TYPE             = 'SD'
          I_KUNDE             = VBAK-KUNNR
          I_VBTYP             = VBAK-VBTYP
          I_SD_AUART          = VBAK-AUART
          I_POSTYP            = VBAP-PSTYV
        TABLES
          T_RIWOL1            = DA_RIWOL1
          T_SER02             = DA_RSERXX
        EXCEPTIONS
          NO_OBJECT_LIST      = 1
          ENTRY_EXISTS        = 2
          INVALID_MATERIAL    = 3
          INVALID_SERIALNR    = 4
          INVALID_EQUIPMENT   = 5
          INVALID_LOCATION    = 6
          INVALID_ASSEMBLY    = 7
          STATUS_NOT_ALLOWED  = 8
          EQUI_FOREIGN_KEY    = 9
          EQUI_SYSTEM_FAILURE = 10
          CUSTOMER_EXIT_ERROR = 11
          OTHERS              = 12.

Also check this thread for sample code of SERNR_ADD_TO_AU.

Regards,

Ferry Lianto

0 Kudos

:):)

hi ferry,

thanks for the quick update...i have been working with that same standard SAP code but it doesnt seem to give me the results.

i think i am missing some small parameter here...

thanks though

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try to add FM IWOL_WV_POST_OBJECT_LIST at the end.


CALL FUNCTION 'IWOL_WV_POST_OBJECT_LIST'
  EXPORTING
    I_SDAUFNR      = VBAK-VBELN
  EXCEPTIONS
    NO_OBJECT_LIST = 1.

Regards,

Ferry Lianto

0 Kudos

I'm also trying similar but it is not working as message i get is 'Invalid Serial and Material number'.

I used following sequence of FM:

SERNR_ADD_TO_AU

IWOL_WV_ADD_OBJECTS

TIA,

0 Kudos

Well, it is working now. I changed sequence as follows:

SERNR_ADD_TO_AU

SERIAL_LISTE_POST_AU

Thanks,

0 Kudos

Hi Sanjay,

With great interest I read your mail regading this subject. Because you appear to be the expert in this area now:), perhaps you can judge whether the desired functionality as described below, is possible. I am a functional consultant, so it is difficult for me to judge it myself.

I need some help in the following issue. In a F2 invoice in the field VBRP-CHARG, the serial number of the product is available. In the business of my client, many return orders exist (KR, RE, etc.). The return order is created while referencing to the billing document. VBRP-CHARG is copied into VBAP-CHARG via copy control. At this moment SAP users (transaction VA01) must fill in the serial number manually via Extra -> Technical Objects. This serial number is always the same as VBRP-CHARG and VBAP-CHARG. Regularly people forget to fill in the serial number in Technical Objects or use an incorrect serial number. This leads to all kind of problems further on in the process.

So my question is: can this process be automatized following the solution you use?

Best regards,

Paul Fieten

0 Kudos

Good find Ferry... worked for me with a little tweaking... on an auto delivery create after the sales order

Doug -

Former Member
0 Kudos

Hi SAP experts,

With great interest I read your mail regading this subject. Because you appear to be the experts in this area now:), perhaps you can judge whether the desired functionality as described below, is possible. I am a functional consultant, so it is difficult for me to judge it myself.

I need some help in the following issue. In a F2 invoice in the field VBRP-CHARG, the serial number of the product is available. In the business of my client, many return orders exist (KR, RE, etc.). The return order is created while referencing to the billing document. VBRP-CHARG is copied into VBAP-CHARG via copy control. At this moment SAP users (transaction VA01) must fill in the serial number manually via Extra -> Technical Objects. This serial number is always the same as VBRP-CHARG and VBAP-CHARG. Regularly people forget to fill in the serial number in Technical Objects or use an incorrect serial number. This leads to all kind of problems further on in the process.

So my question is: can this process be automatized following the solution you use?

Best regards,

Paul Fieten

0 Kudos

Sorry for late reply.

In the scenario which you have mentioned, this solution will not work. What you need is basically userexit/enhancement at the time of transaction VA01. In this userexit/enhancement either you can validate that serial number is same as one in VBAP-CHARG or you can directly copy it from VBAP-CHARG.

0 Kudos

Hi Sanha,

I had finished a functional specification already, using your solution. The main issue is that the serial number needs to be processed in a correct way in the technical objects in the sales order. So I suggested first pulling the serial number from VBAP-CHARG (using a userexit as you mention also). This serial number is the input for the function modules (you used also). These function modules will be called in MV45AFZZ at the moment of saving the sales order. Programmers are now analyzing this. I expect it will work.

Many thanks!

Paul

We have a similar requirement where the sales order is created in ERP through CRM. Basically it concerns a CRM inhouse order that is replicated to ERP where it is handled logistically (outbound return delivery and so on).

  In ERP this is created through a CRM specific BAPI BAPI_SALESDOCU_PROXY_UPLOAD.  This BAPI does not allow to pass on the SN either.

Based upon the above suggestions we did following:

What we did (draft version that still needs some extensive testing):

- we give along the serial information in TI_EXTENSIONIN (table of structure BAPIPAREX). I assume that the other SD BAPI's have the same EXTENSION table in the function signature.

- we implemented an implicite enhancement at the start of BAPI_SALESDOCU_PROXY_UPLOAD to store this extension data in the global data of a new function group. The standard EXTENSION handling only allows some specific strucures to be handled.

- in the SD exit USEREXIT_SAVE_DOCUMENT_PREPARE we then use function modules SERNR_ADD_TO_AU and SERIAL_LISTE_POST_AU to link the SN's to the item. We also update ANZSN in FXVBAP. We get the relevant SN's from the global data of our new function group.

It appears to function correctly. The SN is updated in the sales document item as a technical object.

I hope it helps you all who are looking to find a BAPI that can handle technical objects....

0 Kudos

Thank you Tom! Finally SAP released an OSS note 1795864 suggesting the solution you mentioned