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: 

Order with Serial number in Technical Objects

Former Member
0 Kudos

Hi Forum,

I am using the BAPI_SALESORDER_CREATEFROMDAT2 to create a sales order.

That is working without problems. But the Salesorder that is beeing created is a repair of a before sold Material with a Serial Number.

So I am trying to get a connection of the new Sales Order with the specific serial no. history.

We are not using the "CS" - Module.

I found out, that if I change the value of some (exactly 2) variables in the debugger, I am able to use the "Extras->Technicalobjects" to assign a Serialnumber for that position. If I use this there is automatically a history entry created.

There is no need to assign the Serial Number in that way, but it is needed in the Serial no History.

So I have two questions:

Is it possible to assign a serial number using the Technical Objects by using a BAPI?

OR

How can I achieve a new serial history entry?

I searched through the SDN 2 days, but all I didn´t found a working solution.

Thanks for any help/ideas.

Dennis

Edited by: Dennis Schulz on Jun 9, 2009 4:23 PM

3 REPLIES 3

Former Member
0 Kudos

I solved it now using a batchinput call directly after creation using the bapi.

0 Kudos

Hi Dennis Schulz ,

I have seen that you got solution. Can you share me that information that is very usefull for me.

Thanks in Advance,

Krishna

0 Kudos

Hi Krishna,

no problem!

After calling the BAPI with commit and wait, I get the new VBELN in return. Using this number I now build a Batchinput call:

FORM add_serial_to_au  USING    p_salesdocument LIKE vbap-vbeln.

  DATA: bdc_tab TYPE TABLE OF bdcdata,
         wa_bdc_tab LIKE LINE OF bdc_tab,
         datum_trans(10) TYPE c.
  DATA opt TYPE ctu_params.

  REFRESH bdc_tab.
  wa_bdc_tab-dynbegin = 'X'.
  wa_bdc_tab-program = 'SAPMV45A'.
  wa_bdc_tab-dynpro = '0102'.
  APPEND wa_bdc_tab TO bdc_tab.
  CLEAR wa_bdc_tab.
  wa_bdc_tab-fnam = 'VBAK-VBELN'.
  wa_bdc_tab-fval = p_salesdocument.
  APPEND wa_bdc_tab TO bdc_tab.
  CLEAR wa_bdc_tab.
  wa_bdc_tab-fnam = 'BDC_OKCODE'.
  wa_bdc_tab-fval = 'UER1'.
  APPEND wa_bdc_tab TO bdc_tab.

  CLEAR wa_bdc_tab.
  wa_bdc_tab-dynbegin = 'X'.
  wa_bdc_tab-program = 'SAPMV45A'.
  wa_bdc_tab-dynpro = '4001'.
  APPEND wa_bdc_tab TO bdc_tab.



  CLEAR wa_bdc_tab.
  wa_bdc_tab-fnam = 'RV45A-VBAP_SELKZ(01)'.
  wa_bdc_tab-fval = 'X'.
  APPEND wa_bdc_tab TO bdc_tab.
  CLEAR wa_bdc_tab.
  wa_bdc_tab-fnam = 'BDC_OKCODE'.
  wa_bdc_tab-fval = 'POTO'.
  APPEND wa_bdc_tab TO bdc_tab.




  wa_bdc_tab-dynbegin = 'X'.
  wa_bdc_tab-program = 'SAPLIPW1'.
  wa_bdc_tab-dynpro = '0200'.
  APPEND wa_bdc_tab TO bdc_tab.
  CLEAR wa_bdc_tab.
  wa_bdc_tab-fnam = 'RIPW0-SELKZ(01)'.
  wa_bdc_tab-fval = 'X'.
  APPEND wa_bdc_tab TO bdc_tab.
  CLEAR wa_bdc_tab.
  wa_bdc_tab-fnam = 'RIPW0-SERNR(01)'.
  wa_bdc_tab-fval = serial.
  APPEND wa_bdc_tab TO bdc_tab.
  CLEAR wa_bdc_tab.
  wa_bdc_tab-fnam = 'BDC_OKCODE'.
  wa_bdc_tab-fval = 'RWS'.
  APPEND wa_bdc_tab TO bdc_tab.


  wa_bdc_tab-dynbegin = 'X'.
  wa_bdc_tab-program = 'SAPMV45A'.
  wa_bdc_tab-dynpro = '4001'.
  APPEND wa_bdc_tab TO bdc_tab.
  CLEAR wa_bdc_tab.
  wa_bdc_tab-fnam = 'BDC_OKCODE'.
  wa_bdc_tab-fval = 'SICH'.
  APPEND wa_bdc_tab TO bdc_tab.


  opt-dismode = 'E'.
*opt-defsize = 'X'.

  CALL TRANSACTION 'VA02'
       USING bdc_tab OPTIONS FROM opt.

ENDFORM.                    " add_serial_to_au

Dennis