Bapi Po Create1 Manual Price

  1. Bapi Po Create1 Manual Price In India
  2. Bapi Po Create1 Manual Priced
  3. Bapi Po Create1 Manual Price
*&---------------------------------------------------------------------*
*& REPORT ZAN_PR2POBAPI1

BAPIPOCREATE1: Price is not transferred: Popular articles. 16 Run ABAP program from Excel 13 Extract SAP table Data from Excel 10 Extract SAP Table structure from Excel 7 BADIS: Exercice 7 Optimizing the number of SAP work processes. Knowledge Bases. Further information on purchase order BAPIs is available in SAP Note 197958. If you test the BAPIs BAPIPOCREATE1 or BAPIPOCHANGE in the Function Builder (transaction code SE37), no database updates will be carried out. If you need this function, take a look at Note 420646. The BAPI BAPIPOGETDETAIL serves to read the details of a purchase.


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZAN_PR2POBAPI1.
TYPE-POOLS : SLIS.
TABLES ZLOGHEAD.
DATA:BEGIN OF ITAB_PRLIST OCCURS 0,
BANFN LIKE EBAN-BANFN,
BNFPO LIKE EBAN-BNFPO,
MATNR LIKE EBAN-MATNR,
FLIEF LIKE EBAN-FLIEF, 'FVENDOR
MENGE LIKE EBAN-MENGE,
BSMNG LIKE EBAN-BSMNG, 'OQTY'
INFNR LIKE EBAN-INFNR,
FRGZU LIKE EBAN-FRGZU, 'RELEASE STATUS
BADAT LIKE EBAN-BADAT, 'REQUEST DATE
WERKS LIKE EBAN-WERKS,
NETPR LIKE EINE-NETPR,
LIFNR LIKE EINA-LIFNR,
BSART LIKE EBAN-BSART,
APLFZ LIKE EINE-APLFZ,
END OF ITAB_PRLIST.
TYPES: BEGIN OF STR_PREVPR,
KEY1 TYPE ZLOGHEAD-KEY1 ,
KEY2 TYPE ZLOGHEAD-KEY2,
MATNR TYPE ZLOGHEAD-DATA1,
END OF STR_PREVPR.
DATA: ITAB_PREVPR TYPE TABLE OF STR_PREVPR WITH HEADER LINE.
DATA: WAPREVPR TYPE STR_PREVPR.
DATA:ITAB_PRLIST1 LIKE ITAB_PRLIST OCCURS 0,
WA TYPE ZLOGHEAD,
IT_LOGHEAD TYPE TABLE OF ZLOGHEAD WITH HEADER LINE.
DATA: BEGIN OF IT_DISLOGHEAD OCCURS 0,
PO LIKE BAPIMEPOHEADER-PO_NUMBER,
VENDOR LIKE BAPIMEPOHEADER-VENDOR,
MSGTYPE LIKE BAPIRET2-TYPE,
MSG LIKE BAPIRET2-MESSAGE_V1,
EXPAND LIKE BAPIRET2-TYPE,
END OF IT_DISLOGHEAD .
DATA: BEGIN OF IT_DISLOGDETAIL OCCURS 0,
PO LIKE BAPIMEPOHEADER-PO_NUMBER,
VENDOR LIKE BAPIMEPOHEADER-VENDOR,
LINE LIKE BAPIMEPOITEM-PO_ITEM,
MATERIAL LIKE BAPIMEPOITEM-MATERIAL,
MSGTYPE LIKE BAPIRET2-TYPE,
MSG LIKE BAPIRET2-MESSAGE_V1,
END OF IT_DISLOGDETAIL.
DATA: VLINES TYPE I,
VLINECOUNT TYPE I,
VFIRST TYPE C,
VMATNR LIKE EBAN-MATNR,
VPREVMATNR LIKE EBAN-MATNR,
VNETPR LIKE EINE-NETPR,
VAPLFZ LIKE EINE-APLFZ,
VPORG LIKE EBAN-EKORG VALUE 'BP01',
VPGRP LIKE EBAN-EKGRP VALUE '001',
VCCODE LIKE EKKO-BUKRS VALUE 'BP01',
'VVENDOR LIKE EBAN-LIFNR,
VTEXT(50) TYPE C,
V_PER TYPE P,
VINFNR LIKE EINA-INFNR,
vvendor LIKE bapimepoheader-vendor,
VBANFN LIKE ZLOGHEAD-KEY1,
VBNFPO LIKE ZLOGHEAD-KEY2,
VPREVBANFN LIKE ZLOGHEAD-KEY1,
VPREVBNFPO LIKE ZLOGHEAD-KEY2,
V_TXT(50),
VRUNBAPI TYPE C.
DATA: A1 LIKE EBAN-BANFN,
A2 LIKE EBAN-BNFPO.
DATA: PONUM TYPE BAPIMEPOHEADER-PO_NUMBER.
* DECLARATION RELATED TO PO BAPI
DATA: LPOHEADER TYPE BAPIMEPOHEADER,
LPOHEADERX TYPE BAPIMEPOHEADERX.
DATA:T_POITEM TYPE STANDARD TABLE OF BAPIMEPOITEM WITH HEADER LINE,
T_POITEMX TYPE STANDARD TABLE OF BAPIMEPOITEMX WITH HEADER LINE,
T_RETURN TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE LINE OF SLIS_T_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_KEYINFO TYPE TABLE OF SLIS_KEYINFO_ALV WITH HEADER LINE.
DO.
CLEAR IT_LOGHEAD[]. ' CLEAR INTERNAL TABLES HOLDING MESSAGES
PERFORM READ_LOG.
PERFORM COLLECT_DATA.
PERFORM BAPIDATA_FILL.
PERFORM DISPLAY_LOG_LIST.
EXIT.
ENDDO.
FORM READ_LOG.
SELECT * FROM ZLOGHEAD INTO TABLE IT_LOGHEAD.
ENDFORM.
FORM COLLECT_DATA.
DESCRIBE TABLE IT_LOGHEAD LINES VLINES.
READ TABLE IT_LOGHEAD INDEX VLINES.
IF IT_LOGHEAD[] IS NOT INITIAL.
SELECT BANFN BNFPO MATNR FLIEF MENGE BSMNG INFNR FRGZU BADAT WERKS
BSART
FROM EBAN
INTO CORRESPONDING FIELDS OF TABLE ITAB_PRLIST
WHERE BANFN > IT_LOGHEAD-KEY1 AND
LOEKZ <> 'X'.
SELECT KEY1 KEY2 FROM ZLOGHEAD
INTO CORRESPONDING FIELDS OF TABLE ITAB_PREVPR
WHERE PROCESSNAME = 'PR2POBAPI' AND
PROCESSED = '.
LOOP AT ITAB_PREVPR.
READ TABLE ITAB_PRLIST WITH KEY BANFN = ITAB_PREVPR-KEY1
BNFPO = ITAB_PREVPR-KEY2.
IF SY-SUBRC <> 0.
SELECT BANFN BNFPO MATNR FLIEF MENGE BSMNG INFNR FRGZU
BADAT WERKS BSART
FROM EBAN
APPENDING CORRESPONDING FIELDS OF
TABLE ITAB_PRLIST1
WHERE BANFN = ITAB_PREVPR-KEY1 AND
BNFPO = ITAB_PREVPR-KEY2 AND
LOEKZ <> 'X'.
ENDIF.
ENDLOOP.
ELSE.
SELECT A~BANFN A~BNFPO A~MATNR A~FLIEF A~MENGE B~BSMNG A~INFNR
A~FRGZU A~BADAT A~WERKS A~BSART
FROM EBAN AS A
INNER JOIN EBAN AS B ON A~BANFN = B~BANFN AND A~BNFPO =
Bapi Po Create1 Manual PriceB~BNFPO
INTO CORRESPONDING FIELDS OF TABLE ITAB_PRLIST
WHERE ( A~BADAT = SY-DATUM AND
( A~EBELN = ' OR ( A~EBELN <> ' AND A~MENGE >
B~BSMNG ) ) AND
A~LOEKZ <> 'X' AND
A~BANFN <> '0010000091' ).
ENDIF.
IF ITAB_PRLIST1 IS NOT INITIAL.
APPEND LINES OF ITAB_PRLIST1 TO ITAB_PRLIST.
ENDIF.
LOOP AT ITAB_PRLIST.
VNETPR = 0.
VAPLFZ = '.
VINFNR = '.
IF ITAB_PRLIST-FLIEF = '.
SELECT LIFNR INFNR FROM EINA INTO (VVENDOR , VINFNR)
WHERE MATNR = ITAB_PRLIST-MATNR.
ENDSELECT.
IF SY-SUBRC = 0.
ITAB_PRLIST-LIFNR = VVENDOR.
ITAB_PRLIST-INFNR = VINFNR.Bapi po create1 manual priced
MODIFY ITAB_PRLIST FROM ITAB_PRLIST.
ENDIF.
ENDIF.
IF ITAB_PRLIST-INFNR <> '.
SELECT NETPR APLFZ FROM EINE INTO (VNETPR , VAPLFZ)
WHERE
INFNR = ITAB_PRLIST-INFNR AND
EKORG = VPORG AND
ESOKZ = '0' AND
WERKS = ITAB_PRLIST-WERKS.
ENDSELECT.
IF SY-SUBRC = 0.
ITAB_PRLIST-NETPR = VNETPR.
ITAB_PRLIST-APLFZ = VAPLFZ.
MODIFY ITAB_PRLIST FROM ITAB_PRLIST.
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT ITAB_PRLIST.
IF ITAB_PRLIST-BADAT <> SY-DATUM or
itab_prlist-banfn <= '0010000212'.
DELETE ITAB_PRLIST.
ENDIF.
ENDLOOP.
ITAB_PRLIST-MATNR = 'ZZZZZZZZZZZZZZZZZZ'.
APPEND ITAB_PRLIST.
SORT ITAB_PRLIST BY MATNR BANFN BNFPO.
ENDFORM.
FORM BAPIDATA_FILL.
* DETERMINE THE NUMBER OF RECORDS IN THE INTERNAL TABLE
DESCRIBE TABLE ITAB_PRLIST LINES VLINES.
IF VLINES = 1.
EXIT.
ENDIF.
VLINECOUNT = 0.
VFIRST = 'X'.
VMATNR = '.
VPREVMATNR = '.
VPREVBANFN = '.
VPREVBNFPO = 0.
VRUNBAPI = '.
PERFORM DISPLAY_PROGRESS_TIMER.
CLEAR ITAB_PREVPR[].
LOOP AT ITAB_PRLIST.
IF VMATNR <> ITAB_PRLIST-MATNR.
IF VFIRST <> 'X'.
VRUNBAPI = 'X'.
ENDIF.
VMATNR = ITAB_PRLIST-MATNR.
VLINECOUNT = 10.
ENDIF.
IF VRUNBAPI = 'X'.
VMATNR = ITAB_PRLIST-MATNR.
VRUNBAPI = '.
PERFORM BAPI_LOAD.
READ TABLE T_RETURN INDEX 1.
DESCRIBE TABLE T_RETURN.
IF T_RETURN-TYPE = 'S'.
PERFORM DATACOMMIT.
CONCATENATE 'PO CREATED SUCCESSFULLY:' PONUM INTO VTEXT.
LOOP AT ITAB_PREVPR WHERE MATNR = VPREVMATNR.
UPDATE ZLOGHEAD SET MSGTYPE = 'S'
PROCESSED = 'X'
MSGTEXT = VTEXT
WHERE CREATEDATE = SY-DATUM AND
KEY1 = ITAB_PREVPR-KEY1 AND
KEY2 = ITAB_PREVPR-KEY2.
DELETE ITAB_PREVPR.
ENDLOOP.
'ADD RECORDS TO DIS LOGS
IT_DISLOGHEAD-PO = PONUM.
IT_DISLOGHEAD-VENDOR = VVENDOR.
IT_DISLOGHEAD-MSGTYPE = 'S'.
IT_DISLOGHEAD-MSG = VTEXT.
APPEND IT_DISLOGHEAD.
LOOP AT IT_DISLOGDETAIL .
IF IT_DISLOGDETAIL-PO = '.
IT_DISLOGDETAIL-PO = PONUM.
ENDIF.
ENDLOOP.
LOOP AT T_RETURN.
IT_DISLOGDETAIL-PO = PONUM.
IT_DISLOGDETAIL-VENDOR = VVENDOR.
IT_DISLOGDETAIL-LINE = '.
IT_DISLOGDETAIL-MATERIAL = '.
IT_DISLOGDETAIL-MSGTYPE = 'S'.
IT_DISLOGDETAIL-MSG = T_RETURN-MESSAGE(50).
APPEND IT_DISLOGDETAIL.
ENDLOOP.
REFRESH T_RETURN.
ELSE. 'BAPI FAILED
'ADD RECORDS TO DIS LOGS
IT_DISLOGHEAD-PO = '*****'.
IT_DISLOGHEAD-VENDOR = VVENDOR.
IT_DISLOGHEAD-MSGTYPE = 'E'.
IT_DISLOGHEAD-MSG = 'PO CREATION FAILED'.
APPEND IT_DISLOGHEAD.
LOOP AT T_RETURN.
IT_DISLOGDETAIL-PO = '*****'.
IT_DISLOGDETAIL-VENDOR = VVENDOR.
IT_DISLOGDETAIL-LINE = '.
IT_DISLOGDETAIL-MATERIAL = '.

