2013 Jan 04 6:36 AM
Hello experts!
I need your help. I need to create заяки (order), I found BAPI_PR_CREATE, but it gives out me mistakes and I won't understand that мнеделать! help. !
code example:
constants:
c_x type c value 'X'.
data: data(10) type c,
l_packno LIKE INRI-QUANTITY,
num like BAPIMEREQHEADER-PREQ_NO.
DATA: header type BAPIMEREQHEADER ,
headerx type BAPIMEREQHEADERX ,
RETURN type table of BAPIRET2 WITH HEADER LINE,
PRITEM type table of BAPIMEREQITEMIMP WITH HEADER LINE,
pritemx TYPE TABLE OF bapimereqitemx WITH HEADER LINE.
DATA: extensionin TYPE TABLE OF bapiparex WITH HEADER LINE,
EXTENSIONOUT TYPE TABLE OF bapiparex WITH HEADER LINE.
header-PREQ_NO = '13V104Т-0Т'.
header-PR_TYPE = 'NB'.
header-memory = 'X'.
headerx-PREQ_NO = c_x.
headerx-PR_TYPE = c_x.
headerx-memory = c_x.
pritem-PREQ_ITEM = sy-tabix."'10'.
pritem-CTRL_IND = 'X'.
pritem-PREQ_NAME = sy-uname.
pritem-PUR_GROUP = 'A01'.
pritem-SHORT_TEXT = 'Клей Декстрин'.
pritem-PLANT = 'KP99'. " заваод
pritem-MATL_GROUP = '50605'.
pritem-QUANTITY = '1660.00'.
pritem-UNIT = 'ШТ'.
pritem-PRICE_UNIT = '1160.72'.
pritem-ACCTASSCAT = 'W'.
WRITE sy-datum to data.
pritem-PREQ_DATE = data.
pritem-PURCH_ORG = 'KP99'.
pritem-LANGU = 'R'.
pritem-DEL_DATCAT_EXT = 'M'.
APPEND pritem.
pritemx-PREQ_ITEM = sy-tabix.
pritemx-PREQ_ITEMX = c_x.
pritemx-CTRL_IND = c_x.
pritemx-PREQ_NAME = c_x.
pritemx-PUR_GROUP = c_x.
pritemx-SHORT_TEXT = c_x.
pritemx-PLANT = c_x.
pritemx-MATL_GROUP = c_x.
pritemx-QUANTITY = c_x.
pritemx-UNIT = c_x.
pritemx-PRICE_UNIT = c_x.
pritemx-ACCTASSCAT = c_x.
pritemx-PREQ_DATE = c_x.
pritemx-PURCH_ORG = c_x.
pritemx-LANGU = c_x.
pritemx-DEL_DATCAT_EXT = c_x.
APPEND pritemx.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
PRHEADER = header
PRHEADERX = headerx
TESTRUN = c_x
IMPORTING
NUMBER = num
TABLES
RETURN = return
PRITEM = pritem
PRITEMX = pritemx
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
values return:
E BAPI 001 No instance of object type PurchaseRequisition has been created. External reference: # 1
W ME 040 Can delivery date be met?
E ME 057 Unit of measure ШТ not defined (please check your input)
W 06 190 Requisition date is in the past
2013 Jan 04 11:02 AM
the error messagae is: Unit of measure ШТ not defined (please check your input)
In a BAPI you have to use the ISO code of a unit instead of the unit
use SE16 at table T006 to find the ISO code for your unit (I guess PCE )
2013 Jan 04 11:09 AM
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'.....!
Thanks I understood. ! who looks for that finds! I use BAPI_REQUISITION_CREATE - and all ok. !