‎2007 Nov 28 6:43 AM
Hi guys,
Im using the above said BAPI for PO Creation. Im getting errors in the return table sayinh "Net price should be greater than Zero". I tried testing the BAPI thro se37, where it doesnot give me any errors in the return table and automatically picks the net_price. The same BAPI is not picking net_price in my program.
Any suggestions.
Thanks,
S S K
‎2007 Nov 28 6:50 AM
If u are passing 'X' to field POITEMX-NET_PRICE then remove & try.
‎2007 Nov 28 6:52 AM
‎2007 Nov 28 6:56 AM
‎2007 Nov 28 8:15 AM
Hi,
Have you populated the field po_item with the same value fro poitem and poitemx?
POITEM-PO_ITEM = item_number
POITEMX-PO_ITEM = item_number
One example of pseudo-code:
wa_poheader-vendor = vendor.
wa_poheader-suppl_plnt = suppl_plnt.
wa_poheader-pur_group = pur_group
wa_poheader-purch_org = purch_org.
wa_poheader-doc_type = l_bsart.
wa_poheader-created_by = sy-uname.
wa_poheader-creat_date = sy-datum.
wa_poheader-comp_code = v_company_code.
lwa_poheaderx-vendor = c_x.
lwa_poheaderx-suppl_plnt = c_x.
lwa_poheaderx-pur_group = c_x.
lwa_poheaderx-purch_org = c_x.
lwa_poheaderx-doc_type = c_x.
lwa_poheaderx-creat_date = c_x.
lwa_poheaderx-created_by = c_x.
lwa_poheaderx-comp_code = c_x.
Item PO----
wa_poitem-po_item = c_seq_poitem.
wa_poitem-material = v_matnr.
wa_poitem-plant = Receiving Plant
wa_poitem-stge_loc = Receiving Storage Loc
wa_poitem-quantity = Qty.
wa_poitem-po_unit = uom.
wa_poitem-batch = batch.
wa_poitem-suppl_stloc = Supplying Stor. Loc.
APPEND wa_poitem TO i_poitem.
lwa_poitemx-po_item = c_seq_poitem.
lwa_poitemx-material = c_x.
lwa_poitemx-plant = c_x.
lwa_poitemx-stge_loc = c_x.
lwa_poitemx-quantity = c_x.
lwa_poitemx-po_unit = c_x.
lwa_poitemx-batch = c_x.
lwa_poitemx-suppl_stloc = c_x.
APPEND lwa_poitemx TO li_poitemx.
----
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = wa_poheader
poheaderx = lwa_poheaderx
IMPORTING
exppurchaseorder = po_ebeln
TABLES
return = i_return1
poitem = i_poitem
poitemx = li_poitemx.
‎2007 Nov 28 8:19 AM
***********************************************************************
** Program ID :
** Program Desc : PO Creation Using BAPI
** Process Overview :
** Created By : P.KARTHIKEYAN
** Created Date : 25/10/2006
** Company Name : Infoview Technologies Limited
************************************************************************
&----
*& Report ZBAPI_CREATE_PO *
*& *
&----
REPORT ZBAPI_CREATE_PO .
&----
*DATA DECLARATION
CONSTANTS : C_X VALUE 'X'.
*Structures to hold PO header data
DATA : HEADER LIKE BAPIMEPOHEADER ,
HEADERX LIKE BAPIMEPOHEADERX .
*Internal Tables to hold PO ITEM DATA
DATA : ITEM LIKE BAPIMEPOITEM OCCURS 0 WITH HEADER LINE,
ITEMX LIKE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE,
**Internal table to hold messages from BAPI call
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
data : w_header(40) value 'PO Header'.
data : ws_langu like sy-langu.
data: V_EXPPURCHASEORDER like BAPIMEPOHEADER-PO_NUMBER.
*text-001 = 'PO Header' - define as text element
selection-screen begin of block b1 with frame title text-001.
parameters : company like header-comp_code default '1000' ,
doctyp like HEADER-DOC_TYPE default 'NB' ,
cdate like HEADER-CREAT_DATE default sy-datum ,
vendor like HEADER-VENDOR default 'RAJ',
pur_org like HEADER-PURCH_ORG default '0001' ,
pur_grp like HEADER-PUR_GROUP default '001' .
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters : item_num like ITEM-PO_ITEM default '00020',
material like ITEM-MATERIAL default 'M-127' ,
plant like ITEM-PLANT default '0001' ,
quantity like ITEM-QUANTITY default 200.
selection-screen end of block b2.
*&----
**START-OF-SELECTION.
*&----
**DATA POPULATION
*&----
ws_langu = sy-langu. "Language variable
*POPULATE HEADER DATA FOR PO
HEADER-COMP_CODE = company .
HEADER-DOC_TYPE = doctyp .
HEADER-CREAT_DATE = cdate .
HEADER-VENDOR = vendor .
HEADER-LANGU = ws_langu .
HEADER-PURCH_ORG = pur_org .
HEADER-PUR_GROUP = pur_grp .
&----
*POPULATE HEADER FLAG.
&----
HEADERX-comp_code = c_x.
HEADERX-doc_type = c_x.
HEADERX-creat_date = c_x.
HEADERX-vendor = c_x.
HEADERX-langu = c_x.
HEADERX-purch_org = c_x.
HEADERX-pur_group = c_x.
*HEADERX-doc_date = c_x.
&----
*POPULATE ITEM DATA.
&----
ITEM-PO_ITEM = item_num.
ITEM-MATERIAL = material.
ITEM-PLANT = plant.
ITEM-QUANTITY = quantity.
APPEND ITEM.
&----
*POPULATE ITEM FLAG TABLE
&----
ITEMX-PO_ITEM = item_num.
ITEMX-MATERIAL = C_X.
ITEMX-PLANT = C_X .
*ITEMX-STGE_LOC = C_X .
ITEMX-QUANTITY = C_X .
*ITEMX-TAX_CODE = C_X .
*ITEMX-ITEM_CAT = C_X .
*ITEMX-ACCTASSCAT = C_X .
APPEND ITEMX.
&----
*BAPI CALL
&----
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = HEADER
POHEADERX = HEADERX
POADDRVENDOR =
TESTRUN =
IMPORTING
EXPPURCHASEORDER = V_EXPPURCHASEORDER
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = RETURN
POITEM = ITEM
POITEMX = ITEMX.
&----
*Confirm the document creation by calling database COMMIT
&----
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
.
end-of-selection.
***&----
****Output the messages returned from BAPI call
***&----
*LOOP AT RETURN.
WRITE / v_EXPPURCHASEORDER.
*ENDLOOP.
‎2007 Nov 28 8:31 AM
only thing you have to keep in mind is that while testing bapi thru se 37, it does all the padding all by itself. so if you enter '10' and field is of 4 length, then data would go as '0010'. but while entering data thru program you have to do left padding .
with regards
mandeep
‎2007 Nov 28 10:25 AM
Thank u guys for all ur inputs....
The actual problem was with purchase info records.
Thanks,
Suresh
‎2009 May 06 10:09 PM
Hi Suresh,
I'm having the same problem. Could you explain me how did you fix it?
Thanks & regards,
Ricardo.
‎2009 May 15 8:15 AM
Hi all,
The problem was we were dividing the values by /1000, so for some small values like 5 it returns 0,005 and when BAPI round this value 0,005 is equal to 0 (zero) and we get the error "net price should be greater than zero".
Solution: we have decreased the divisor to /100.
Currently, I don't remember the note number, but there is one that describes this issue. Search with the following key words "net price should be greater than zero" and you will get it.
Regards,
Ricardo.