Bapi Po Create1 Manual Price In India

IT_DISLOGDETAIL-MSGTYPE = 'E'.
IT_DISLOGDETAIL-MSG = T_RETURN-MESSAGE(50).
APPEND IT_DISLOGDETAIL.
ENDLOOP.
REFRESH T_RETURN.
ENDIF.
CLEAR T_RETURN[].
CLEAR T_POITEM[].
CLEAR T_POITEMX[].
CLEAR LPOHEADER.
CLEAR LPOHEADERX.
ENDIF.
IF ITAB_PRLIST-MATNR <> 'ZZZZZZZZZZZZZZZZZZ'.
LPOHEADER-COMP_CODE = VCCODE.
LPOHEADER-DOC_TYPE = ITAB_PRLIST-BSART.
LPOHEADER-CREAT_DATE = SY-DATUM.
LPOHEADER-VENDOR = ITAB_PRLIST-FLIEF.
LPOHEADER-PURCH_ORG = VPORG.
LPOHEADER-PUR_GROUP = VPGRP.
IF LPOHEADER-VENDOR = '.
LPOHEADER-VENDOR = ITAB_PRLIST-LIFNR.
ENDIF.
LPOHEADERX-COMP_CODE = 'X'.
LPOHEADERX-DOC_TYPE = 'X'.
LPOHEADERX-CREAT_DATE = 'X'.
LPOHEADERX-VENDOR = 'X'.
LPOHEADERX-PURCH_ORG = 'X'.
LPOHEADERX-PUR_GROUP = 'X'.
T_POITEM-PO_ITEM = VLINECOUNT.
T_POITEM-PREQ_NO = ITAB_PRLIST-BANFN.
T_POITEM-PREQ_ITEM = ITAB_PRLIST-BNFPO.
T_POITEM-PO_PRICE = 2.
T_POITEM-NET_PRICE = ITAB_PRLIST-NETPR.
T_POITEM-QUANTITY = ITAB_PRLIST-MENGE - ITAB_PRLIST-BSMNG.
T_POITEM-PLAN_DEL = ITAB_PRLIST-APLFZ.
APPEND T_POITEM.
T_POITEMX-PO_ITEM = VLINECOUNT.
T_POITEMX-PREQ_NO = ITAB_PRLIST-BANFN.
T_POITEMX-PREQ_ITEM = ITAB_PRLIST-BNFPO.
T_POITEMX-PO_PRICE = 'X'.
T_POITEMX-NET_PRICE = 'X'.
T_POITEMX-QUANTITY = 'X'.
T_POITEMX-PLAN_DEL = 'X'.
APPEND T_POITEMX.
SELECT KEY1 KEY2 FROM ZLOGHEAD
INTO (VBANFN , VBNFPO)
WHERE PROCESSNAME = 'PR2POBAPI' AND
PROCESSED = ' ' AND
KEY1 = ITAB_PRLIST-BANFN AND
KEY2 = ITAB_PRLIST-BNFPO.
ENDSELECT.
IF SY-SUBRC <> 0.
WA-MANDT = SY-MANDT.
WA-PROCESSNAME = 'PR2POBAPI'.
WA-KEY1 = ITAB_PRLIST-BANFN.
WA-KEY2 = ITAB_PRLIST-BNFPO.
WA-PROCESSED = ' '.
WA-MSGTYPE = 'E'.
WA-DATA1 = ITAB_PRLIST-MATNR.
WA-CREATEDATE = SY-DATUM.
WA-CREATETIME = SY-UZEIT.
WA-MSGTEXT = 'PO CREATION FAILED'.
INSERT ZLOGHEAD FROM WA.
ENDIF.
WAPREVPR-KEY1 = ITAB_PRLIST-BANFN.
WAPREVPR-KEY2 = ITAB_PRLIST-BNFPO.
WAPREVPR-MATNR = ITAB_PRLIST-MATNR.
APPEND WAPREVPR TO ITAB_PREVPR.
VLINECOUNT = VLINECOUNT + 10.
VVENDOR = ITAB_PRLIST-LIFNR.
VPREVMATNR = ITAB_PRLIST-MATNR.
VFIRST = '.
ENDIF.
ENDLOOP.
ENDFORM.
FORM BAPI_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 = T_RETURN
POITEM = T_POITEM
POITEMX = T_POITEMX
* 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. 'BAPI_LOAD

