2009 Apr 15 4:10 PM
Hi all,
Iam trying to create Purchase requisition with BAPI_PR_CREATE with Account assignment and Item category in ECC 6.0. when i execute the bapi it throwing up message 'MAINTAIN SERVICES OR LIMITS' . when i check it in BAPI_PR_CREATE structure fields , services field is not there
could any body please let me know how to handle the scenario.
thanks in advance
prasanna kumar
Hi all,
Iam trying to create Purchase requisition with BAPI_PR_CREATE with Account assignment and Item category in ECC 6.0. when i execute the bapi it throwing up message 'MAINTAIN SERVICES OR LIMITS' . when i check it in BAPI_PR_CREATE structure fields , services field is not there
could any body please let me know how to handle the scenario.
thanks in advance
prasanna kumar
2009 Apr 15 6:25 PM
Try to debug your bapi from se37. Check where is the message populated.
You will definitely help yourself finding the reason of error.
Regards,
Lalit Mohan Gupta.
2009 Apr 15 6:30 PM
Hi,
Try this sample code
DATA : T_REQUISITION_ITEMS LIKE BAPIEBANC OCCURS 0 WITH HEADER LINE,
T_RETURN LIKE BAPIRETURN OCCURS 0 WITH HEADER LINE .
DATA : E_NUMBER LIKE BAPIEBANC-PREQ_NO.
T_REQUISITION_ITEMS-DOC_TYPE &H3D 'NB'.
T_REQUISITION_ITEMS-DEL_DATCAT &H3D '1'.
T_REQUISITION_ITEMS-DELIV_DATE &H3D '20020626'.
T_REQUISITION_ITEMS-PLANT &H3D 'P1'.
T_REQUISITION_ITEMS-STORE_LOC &H3D '01'.
T_REQUISITION_ITEMS-PUR_GROUP &H3D 'P01'.
T_REQUISITION_ITEMS-MAT_GRP &H3D '01'.
T_REQUISITION_ITEMS-PREQ_ITEM &H3D 1.
T_REQUISITION_ITEMS-MATERIAL &H3D '1MAT1'.
T_REQUISITION_ITEMS-QUANTITY &H3D 10.
T_REQUISITION_ITEMS-PREQ_NAME &H3D '123456'.
T_REQUISITION_ITEMS-PURCH_ORG &H3D '1000'.
T_REQUISITION_ITEMS-ACCTASSCAT &H3D 'U' .
T_REQUISITION_ITEMS-VEND_MAT &H3D 'G'.
APPEND T_REQUISITION_ITEMS.
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
EXPORTING
SKIP_ITEMS_WITH_ERROR &H3D
IMPORTING
NUMBER &H3D E_NUMBER
TABLES
REQUISITION_ITEMS &H3D T_REQUISITION_ITEMS
REQUISITION_ACCOUNT_ASSIGNMENT &H3D T_REQ_ACCOUNT_ASSIGNMENT
REQUISITION_ITEM_TEXT &H3D
REQUISITION_LIMITS &H3D
REQUISITION_CONTRACT_LIMITS &H3D
REQUISITION_SERVICES &H3D
REQUISITION_SRV_ACCASS_VALUES &H3D
RETURN &H3D T_RETURN
REQUISITION_SERVICES_TEXT &H3D
EXTENSIONIN &H3D
REQUISITION_ADDRDELIVERY &H3D
.
IF NOT E_NUMBER IS INITIAL .
WRITE:/ 'REQ NO:' , E_NUMBER , 'CREATED'.
ELSE.
LOOP AT T_RETURN.
WRITE T_RETURN-MESSAGE.
ENDLOOP.
ENDIF.
Regards
Krishna
2009 Apr 15 6:31 PM
Hi Prasana,
see the sample code and correct the msiing..
FORM bapi_pr_create USING pwa_purreq_ib TYPE zce2o_purreq_ib
pw_notes TYPE string
CHANGING pw_pr_number TYPE bapimereqheader-preq_no
pw_msg TYPE sxdp_message"dar013009
pw_flag TYPE char1.
DATA : t_item TYPE TABLE OF bapimereqitemimp,
t_itemx TYPE TABLE OF bapimereqitemx,
t_itext TYPE TABLE OF bapimereqitemtext,
t_itemsource TYPE TABLE OF bapimereqsource,
t_return TYPE TABLE OF bapiret2,
wa_return TYPE bapiret2, "dar013009
wa_itemsource TYPE bapimereqsource,
wa_item TYPE bapimereqitemimp,
wa_itemx TYPE bapimereqitemx,
wa_header TYPE bapimereqheader,
wa_headerx TYPE bapimereqheaderx,
wa_itext TYPE bapimereqitemtext.
CLEAR : pw_flag.
* Assigns the item details
wa_item-preq_item = c_item_1.
wa_item-pur_group = pwa_purreq_ib-purch_group.
wa_item-preq_name = pwa_purreq_ib-requisitioner_n.
wa_item-material = pwa_purreq_ib-material_number.
wa_item-plant = pwa_purreq_ib-plant.
wa_item-store_loc = pwa_purreq_ib-storage_loc.
wa_item-quantity = pwa_purreq_ib-quantity.
wa_item-unit = pwa_purreq_ib-uom.
wa_item-preq_date = w_date.
wa_item-fixed_vend = pwa_purreq_ib-vendor_number.
wa_item-purch_org = pwa_purreq_ib-purch_org.
wa_item-agreement = pwa_purreq_ib-agrmnt_no.
wa_item-agmt_item = pwa_purreq_ib-agrmnt_line_item.
wa_item-deliv_date = pwa_purreq_ib-request_date + pwa_purreq_ib-lead_time_offset.
* If the part class is in foundry assign the ship to oa number to supplying vendor, else it is blank
IF pwa_purreq_ib-part_class IN r_foundry.
wa_item-supp_vendor = pwa_purreq_ib-shipto_oa_number.
ENDIF.
*** DELETE: Removed per Ravi --------------------------- dar101708 ---v
** Assigns the account assignment for the generic part
* IF pwa_purreq_ib-part_class = c_part_gen.
* wa_item-acctasscat = c_knttp_7. "'7'.
* ENDIF.
*** DELETE: Removed per Ravi --------------------------- dar101708 ---^
APPEND wa_item TO t_item.
* Assigns the fields to be updated
wa_itemx-preq_item = c_item_1.
wa_itemx-preq_itemx = c_check.
wa_itemx-pur_group = c_check.
wa_itemx-preq_name = c_check.
wa_itemx-material = c_check.
wa_itemx-plant = c_check.
wa_itemx-store_loc = c_check.
wa_itemx-quantity = c_check.
wa_itemx-unit = c_check.
wa_itemx-preq_date = c_check.
wa_itemx-fixed_vend = c_check.
wa_itemx-purch_org = c_check.
wa_itemx-agreement = c_check.
wa_itemx-agmt_item = c_check.
wa_itemx-deliv_date = c_check.
wa_itemx-acctasscat = c_check.
wa_itemx-supp_vendor = c_check.
APPEND wa_itemx TO t_itemx.
* Assigns the header
wa_header-pr_type = c_bsart_mrp.
wa_headerx-pr_type = c_check.
* Assigns the item source
wa_itemsource-preq_item = c_item_1.
wa_itemsource-info_rec = pwa_purreq_ib-pir_no.
APPEND wa_itemsource TO t_itemsource.
* Assigns the notes if the notes is not blank
IF pw_notes IS NOT INITIAL.
wa_itext-text_id = 'B01'.
wa_itext-text_line = pw_notes.
wa_itext-preq_item = c_item_1.
APPEND wa_itext TO t_itext.
* Begin of addition BRB040309
* Since item text can only be 132 characters, append new lines
* to text table for each 132 characters.
DO.
IF STRLEN( pw_notes ) > 132.
SHIFT pw_notes LEFT BY 132 PLACES.
wa_itext-text_line = pw_notes.
APPEND wa_itext TO t_itext.
ELSE.
EXIT.
ENDIF.
ENDDO.
* End of addition BRB040309
ENDIF.
* Create the PR with the above data's.
CALL FUNCTION 'BAPI_PR_CREATE' "#EC *
EXPORTING
prheader = wa_header
prheaderx = wa_headerx
IMPORTING
number = pw_pr_number
TABLES
return = t_return
pritem = t_item
pritemx = t_itemx
pritemsource = t_itemsource
pritemtext = t_itext
EXCEPTIONS
OTHERS = 1.
* Check whether any error exist. If not commit the changes else rollback the changes.
READ TABLE t_return
* TRANSPORTING NO FIELDS dar013009
INTO wa_return "dar013009
WITH KEY type = c_msgty_e.
IF sy-subrc = 0.
pw_flag = c_error.
pw_msg = wa_return-message. "dar013009
ELSE.
pw_flag = c_success.
ENDIF.
ENDFORM. " BAPI_PR_CREATE
regards,
Prabhudas
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |