Bapi Po Create1 Manual Price

*&---------------------------------------------------------------------*

  1. Bapi Po Create1 Manual Price In India
  2. Bapi Po Create1 Manual Price

*& Report zan_pobapi
  • BAPIPOCREATE1 다양한 Condition을 사용한 사례 BAPI / SAP 모듈별. Customizing 되었다면 PB00을 BAPI를 이용하여 수정 할 수 없게 된다.
  • BAPIPOCREATE1 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 BAPIPOCREATE1 to create Purchase Orders although you have.
  • ECC, BAPI, BAPIPOCHANGE, SRM, BACKEND, BACK-END, 06215, 06 215, PO, PURCHASEORDER, PRICE, NON-ZERO, CONDITION, SAPL2012, L2012U01, NETPRICE, PRICING, KOMP, NETPR.

Create SAP PO Explicit PO Number using BAPI. Once the Customizing for External Number Range for PO is done, you can move to ABAP report/Code. In order to create a SAP Purchasing document with an External PO number use the standard BAPI BAPIPOCREATE1 (Create Purchase Order). Check also List of Important SAP SD Tables (Sales and Distribution). Read the OSS note for more details and implement the correction to avoid the performance issue. Also please have a look into the OSS note 1355577 – BAPIPOCREATE1: Runtime problems when calling RTTS, it also explains about the performance issue regarding the bapi BAPIPOCREATE1 or BAPIPOCHANGE.

*&
*&---------------------------------------------------------------------*
*&
*& 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.
BapiPARAMETERS 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
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 '
'
INTOBapi
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 =
Bapi* 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
*&---------------------------------------------------------------------*

Bapi Po Create1 Manual Price In India


* text
*----------------------------------------------------------------------*
FORM datacommit.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

Bapi Po Create1 Manual Price


EXPORTING
wait = '2'
* IMPORTING
* 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.