Bapi Po Create1 Manual Priced


*&---------------------------------------------------------------------*
*& FORM DATACOMMIT
*&---------------------------------------------------------------------*
* TEXT
*----------------------------------------------------------------------*
FORM DATACOMMIT.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = '2'
* IMPORTING
* RETURN =
.
WAIT UP TO 2 SECONDS.
* WRITE: 'GENERATED PO:', PONUM.
* LOOP AT T_RETURN.
* WRITE:/ T_RETURN-MESSAGE, T_RETURN-MESSAGE_V1.
* ENDLOOP.
ENDFORM. 'DATACOMMIT
FORM DISPLAY_PROGRESS_TIMER .
V_PER = SY-TABIX / VLINES * 100.
WRITE V_PER TO V_TXT.
CONDENSE V_TXT.
CONCATENATE V_TXT '% OF PO RECORDS CREATED...'
INTO V_TXT SEPARATED BY
SPACE.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = V_PER
TEXT = V_TXT.
ENDFORM. ' DISPLAY_PROGRESS_TIMER
FORM DISPLAY_LOG_LIST.
* CREATE FIELDCATALOG FOR ALV
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_DISLOGHEAD'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FIELDCAT
'I_INCLNAME = SY-REPID
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF IT_DISLOGDETAIL IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_DISLOGDETAIL'

