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: 

BAPI_PO_CHANGE - add serial

0 Kudos

Hello!

I'm trying to add a serial number to position in order.

Using  BAPI_PO_CHANGE.

(Order is created and has single position without serial number. Component structure has 1 line with batch filled)

I'm filling mt_serialnumber from a scratch:

           <fs_serialnumber>-po_item = '00010'.

           <fs_serialnumber>-sched_line = '1'.  

           <fs_serialnumber>-serialno = '919191'.

           <fs_serialnumberx>-po_item = '00010'.

           <fs_serialnumberx>-sched_line = '1'.

           <fs_serialnumberx>-po_itemx = 'X'.

           <fs_serialnumberx>-sched_linex = 'X'.

           <fs_serialnumberx>-serialno = 'X'.


I get mt_item, mt_comp structures from FM BAPI_GETDETAILS1.

+ add some new data:

<fs_itemx>-po_itemx   = 'X'.

<fs_comp>-batch = 'P0000010'. "new batch according serial

<fs_compx>-batch = 'X'.

and starting BAPI:

CALL FUNCTION 'BAPI_PO_CHANGE'

       EXPORTING

         purchaseorder = mv_ebeln

         poheader      = ms_header

         poheaderx     = ms_headerx

       TABLES

         return        = lt_return

         poitem        = mt_item

         poitemx       = mt_itemx

         pocomponents  = mt_comp

         pocomponentsx = mt_compx

         serialnumber  = mt_serialnumber

         serialnumberx = mt_serialnumberx.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

         EXPORTING

           wait = 'X'.


But no update

lt_return has no errors (S and couple minor W)


Maybe I only able to CHANGE data with this BAPI, not adding new lines? Hm.

Any clues?


Best regards,

Maxim.

1 ACCEPTED SOLUTION

former_member235395
Contributor
0 Kudos

Hi Maxim,

BAPI have those restrictions:

Restrictions

With this function module, it is not possible to:

  • Create subcontracting components (you can only use existing ones)
  • Create configurations (you can only use existing ones)
  • Change message records (table NAST) and additional message data (this data can only be determined via the message determination facility (Customizing))
  • Attach documents to the purchase order
  • Change foreign trade data
  • Change service data
  • Change or reexplode BOMs
  • A firewall prevents the manipulation of data that is not changeable in Purchasing according to the business logic of the purchase order (e.g. PO number, vendor, etc.).
  • PO items with an invoicing plan cannot be created or changed using the BAPIs

Regards,

2 REPLIES 2

former_member235395
Contributor
0 Kudos

Hi Maxim,

BAPI have those restrictions:

Restrictions

With this function module, it is not possible to:

  • Create subcontracting components (you can only use existing ones)
  • Create configurations (you can only use existing ones)
  • Change message records (table NAST) and additional message data (this data can only be determined via the message determination facility (Customizing))
  • Attach documents to the purchase order
  • Change foreign trade data
  • Change service data
  • Change or reexplode BOMs
  • A firewall prevents the manipulation of data that is not changeable in Purchasing according to the business logic of the purchase order (e.g. PO number, vendor, etc.).
  • PO items with an invoicing plan cannot be created or changed using the BAPIs

Regards,

0 Kudos

Thx, David.

I've solved the problem by deleting component (change_id = 'D') in 1st iteration and re-creating comp + serial in 2nd.

Maybe it checks new serial with old batch? ))

And stops performimg as they dont match each other.

Anyway, now its works