Bapi Po Create1 Manual Price
Hi, I have a problem to create a PO using BAPIPOCREATE1. I fill the field net price from item, but it doesn 't fill the value right (it always fill with 1) I found this note,and I tried but still doesn 't working. 1899549 - BAPIPOCREATE1: Net pr. BAPIPOCREATE1 will be used when creating a purchase order slip with an add-on program. Of course, you can do it with batch input, but it is quite difficult to control according to customization and control tab movement, so if you want to create it simply, use BAPIPOCREATE1. In this article, the sample code that can be input at.
What is BAPI_PO_CREATE1
BAPI_PO_CREATE1 is the function module that is allowed you to create purchase orders, this BAPI use the technology behind the enjoy purchase order transaction ( ME21N).
In this article i would share you the solution when you cannot input net price ( net price always 0 ) when using BAPI_PO_CREATE1 to create Purchase Orders although you have inputted net price.
I have posted how to use this BAPI in another article with ABAP Full source code, you can read it on this link ,
What the solution when you cannot input net price
I have searched and gather those result, Actually there are two solutions that applicable ( i think ) for this problem.
- Populate Condition and input your net price into condition value.
- Input value PO_ITEM-PO_PRICE field with ‘2’.
I try to implemented those solutions, but still cannot input net price. but at last i found the solution, this is very simple solution. You must populate Invoice Receipt Indicator field ( PO_ITEM-IR_IND ) with ‘X’ value, input PO_ITEMX-IR_IND with ‘X’ and populate NO_PRICE_FROM_PO field with ‘X’ value.
2 4 6 8 10 12 | i_poitems-ir_ind='X'. EXPORTING poheaderx=wa_poheaderx no_price_from_po='X' |
Voila you success create purchase orders with you own net price.
Incoming search terms:
nu vot,invoice receipt indicator technical name in BAPI_PO_CREATE1,BAPI_PO_CREATE1 TD600,sap PO price hide,bapi_po_create1 price error,Manually entered Condition price BAPI_PO_CREATE1,BAPI_PO_CREATE1 use no_price_from_po,bapi_po_create1 please enter net price error sap,net price is 0 so bapi po create is giving issue,BAPI_PO_CREATE1 net price*&---------------------------------------------------------------------**& Report zan_pobapi
*&
*&---------------------------------------------------------------------*
*&
*& BAPI upload for Purchase Orders
*&
*&---------------------------------------------------------------------*
REPORT zan_pobapi.
*& Internal table containing data from input data file
DATA: BEGIN OF itab_po OCCURS 0,
rectype(1),
comp_code(4),
doc_type(2),
creat_date TYPE d,
vendor LIKE ekko-lifnr,
purch_org LIKE ekko-ekorg,
purch_group LIKE ekko-ekgrp,
po_item LIKE ekpo-ebelp,
material LIKE ekpo-matnr,
plant LIKE ekpo-werks,
quantity(15) ,'like ekpo-menge,
po_unit LIKE ekpo-meins,
net_price(15) ,'like ekpo-netwr,
plan_del(3) ,'like ekpo-plifz,
END OF itab_po.
DATA: lexists TYPE c,
chkfile(128) TYPE c,
idatstr TYPE string,
ponum TYPE bapimepoheader-po_number.
*& Internal table to temporarily read the data in a string for splitting
DATA: BEGIN OF itabstr OCCURS 0,
str(120),
END OF itabstr.
* Declaration related to PO BAPI
DATA: lpoheader TYPE bapimepoheader,
lpoheaderx TYPE bapimepoheaderx.
DATA:lpoitem TYPE STANDARD TABLE OF bapimepoitem WITH HEADER LINE,
lpoitemx TYPE STANDARD TABLE OF bapimepoitemx WITH HEADER LINE,
lreturn TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
PARAMETERS idatfile(40) DEFAULT 'c:sapPOInputData.txt'.
chkfile = idatfile.
idatstr = idatfile.
DO.
'perform ChooseDataFile.
PERFORM datafileexists.
PERFORM readdatafile.
PERFORM populatedata.
* loop at itab_po.
* write:/ itab_po-rectype,
* itab_po-comp_code,
* itab_po-doc_type,
* itab_po-creat_date,
* itab_po-vendor,
* itab_po-purch_org,
* itab_po-purch_group ,
* itab_po-po_item,
* itab_po-material,
* itab_po-plant,
* itab_po-quantity,
* itab_po-po_unit,
* itab_po-net_price,
* itab_po-plan_del.
* endloop.
'PERFORM validate_data tables itab_po.
'editor-call for itab_po.
PERFORM data_fill.
EXIT.
ENDDO.
*&---------------------------------------------------------------------*
*& Form DataFileExists
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM datafileexists.
*This function will check to see whether the input data file exists
CALL FUNCTION 'DX_FILE_EXISTENCE_CHECK'
EXPORTING
filename = chkfile
pc = 'X'
* SERVER =
IMPORTING
file_exists = lexists
* EXCEPTIONS
* RFC_ERROR = 1
* FRONTEND_ERROR = 2
* NO_AUTHORITY = 3
* OTHERS = 4
.
IF NOT ( sy-subrc = 0 AND lexists = 'X').
MESSAGE 'Input Data File does not exist' TYPE 'E'.
ENDIF.
ENDFORM. 'DataFileExists
*& Call the function module to load the data into the internal table
FORM readdatafile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = idatstr
filetype = 'ASC'
has_field_separator = '
'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = itabstr
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
Bapi Po Create1 Manual Priced
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
ENDFORM. 'ReadDataFile
*&---------------------------------------------------------------------*
*& Form populatedata
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM populatedata.
CLEAR itab_po.
LOOP AT itabstr.
SPLIT itabstr-str AT '
'
INTO
itab_po-rectype
itab_po-comp_code
itab_po-doc_type
itab_po-creat_date
itab_po-vendor
itab_po-purch_org
itab_po-purch_group
itab_po-po_item
itab_po-material
itab_po-plant
itab_po-quantity
itab_po-po_unit
itab_po-net_price
itab_po-plan_del.
APPEND itab_po.
CLEAR itab_po.
ENDLOOP.
ENDFORM. 'populatedata
*form validate_data tables ritab_po.
* loop at ritab_po.
* IF itab_po-rectype = 'H'.
*
*
* endloop.
*
*endform.
*&---------------------------------------------------------------------*
*& Form data_fill
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM data_fill.
LOOP AT itab_po.
IF itab_po-rectype = 'H'.
lpoheader-comp_code = itab_po-comp_code. 'BP01'.
lpoheader-doc_type = itab_po-doc_type. 'NB'.
lpoheader-creat_date = itab_po-creat_date. '22.04.2010'.
lpoheader-vendor = itab_po-vendor. 'C8000'.
lpoheader-purch_org = itab_po-purch_org. 'BP01'.
lpoheader-pur_group = itab_po-purch_group. '001'.
lpoheaderx-comp_code = 'X'.
lpoheaderx-doc_type = 'X'.
lpoheaderx-creat_date = 'X'.
lpoheaderx-vendor = 'X'.
lpoheaderx-purch_org = 'X'.
lpoheaderx-pur_group = 'X'.
ELSEIF itab_po-rectype = 'L'.
lpoitem-po_item = itab_po-po_item. '00010'.
lpoitem-material = itab_po-material. 'ZTC1'.
lpoitem-plant = itab_po-plant. 'BP01'.
lpoitem-quantity = itab_po-quantity. '10.
lpoitem-po_unit = itab_po-po_unit. 'M'.
lpoitem-net_price = itab_po-net_price. '10.
lpoitem-plan_del = itab_po-plan_del. '10.
APPEND lpoitem.
lpoitemx-po_item = itab_po-po_item.
lpoitemx-material = 'X'.
lpoitemx-plant = 'X'.
lpoitemx-quantity = 'X'.
lpoitemx-po_unit = 'X'.
lpoitemx-net_price = 'X'.
lpoitemx-plan_del = 'X'.
APPEND lpoitemx.
ELSEIF itab_po-rectype = 'X'.
PERFORM data_load.
PERFORM datacommit.
ELSE.
WRITE:/ 'Put in exception'.
ENDIF.
ENDLOOP.
ENDFORM. 'data_fill
*&---------------------------------------------------------------------*
*& Form data_load
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM data_load.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = lpoheader
poheaderx = lpoheaderx
* POADDRVENDOR =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
* NO_PRICE_FROM_PO =
IMPORTING
exppurchaseorder = ponum
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
return = lreturn
poitem = lpoitem
poitemx = lpoitemx
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
* POACCOUNT =
* POACCOUNTPROFITSEGMENT =
* POACCOUNTX =
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* POEXPIMPITEM =
* POEXPIMPITEMX =
* POTEXTHEADER =
* POTEXTITEM =
* ALLVERSIONS =
* POPARTNER =
* POCOMPONENTS =
* POCOMPONENTSX =
* POSHIPPING =
* POSHIPPINGX =
* POSHIPPINGEXP =
.
ENDFORM. 'data_load
*&---------------------------------------------------------------------*
*& Form datacommit
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM datacommit.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
Bapi Po Create1 Manual Price In India
EXPORTING
wait = '2'
* IMPORTING
Bapi Po Create1 Manual Price
* RETURN =.
WAIT UP TO 2 SECONDS.
WRITE: 'Generated PO:', ponum.
LOOP AT lreturn.
WRITE:/ lreturn-message, lreturn-message_v1.
ENDLOOP.
ENDFORM. 'datacommit
*LOOP AT lreturn.
* WRITE:/ lreturn-message, lreturn-message_v1.
*
*ENDLOOP.