Bapi Po Create1 Manual Price


I_INCLNAME = SY-REPID
I_CLIENT_NEVER_DISPLAY = 'X'
CHANGING
CT_FIELDCAT = IT_FIELDCAT[]
'I_INCLNAME = SY-REPID
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IT_KEYINFO-HEADER01 = 'PO'.
IT_KEYINFO-ITEM01 = 'PO'.
IT_KEYINFO-ITEM02 = 'LINE'.
APPEND IT_KEYINFO.
WA_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
WA_LAYOUT-DEF_STATUS = ' '.
'SORT IT_LOGDETAIL BY PLANT MATERIAL MSG.
'DELETE ADJACENT DUPLICATES FROM IT_LOGDETAIL COMPARING
'PLANT MATERIAL MSG.
* CALL FUNCTION TO DISPLAY ALV LOG
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT[]
IS_LAYOUT = WA_LAYOUT
I_DEFAULT = ' '
I_SAVE = 'A'
I_TABNAME_HEADER = 'IT_DISLOGHEAD'
I_TABNAME_ITEM = 'IT_DISLOGDETAIL'
IS_KEYINFO = IT_KEYINFO
I_BYPASSING_BUFFER = 'X'
' I_SUPPRESS_EMPTY_DATA = abap_true
TABLES
T_OUTTAB_HEADER = IT_DISLOGHEAD
T_OUTTAB_ITEM = IT_DISLOGDETAIL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. 'DISPLAY_LOG_LIST

