BAPI_PO_CREATE1 - Services
Hi everybody, i have tried to create purchase orders, but that contains service positions, i filled the structures POSERVICES, but always it leaves the same error to me:
"Please maintain services or limits"
Anybody can help me to solve this problem???
Thkns.
Mauricio N.
May be I am wrong. Look at the code below from LMEPOF2B. This is where the message is coming from and looks like it has got something to do with the outline agreement.
IF ( ekpo-pstyp EQ pstyp-dien OR ekpo-pstyp EQ pstyp-blnk ) AND
ekpo-packno IS INITIAL.
* service item without services
* check comsrv
DATA: l_success TYPE mmpur_bool VALUE mmpur_yes. "511338
* check outline agreement is obligatory (only for services) 511338
PERFORM mepo_check_agmt_srv USING l_success "511338
mmpur_yes. "511338
CASE ekpo-pstyp.
WHEN pstyp-dien.
mmpur_metafield mmmfd_services.
mmpur_metafield_add mmmfd_limits. "619075
WHEN pstyp-blnk.
mmpur_metafield mmmfd_limits.
ENDCASE.
IF l_success EQ mmpur_yes. "511338
MESSAGE e029(se).
ENDIF. "511338
ENDIF.
Similar Messages
-
BAPI_PO_CREATE1, Service line, PREQ_NO
Hi friends,
I use bapi_po_create1 in combination with purchase requesition and service.
Retunrvalue is with Msg: SE 518 - No account assignment exists for service line 0000000010.
Population is without preq_no and item possible. If I use transaction code ME21N with same population, purchase order will be created.
Thank you in advance for your help and ideas
Here is the population of fields...
po_header-COMP_CODE = '1000' .
po_header-DOC_TYPE = 'NB' .
po_header-ITEM_INTVL = '00010' .
po_header-VENDOR = '0000001101'.
po_header-PMNTTRMS = '0001' .
po_header-PURCH_ORG = '1000' .
po_header-PUR_GROUP = '008' .
po_header-CURRENCY = 'EUR' .
populated same header X-Flags
po_item_-PO_ITEM = '00010' .
po_item_-PLANT = '1000' .
po_item_-QUANTITY = '1.000' .
po_item_-TAX_CODE = 'V0' .
po_item_-item_cat = '9'. "Leist
po_item_-ACCTASSCAT = 'F'.
po_item_-short_text = 'Leistung'.
po_item_-NET_PRICE = '12'.
po_item_-MATL_GROUP = '007'.
po_item_-PCKG_NO = '0100002226'.
po_item_-PREQ_NO = '0010008985'.
po_item_-PREQ_ITEM = '00010'.
populated same itemx-Flags...
po_sched-PO_ITEM = '00010'.
po_sched-SCHED_LINE = '0001' .
po_sched-DELIVERY_DATE = '20060526'.
with account fields and account assignment fields (X-Flags)
po_acc-PO_ITEM = '00010' .
po_acc-SERIAL_NO = '01' .
po_acc-QUANTITY = '1' .
po_acc-GL_ACCOUNT = '0000400000' .
po_acc-COSTCENTER = '0000001000' .
po_acc-CO_AREA = '1000' .
Fields of Service:
po_serv-PCKG_NO = '0100002226'.
po_serv-line_no = '0000000001'.
po_serv-OUTL_IND = 'X'.
po_serv-SUBPCKG_NO = '0100002227'.
po_serv-SHORT_TEXT = 'TEST LEISTUNG'.
po_serv-QUANTITY = '1.000' .
po_serv-BASE_UOM = 'LE'.
po_serv-GR_PRICE = '1'.
append po_serv to po_services.
second item
po_serv-PCKG_NO = '0100002227'. "'0100002506'.
po_serv-line_no = '0000000002'.
po_serv-EXT_LINE = '0000000010'.
po_serv-MATL_GROUP = '007'.
po_serv-OUTL_IND = ''.
and item to accesvalue:
po_accval-PCKG_NO = '0100002227'.
po_accval-line_no = '0000000002'.
po_accval-serno_line = '01'.
po_accval-SERIAL_NO = '01'. "Link to account assing
po_accval-PERCENTAGE = '100'.
po_accval-QUANTITY = '1'.
po_accval-NET_VALUE = '1'.Hi,
I am able tio create PO with the following data in combination with PR. Pls check.
PO Header Data:
PO_NUMBER
COMP_CODE ZN01
DOC_TYPE ZPRC
DELETE_IND
STATUS
CREAT_DATE
CREATED_BY
ITEM_INTVL 00000
VENDOR
LANGU EN
LANGU_ISO
PMNTTRMS
DSCNT1_TO 0
DSCNT2_TO 0
DSCNT3_TO 0
DSCT_PCT1 0,000
DSCT_PCT2 0,000
PURCH_ORG ZNPR
PUR_GROUP ZPG
CURRENCY USD
CURRENCY_ISO
EXCH_RATE
EX_RATE_FX
DOC_DATE 26.06.2006
VPER_START
VPER_END
WARRANTY
QUOTATION
QUOT_DATE
REF_1
SALES_PERS
TELEPHONE
SUPPL_VEND
CUSTOMER
AGREEMENT
GR_MESSAGE
SUPPL_PLNT
INCOTERMS1
INCOTERMS2
COLLECT_NO
DIFF_INV
OUR_REF
LOGSYSTEM
SUBITEMINT 00000
PO_REL_IND
REL_STATUS
VAT_CNTRY
VAT_CNTRY_ISO
REASON_CANCEL 00
PO Item Data:
PO_ITEM 00010
DELETE_IND
SHORT_TEXT MATERIAL 1 - XPRO PC
MATERIAL
MATERIAL_EXTERNAL
MATERIAL_GUID
MATERIAL_VERSION
EMATERIAL
EMATERIAL_EXTERNAL
EMATERIAL_GUID
EMATERIAL_VERSION
PLANT ZNP1
STGE_LOC
TRACKINGNO
MATL_GROUP 00706
INFO_REC
VEND_MAT
QUANTITY 10,000
PO_UNIT EA
PO_UNIT_ISO
ORDERPR_UN
ORDERPR_UN_ISO
CONV_NUM1 0
CONV_DEN1 0
NET_PRICE 1.000,000000000
PRICE_UNIT 100
GR_PR_TIME 0
TAX_CODE
BON_GRP1
QUAL_INSP
INFO_UPD
PRNT_PRICE
EST_PRICE
REMINDER1 0
REMINDER2 0
REMINDER3 0
OVER_DLV_TOL 0,0
UNLIMITED_DLV
UNDER_DLV_TOL 0,0
VAL_TYPE
NO_MORE_GR
FINAL_INV
ITEM_CAT
ACCTASSCAT K
DISTRIB
PART_INV
GR_IND X
GR_NON_VAL
IR_IND X
FREE_ITEM
GR_BASEDIV X
ACKN_REQD
ACKNOWL_NO
AGREEMENT
AGMT_ITEM 00000
SHIPPING
CUSTOMER
COND_GROUP
NO_DISCT
PLAN_DEL 0
NET_WEIGHT 0,000
WEIGHTUNIT
WEIGHTUNIT_ISO
TAXJURCODE
CTRL_KEY
CONF_CTRL
REV_LEV
FUND
FUNDS_CTR
CMMT_ITEM
PRICEDATE
PRICE_DATE
GROSS_WT 0,000
VOLUME 0,000
VOLUMEUNIT
VOLUMEUNIT_ISO
INCOTERMS1
INCOTERMS2
PRE_VENDOR
VEND_PART NWV05
HL_ITEM 00000
GR_TO_DATE
SUPP_VENDOR
SC_VENDOR
KANBAN_IND
ERS
R_PROMO
POINTS 0,000
POINT_UNIT
POINT_UNIT_ISO
SEASON
SEASON_YR
BON_GRP2
BON_GRP3
SETT_ITEM
MINREMLIFE 0
RFQ_NO
RFQ_ITEM 00000
PREQ_NO 5000000011
PREQ_ITEM 00010
REF_DOC
REF_ITEM 00000
SI_CAT
RET_ITEM
AT_RELEV
ORDER_REASON
BRAS_NBM
MATL_USAGE
MAT_ORIGIN
IN_HOUSE
INDUS????
INF_INDEX
UNTIL_DATE
DELIV_COMPL
SHIP_BLOCKED
PREQ_NAME CCMUSR
PERIOD_IND_EXPIRATION_DATE D
INT_OBJ_NO 000000000000000000
PCKG_NO 0000000000
BATCH
VENDRBATCH
CALCTYPE
NO_ROUNDING
PO_PRICE
SRV_BASED_IV
PO Account Data:
PO_ITEM 00010
SERIAL_NO 00
DELETE_IND
CREAT_DATE
QUANTITY 0,000
DISTR_PERC 0,0
NET_VALUE 0,000000000
GL_ACCOUNT 400998
BUS_AREA
COSTCENTER CC_1
SD_DOC
ITM_NUMBER 000000
SCHED_LINE 0000
ASSET_NO
SUB_NUMBER
ORDERID
GR_RCPT
UNLOAD_PT
CO_AREA ZN01
COSTOBJECT
PROFIT_CTR
WBS_ELEMENT
NETWORK
RL_EST_KEY
PART_ACCT
CMMT_ITEM
REC_IND
FUNDS_CTR
FUND
FUNC_AREA
REF_DATE
TAX_CODE
TAXJURCODE
NOND_ITAX 0,000000000
ACTTYPE
CO_BUSPROC
RES_DOC
RES_ITEM 000
ACTIVITY -
Hello together,
i have the following problem. I used the BAPI BAPI_PO_CREATE1 to create Purchase Orders with reference to a purchase requsition. I have 2 different types of purchase requsitions. One with normal items and one with services.
So for both the creation of the purchase order works but if i add Conditions on Serivce Item Level to the purchase requsition they are not transfered to the purchase order.
To eliminate misunderstandings in a purchase order there are 3 diffent typs of conditions possible. First on header Level of the purchase order which can easly be filled with BAPI. The second on item level of the purchase order with can also easily be filled with BAPI and the last on service level which i doesn't found in BAPI. May be someone has an idea how to fill these conditions.
Here is my code:
header-doc_date = wa_eban-erdat.
value = 10.
Set COMP_CODE
select single bwkey from t001w into lv_bwkey
where werks = wa_eban-werks.
select single bukrs from t001k into header-comp_code
where bwkey = lv_bwkey.
header-doc_type = wa_eban-bsart.
header-vendor = wa_eban-flief.
header-created_by = sy-uname.
header-purch_org = wa_eban-ekorg.
header-pur_group = wa_eban-ekgrp.
header-langu = sy-langu.
header-status = 'B'.
header-indx = header-indx + 1.
append header.
headerx-doc_type = 'X'.
headerx-comp_code = 'X'.
headerx-vendor = 'X'.
headerx-purch_org = 'X'.
headerx-created_by = 'X'.
headerx-pur_group = 'X'.
headerx-created_by = 'X'.
headerx-langu = 'X'.
headerx-status = 'X'.
headerx-indx = header-indx.
append headerx.
*!-- Populating the BAPI for PO Item data
poitems-po_item = value.
poitems-material = wa_eban-matnr.
poitems-stge_loc = wa_eban-lgort.
poitems-plant = wa_eban-werks.
poitems-item_cat = wa_eban-pstyp.
poitems-po_unit = wa_eban-meins.
poitems-quantity = wa_eban-menge - wa_eban-bsmng.
poitems-preq_no = wa_eban-banfn.
poitems-preq_item = wa_eban-bnfpo.
poitems-tax_code = wa_eban-yy_mwskz.
poitems-indx = header-indx.
poitemsx-po_item = value.
poitemsx-material = 'X'.
poitemsx-stge_loc = 'X'.
poitemsx-plant = 'X'.
poitemsx-item_cat = 'X'.
poitemsx-preq_no = 'X'.
poitemsx-preq_item = 'X'.
poitemsx-po_unit = 'X'.
poitemsx-quantity = 'X'.
poitemsx-tax_code = 'X'.
poitemsx-indx = header-indx.
Create Construction with Services
if wa_eban-bsart eq 'ZXXXX.
poitemsx-pckg_no = 'X'.
poitems-pckg_no = wa_eban-packno.
endif.
append poitems.
append poitemsx.
*!-- Populating the BAPI for PO Item Schedule data
scd-po_item = value.
scd-sched_line = value1.
scd-delivery_date = wa_eban-lfdat.
scd-quantity = wa_eban-menge - wa_eban-bsmng.
scd-indx = header-indx.
append scd.
scdx-po_item = value.
scdx-sched_line = value1.
scdx-delivery_date = 'X'.
scdx-quantity = 'X'.
scdx-indx = header-indx.
append scdx.
*!-- Populating the BAPI for PO Item data for Accounting
account-po_item = value.
account-quantity = wa_eban-menge - wa_eban-bsmng.
account-indx = header-indx.
accountx-po_item = value.
accountx-quantity = 'X'.
accountx-indx = header-indx.
Create Construction with Services
if wa_eban-bsart eq 'ZXXX.
account-costcenter = wa_ebkn-kostl.
account-gl_account = wa_ebkn-sakto.
account-orderid = wa_ebkn-aufnr.
select single posid from prps into account-wbs_element where pspnr = wa_ebkn-ps_psp_pnr .
account-serial_no = wa_ebkn-zebkn.
accountx-costcenter = 'X'.
accountx-gl_account = 'X'.
accountx-orderid = 'X'.
accountx-wbs_element = 'X'.
accountx-serial_no = 'X'.
endif.
append account.
append accountx.https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/rfc%2bpurchase%2border%2bcreation%2bfm%2bfrom%2bariba
cheers
Aveek -
BAPI_PO_CREATE1 - Service order Creation
Hi,
Im trying to use BAPI_PO_CREATE1 to create service orders using the test run in ECC6 but the return table shows an error 'Please maintain Services or limits' .
With the same values i'm able to create a service order by running the transaction online.
The normal PO's are also getting created without any problems.
Is there anything im missing out???
Thanks & Regards,
Navaneethhttps://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/rfc%2bpurchase%2border%2bcreation%2bfm%2bfrom%2bariba
cheers
Aveek -
HI
while posting new BAPI for creating BAPI_PO_CREATE1,
is is saying that, my 1...PURCHASE ORDER STILL CONTAIN faulty items,
2.....please maintain services or limits...
i am new to BAPI. PLZ SUGGEST ME SUITABLE SOLUTIONCheck OSS notes 373989 BAPI_PO_CREATE1: Service item -> SE029
and Note 634395 - FAQ: Purchase orders in the service
rgds,
raj -
Error while creating a Service PO using BAPI_PO_CREATE1
Hi,
Im facing Error as "In case of account assignment, please enter acc. assignment data for item" while creating Service PO using BAPI_PO_CREATE1.
Header Data
w_poheader-comp_code = w_src-bukrs. "Company Code
w_poheader-doc_type = w_src-bsart. "Document type
w_poheader-delete_ind = w_src-vrtkz. "Deletion Indicator
CLEAR: lv_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = w_src-aedat
IMPORTING
date_internal = lv_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
w_poheader-creat_date = lv_date. "Creation Date
w_poheader-created_by = sy-uname. "Creator Name
w_poheader-vendor = w_src-lifnr. "Vendor
w_poheader-pmnttrms = w_src-zterm. "Payment Terms
w_poheader-purch_org = w_src-ekorg. "Purchase Organization
w_poheader-pur_group = w_src-ekgrp. "Purchase Group
w_poheader-ref_1 = w_src-ihrez. "OLD PO
w_poheaderx-comp_code = 'X'. "Company Code
w_poheaderx-doc_type = 'X'. "Document type
w_poheaderx-delete_ind = 'X'. "Deletion Indicator
w_poheaderx-creat_date = 'X'. "Creation Date
w_poheaderx-created_by = 'X'.
w_poheaderx-vendor = 'X'.
w_poheaderx-pmnttrms = 'X'. "Payment Terms
w_poheaderx-purch_org = 'X'. "Purchase Organization
w_poheaderx-pur_group = 'X'. "Purchase Group
w_poheaderx-ref_1 = 'X'.
Item Data
w_poitem-po_item = w_src-ebelp.
IF NOT w_src-elikz IS INITIAL.
w_poitem-delete_ind = w_src-elikz.
ENDIF.
IF NOT w_src-txz01 IS INITIAL.
w_poitem-short_text = w_src-txz01.
ENDIF.
IF NOT w_src-werks IS INITIAL.
w_poitem-plant = w_src-werks.
ENDIF.
Material group
IF NOT w_src-matkl IS INITIAL.
w_poitem-matl_group = w_src-matkl.
ENDIF.
Open or Partial Qty
IF w_src-opqty IS NOT INITIAL.
w_poitem-quantity = w_src-opqty.
ELSEIF NOT w_src-paqty IS INITIAL.
w_poitem-quantity = w_src-paqty.
ENDIF.
IF NOT w_src-meins IS INITIAL.
w_poitem-po_unit = w_src-meins. "Base Unit of Measure
ENDIF.
IF NOT w_src-netpr IS INITIAL.
w_poitem-net_price = w_src-netpr. "Net Price
ENDIF.
IF NOT w_src-mwskz IS INITIAL.
w_poitem-tax_code = w_src-mwskz.
ENDIF.
IF NOT w_src-pstyp IS INITIAL.
w_poitem-item_cat = w_src-pstyp.
ENDIF.
IF NOT w_src-knttp IS INITIAL.
w_poitem-acctasscat = w_src-knttp.
ENDIF.
IF NOT w_src-vrtkz IS INITIAL.
w_poitem-distrib = w_src-vrtkz.
ENDIF.
Package No
IF NOT w_src-packno IS INITIAL.
w_poitem-pckg_no = w_src-packno. "Package no
ENDIF.
IF w_poitem-delete_ind IS INITIAL AND
w_poitem-short_text IS INITIAL AND
w_poitem-plant IS INITIAL AND
w_poitem-matl_group IS INITIAL AND
w_poitem-quantity IS INITIAL AND
w_poitem-po_unit IS INITIAL AND
w_poitem-net_price IS INITIAL AND
w_poitem-tax_code IS INITIAL.
CLEAR lv_item.
ELSE.
APPEND w_poitem TO i_poitem.
CLEAR: w_poitem.
lv_item = 'X'.
ENDIF.
w_poitemx-po_item = w_src-ebelp.
w_poitemx-delete_ind = 'X'.
w_poitemx-short_text = 'X'.
w_poitemx-plant = 'X'.
w_poitemx-matl_group = 'X'.
w_poitemx-quantity = 'X'.
w_poitemx-po_unit = 'X'.
w_poitemx-net_price = 'X'.
w_poitemx-tax_code = 'X'.
w_poitemx-item_cat = 'X'.
w_poitemx-acctasscat = 'X'.
w_poitemx-distrib = 'X'.
IF NOT w_src-packno IS INITIAL.
w_poitemx-pckg_no = 'X'.
ENDIF.
IF lv_item = 'X'.
APPEND w_poitemx TO i_poitemx.
CLEAR: w_poitemx,
lv_item.
ENDIF.
PO Deliery Address
w_poaddrdelivery-po_item = w_src-ebelp.
IF NOT w_src-adrn2 IS INITIAL.
w_poaddrdelivery-addr_no = w_src-adrn2.
APPEND w_poaddrdelivery TO i_poaddrdelivery.
CLEAR w_poaddrdelivery.
ENDIF.
POschedule
w_poschedule-po_item = w_src-ebelp.
CLEAR: lv_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = w_src-eindt
IMPORTING
date_internal = lv_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF NOT lv_date IS INITIAL.
w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
w_poschedule-delivery_date = lv_date.
w_poschedule-quantity = w_src-menge.
APPEND w_poschedule TO i_poschedule.
CLEAR w_poschedule.
lv_schd = 'X'.
ENDIF.
w_poschedulex-po_item = w_src-ebelp.
w_poschedulex-del_datcat_ext = 'X'.
w_poschedulex-delivery_date = 'X'.
w_poschedulex-quantity = 'X'.
IF lv_schd = 'X'.
APPEND w_poschedulex TO i_poschedulex.
CLEAR : w_poschedulex,
lv_schd.
ENDIF.
PO Account Assignment
w_poaccount-po_item = w_src-ebelp.
w_poaccount-serial_no = w_src-zekkn.
Distribution Indicator is 1
IF w_src-vrtkz EQ '1'.
w_poaccount-distr_perc = w_src-vproz.
IF NOT w_src-menge IS INITIAL.
CLEAR lv_menge.
lv_menge = w_src-menge.
ENDIF.
lv_acct_qty = lv_menge * w_src-vproz / 100.
Get Round value of Quanity
frac = FRAC( lv_acct_qty ).
IF frac EQ 0.
lv_acct_qty = FLOOR( lv_acct_qty ).
ELSE.
lv_acct_qty = CEIL( lv_acct_qty ).
ENDIF.
w_poaccount-quantity = lv_acct_qty.
ELSEIF w_src-vrtkz IS INITIAL.
w_poaccount-quantity = w_src-menge.
ENDIF.
w_poaccount-gl_account = w_src-saknr.
w_poaccount-costcenter = w_src-kostl.
w_poaccount-asset_no = w_src-anln1.
w_poaccount-wbs_element = w_src-wbs.
w_poaccount-network = w_src-nplnr.
w_poaccount-tax_code = w_src-mwskz.
w_poaccount-activity = w_src-vornr.
APPEND w_poaccount TO i_poaccount.
CLEAR w_poaccount.
w_poaccountx-po_item = w_src-ebelp.
w_poaccountx-serial_no = w_src-zekkn.
IF w_src-vrtkz EQ '1'.
w_poaccountx-distr_perc = 'X'.
ENDIF.
w_poaccountx-quantity = 'X'.
w_poaccountx-gl_account = 'X'.
w_poaccountx-costcenter = 'X'.
w_poaccountx-wbs_element = 'X'.
w_poaccountx-network = 'X'.
w_poaccountx-tax_code = 'X'.
w_poaccountx-activity = 'X'.
APPEND w_poaccountx TO i_poaccountx.
CLEAR w_poaccountx.
PO Services
w_poservices-pckg_no = w_src-packno. "Package no
w_poservices-line_no = w_src-srv_line_no. "Line item
w_poservices-ext_line = w_src-extrow. "External line
w_poservices-outl_level = 0.
w_poservices-outl_ind = 'X'.
w_poservices-subpckg_no = w_src-sub_packno. "Sub package no
w_poservices-quantity = w_src-srqty. "Service Quantity
w_poservices-base_uom = w_src-srmeins. "Service Basic unit of Measure
w_poservices-price_unit = '1'.
w_poservices-from_line = '1'.
w_poservices-gr_price = w_src-brtwr. "GR Price
w_poservices-short_text = w_src-sh_text1. "Service Short Text
w_poservices-matl_group = w_src-matkl. "Material Group
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
PO Service Access values
w_posrvacc-pckg_no = w_src-packno. "Package no
w_posrvacc-line_no = w_src-srv_line_no. "Line item
w_posrvacc-serno_line = w_src-zekkn. "'01'..
IF w_src-vproz IS INITIAL.
w_posrvacc-percentage = '100.0'.
ENDIF.
w_posrvacc-serial_no = w_src-zekkn. "'01'.
w_posrvacc-quantity = w_src-srqty. "Service Quantity
w_posrvacc-net_value = w_src-srqty. "Net value
APPEND w_posrvacc TO i_posrvacc.
CLEAR w_posrvacc.
ENDIF.
***Create a NEW PO
AT END OF ihrez.
Call BAPI
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = w_poheader
poheaderx = w_poheaderx
IMPORTING
exppurchaseorder = gv_ebeln
TABLES
return = i_return
poitem = i_poitem[]
poitemx = i_poitemx[]
poaddrdelivery = i_poaddrdelivery[]
poschedule = i_poschedule[]
poschedulex = i_poschedulex[]
poaccount = i_poaccount[]
poaccountx = i_poaccountx[]
poservices = i_poservices[]
posrvaccessvalues = i_posrvacc[]
extensionin = i_extensionin[].
Commit the Transaction
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
Regards,
Deepthi.1. If we get error as "In case of account assignment, please enter acc. assignment data for item" than First cehck whetaher u have authorization to Tcode ME23n or not. In my case, I din't had authorization to Me23n tcode.
2. If we get Error as "Please Mainatain Services or Limits". Please create a Service PO in the following Order.
*& Internal Table Declaration
DATA : i_intern TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE,
i_poitem TYPE STANDARD TABLE OF bapimepoitem,
i_poitemx TYPE STANDARD TABLE OF bapimepoitemx,
i_poaddrdelivery TYPE STANDARD TABLE OF bapimepoaddrdelivery,
i_poschedule TYPE STANDARD TABLE OF bapimeposchedule,
i_poschedulex TYPE STANDARD TABLE OF bapimeposchedulx,
i_poaccount TYPE STANDARD TABLE OF bapimepoaccount,
i_poaccountx TYPE STANDARD TABLE OF bapimepoaccountx,
i_poservices TYPE STANDARD TABLE OF bapiesllc,
i_posrvacc TYPE STANDARD TABLE OF bapiesklc,
i_extensionin TYPE STANDARD TABLE OF bapiparex,
i_return TYPE STANDARD TABLE OF bapiret2.
*& Work Area Declaration
DATA:
w_poheader TYPE bapimepoheader,
w_poheaderx TYPE bapimepoheaderx,
w_poitem TYPE bapimepoitem,
w_poitemx TYPE bapimepoitemx,
w_poaddrdelivery TYPE bapimepoaddrdelivery,
w_poschedule TYPE bapimeposchedule,
w_poschedulex TYPE bapimeposchedulx,
w_poaccount TYPE bapimepoaccount,
w_poaccountx TYPE bapimepoaccountx,
w_poservices TYPE bapiesllc,
w_posrvacc TYPE bapiesklc,
w_extensionin TYPE bapiparex,
w_return TYPE bapiret2.
START-OF-SELECTION.
Header Data
w_poheader-comp_code = '5791'. "Company Code
w_poheader-doc_type = 'Z0CM'. "Document type
w_poheader-creat_date = sy-datum. "lv_date. "Creation Date
w_poheader-created_by = sy-uname. "Creator Name
w_poheader-vendor = '0005012343'. "Vendor
w_poheader-pmnttrms = 'Z004'. "Payment Terms
w_poheader-purch_org = 'P000'. "Purchase Organization
w_poheader-pur_group = '001'. "Purchase Group
w_poheader-ref_1 = '004500007671'. "OLD PO
w_poheaderx-comp_code = 'X'. "Company Code
w_poheaderx-doc_type = 'X'. "Document type
w_poheaderx-creat_date = 'X'. "Creation Date
w_poheaderx-created_by = 'X'.
w_poheaderx-vendor = 'X'.
w_poheaderx-pmnttrms = 'X'. "Payment Terms
w_poheaderx-purch_org = 'X'. "Purchase Organization
w_poheaderx-pur_group = 'X'. "Purchase Group
w_poheaderx-ref_1 = 'X'.
Item Data
w_poitem-po_item = '000010'.
w_poitem-short_text = 'Z0CM - Default Appr. Test '.
w_poitem-plant = '5368'.
Trackign no
w_poitem-trackingno = ''.
Material group
w_poitem-matl_group = '119'.
w_poitem-po_unit = 'EA'. "Base Unit of Measure
w_poitem-net_price = '17500.00'. "Net Price
w_poitem-tax_code = 'I0'.
w_poitem-item_cat = '9'.
w_poitem-acctasscat = 'K'.
w_poitem-distrib = space.
Package must be given in item to create Service PO
w_poitem-pckg_no = 0000000001.
APPEND w_poitem TO i_poitem.
CLEAR: w_poitem.
w_poitemx-po_item = '000010'.
w_poitemx-delete_ind = 'X'.
w_poitemx-short_text = 'X'.
w_poitemx-plant = 'X'.
w_poitemx-trackingno = 'X'.
w_poitemx-matl_group = 'X'.
w_poitemx-quantity = 'X'.
w_poitemx-po_unit = 'X'.
w_poitemx-net_price = 'X'.
w_poitemx-tax_code = 'X'.
w_poitemx-item_cat = 'X'.
w_poitemx-acctasscat = 'X'.
w_poitemx-distrib = 'X'.
w_poitemx-pckg_no = 'X'.
APPEND w_poitemx TO i_poitemx.
CLEAR: w_poitemx.
PO Deliery Address
w_poaddrdelivery-po_item = '000010'.
w_poaddrdelivery-addr_no = '0000061208'.
APPEND w_poaddrdelivery TO i_poaddrdelivery.
CLEAR w_poaddrdelivery.
POschedule
w_poschedule-po_item = '000010'..
DATA : LV_DATE TYPE SY-DATUM,
lv_schd.
CLEAR: lv_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = '12/2/2009'
IMPORTING
date_internal = lv_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF NOT lv_date IS INITIAL.
w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
w_poschedule-delivery_date = lv_date.
w_poschedule-quantity = '1.000'.
APPEND w_poschedule TO i_poschedule.
CLEAR w_poschedule.
lv_schd = 'X'.
ENDIF.
w_poschedulex-po_item = '000010'.
w_poschedulex-del_datcat_ext = 'X'.
w_poschedulex-delivery_date = 'X'.
w_poschedulex-quantity = 'X'.
IF lv_schd = 'X'.
APPEND w_poschedulex TO i_poschedulex.
CLEAR : w_poschedulex,
lv_schd.
ENDIF.
PO Account Assignment
w_poaccount-po_item = '000010'.
w_poaccount-serial_no = '01'.
w_poaccount-distr_perc = ''.
w_poaccount-quantity = '1.000'.
w_poaccount-gl_account = '0000603064'.
w_poaccount-costcenter = '0053680100'.
w_poaccount-asset_no = ''.
w_poaccount-wbs_element = ''.
w_poaccount-network = ''.
w_poaccount-tax_code = 'I0'.
w_poaccount-activity = ''.
APPEND w_poaccount TO i_poaccount.
CLEAR w_poaccount.
w_poaccountx-po_item = '000010'.
w_poaccountx-serial_no = '01'.
w_poaccountx-distr_perc = 'X'.
w_poaccountx-quantity = 'X'.
w_poaccountx-gl_account = 'X'.
w_poaccountx-costcenter = 'X'.
w_poaccountx-wbs_element = 'X'.
w_poaccountx-network = 'X'.
w_poaccountx-tax_code = 'X'.
w_poaccountx-activity = 'X'.
w_poaccountx-cmmt_item = 'X'.
APPEND w_poaccountx TO i_poaccountx.
CLEAR w_poaccountx.
Extension for ZZSub
w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTING'.
w_extensionin-valuepart1+0(5) = '00010'..
w_extensionin-valuepart1+5(2) = '01'.
w_extensionin-valuepart1+28(5) = ''.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTINGX'.
w_extensionin-valuepart1+0(5) = '00010'.
w_extensionin-valuepart1+5(2) = '01'.
w_extensionin-valuepart1+11(1) = 'X'.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
Extension to add Expense Type only
w_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
w_extensionin-valuepart1+10(4) = '0131'.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
w_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
w_extensionin-valuepart1+10(4) = 'X'.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
EXPORT i_extensionin[] TO MEMORY ID 'SUB'.
PO Services
PO Services( One Line Iem)
Assign the dummy no as Pacakage no
w_poservices-pckg_no = 0000000001. "(assign package no as a dummy number)
w_poservices-line_no = 0000000001. "Line item
w_poservices-outl_ind = 'X'.
Assign Dummy no as sub package no
w_poservices-subpckg_no = 0000000003. "(Dummy No.) "Sub package no
w_poservices-from_line = '1'.
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
PO Services(Second Line Item )
Assign the same sub package dummy no which is mentioned above
w_poservices-pckg_no = 0000000003. "(Dummy No.) "Sub package no
w_poservices-line_no = 0000000002.
w_poservices-ext_line = '0000000010'. "External line
w_poservices-quantity = '17500.0'. "Service Quantity
w_poservices-base_uom = 'EA'. "Service Basic unit of Measure
w_poservices-price_unit = '1'.
w_poservices-gr_price = '1'. "GR Price
w_poservices-short_text = 'Z0CM - Default Appr. T'. "Service Short Text
w_poservices-matl_group = '119'. "w_src-matkl. "Material Group
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
PO Service Access values
w_posrvacc-pckg_no = 0000000003. "w_src-sub_packno. "Sub package no
w_posrvacc-line_no = 0000000002. "w_src-srv_line_no. "Line item
w_posrvacc-serno_line = '01'.
w_posrvacc-percentage = '100.0'.
w_posrvacc-serial_no = '01'.
w_posrvacc-quantity = '17500.0'. "w_src-srqty. "Service Quantity
APPEND w_posrvacc TO i_posrvacc.
CLEAR w_posrvacc.
DATA : gv_ebeln TYPE ebeln.
Call BAPI
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = w_poheader
poheaderx = w_poheaderx
IMPORTING
exppurchaseorder = gv_ebeln
TABLES
return = i_return
poitem = i_poitem[]
poitemx = i_poitemx[]
poaddrdelivery = i_poaddrdelivery[]
poschedule = i_poschedule[]
poschedulex = i_poschedulex[]
poaccount = i_poaccount[]
poaccountx = i_poaccountx[]
poservices = i_poservices[]
posrvaccessvalues = i_posrvacc[]
extensionin = i_extensionin[].
Commit the Transaction
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WRITE:/5 gv_ebeln COLOR 5.
SKIP 2.
DATA : lv_msg TYPE string.
LOOP AT i_return INTO w_return WHERE type = 'E'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = w_return-id
lang = 'EN'
no = w_return-number
v1 = w_return-message_v1
v2 = w_return-message_v2
v3 = w_return-message_v3
v4 = w_return-message_v4
IMPORTING
msg = lv_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
WRITE:/10 lv_msg.
ENDLOOP. -
Service PO for Multiple Acct Assig is not created using BAPI_PO_CREATE1
Hi,
Im unable to create the Service po with multiple acct assiignment using BAPI_PO_CREATE1
Header Data
w_poheader-comp_code = w_src-bukrs. "Company Code
w_poheader-doc_type = w_src-bsart. "Document type
w_poheader-delete_ind = w_src-vrtkz. "Deletion Indicator
CLEAR: lv_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = w_src-aedat
IMPORTING
date_internal = lv_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
w_poheader-creat_date = lv_date. "Creation Date
w_poheader-created_by = sy-uname. "Creator Name
w_poheader-vendor = w_src-lifnr. "Vendor
w_poheader-pmnttrms = w_src-zterm. "Payment Terms
w_poheader-purch_org = w_src-ekorg. "Purchase Organization
w_poheader-pur_group = w_src-ekgrp. "Purchase Group
w_poheader-ref_1 = w_src-ihrez. "OLD PO
w_poheaderx-comp_code = 'X'. "Company Code
w_poheaderx-doc_type = 'X'. "Document type
w_poheaderx-delete_ind = 'X'. "Deletion Indicator
w_poheaderx-creat_date = 'X'. "Creation Date
w_poheaderx-created_by = 'X'.
w_poheaderx-vendor = 'X'.
w_poheaderx-pmnttrms = 'X'. "Payment Terms
w_poheaderx-purch_org = 'X'. "Purchase Organization
w_poheaderx-pur_group = 'X'. "Purchase Group
w_poheaderx-ref_1 = 'X'.
Item Data
w_poitem-po_item = w_src-ebelp.
IF NOT w_src-elikz IS INITIAL.
w_poitem-delete_ind = w_src-elikz.
ENDIF.
IF NOT w_src-txz01 IS INITIAL.
w_poitem-short_text = w_src-txz01.
ENDIF.
IF NOT w_src-werks IS INITIAL.
w_poitem-plant = w_src-werks.
ENDIF.
Material group
IF NOT w_src-matkl IS INITIAL.
w_poitem-matl_group = w_src-matkl.
ENDIF.
Open or Partial Qty
IF w_src-opqty IS NOT INITIAL.
w_poitem-quantity = w_src-opqty.
ELSEIF NOT w_src-paqty IS INITIAL.
w_poitem-quantity = w_src-paqty.
ENDIF.
IF NOT w_src-meins IS INITIAL.
w_poitem-po_unit = w_src-meins. "Base Unit of Measure
ENDIF.
IF NOT w_src-netpr IS INITIAL.
w_poitem-net_price = w_src-netpr. "Net Price
ENDIF.
IF NOT w_src-mwskz IS INITIAL.
w_poitem-tax_code = w_src-mwskz.
ENDIF.
IF NOT w_src-pstyp IS INITIAL.
w_poitem-item_cat = w_src-pstyp.
ENDIF.
IF NOT w_src-knttp IS INITIAL.
w_poitem-acctasscat = w_src-knttp.
ENDIF.
w_src-vrtkz = '2'. "Added
IF NOT w_src-vrtkz IS INITIAL.
w_poitem-distrib = w_src-vrtkz.
ENDIF.
Package No
IF w_src-srv_line_no EQ '2'.
w_poitem-pckg_no = 0000000001. "Assign dummy package no "w_src-packno. "Package no
ELSEIF w_src-srv_line_no EQ '3'.
w_poitem-pckg_no = 0000000004. "Assign dummy package no "w_src-packno. "Package no
ENDIF.
IF w_poitem-delete_ind IS INITIAL AND
w_poitem-short_text IS INITIAL AND
w_poitem-plant IS INITIAL AND
w_poitem-matl_group IS INITIAL AND
w_poitem-quantity IS INITIAL AND
w_poitem-po_unit IS INITIAL AND
w_poitem-net_price IS INITIAL AND
w_poitem-tax_code IS INITIAL.
CLEAR lv_item.
ELSE.
APPEND w_poitem TO i_poitem.
CLEAR: w_poitem.
lv_item = 'X'.
ENDIF.
w_poitemx-po_item = w_src-ebelp.
w_poitemx-delete_ind = 'X'.
w_poitemx-short_text = 'X'.
w_poitemx-plant = 'X'.
w_poitemx-matl_group = 'X'.
w_poitemx-quantity = 'X'.
w_poitemx-po_unit = 'X'.
w_poitemx-net_price = 'X'.
w_poitemx-tax_code = 'X'.
w_poitemx-item_cat = 'X'.
w_poitemx-acctasscat = 'X'.
w_poitemx-distrib = 'X'.
w_poitemx-pckg_no = 'X'.
IF lv_item = 'X'.
APPEND w_poitemx TO i_poitemx.
CLEAR: w_poitemx,
lv_item.
ENDIF.
PO Deliery Address
w_poaddrdelivery-po_item = w_src-ebelp.
IF NOT w_src-adrn2 IS INITIAL.
w_poaddrdelivery-addr_no = w_src-adrn2.
APPEND w_poaddrdelivery TO i_poaddrdelivery.
CLEAR w_poaddrdelivery.
ENDIF.
POschedule
w_poschedule-po_item = w_src-ebelp.
w_poschedule-SCHED_LINE = w_src-
CLEAR: lv_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = w_src-eindt
IMPORTING
date_internal = lv_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF NOT lv_date IS INITIAL.
w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
w_poschedule-delivery_date = lv_date.
w_poschedule-quantity = w_src-menge.
APPEND w_poschedule TO i_poschedule.
CLEAR w_poschedule.
lv_schd = 'X'.
ENDIF.
w_poschedulex-po_item = w_src-ebelp.
w_poschedule-SCHED_LINE = 'X'.
w_poschedulex-del_datcat_ext = 'X'.
w_poschedulex-delivery_date = 'X'.
w_poschedulex-quantity = 'X'.
IF lv_schd = 'X'.
APPEND w_poschedulex TO i_poschedulex.
CLEAR : w_poschedulex,
lv_schd.
ENDIF.
PO Account Assignment
w_poaccount-po_item = w_src-ebelp.
w_poaccount-serial_no = w_src-zekkn.
Distribution Indicator is 1
IF w_src-vrtkz EQ '1'.
w_poaccount-distr_perc = w_src-vproz.
IF NOT w_src-menge IS INITIAL.
CLEAR lv_menge.
lv_menge = w_src-menge.
ENDIF.
lv_acct_qty = lv_menge * w_src-vproz / 100.
Get Round value of Quanity
frac = FRAC( lv_acct_qty ).
IF frac EQ 0.
lv_acct_qty = FLOOR( lv_acct_qty ).
ELSE.
lv_acct_qty = CEIL( lv_acct_qty ).
ENDIF.
w_poaccount-quantity = lv_acct_qty.
ELSEIF w_src-vrtkz IS INITIAL.
w_poaccount-quantity = w_src-menge.
ENDIF.
w_poaccount-quantity = w_src-menge. "added
w_poaccount-gl_account = w_src-saknr.
w_poaccount-costcenter = w_src-kostl.
w_poaccount-asset_no = w_src-anln1.
w_poaccount-wbs_element = w_src-wbs.
w_poaccount-network = w_src-nplnr.
w_poaccount-tax_code = w_src-mwskz.
w_poaccount-activity = w_src-vornr.
APPEND w_poaccount TO i_poaccount.
CLEAR w_poaccount.
w_poaccountx-po_item = w_src-ebelp.
w_poaccountx-serial_no = w_src-zekkn.
IF w_src-vrtkz EQ '1'.
w_poaccountx-distr_perc = 'X'.
ENDIF.
w_poaccountx-quantity = 'X'.
w_poaccountx-gl_account = 'X'.
w_poaccountx-costcenter = 'X'.
w_poaccountx-wbs_element = 'X'.
w_poaccountx-network = 'X'.
w_poaccountx-tax_code = 'X'.
w_poaccountx-activity = 'X'.
w_poaccountx-cmmt_item = 'X'.
APPEND w_poaccountx TO i_poaccountx.
CLEAR w_poaccountx.
Extension for ZZSub
IF NOT w_src-zzsub IS INITIAL.
w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTING'.
w_extensionin-valuepart1+0(5) = w_src-ebelp.
w_extensionin-valuepart1+5(2) = '01'.
w_extensionin-valuepart1+28(5) = w_src-zzsub.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTINGX'.
w_extensionin-valuepart1+0(5) = w_src-ebelp.
w_extensionin-valuepart1+5(2) = '01'.
w_extensionin-valuepart1+11(1) = 'X'.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
ENDIF.
Extension to add Expense Type only
IF NOT w_src-zzexptype IS INITIAL.
w_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
w_extensionin-valuepart1+10(4) = w_src-zzexptype.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
w_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
w_extensionin-valuepart1+10(4) = 'X'.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
ENDIF.
EXPORT i_extensionin[] TO MEMORY ID 'SUB'.
PO Services( One Line Iem)
IF w_src-srv_line_no EQ '2'.
w_poservices-pckg_no = 0000000001. "w_src-packno. "(assign package no as a dummy number)
w_poservices-line_no = 0000000001. "w_src-srv_line_no. "Line item
w_poservices-outl_ind = 'X'.
w_poservices-subpckg_no = 0000000003. "w_src-sub_packno. "(Dummy No.) "Sub package no
w_poservices-quantity = w_src-srqty. "Service Quantity
w_poservices-base_uom = w_src-srmeins. "Service Basic unit of Measure
w_poservices-price_unit = '1'.
w_poservices-from_line = '1'.
w_poservices-gr_price = w_src-brtwr. "GR Price
w_poservices-short_text = w_src-sh_text1. "Service Short Text
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
PO Services(Second Line Item )
w_poservices-pckg_no = 0000000003. "w_src-sub_packno. "(Dummy No.) "Sub package no
w_poservices-line_no = 0000000002.
w_poservices-ext_line = w_src-extrow. "External line
w_poservices-quantity = w_src-srqty. "Service Quantity
w_poservices-base_uom = w_src-srmeins. "Service Basic unit of Measure
w_poservices-price_unit = '1'.
w_poservices-gr_price = w_src-brtwr. "GR Price
w_poservices-short_text = w_src-sh_text1. "Service Short Text
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
PO Service Access values
w_posrvacc-pckg_no = 0000000003. "w_src-sub_packno. "Sub package no
w_posrvacc-line_no = 0000000002. "w_src-srv_line_no. "Line item
w_posrvacc-serno_line = w_src-zekkn. "'01'.
IF w_src-vproz IS INITIAL.
w_posrvacc-percentage = '100.0'.
ENDIF.
w_posrvacc-serial_no = '01'.
w_posrvacc-quantity = w_src-srqty. "Service Quantity
APPEND w_posrvacc TO i_posrvacc.
CLEAR w_posrvacc.
ELSEIF w_src-srv_line_no EQ '3'.
PO Services
if w_src-srv_line_no EQ '2'.
w_poservices-pckg_no = 0000000004. "(assign package no as a dummy number)
w_poservices-line_no = 0000000001. "Line item
w_poservices-outl_ind = 'X'.
w_poservices-subpckg_no = 0000000005. "(Dummy No.) "Sub package no
w_poservices-from_line = '1'.
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
w_poservices-pckg_no = 0000000005. "w_src-sub_packno. "(Dummy No.) "Sub package no
w_poservices-line_no = 0000000002.
w_poservices-ext_line = w_src-extrow. "External line
w_poservices-quantity = w_src-srqty. "Service Quantity
w_poservices-base_uom = w_src-srmeins. "Service Basic unit of Measure
w_poservices-price_unit = '1'.
w_poservices-gr_price = w_src-brtwr. "GR Price
w_poservices-short_text = w_src-sh_text1. "Service Short Text
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
endif.
if w_src-srv_line_no EQ '3'.
w_poservices-pckg_no = 0000000005. "w_src-sub_packno. "(Dummy No.) "Sub package no
w_poservices-line_no = 0000000003.
w_poservices-ext_line = w_src-extrow. "External line
w_poservices-quantity = w_src-srqty. "Service Quantity
w_poservices-base_uom = w_src-srmeins. "Service Basic unit of Measure
w_poservices-price_unit = '1'.
w_poservices-gr_price = w_src-brtwr. "GR Price
w_poservices-short_text = w_src-sh_text1. "Service Short Text
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
endif.
PO Service Access values
if w_src-srv_line_no EQ '2'.
w_posrvacc-pckg_no = 0000000005. "w_src-sub_packno. "Sub package no
w_posrvacc-line_no = 0000000002. "w_src-srv_line_no. "Line item
w_posrvacc-serno_line = '01'.
w_posrvacc-percentage = '100.0'.
w_posrvacc-serial_no = '01'. "w_src-zekkn.
w_posrvacc-quantity = w_src-srqty. "Service Quantity
APPEND w_posrvacc TO i_posrvacc.
CLEAR w_posrvacc.
endif.
if w_src-srv_line_no EQ '3'.
w_posrvacc-pckg_no = 0000000005. "w_src-sub_packno. "Sub package no
w_posrvacc-line_no = 0000000003. "w_src-srv_line_no. "Line item
w_posrvacc-serno_line = '01'.
w_posrvacc-percentage = '100.0'.
w_posrvacc-serial_no = '02'. "w_src-zekkn. "'01'.
w_posrvacc-quantity = w_src-srqty. "Service Quantity
APPEND w_posrvacc TO i_posrvacc.
CLEAR w_posrvacc.
endif.
ENDIF.
ENDIF.
***Create a NEW PO
Call BAPI
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = w_poheader
poheaderx = w_poheaderx
TESTRUN = ' '
IMPORTING
exppurchaseorder = gv_ebeln
TABLES
return = i_return
poitem = i_poitem[]
poitemx = i_poitemx[]
poaddrdelivery = i_poaddrdelivery[]
poschedule = i_poschedule[]
poschedulex = i_poschedulex[]
poaccount = i_poaccount[]
poaccountx = i_poaccountx[]
poservices = i_poservices[]
posrvaccessvalues = i_posrvacc[]
extensionin = i_extensionin[].
Commit the Transaction
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Regards,
Deepthi.it is solved
-
Creating Service PO using BAPI_PO_CREATE1
Hi gurus,
I am trying to create a PO with service lines using BAPI_PO_CREATE1 but am getting the following errror even though i have passed values to the structures POSERVICES POSRVACCESSVALUES and POACCOUNT along with item and header details:
Please maintain services or limits
Please suggest what are the basic details that need to be passed to the structures for creating a PO with service lines.Hi,
You need to use Package Number to link the services with the item. Check the tables like ESKN to know how the linking works with your existing data.
There are lot of posts related to this. Please do a search to get detailed answers. Thanks for your patience!!
Regards,
Yogesh -
Error while creating service PO by BAPI_PO_CREATE1
Hi,
I am trying to create a service PO using the BAPI_PO_CREATE1 with reference to service PR and I am getting an "In case of account assignment, please enter acc. assignment data for item" for which i found so many threads but none had resolved this error in my case eventhough i filled up all the required structure such as
LOOP AT gt_esll INTO gs_esll.
gs_services-pckg_no = gs_esll-packno.
gs_services-line_no = gs_esll-introw.
gs_services-subpckg_no = gs_esll-sub_packno.
gs_services-quantity = gs_esll-menge.
gs_services-base_uom = gs_esll-meins.
gs_services-gr_price = gs_esll-brtwr.
gs_services-outl_ind = 'X'.
APPEND gs_services TO gt_services.
CLEAR gs_services.
ENDLOOP.
LOOP AT gt_esll1 INTO gs_esll1.
gs_services-pckg_no = gs_esll1-packno.
gs_services-line_no = gs_esll1-introw.
gs_services-ext_line = gs_esll1-extrow.
gs_services-quantity = gs_esll1-menge.
gs_services-base_uom = gs_esll1-meins.
gs_services-gr_price = gs_esll1-brtwr.
APPEND gs_services TO gt_services.
CLEAR gs_services.
gs_servalues-pckg_no = gs_esll1-packno.
gs_servalues-line_no = gs_esll1-introw.
gs_servalues-serno_line = '01'.
gs_servalues-quantity = gs_esll1-menge.
gs_servalues-net_value = gs_esll1-brtwr.
APPEND gs_servalues TO gt_servalues.
CLEAR: gs_servalues, gs_esll1.
ENDLOOP.
gs_poacct-po_item = gv_poitm.
gs_poacct-serial_no = gs_ebkn-zebkn.
gs_poacct-quantity = gs_ebkn-menge.
gs_poacct-gl_account = gs_ebkn-sakto.
gs_poacct-costcenter = gs_ebkn-kostl.
gs_poacct-co_area = gs_ebkn-kokrs.
APPEND gs_poacct TO gt_poacct.
CLEAR gs_poacct.
gs_poacctx-po_item = gv_poitm.
gs_poacctx-serial_no = gs_ebkn-zebkn.
gs_poacctx-po_itemx = 'X'.
gs_poacctx-serial_nox = 'X'.
gs_poacctx-quantity = 'X'.
gs_poacctx-gl_account = 'X'.
gs_poacctx-costcenter = 'X'.
gs_poacctx-co_area = 'X'.
APPEND gs_poacctx TO gt_poacctx.
CLEAR : gs_poacctx, gs_ebkn.
LOOP AT gt_ppsitm INTO gs_ppsitm.
CLEAR: gs_poitm. " gt_poitm.
READ TABLE gt_matnr INTO gs_matnr WITH KEY banfn = gs_ppsitm-banfn bnfpo = gs_ppsitm-bnfpo.
CLEAR: gs_poitm.
gv_poitm = gv_poitm + 10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = gv_poitm
IMPORTING
OUTPUT = gv_poitm.
gs_poitm-po_item = gv_poitm.
gs_poitm-quantity = gs_ppsitm-menge.
gs_poitm-po_unit = gs_matnr-meins.
gs_poitm-net_price = gs_ppsitm-quote_price.
* gs_poitm-price_unit = '1'.
gs_poitm-tax_code = gs_ppsitm-mwskz.
gs_poitm-preq_no = gs_ppsitm-banfn.
gs_poitm-preq_item = gs_ppsitm-bnfpo.
IF gs_matnr-packno IS NOT INITIAL.
gs_poitm-pckg_no = gs_matnr-packno. " ADDED BY SKE FOR SERVICE PO
ENDIF.
gs_poitm-item_cat = gs_matnr-pstyp.
gs_poitm-acctasscat = gs_matnr-knttp.
APPEND gs_poitm TO gt_poitm.
ENDLOOP.
aftrer executing this bapi, the accounts structure has been cleared whereas other sturcture has values.
Please give me some hints to fix this.
Thanks in Advance,
Kalidass.Hi pranav,
from EBAN table i got the package no for a PR and passing that package No into ESLL table i am getting the subpaack No.
SELECT banfn bnfpo txz01 matnr bsart ekgrp meins pstyp knttp packno FROM eban
INTO TABLE gt_matnr
FOR ALL ENTRIES IN gt_ppsitm
WHERE banfn = gt_ppsitm-banfn
AND bnfpo = gt_ppsitm-bnfpo.
SELECT packno introw package sub_packno FROM esll
INTO CORRESPONDING FIELDS OF TABLE gt_esll
FOR ALL ENTRIES IN gt_matnr
WHERE packno = gt_matnr-packno.
IF gt_esll IS NOT INITIAL.
SELECT packno introw extrow package sub_packno menge meins brtwr ktext1 FROM ESLL
INTO TABLE gt_esll1
FOR ALL ENTRIES IN gt_esll
WHERE packno = gt_esll-sub_packno.
ENDIF.
LOOP AT gt_esll INTO gs_esll.
gs_services-pckg_no = gs_esll-packno.
gs_services-line_no = gs_esll-introw.
gs_services-subpckg_no = gs_esll-sub_packno.
gs_services-quantity = gs_esll-menge.
gs_services-base_uom = gs_esll-meins.
gs_services-gr_price = gs_esll-brtwr.
gs_services-outl_ind = 'X'.
APPEND gs_services TO gt_services.
CLEAR gs_services.
ENDLOOP.
LOOP AT gt_esll1 INTO gs_esll1.
gs_services-pckg_no = gs_esll1-packno.
gs_services-line_no = gs_esll1-introw.
gs_services-ext_line = gs_esll1-extrow.
gs_services-quantity = gs_esll1-menge.
gs_services-base_uom = gs_esll1-meins.
gs_services-gr_price = gs_esll1-brtwr.
APPEND gs_services TO gt_services.
CLEAR gs_services.
gs_servalues-pckg_no = gs_esll1-packno.
gs_servalues-line_no = gs_esll1-introw.
gs_servalues-serno_line = '01'.
gs_servalues-quantity = gs_esll1-menge.
gs_servalues-net_value = gs_esll1-brtwr.
APPEND gs_servalues TO gt_servalues.
CLEAR: gs_servalues, gs_esll1.
ENDLOOP.
Edited by: Kalidass Etienne.S on Jan 31, 2012 11:07 AM -
[VERY LOW IMPORTANCE] Creation of a Service Po via BAPI_PO_CREATE1
Hi guys.
I need a complete or maybe a code solution to implement a Service PO creation using BAPI_PO_CREATE1. All the examples I see just only show at least 1 service item and trying to reply those examples was ùnsuccesful...
Pease can anyone provide me a code using BAPI_PO_CREATE1, for a list of N service items.
Thanks in advance.
RR:
Edited by: Julius Bussche on Feb 16, 2010 8:37 AM
Importance "corrected" ...Hi guys...
Finally I found the solution, in a quite clear ABAP code.
As you mention Manesh, we have to increment by2 for each service Item in the package number. I mean: remember we have a service line in ME21N (showing this transaction code as an example) and for each service we can have N position items. In my case, only we need 1:1 relation (service and position).
Considering we need a package number per each service (f.e. 0000013291), a subpackage number per each position (this is the package number incremented by one -0000013292- if there is another position then the subpackage number is 0000013293 and so on). After we've completed all the positions for the previous service wa have to increment by (N + 1) where N is the number of positions taken by the previous service. So if the previous have 3 positions (0000013292, 0000013293 and 0000013294) then the new package number is 0000013295. Don't forget that if we have a service with N positions then we need to complete the POSERVICES table 2XN times (for the N positions and repeat N times the main service declaration for which correspond all these positions:
services-pckg_no = pckg_nro.
services-line_no = gvc_no.
services-subpckg_no = pckg_nro + 1.
I hope you've understood clearly my explanation.
Well here is the code. -
Maintain Services or Limits in BAPI_PO_CREATE1
Great day Friends,
Its my first day on SDN. Hoping to find helpful answers here and Wish you luck for your career also.
I am working on BAPI_PO_CREATE1.
I've used following tables.
return
poitem
poitemx
poaccount
poaccountx
poservices
I've passed the data for POSERVICES as following:
wa_poservices-line_no = '0000000010'.
wa_poservices-ext_line = '0000000010'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wt_tab2-service
IMPORTING
output = wt_tab2-service.
wa_poservices-service = wt_tab2-service.
wa_poservices-outl_ind = 'X'.
wa_poservices-quantity = wt_tab2-quantity.
wa_poservices-gr_price = wt_tab2-gr_price.
APPEND wa_poservices TO poservices.
As there's only one service item so I've hard coded the Iine_no and Ext_no.
After Executing it's giving me error as 'Maintain Services or Limits'.
I've gone through the documentation but couldn't find it helpful.
Any suggestions ?Hi Varun...
My query regarding "Maintain Services or Limits" has been resolvd.
It is now saying No account assignment exist for po service line 000000010..
Anyway I would be rating you for sure for solving my issue. But It will be more helpful if you help me on this also...
here's my code...
FORM po_services .
CLEAR: wa_poservices, wa_posrvaccessvalues.
wa_poservices-pckg_no = pckg_no.
wa_poservices-line_no = '0000000001'.
wa_poservices-subpckg_no = pckg_no + 1.
APPEND wa_poservices TO poservices.
wa_poservices-pckg_no = pckg_no + 1.
wa_poservices-line_no = '0000000002'.
wa_poservices-ext_line = '0000000010'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wt_tab2-service
IMPORTING
output = wt_tab2-service.
wa_poservices-service = wt_tab2-service.
wa_poservices-outl_ind = 'X'.
wa_poservices-quantity = wt_tab2-quantity.
wa_poservices-gr_price = wt_tab2-gr_price.
wa_poservices-subpckg_no = '0000000000'.
APPEND wa_poservices TO poservices.
wa_posrvaccessvalues-pckg_no = pckg_no + 1.
wa_posrvaccessvalues-line_no = '0000000001'.
wa_posrvaccessvalues-serial_no = '01'.
APPEND wa_posrvaccessvalues TO posrvaccessvalues.
ENDFORM. " PO_SERVICES
FORM acc_assignment .
CLEAR : wa_poaccount, wa_poaccountx.
wa_poaccount-po_item = wt_tab2-po_item.
wa_poaccount-serial_no = '01'.
wa_poaccount-gl_account = '400265'.
wa_poaccount-quantity = '1.000'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wt_tab2-orderid
IMPORTING
output = wt_tab2-orderid.
wa_poaccount-orderid = wt_tab2-orderid.
APPEND wa_poaccount TO poaccount.
wa_poaccountx-po_item = wt_tab2-po_item.
wa_poaccountx-serial_no = '01'.
wa_poaccountx-quantity = 'X'.
wa_poaccountx-gl_account = 'X'.
wa_poaccountx-orderid = 'X'.
APPEND wa_poaccountx TO poaccountx.
ENDFORM. " ACC_ASSIGNMENT -
hi,
Hello all, please help!! I used function BAPI_PO_CREATE1 to create PO with limit item but function returned message error '518 No account assignment exist for service line 0000000000'. Can anyone give me an idea to slove this problem?
i am passing po header, po headerx, po item , po itemx, po account, po accountx, po limits, po services, po service values, to bapi. if i comment package number in po limits structure , po was creating but limits data not updating in po., if i pass package number i am getting above error.
Thanks In Advance,
regardshi Dinesh,
am also having same error for bap po create1 . did it get resolved for you? please help its urgently needed for me here -
Issue when uploading Purchase Order for Services (LSMW and BAPI_PO_CREATE1)
Hi,
I`m getting the error message "In case of account assignment, please enter acc. assignment data for item" when trying to updoad a Service Purchase Order via LSMW using BAPI_PO_CREATE1.
I'm using two files, one for header and item data and the other one to service lines. Even the account assignment is maintained the error persists. What am I doing wrong?
Regards,
EvertonHi
Check If you are giving the Account Assignment Number correct.
I mean....for a value...to be recognized by the BAPI, the number should be exactly same as it is stored in DATABASE.
For example: the number stored in database is 0000123...and you enter 123..in the program, then BAPI would fail to recognise the number. The value should be exactly as the field length.
Regards,
Vishwa. -
Creation of Service POs using BAPI_PO_CREATE1
Hi Friends,
I am trying to create service POs through BAPI (BAPI_PO_CREATE1). I am facing different errors like Please maintain service or limits eve though I am providing the details in POSERVICES. Can any one suggest me the fields which we have to provide for creating the service POs.
I am using this BAPI in LSMW.
Thanks,
Gagan ChodhryCheck this it may help u.
DATA: BEGIN OF po_header OCCURS 0.
INCLUDE STRUCTURE BAPIEKKOC.
DATA: END OF po_header.
DATA: BEGIN OF po_iteam OCCURS 10.
INCLUDE STRUCTURE BAPIEKPOC.
DATA: END OF po-items.
DATA: BEGIN OF PO_ITEM_SCHEDULES OCCURS 0.
INCLUDE STRUCTURE BAPIEKET.
DATA: END OF PO_ITEM_SCHEDULES.
DATA: BEGIN OF I_BAPIRETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRETURN.
DATA: END OF I_BAPIRETURN.
CALL FUNCTION 'BAPI_PO_CREATE'
EXPORTING
PO_HEADER = PO_HEADER
SKIP_ITEMS_WITH_ERROR = 'X'
TABLES
PO_ITEMS = PO_ITEMS
PO_ITEM_SCHEDULES = PO_ITEM_SCHEDULES
RETURN = I_BAPIRETURN
EXCEPTIONS
OTHERS = 1.
Regards -
Using BAPI_PO_CREATE1 : Linking service, and account assignment
Hello,
I have trouble when using BAPI_PO_CREATE1. When creating PO using BAPI_PO_CREATE1, I need to input service for each po item and the service itself need to have account assignment. I simplify the code below.
**PO item
t_poitem-po_item = '10'. "for item 10
t_poitem-PCKG_NO = '20'. "link with service
t_poitemx-po_item = 'X'.
t_poitemx-PCKG_NO = 'X'.
**Account Assignment
t_poaccount-po_item = '10'. "link with PO Item
t_poaccount-SERIAL_NO = '01'.
t_poaccount-DISTR_PERC = 1.
t_poaccountx-po_item = '10'.
t_poaccountx-SERIAL_NO = '01'.
t_poaccountx-po_itemx = 'X'.
t_poaccountx-SERIAL_NOx = 'X'.
t_poaccountx-DISTR_PERC = 'X'.
**PO Services
**1st row
t_poservices-PCKG_NO = '20'.
t_poservices-LINE_NO = '0000000001'.
t_poservices-SUBPCKG_NO = '21'.
APPEND t_poservices.
clear t_poservices.
**2nd row
t_poservices-PCKG_NO = '21'.
t_poservices-LINE_NO = '0000000002'.
t_poservices-EXT_LINE = '0000000010'.
**fill account assignment for services
t_POSRVACCESSVALUES-pckg_no = '21'.
t_POSRVACCESSVALUES-LINE_NO = '0000000002'.
T_POSRVACCESSVALUES-SERNO_LINE = '01'.
t_POSRVACCESSVALUES-SERIAL_NO = '01'. "acct. assign. link
t_POSRVACCESSVALUES-PERCENTAGE = '100'.
Every time i execute BAPI_PO_CREATE1 using entry similar like above, i always found error message in t_return like this:
No account assignment exists for service line 0000000010
I feel sure that i have fill every field needed to link services and account assignment which is using serial_no, but somehow it does not link correctly. Can anyone advise me if there is some thing missing or incorrect with my ABAP code above? Thank you in advance for your help. For sure, first helpful answer will receive my rewards point.
Regards,
AbrahamThank you for the code. Actually i have fill the required field as you told but i did not put it in my code here to focus the problem on service and account assignment. After checking out your code, i found that the different between your code and mine is in services table.
<u><b>your code :</b></u>
<b>POSERVICES:structure</b>
PCKG_NO : 0000000001
LINE_NO :0000000001
SUBPCKG_NO : 0000000002
SERVICE :3000000000017
QUANTITY :5
BASE_UOM :AU
GR_PRICE :20000
<b>POSRVACCESSVALUES: structure name</b>
PCKG_NO :0000000002
LINE_NO :0000000002
<u><b>my code are:</b></u>
<b>POSERVICES:structure</b>
PCKG_NO : 0000000001
LINE_NO :0000000001
SUBPCKG_NO : 0000000002
PCKG_NO : 0000000002
LINE_NO :0000000002
SERVICE :3000000000017
QUANTITY :5
BASE_UOM :AU
GR_PRICE :20000
<b>POSRVACCESSVALUES: structure name</b>
PCKG_NO :0000000002
LINE_NO :0000000002
SERIAL_NO :0000000001
The other difference are in account assignment table, you didn't fill SERIAL_NO field.
my code will be like below:
<b>POACCOUNT: structure name</b>
PO_ITEM :10
SERIAL_NO : 0000000001
If using your version, the error message will be:
<i>In case of account assignment, please enter acc. assignment data for item</i>
If using my version, the error message will be:
<i>No account assignment exists for service line 0000000010</i>
Please advise what was wrong with my code. Thank you.
Regards,
Abraham
Maybe you are looking for
-
I have an iPad 2 -- 32 GB memory... can the memory be upgraded?
I just have lots and lots of apps and want more space without having to keep deleting apps to make room for more apps.
-
MacBook Air not recognizing an LG external DVD burner?
I have used this burner more than once before with this MacBook, yet this time it's choosing not to recognize it. I'm not familiar enough with Macs to know how to check myself if it's being recognized. Although I did go through the Disk Utility and n
-
Problem Loading JDBC Enabled JSP Page
Hi all, does anyone knows that's the case of this error: This happened when I tried to access MySQL Database from remote client. I have no problem loading normal jsp file w/o JDBC Connection. Kind of confused on what is going on Regards, Joe HTTP Sta
-
@RequestScoped - preserving instance variables?
This is related to my other post at http://forums.sun.com/thread.jspa?threadID=5445588&tstart=0 Suppose I have the following situation. There is page 1 called index and page 2 called hello. They are handled by a bean called NameBean which is @Request
-
Autmatically dating in a template
I use Pages to create sales quotes. I have a template and I want the date I create the template quote to automatically fill in the date field and the date 30 days away to automatically fill in the "quote valid until" field. Suggestions? Thanks.