Skip to Content
0
Aug 04 at 11:47 AM

Error determining the material components when creating subcontracting PO with bapi_po_create1.

53 Views Last edit Aug 04 at 11:49 AM 3 rev

I wrote a test program to create PO using bapi_po_create1. It failed when I tried to create subcontracting PO.

The error is 61781 'Error determining the material components'

The related code is below:

GS_OPOCOMPONENTS-PO_ITEM         = 10.
GS_OPOCOMPONENTS-SCHED_LINE      = '0001'.
GS_OPOCOMPONENTS-ITEM_NO         = 1.
GS_OPOCOMPONENTS-MATERIAL   = 'G011020'.
GS_OPOCOMPONENTS-ENTRY_QUANTITY  = 6.
GS_OPOCOMPONENTS-ENTRY_UOM = 'BOT'.
GS_OPOCOMPONENTS-PLANT           = '1000'.
GS_OPOCOMPONENTS-REQ_QUAN        = 5.
GS_OPOCOMPONENTS-CHANGE_ID       = 'I'.
APPEND GS_OPOCOMPONENTS TO GT_OPOCOMPONENTS.
CLEAR GS_OPOCOMPONENTS.

GS_OPOCOMPONENTSX-PO_ITEM        = 10.
GS_OPOCOMPONENTSX-PO_ITEMX        = 'X'.
GS_OPOCOMPONENTSX-SCHED_LINE     = '0001'.
GS_OPOCOMPONENTSX-SCHED_LINEX     = 'X'.
GS_OPOCOMPONENTSX-ITEM_NO        = 1.
GS_OPOCOMPONENTSX-ITEM_NOX       = 'X'.
GS_OPOCOMPONENTSX-MATERIAL  = 'X'.
GS_OPOCOMPONENTSX-ENTRY_QUANTITY = 'X'.
GS_OPOCOMPONENTSX-ENTRY_UOM = 'X'.
GS_OPOCOMPONENTSX-PLANT          = 'X'.
GS_OPOCOMPONENTSX-REQ_QUAN       = 'X'.
GS_OPOCOMPONENTSX-CHANGE_ID      = 'X'.
APPEND GS_OPOCOMPONENTSX TO GT_OPOCOMPONENTSX.
CLEAR:GS_OPOCOMPONENTSX.

GS_OPOSCHEDULE-PO_ITEM = 10.
GS_OPOSCHEDULE-DELIVERY_DATE = '20220804'.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
  EXPORTING
    DATE_EXTERNAL            = GS_OPOSCHEDULE-DELIVERY_DATE
  IMPORTING
    DATE_INTERNAL            = GS_OPOSCHEDULE-DELIVERY_DATE
  EXCEPTIONS
    DATE_EXTERNAL_IS_INVALID = 1
    OTHERS                   = 2.

GS_OPOSCHEDULE-SCHED_LINE = 0001.
APPEND GS_OPOSCHEDULE TO GT_OPOSCHEDULE.
CLEAR GS_OPOSCHEDULE.

GS_OPOSCHEDULEX-PO_ITEM = 10.
GS_OPOSCHEDULEX-DELIVERY_DATE = 'X'.
GS_OPOSCHEDULEX-SCHED_LINE = 0001.
APPEND GS_OPOSCHEDULEX TO GT_OPOSCHEDULEX.
CLEAR GS_OPOSCHEDULEX.

Acoording similar post https://answers.sap.com/questions/264241/error-determining-material-components-with-bapipoc.html, I already add everything and We also do't use BOM so there is no data in MAST table. Then what I'm missing? Any help? Thx.