Contents
1 Short Description
2 Function Module
3 Description
3.1 Functionality
3.2 Functionality in Detail
3.3 Authorization
3.4 Controlling adoption of field values via X parameter
3.5 Transfer
3.6 Return
3.7 Return messages
3.8 Restrictions
3.9 Example
3.10 Help in the Case of Problems
3.11 Customer Enhancements
3.12 Further information
4 Import
5 Export
6 Changing
7 Pattern

[edit]Short Description
Create Enjoy Purchase Orders

[edit]Function Module
BAPI_PO_CREATE1

[edit]Description
[edit]Functionality
STYLE S_DOCUS1 Function module BAPI_PO_CREATE1 enables you to create purchase orders. The BAPI uses the technology behind the Enjoy purchase order transaction (ME21N). Alternatively, the IDoc type PORDCR1 is available. The data from this IDoc automatically populates the interface parameters of the function module BAPI_PO_CREATE1. STYLE *

[edit]Functionality in Detail
STYLE S_DOCUS1

[edit]Authorization
The following authorization objects are checked when an Enjoy purchase order is created (activity 01):

M_BEST_BSA (document type in PO)
M_BEST_EKG (purchasing group in PO)
M_BEST_EKO (purchasing organization in PO)
M_BEST_WRK (plant in PO)
[edit]Controlling adoption of field values via X parameter
For most tables, you can determine via your own parameters in the associated X parameter in each case (e.g. PoItemX) whether fields are to be set initial, values inserted via the interface, or default values adopted (e.g. from Customizing or master records) (for example, it is not mandatory to adopt the material group from an underlying purchase requisition – you can change it with the BAPI).

