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: 

Demand creation with the help - BAPI_PR_CREATE

l_nemzov3
Explorer
0 Kudos
318

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

2 REPLIES 2

JL23
Active Contributor
0 Kudos
172

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     )


0 Kudos
172

CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'.....!


Thanks I understood. ! who looks for that finds! I use BAPI_REQUISITION_CREATE - and all ok. !