[edit]Transfer
Header data
The header data of the Enjoy purchase order is transferred in the table PoHeader.

Item data
The item data of the Enjoy purchase order is stored in the table PoItem (general item data). The delivery schedule lines are stored in the table PoSchedule. Use the table PoAccount to specify the account assignment information. If account assignments have been specified for services and limits, you show the relevant account assignment line in PoAccount in the table PoSrvAccessValues via the package number of the service or the limit.

Services and limits
Services, free limits and limits with contract reference can be specified in the tables PoServices, PoLimits, and PoContractLimits.

Conditions
Conditions are transferred in the table PoCond; header conditions in the table PoCondHeader. Price determination is reinitiated via the parameter CALCTYPE in the table PoItem.

Vendor and delivery address
The vendor’s address can be specified individually in the table PoAddrVendor; the delivery address in the table PoAddrDelivery. If you do not make any individual specification, the fields will be populated via the central address management facility. Note In this method, the following restrictions apply with regard to addresses: Addresses can only be created with this method – they cannot be changed. You can only change address data with the method BAPI_ADDRESSORG_CHANGE. When you create addresses, they are not checked by the method. An Enjoy purchase order may therefore contain faulty address data.

Partner roles
The partners can be maintained individually via the table PoPartner (with the exception of the partner role 'vendor').

Import/export data
Import/Export data can be specified per item in the table PoExpImpItem. Foreign trade data can only be transferred as default data for new items.

Texts
Header and item texts can be transferred in the tables PoTextHeader and PoTextItem. Texts for services are imported in the table PoServicesText.

Version Management
You can make use of the Version Management facility via the table AllVersions.

[edit]Return
The PO number is returned in the parameter ExpPurchaseOrder. In addition, all information except the service and export/import tables is placed in the output structures.

[edit]Return messages
Messages are returned in the parameter Return. This also contains information as to whether interface data has been wrongly or probably wrongly (heuristical interface check) populated. When a PO has been created successfully, the PO number is also placed in the return table with the appropriate message. STYLE * STYLE S_DOCUS1

Create1

[edit]Restrictions
With this function module, it is not possible to:

Create subcontracting components (you can only use existing ones)
Create configurations (you can only use existing ones)
Change message records (table NAST) and additional message data (this data can only be determined via the message determination
facility (Customizing))

Attach documents to the purchase order
See also further information in SAP Note 197958. STYLE *

[edit]Example
STYLE S_DOCUS1 Example of population of BAPI interface in the Function Builder Parameter: POHEADER COMP_CODE,=,1000 DOC_TYPE,=,NB ITEM_INTVL,=,00001 VENDOR,=,0000001000 PMNTTRMS,=, 0001 PURCH_ORG,=, 1000 PUR_GROUP,=, 001 CURRENCY,=, EUR Parameter: POHEADERX COMP_CODE,=, X DOC_TYPE,=, X ITEM_INTVL,=, X VENDOR,=, X PMNTTRMS,=, X PURCH_ORG,=, X PUR_GROUP,=, X Parameter: POITEM PO_ITEM,=, 00001 MATERIAL,=,100-100 PLANT,=,1000 STGE_LOC,=,0001 QUANTITY,=,15.000 TAX_CODE,=,V0 ITEM_CAT,=, 0 ACCTASSCAT,=,K Parameter: POITEMX PO_ITEM,=,00001 MATERIAL,=,X PLANT,=,X STGE_LOC,=,X QUANTITY,=,X TAX_CODE,=,X ITEM_CAT,=,X ACCTASSCAT,=,X Parameter: POSCHEDULE PO_ITEM,=,00001 SCHED_LINE,=,0001 DELIVERY_DATE,=,02.12.2002 QUANTITY,=,6.000 PO_ITEM,=,00001 SCHED_LINE,=,0002 DELIVERY_DATE,=,03.12.2002 QUANTITY,=,5.000 PO_ITEM,=,00001 SCHED_LINE,=,0003 DELIVERY_DATE,=,04.12.2002 QUANTITY,=,4.000 Parameter: POSCHEDULEX PO_ITEM,=,00001 SCHED_LINE,=,0001 PO_ITEMX,=,X SCHED_LINEX,=,X DELIVERY_DATE,=,X QUANTITY,=,X PO_ITEM,=,00001 SCHED_LINE,=,0002 PO_ITEMX,=,X SCHED_LINEX,=,X DELIVERY_DATE,=,X QUANTITY,=,X PO_ITEM,=,00001 SCHED_LINE,=,0003 PO_ITEMX,=,X SCHED_LINEX,=,X DELIVERY_DATE,=,X QUANTITY,=,X Parameter: POACCOUNT PO_ITEM,=,00001 SERIAL_NO,=,01 QUANTITY,=,15.000 GL_ACCOUNT,=,0000400000 COSTCENTER,=,0000001000 CO_AREA,=,1000 Parameter: POACCOUNTX PO_ITEM,=,00001 SERIAL_NO,=,01 QUANTITY,=,X GL_ACCOUNT,=,X COSTCENTER,=,X CO_AREA,=,X Parameter: POCOND ITM_NUMBER,=,000001 COND_ST_NO,=,001 COND_TYPE,=,PB00 COND_VALUE,=,79.900000000 CURRENCY,=,EUR CURRENCY_ISO,=,EUR COND_UNIT,=,KG COND_P_UNT,=,1 CHANGE_ID,=,U Parameter: POCONDX ITM_NUMBER,= ,000001 COND_ST_NO,= ,001 ITM_NUMBERX,= ,X COND_TYPE,= ,X COND_VALUE,= ,X CURRENCY,= ,X CHANGE_ID,= ,X Parameter: POPARTNER PARTNERDESC,= ,OA LANGU,= ,EN BUSPARTNO,= ,0000001100 PARTNERDESC,= ,GS LANGU,= ,EN BUSPARTNO,= ,0000001200 PARTNERDESC,= ,PI LANGU,= ,EN BUSPARTNO,= ,0000001000 STYLE *

[edit]Help in the Case of Problems
RESET N1 STYLE S_DOCUS1

SAP Note 197958 lists answers to frequently asked questions (FAQs). (Note 499626 contains answers to FAQs relating specifically
to External Services Management.)

If you have detected an error in the function of a BAPI, create a reproducible example in the test data directory in the
Function Builder (transaction code SE37). SAP Note 375886 tells you how to do this.

If the problem persists, create a Customer Problem Message for the componente MM-PUR-PO-BAPI, and document the reproducible
example where appropriate. STYLE *

[edit]Customer Enhancements
STYLE S_DOCUS1 The following customer exits (function modules) are available for the BAPI BAPI_PO_CREATE1:

EXIT_SAPL2012_001 (at start of BAPI)
EXIT_SAPL2012_003 (at end of BAPI)
The following customer exits (function modules) are available for the BAPI BAPI_PO_CHANGE:

EXIT_SAPL2012_002 (at start of BAPI)
EXIT_SAPL2012_004 (at end of BAPI)
These exits belong to the enhancement SAPL2012 (see also transaction codes SMOD and CMOD). There is also the option of populating customers’ own fields for header, item, or account assignment data via the parameter EXTENSIONIN. STYLE *

[edit]Further information
RESET N1 STYLE S_DOCUS1

Further information on purchase order BAPIs is available in SAP Note 197958.
If you test the BAPIs BAPI_PO_CREATE1 or BAPI_PO_CHANGE in the Function Builder (transaction code SE37), no database updates
will be carried out. If you need this function, take a look at Note 420646.

The BAPI BAPI_PO_GETDETAIL serves to read the details of a purchase order. The BAPI cannot read all details (e.g. conditions).
However, you can use the BAPI BAPI_PO_CHANGE for this purpose if just the document number is populated and the invoker has change authorizations for purchase orders.

Frequently used BAPIs for purchase orders are BAPI_PO_CREATE, BAPI_PO_CREATE1, BAPI_PO_CHANGE, BAPI_PO_GETDETAIL,
BAPI_PO_GETITEMS, BAPI_PO_GETITEMSREL, and BAPI_PO_GETRELINFO.

For more information on purchase orders, refer to the SAP library (under MM Purchasing -> Purchase Orders) or the Help for
the Enjoy Purchase Order, or choose the path Tools -> ABAP Workbench -> Overview -> BAPI Explorer from the SAP Easy Access menu. STYLE *

[edit]Import
ExtensionIn
MemoryComplete
MemoryUncomplete
NoAuthority
NoMessageReq
NoMessaging
NoPriceFromPo
PoAccountProfitSegment
PoAccountX
PoAddrVendor
PoComponentsX
PoCondX
PoContractLimits
PoExpImpHeader
PoExpImpHeaderX
PoExpImpItemX
PoHeader
PoHeaderX
PoItemX
PoLimits
PoScheduleX
PoServices
PoServicesText
PoShipping
PoShippingX
PoSrvAccessValues
TestRun
Versions
[edit]Export
AllVersions
ExpHeader
ExpPoExpImpHeader
ExpPurchaseOrder
ExtensionOut
PoShippingExp
Return
[edit]Changing
PoAccount
PoAddrDelivery
PoComponents
PoCond
PoCondHeader
PoCondHeaderX
PoExpImpItem
PoItem
PoPartner
PoSchedule
PoTextHeader
PoTextItem
[edit]Pattern

CALL FUNCTION ‘BAPI_PO_CREATE1’
EXPORTING
POHEADER =
' POHEADERX =
' POADDRVENDOR =
' TESTRUN =
' MEMORY_UNCOMPLETE =
' MEMORY_COMPLETE =
' POEXPIMPHEADER =
' POEXPIMPHEADERX =
' VERSIONS =
' NO_MESSAGING =
' NO_MESSAGE_REQ =
' NO_AUTHORITY =
' NO_PRICE_FROM_PO =
' IMPORTING
' EXPPURCHASEORDER =
' EXPHEADER =
' EXPPOEXPIMPHEADER =
' TABLES
' RETURN =
' POITEM =
' POITEMX =
' 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 =
.

Retrieved from 'http://abap.wikiprog.com/wiki/BAPI_PO_CREATE1'
Category: BAPI PurchaseOrderFRE

Views

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.