BAPI_PR_CREATE EXTENSIONIN
Hello Gurus,
I am creating a PR using BAPI_PR_CREATE, I achieve creating the PR, but I can't save value in the custom fields.
This is my code, would you please help me?
Thanks
DATA: ls_req_item TYPE BAPI_TE_MEREQITEM,
ls_req_itemx TYPE BAPI_TE_MEREQITEMX,
ls_extensionin TYPE bapiparex,
lt_extensionin TYPE STANDARD TABLE OF bapiparex.
clear ls_extensionin.
clear ls_req_item.
ls_req_item-preq_item = wa_gt_data-posic.
ls_req_item-ZZKOSTL = wa_praccount-costcenter.
ls_extensionin-structure = 'BAPI_TE_MEREQITEM'.
PERFORM transfer_to_extensionin USING ls_req_item CHANGING ls_extensionin.
APPEND ls_extensionin to lt_extensionin.
clear ls_extensionin.
clear ls_req_itemx.
ls_req_itemx-preq_item = wa_gt_data-posic.
ls_req_itemx-ZZKOSTL = 'X'.
ls_extensionin-structure = 'BAPI_TE_MEREQITEMX'.
PERFORM transfer_to_extensionin USING ls_req_itemx CHANGING ls_extensionin.
APPEND ls_extensionin to lt_extensionin.
FORM transfer_to_extensionin
USING
is_bapi_extensionin TYPE any
CHANGING
cs_bapiparex TYPE bapiparex.
DATA l_distance_characters TYPE I.
FIELD-SYMBOLS <any> TYPE any.
DESCRIBE DISTANCE BETWEEN cs_bapiparex-structure
AND cs_bapiparex-valuepart1
INTO l_distance_characters
IN CHARACTER MODE.
ASSIGN cs_bapiparex+l_distance_characters(*) TO <any>
CASTING LIKE is_bapi_extensionin.
<any> = is_bapi_extensionin.
ENDFORM.
* Create the PR with the above data's.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
prheader = wa_header
prheaderx = wa_headerx
TABLES
return = t_return
pritem = t_item
pritemx = t_itemx
praccount = t_praccount
praccountx = t_praccountx
"pritemsource = t_itemsource
"pritemtext = t_itext
EXTENSIONIN = lt_extensionin
EXCEPTIONS
OTHERS = 1.
Hi Enrique,
then try the following: Replace
PERFORM transfer_to_extensionin USING ls_req_item CHANGING ls_extensionin.
with
DESCRIBE FIELD ls_req_item LENGTH h_length IN BYTE MODE.
MOVE ls_req_item TO ls_extensionin+30(h_length).
and replace
PERFORM transfer_to_extensionin USING ls_req_itemx CHANGING ls_extensionin.
with
DESCRIBE FIELD ls_req_itemx LENGTH h_length IN BYTE MODE.
MOVE ls_req_itemx TO ls_extensionin+30(h_length).
where h_length is defined as
DATA: h_length TYPE i.
I've checked this in a small sample report and it worked for me
REPORT ztest_extensionin.
DATA: ls_req_item TYPE bapi_te_mereqitem.
DATA: ls_req_itemx TYPE bapi_te_mereqitemx.
DATA: ls_extensionin TYPE bapiparex.
DATA: h_length TYPE i.
START-OF-SELECTION.
DESCRIBE FIELD ls_req_item LENGTH h_length IN BYTE MODE.
MOVE ls_req_item TO ls_extensionin+30(h_length).
DESCRIBE FIELD ls_req_itemx LENGTH h_length IN BYTE MODE.
MOVE ls_req_itemx TO ls_extensionin+30(h_length).
Regards,
Klaus
Similar Messages
-
Custom fields updation in EBAN Table for bapi_pr_create - Extensionin
Hi all,
My requirement is PR creation by BAPI_PR_CREATE Function Module .
for pr item level customer added 10 fields in the EBAN table append structure CI_EBANDB. .
i am creating PR by using Funcation module BAPI_PR_CREATE.
In this Function Module I have to pass the structure name and field values in the EXTENTIONIN .
what is the structure name I have to pass and how populate data in to the EBAN table.
after that i have to create PR and updating 10 two custom field values in the EBAN Table.
how to proceed for updating the customer field values in the eban table.
thanks in advance.
sriIn the Extensionin pass the values
Structure - EBAN
VALUEPART1 - Pass the value for customer fields.
Please reward if useful. -
BAPI_PR_CREATE Extension Issue
Hi
I am using BAPI_PR_CREATE to upload Purchase Requisition Create data for ME51n Transaction. Here there is screen Enhancement has been added to ME51n.
When Iam uploading data through BAPI_PR_CREATE the below error message is been shown in RETURN structure:
No instance of object type PurchaseRequisition has been created. External reference:
Error transferring ExtensionIn data for enhancement CI_EBANDB.
In enhancement implemented code is as below for ME51n :
data: gt_items TYPE mmpur_requisition_items.
data:wa_header TYPE mereq_header.
CALL METHOD im_header->get_data
RECEIVING
re_data = wa_header.
*****Get Item Detail
CALL METHOD im_header->get_items
EXPORTING
im_auth_check = MMPUR_NO
im_release_op = MMPUR_NO
RECEIVING
re_items = gt_items.
When I checked this enhancement iam not able to find BAPI Extension data.Probably:
Ls_acctx-SERIAL_NO = gc_x.
should be
Ls_acctx-SERIAL_NO = '01'.
And uncomment PREQ_ITEM.
Regards,
Jarek -
Enter GL account error in BAPI_PR_CREATE
Hi Experts,
I a using babi BAPI_PR_CREATE to create a PR with two line items. but I am getting error 'Enter GL account'.
Please check below program and let me know if anything wrong in it.
data: lv_prnum type BAPIEBANC-PREQ_NO.
data: lv_prnumber type BAPIMEREQHEADER-PREQ_NO.
data: it_req_item type table of BAPIEBANC,
wa_req_item type BAPIEBANC.
data: it_req_item_new type table of BAPIEBAN,
wa_req_item_new type BAPIEBAN.
data: it_acc_assig type table of BAPIEBKN,
wa_acc_assig type BAPIEBKN.
data: it_req_ser type table of BAPIESLLC,
wa_req_ser type BAPIESLLC.
data: it_ser_val type table of BAPIESKLC,
wa_ser_val type BAPIESKLC.
data: it_return type table of BAPIRETURN,
lv_return type BAPIRET2.
data: lv_msg type char50.
data: it_change_return type table of BAPIRET2,
wa_change_return type BAPIRET2.
data: it_pritem type table of BAPIMEREQITEMIMP,
wa_pritem type BAPIMEREQITEMIMP.
data: it_pritemx type table of BAPIMEREQITEMX,
wa_pritemx type BAPIMEREQITEMX.
data: it_pritemexp type table of BAPIMEREQITEM,
wa_pritemexp type BAPIMEREQITEM.
data: it_praccount type table of BAPIMEREQACCOUNT,
wa_praccount type BAPIMEREQACCOUNT.
data: it_praccountx type table of BAPIMEREQACCOUNTX,
wa_praccountx type BAPIMEREQACCOUNTX.
data: it_ret type table of BAPIRET2,
wa_ret type BAPIRET2.
data: it_prheader type table of BAPIMEREQHEADER,
wa_prheader type BAPIMEREQHEADER.
data: it_prheaderx type table of BAPIMEREQHEADERX,
wa_prheaderx type BAPIMEREQHEADERX.
data: it_ser_acc type table of BAPI_SRV_ACC_DATA,
wa_ser_acc type BAPI_SRV_ACC_DATA.
data: it_ser_accx type table of BAPI_SRV_ACC_DATAX,
wa_ser_accx type BAPI_SRV_ACC_DATAX.
*first item - material
wa_pritem-PREQ_ITEM = '00010'.
wa_pritem-PUR_GROUP = 'ITD'.
wa_pritem-preq_name = 'abcd'.
wa_pritem-SHORT_TEXT = 'ABC'.
wa_pritem-MATERIAL = 'NCAD100001'.
wa_pritem-PLANT = '1100'.
wa_pritem-TRACKINGNO = 'XXX'.
wa_pritem-MATL_GROUP = 'Z111'.
wa_pritem-QUANTITY = 1.
*wa_pritem-UNIT = 'AU'.
wa_pritem-PREQ_DATE = '20140430'.
wa_pritem-DELIV_DATE = '20140505'.
wa_pritem-PRICE_UNIT = 1.
*wa_pritem-ITEM_CAT = ' '.
wa_pritem-ACCTASSCAT = 'N'.
*wa_pritem-des_vendor = '0050000793'.
*wa_pritem-fixed_vend = '0050000793'.
wa_pritem-PURCH_ORG = '1000'.
append wa_pritem to it_pritem.
*2nd item - service
clear wa_pritem.
wa_pritem-PREQ_ITEM = '00020'.
wa_pritem-PUR_GROUP = 'ITD'.
wa_pritem-preq_name = 'abc'.
wa_pritem-SHORT_TEXT = 'ABC'.
*wa_pritem-MATERIAL = 'NCAD100002'.
wa_pritem-PLANT = '1100'.
wa_pritem-TRACKINGNO = 'XXX'.
wa_pritem-MATL_GROUP = 'S0010'.
wa_pritem-QUANTITY = 1.
*wa_pritem-UNIT = 'AU'.
wa_pritem-PREQ_DATE = '20140430'.
wa_pritem-DELIV_DATE = '20140505'.
wa_pritem-PRICE_UNIT = 1.
wa_pritem-ITEM_CAT = '9'.
wa_pritem-ACCTASSCAT = 'N'.
*wa_pritem-des_vendor = '0050000793'.
*wa_pritem-fixed_vend = '0050000793'.
wa_pritem-PURCH_ORG = '1000'.
wa_pritem-pckg_no = '0000000001'.
append wa_pritem to it_pritem.
*fields for 1st item - material
wa_pritemx-PREQ_ITEM = '00010'.
wa_pritemx-PREQ_ITEMX = 'X'.
wa_pritemx-PUR_GROUP = 'X'.
wa_pritemx-preq_name = 'X'.
wa_pritemx-SHORT_TEXT = 'X'.
wa_pritemx-MATERIAL = 'X'.
wa_pritemx-PLANT = 'X'.
wa_pritemx-TRACKINGNO = 'X'.
wa_pritemx-MATL_GROUP = 'X'.
wa_pritemx-QUANTITY = 'X'.
*wa_pritem-UNIT = 'AU'.
wa_pritemx-PREQ_DATE = 'X'.
wa_pritemx-DELIV_DATE = 'X'.
wa_pritemx-PRICE_UNIT = 'X'.
*wa_pritem-ITEM_CAT = ' '.
wa_pritemx-ACCTASSCAT = 'X'.
*wa_pritemx-des_vendor = 'X'.
*wa_pritemx-fixed_vend = 'X'.
wa_pritemx-PURCH_ORG = 'X'.
append wa_pritemx to it_pritemx.
*fields for 2nd item - service
clear wa_pritemx.
wa_pritemx-PREQ_ITEM = '00020'.
wa_pritemx-PREQ_ITEMX = 'X'.
wa_pritemx-PUR_GROUP = 'X'.
wa_pritemx-preq_name = 'X'.
wa_pritemx-SHORT_TEXT = 'X'.
wa_pritemx-MATERIAL = 'X'.
wa_pritemx-PLANT = 'X'.
wa_pritemx-TRACKINGNO = 'X'.
wa_pritemx-MATL_GROUP = 'X'.
wa_pritemx-QUANTITY = 'X'.
*wa_pritem-UNIT = 'X'.
wa_pritemx-PREQ_DATE = 'X'.
wa_pritemx-DELIV_DATE = 'X'.
wa_pritemx-PRICE_UNIT = 'X'.
wa_pritem-ITEM_CAT = 'X'.
wa_pritemx-ACCTASSCAT = 'X'.
*wa_pritemx-des_vendor = 'X'.
*wa_pritemx-fixed_vend = 'X'.
wa_pritemx-PURCH_ORG = 'X'.
wa_pritem-pckg_no = 'X'.
append wa_pritemx to it_pritemx.
*Account assignment data for 1st item - material
wa_praccount-PREQ_ITEM = '00010'.
wa_praccount-SERIAL_NO = '01'.
wa_praccount-QUANTITY = 1.
wa_praccount-DISTR_PERC = '1.00'.
wa_praccount-NET_VALUE = 1.
wa_praccount-GL_ACCOUNT = '0040100801'.
wa_praccount-UNLOAD_PT = 'ABC'.
wa_praccount-CO_AREA = '1000'.
wa_praccount-NETWORK = '000004011841'.
append wa_praccount to it_praccount.
*Account assignment data for 2nd item - service
clear wa_praccount.
wa_praccount-PREQ_ITEM = '00020'.
wa_praccount-SERIAL_NO = '02'.
*wa_praccount-QUANTITY = 1.
*wa_praccount-DISTR_PERC = '1.00'.
*wa_praccount-NET_VALUE = 1.
wa_praccount-GL_ACCOUNT = '0040100801'.
wa_praccount-UNLOAD_PT = 'ABC'.
wa_praccount-CO_AREA = '1000'.
wa_praccount-NETWORK = '000004011841'.
append wa_praccount to it_praccount.
*Account assignment fields for 1st item - material
wa_praccountx-PREQ_ITEM = '00010'.
wa_praccountx-SERIAL_NO = '01'.
wa_praccountx-PREQ_ITEMX = 'X'.
wa_praccountx-SERIAL_NOX = 'X'.
wa_praccountx-QUANTITY = 'X'.
wa_praccountx-DISTR_PERC = 'X'.
wa_praccountx-NET_VALUE = 'X'.
wa_praccountx-GL_ACCOUNT = 'X'.
wa_praccountx-UNLOAD_PT = 'X'.
wa_praccountx-CO_AREA = 'X'.
wa_praccountx-NETWORK = 'X'.
append wa_praccountx to it_praccountx.
*Account assignment fields for 2nd item - service
clear wa_praccountx.
wa_praccountx-PREQ_ITEM = '00020'.
wa_praccountx-SERIAL_NO = '02'.
wa_praccountx-PREQ_ITEMX = 'X'.
wa_praccountx-SERIAL_NOX = 'X'.
*wa_praccountx-QUANTITY = 'X'.
*wa_praccountx-DISTR_PERC = 'X'.
*wa_praccountx-NET_VALUE = 'X'.
wa_praccountx-GL_ACCOUNT = 'X'.
wa_praccountx-UNLOAD_PT = 'X'.
wa_praccountx-CO_AREA = 'X'.
wa_praccountx-NETWORK = 'X'.
append wa_praccountx to it_praccountx.
*2nd item Service details
wa_ser_acc-doc_item = '00020'.
wa_ser_acc-outline = '0000000001'.
wa_ser_acc-srv_line = '0000000010'.
wa_ser_acc-serial_no = '02'.
wa_ser_acc-serial_no_item = '02'.
wa_ser_acc-quantity = 10.
append wa_ser_acc to it_ser_acc.
*2nd item Service fields
wa_ser_accx-doc_item = '00020'.
wa_ser_accx-outline = '0000000001'.
wa_ser_accx-srv_line = '0000000010'.
wa_ser_accx-serial_no = '02'.
wa_ser_accx-serial_no_item = 'X'.
wa_ser_accx-quantity = 'X'.
append wa_ser_accx to it_ser_accx.
*Header details
wa_prheader-pr_type = 'PURE'.
wa_prheaderx-pr_type = 'X'.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
PRHEADER = wa_prheader
PRHEADERX = wa_prheaderx
* TESTRUN =
IMPORTING
NUMBER = lv_prnumber
* PRHEADEREXP =
TABLES
RETURN = it_ret
PRITEM = it_pritem
PRITEMX = it_pritemx
* PRITEMEXP = it_pritemexp
* PRITEMSOURCE =
PRACCOUNT = it_praccount
* PRACCOUNTPROITSEGMENT =
PRACCOUNTX = it_praccountx
* PRADDRDELIVERY =
* PRITEMTEXT =
* PRHEADERTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* PRVERSION =
* PRVERSIONX =
* ALLVERSIONS =
* PRCOMPONENTS =
* PRCOMPONENTSX =
* SERVICEOUTLINE =
* SERVICEOUTLINEX =
* SERVICELINES =
* SERVICELINESX =
* SERVICELIMIT =
* SERVICELIMITX =
* SERVICECONTRACTLIMITS =
* SERVICECONTRACTLIMITSX =
SERVICEACCOUNT = it_ser_acc
SERVICEACCOUNTX = it_ser_accx
* SERVICELONGTEXTS =
* SERIALNUMBER =
* SERIALNUMBERX =
IF sy-subrc eq 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = lv_return.
endif.Hi ,
read the BAPI documentation where they have provided example for PR creation with and without account assignment with example.
check that.
regards, -
Error in Bapi_pr_create
Hi,
I am trying to call Bapi_PR_Create in a report.
But it gives me an error saying "Plant I001 not defined.Please check your input."
The Bapi creates a PR successfully with the same data when called executed separately.
What could be wrong?
Please help.LOOP AT gt_line INTO wa_line.
gt_item_bapi-PLANT = wa_line-werks.
APPEND gt_item_bapi.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
PRHEADER = gt_header_bapi
PRHEADERX = gt_headerx_bapi
IMPORTING
NUMBER = PREQ_NO
TABLES
RETURN = gt_return
PRITEM = gt_item_bapi
PRITEMX = gt_itemx_bapi
PRITEMEXP = gt_item_exp_bapi
PRACCOUNT = GT_ITEM_ACC_BAPI
PRACCOUNTX = gt_item_accx_bapi
EXTENSIONIN = gt_extensionin
The value passed is I001. -
Hi all,
I have a problem with PR creation by BAPI_PR_CREATE. We use ECC 6.0. We have one non-character field in CI_EBANDB. I know, it isn't correct, but we have this field. And there is a BAdI to solve this problem: IF_EX_ME_BAPI_PR_CREATE_02~MAP2I_EXTENSIONIN. I have used this BAdI, and after
implementation of notes 1148689, 1176786, 1156334 and 1173224 it works, but not quite correct.
The problem: It could be the field in EXTENSIONIN brings an conversion error. In this case I want to send a message from BAdI to BAPI and the BAPI has to terminate the creation of the PR.
In many steps with the aid of SAP I have "developed" the following code:
method if_ex_me_bapi_pr_create_02~map2i_extensionin.
*-- define local data
data: l_done type mmpur_bool. "conversion done
data: wa_ebanci_char type zmi_mm_ci_ebandb_char.
data: l_obj type ref to if_message_obj_mm. "#EC NEEDED
data: my_mereq_ref type ref to if_accounting_model_mm.
check im_name = 'CI_EBANDB'.
check im_error eq cl_mmpur_constants=>yes.
include mm_messages_mac.
mmpur_dynamic_cast1 l_obj me->my_mereq_ref.
mmpur_business_obj l_obj.
call method cl_abap_container_utilities=>read_container_c
exporting
im_container = im_container+5
importing
ex_value = wa_ebanci_char
exceptions
illegal_parameter_type = 1
others = 2.
if not sy-subrc is initial.
* Errorhandling needed
return.
endif.
try.
move-corresponding wa_ebanci_char to ch_struc.
*-- Errorhandling
catch cx_sy_conversion_no_number
cx_sy_conversion_overflow
cx_sy_move_cast_error.
mmpur_message_forced 'E' 'ZMIZZD' '809' space space space space.
endtry.
l_done = cl_mmpur_constants=>yes.
move im_container(5) to ch_struc(5).
check l_done eq cl_mmpur_constants=>yes.
raise exception type cx_mmpur_root.
endmethod. "if_ex_me_bapi_pr_create_02~map2i_extensionin
My Problem is the accurate using of the mmpur macros. I have the message 809 in case of a conversion errror in the RETURN-Table in BAPI. But the fields PARAMETER, ROW and FIELDS of the RETURN-Table are not or not well filled. I have seen I have to make something with mmpur_business_obj_id and mmpur_metafield, but I can't find how to do this exactly in this BAdI.
Has anyone a idea?
Thanks in advance.
MichaelHi Michael,
(1) in the BAdI IF_EX_ME_BAPI_PR_CREATE_02~MAP2I_EXTENSIONIN, if you use Method "Read_Container_C" in class CL_abap_container_utilities
as following:
CALL METHOD cl_abap_container_utilities=>read_container_c
EXPORTING
im_container = im_container
IMPORTING
ex_value = ch_struc
EXCEPTIONS
illegal_parameter_type = 1
others = 2
AND (2) in your BAPI-call, for the part exteinionIN, you use another method "Fill_Container_C" of the same class CL_abap_container_utilities
something like these:
DATA: lw_bapi_te_mereqitem TYPE bapi_te_mereqitem,
lw_bapi_te_mereqitemx TYPE bapi_te_mereqitemx.
*-- Feldsymbole Ausgangsparameter
FIELD-SYMBOLS: <lw_extensionin> TYPE bapiparex.
APPEND INITIAL LINE TO pt_extensionin
ASSIGNING <lw_extensionin>.
CLEAR lw_bapi_te_mereqitem.
lw_bapi_te_mereqitem-preq_item = pw_output-bnfpo.
lw_bapi_te_mereqitem-zz_qty = pw_output-meng.
lw_bapi_te_mereqitem-zzdatum_grund = sy-datum.
lw_bapi_te_mereqitem-zzuzeit_grund = sy-uzeit.
<lw_extensionin>-structure = 'BAPI_TE_MEREQITEM'.
* fill extension i-tab which mit ZZ-Felder EBAN
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = lw_bapi_te_mereqitem
IMPORTING
ex_container = <lw_extensionin>+30(930)
EXCEPTIONS
illegal_parameter_type = 1
others = 2
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
* RAISE illegal_parameter_type.
WHEN OTHERS.
* RAISE unknown_error.
ENDCASE..
ENDIF.
APPEND INITIAL LINE TO pt_extensionin
ASSIGNING <lw_extensionin>.
CLEAR lw_bapi_te_mereqitemx.
lw_bapi_te_mereqitemx-preq_item = pw_output-bnfpo.
lw_bapi_te_mereqitemx-zz_qty = true.
lw_bapi_te_mereqitemx-zzdatum_grund = true.
lw_bapi_te_mereqitemx-zzuzeit_grund = true.
<lw_extensionin>-structure = 'BAPI_TE_MEREQITEMX'.
* fill extension i-tabx
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = lw_bapi_te_mereqitemx
IMPORTING
ex_container = <lw_extensionin>+30(930)
EXCEPTIONS
illegal_parameter_type = 1
others = 2
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
* RAISE illegal_parameter_type.
WHEN OTHERS.
* RAISE unknown_error.
ENDCASE..
ENDIF.
It works for BAPI_PR_CHANFGE! It should work for BAPI_PR_CREATE.
(3)One condition is note 1176786, which correced errors in L2014I01 and L2105I01, where the code
CHECK: <comp>-type_kind EQ lr_abap->typekind_packed ,
must be
CHECK: <comp>-type_kind EQ lr_abap->typekind_packed OR "1176786
=> comma "," is wrong, logic operator "OR" is correct.
Viele Grüße
Shuhui -
Differenc in BAPI_PR_CREATE tables structure in 4.7 and ECC 6.0
Hi All,
Following are the tables parameters in 4.7 System for BAPI_PR_CREATE :
Tables
RETURN
PRITEM
PRITEMX
PRITEMEXP
PRITEMSOURCE
PRACCOUNT
PRACCOUNTPROITSEGMENT
PRACCOUNTX
PRADDRDELIVERY
PRITEMTEXT
PRHEADERTEXT
*PRLIMITS*
*PRCONTRACTLIMITS*
*PRSERVICES*
*PRSRVACCESSVALUES*
*PRSERVICESTEXT*
EXTENSIONIN
EXTENSIONOUT
ALLVERSIONS
Following are the tables parameters in ECC 6.0 System for BAPI BAPI_PR_CREATE :
Tables
RETURN
PRITEM
PRITEMX
PRITEMEXP
PRITEMSOURCE
PRACCOUNT
PRACCOUNTPROITSEGMENT
PRACCOUNTX
PRADDRDELIVERY
PRITEMTEXT
PRHEADERTEXT
EXTENSIONIN
EXTENSIONOUT
PRVERSION
PRVERSIONX
ALLVERSIONS
If you compare both, then you will find that Services and limits structures are missing in ECC 6.0.
When I am trying to create Purchase requisition in ECC 6.0 using BAPI_PR_CREATE, it gives me error saying "Please Maintain Services or Limits".
Please suggest me on this, how can I create the PR for Services using BAPI_PR_CREATE.
Thanks in advance.
Regards,
JayaprasannaHi All,
Can any body please provide some suggestions.
Regards
JayPrasanna -
How to create SERVICE PR using BAPI_PR_CREATE
Hi everyone,
How to create SERVICE PR using BAPI_PR_CREATE
Regards,
My Code(it doesn't work,I don't know what's wrong.):
*& Report ZWTEST
REPORT zwtest.
DATA: header TYPE bapimereqheader,
headerx TYPE bapimereqheaderx,
item LIKE TABLE OF bapimereqitemimp WITH HEADER LINE,
itemx LIKE TABLE OF bapimereqitemx WITH HEADER LINE,
account LIKE TABLE OF bapimereqaccount WITH HEADER LINE,
accountx LIKE TABLE OF bapimereqaccountx WITH HEADER LINE,
service LIKE TABLE OF bapi_srv_service_line WITH HEADER LINE,
servicex LIKE TABLE OF bapi_srv_service_linex WITH HEADER LINE,
serviceaccount LIKE TABLE OF bapi_srv_acc_data WITH HEADER LINE,
serviceaccountx LIKE TABLE OF bapi_srv_acc_datax WITH HEADER LINE,
preq_no LIKE bapimereqheader-preq_no,
lt_return LIKE TABLE OF bapiret2 WITH HEADER LINE,
wa_return LIKE bapiret2.
header-pr_type = 'NB'."订单类型(采购)
headerx-pr_type = 'X'.
CLEAR: item.
item-preq_item = '00010'.
item-pur_group = '426'."采购组
item-short_text = '服务类PR'."短文本
item-plant = '1051'."工厂
item-matl_group = 'AS07'."物料组
item-item_cat = '9'."项目类别
item-acctasscat = 'K'."科目分配类别
item-pckg_no = '0000000001'."软件包编号
APPEND item.
CLEAR: itemx.
itemx-preq_item = '00010'.
itemx-preq_itemx = 'X'.
itemx-pur_group = 'X'."采购组
itemx-short_text = 'X'."短文本
itemx-plant = 'X'."工厂
itemx-matl_group = 'X'."物料组
itemx-item_cat = 'X'."项目类别
itemx-acctasscat = 'X'."科目分配类别
itemx-pckg_no = 'X'."软件包编号
APPEND itemx.
CLEAR: account.
account-preq_item = '00010'.
account-serial_no = '01'.
*account-quantity = '0.955'.
*account-distr_perc = '95.5'.
account-gl_account = '4205020000'.
account-costcenter = '1042000001'.
*account-co_area = 'CNOC'.
*account-profit_ctr = '9999999999'.
APPEND account.
CLEAR: accountx.
accountx-preq_item = '00010'.
accountx-serial_no = '01'.
accountx-preq_itemx = 'X'.
accountx-serial_nox = 'X'.
*accountx-quantity = 'X'.
*accountx-distr_perc = 'X'.
accountx-gl_account = 'X'.
accountx-costcenter = 'X'.
*accountx-co_area = 'X'.
*accountx-profit_ctr = 'X'.
APPEND accountx.
CLEAR: service.
service-doc_item = '00010'.
service-outline = '0000000001'.
service-srv_line = '0000000010'.
service-short_text = 'service test'.
service-quantity = '10.000'.
service-uom = 'AU'.
service-gross_price = '10.00'.
service-currency = 'CNY'.
*service-matl_group = 'AS07'."物料组
APPEND service.
CLEAR: servicex.
servicex-doc_item = '00010'.
servicex-outline = '0000000001'.
servicex-srv_line = '0000000010'.
servicex-short_text = 'X'.
servicex-quantity = 'X'.
servicex-uom = 'X'.
servicex-gross_price = 'X'.
servicex-currency = 'X'.
*servicex-matl_group = 'X'.
APPEND servicex.
CLEAR: serviceaccount.
serviceaccount-doc_item = '00010'.
serviceaccount-outline = '0000000001'.
serviceaccount-srv_line = '0000000010'.
serviceaccount-serial_no = '01'.
serviceaccount-serial_no_item = '01'.
serviceaccount-percent = '100'.
APPEND serviceaccount.
CLEAR: serviceaccountx.
serviceaccountx-doc_item = '00010'.
serviceaccountx-outline = '0000000001'.
serviceaccountx-srv_line = '0000000010'.
serviceaccountx-serial_no = '01'.
serviceaccountx-serial_no_item = 'X'.
serviceaccountx-percent = 'X'.
APPEND serviceaccountx.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
prheader = header
prheaderx = headerx
* TESTRUN =
IMPORTING
number = preq_no
* PRHEADEREXP =
TABLES
return = lt_return
pritem = item
pritemx = itemx
* PRITEMEXP =
* PRITEMSOURCE =
praccount = account
* PRACCOUNTPROITSEGMENT =
praccountx = accountx
* PRADDRDELIVERY =
* PRITEMTEXT =
* PRHEADERTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* PRVERSION =
* PRVERSIONX =
* ALLVERSIONS =
* PRCOMPONENTS =
* PRCOMPONENTSX =
* SERVICEOUTLINE =
* SERVICEOUTLINEX =
servicelines = service
servicelinesx = servicex
* SERVICELIMIT =
* SERVICELIMITX =
* SERVICECONTRACTLIMITS =
* SERVICECONTRACTLIMITSX =
serviceaccount = serviceaccount
serviceaccountx = serviceaccountx
* SERVICELONGTEXTS =
* SERIALNUMBER =
* SERIALNUMBERX =
* 处理错误消息:通过判断消息的类型,来判断BAPI是否成功
READ TABLE lt_return INTO wa_return WITH KEY type = 'E'.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WRITE: / '成功创建采购申请', preq_no.
ENDIF.
LOOP AT lt_return INTO wa_return.
WRITE: / wa_return-message, wa_return-type, wa_return-id, wa_return-number.
ENDLOOP.see note:
1950319 - How to create service PR with BAPI_PR_CREATE.pdf -
Custom field for bapi_pr_create
Hello Experts,
I have a requirement of adding custom field at the header level. Can i use bapiextensionin in the FM BAPI_PR_CREATE
if yes what is the structure that need to be modified for appending new fields and transfer the data to the EBAN table.
Thanks in advance.
PraveenHi to All,
I've the same problem, using BAPI_PR_CREATE and filling EXTENSIONIN ( BAPI_TE_MEREQITEM/X)
the custom field has not filled. I've also tried to implement BADI ME_PR_CUST but doesn't work.
Please help up.
Thanks a lot.
Umberto -
Account assignment category in bapi_pr_create.
Hi All,
While using account assignment category F in PRITEM table of BAPI_PR_CREATE and marking appropriate flag = X in PRITEMX
table requsition is creating but also an error message is coming "enter G/L account" although i am passing it .
Any body know's this how to create a PR with this BAPI .
Thanks & Regards,
Ruchi TiwariHi,
Try using this code
DATA : S_HEADER LIKE BAPIMEREQHEADER OCCURS 0 WITH HEADER LINE.
S_HEADER-PR_TYPE = 'NB'.
S_HEADER-CTRL_IND = 'X'.
S_HEADER-GENERAL_RELEASE = 'X'.
S_HEADER-CREATE_IND = 'X'.
S_HEADER-ITEM_INTVL = 0000.
S_HEADER-LAST_ITEM = 0000.
S_HEADER-AUTO_SOURCE = 'X'.
S_HEADER-MEMORY = 'X'.
APPEND S_HEADER.
DATA : S_HEADERX LIKE BAPIMEREQHEADERX OCCURS 0 WITH HEADER LINE.
S_HEADERX-PR_TYPE = 'X'.
S_HEADER-CTRL_IND = 'X'.
S_HEADER-GENERAL_RELEASE = 'X'.
S_HEADER-CREATE_IND = 'X'.
S_HEADER-ITEM_INTVL = 'X'.
S_HEADER-LAST_ITEM = 'X'.
S_HEADER-AUTO_SOURCE = 'X'.
S_HEADER-MEMORY = 'X'.
APPEND S_HEADERX.
DATA : S_ITEMX LIKE BAPIMEREQITEMX OCCURS 0 WITH HEADER LINE.
S_ITEMX-MATERIAL = 'X'.
S_ITEMX-PLANT = 'X'.
S_ITEMX-QUANTITY = 'X'.
S_ITEMX-DELIV_DATE = 'X'.
APPEND S_ITEMX.
DATA : S_ITEMEXP LIKE BAPIMEREQITEM OCCURS 0 WITH HEADER LINE.
S_ITEMEXP-DOC_TYPE = 'NB'.
APPEND S_ITEMEXP.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
PRHEADER = S_HEADER
PRHEADERX = S_HEADERX
VERSIONS =
TESTRUN =
IMPORTING
NUMBER = NUMBER
PRHEADEREXP =
TABLES
RETURN = RETURN
PRITEM = PRITEM
PRITEMX = S_ITEMX
PRITEMEXP = S_ITEMEXP
PRITEMSOURCE =
PRACCOUNT =
PRACCOUNTPROITSEGMENT =
PRACCOUNTX =
PRADDRDELIVERY =
PRITEMTEXT =
PRHEADERTEXT = PRHEADERTEXT
EXTENSIONIN =
EXTENSIONOUT =
PRVERSION =
PRVERSIONX =
ALLVERSIONS =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
or
REPORT z_datainit_me51n .
TABLES:eban.
DATA: BEGIN OF itab OCCURS 0,
NO(5),
bnfpo LIKE eban-bnfpo,
bsart LIKE eban-bsart,
matnr LIKE eban-matnr,
lgort LIKE eban-lgort,
menge LIKE eban-menge,
bednr LIKE eban-bednr,
lfdat LIKE eban-lfdat,
TX(132),
END OF itab.
DATA :
prheader LIKE TABLE OF bapimereqheader WITH HEADER LINE,
prheaderx LIKE TABLE OF bapimereqheaderx WITH HEADER LINE,
PRITEMEXP LIKE TABLE OF BAPIMEREQITEM WITH HEADER LINE,
return LIKE TABLE OF bapiret2 WITH HEADER LINE,
pritem LIKE TABLE OF bapimereqitemimp WITH HEADER LINE,
pritemx LIKE TABLE OF bapimereqitemx WITH HEADER LINE,
PRITEMTEXT LIKE TABLE OF BAPIMEREQITEMTEXT WITH HEADER LINE.
DATA auxfilename LIKE rlgrap-filename.
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = 'C:\PRCREATE.TXT'
filetype = 'DAT'
IMPORTING
act_filename = auxfilename
TABLES
data_tab = itab.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT ITAB .
prheader-pr_type = itab-bsart.
APPEND prheader.
CLEAR prheader.
prheaderx-pr_type = 'X'.
APPEND prheaderx.
CLEAR prheaderx.
pritem-preq_item = itab-bnfpo.
pritem-material = itab-matnr.
pritem-plant = '0100'.
pritem-store_loc = itab-lgort.
pritem-quantity = itab-menge.
pritem-trackingno = itab-bednr.
pritem-deliv_date = itab-lfdat.
APPEND pritem.
CLEAR pritem.
pritemx-PREQ_ITEM = itab-bnfpo.
pritemx-preq_itemX = 'X'.
pritemx-material = 'X'.
pritemx-plant = 'X'.
pritemx-store_loc = 'X'.
pritemx-quantity = 'X'.
pritemx-trackingno = 'X'.
pritemx-deliv_date = 'X'.
pritemx-SHORT_TEXT = 'X'.
APPEND pritemx.
CLEAR pritemx.
PRITEMTEXT-PREQ_ITEM = itab-BNFPO.
PRITEMTEXT-TEXT_ID = 'B01'.
PRITEMTEXT-TEXT_LINE = ITAB-TX.
append PRITEMTEXT.
CLEAR PRITEMTEXT.
ENDLOOP.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
VERSIONS =
SKIP_ITEMS_WITH_ERROR =
TESTRUN =
IMPORTING
PRNUMBER =
TABLES
RETURN = RETURN
pritem = PRITEM
PRITEMX = PRITEMX
PRITEMEXP = PRITEMEXP
PRITEMSOURCE =
PRACCOUNT =
PRACCOUNTPROITSEGMENT =
PRACCOUNTX =
PRADDRDELIVERY =
PRITEMTEXT = PRITEMTEXT
PRHEADERTEXT =
PRLIMITS =
PRCONTRACTLIMITS =
PRSERVICES =
PRSRVACCESSVALUES =
PRSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
ALLVERSIONS =
CHANGING
PRHEADER = PRHEADER
PRHEADERX = PRHEADERX .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
REFRESH PRITEM.
REFRESH prheader.
REFRESH prheaderx.
REFRESH PRITEMX.
REFRESH PRITEMTEXT.
Regrds
Hiren K.Chitalia -
Updating EBAN table with custom field values for BAPI_PR_CREATE
Hi all,
My requirement is PR creation by BAPI_PR_CREATE Function Module .
for pr item level customer added 10 fields in the EBAN table append structure CI_EBANDB. .
i am creating PR by using Funcation module BAPI_PR_CREATE.
In this Function Module I have to pass the structure name and field values in the EXTENTIONIN .
what is the structure name I have to pass and how populate data in to the EBAN table.
after that i have to create PR and updating 10 two custom field values in the EBAN Table.
how to proceed for updating the customer field values in the eban table.
thanks in advance.
sriHi
First you need to append a structure in EBAN table, The values you need to pass to the
BAPIPAREX - Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
Structure will be the appen strucre created in EBAN.
You can pass the values of the 10 fileds to the VALUEPART1, VALUEPART2 fileds in the structure with 240 charcters each.
Hope this helps.
Thanks & Regards
Kishore -
BAPI_PR_CREATE enter GL account error
Hi Experts,
I a using babi BAPI_PR_CREATE to create a PR with two line items. but I am getting error 'Enter GL account'.
Please check below program and let me know if anything wrong in it.
data: lv_prnum type BAPIEBANC-PREQ_NO.
data: lv_prnumber type BAPIMEREQHEADER-PREQ_NO.
data: it_req_item type table of BAPIEBANC,
wa_req_item type BAPIEBANC.
data: it_req_item_new type table of BAPIEBAN,
wa_req_item_new type BAPIEBAN.
data: it_acc_assig type table of BAPIEBKN,
wa_acc_assig type BAPIEBKN.
data: it_req_ser type table of BAPIESLLC,
wa_req_ser type BAPIESLLC.
data: it_ser_val type table of BAPIESKLC,
wa_ser_val type BAPIESKLC.
data: it_return type table of BAPIRETURN,
lv_return type BAPIRET2.
data: lv_msg type char50.
data: it_change_return type table of BAPIRET2,
wa_change_return type BAPIRET2.
data: it_pritem type table of BAPIMEREQITEMIMP,
wa_pritem type BAPIMEREQITEMIMP.
data: it_pritemx type table of BAPIMEREQITEMX,
wa_pritemx type BAPIMEREQITEMX.
data: it_pritemexp type table of BAPIMEREQITEM,
wa_pritemexp type BAPIMEREQITEM.
data: it_praccount type table of BAPIMEREQACCOUNT,
wa_praccount type BAPIMEREQACCOUNT.
data: it_praccountx type table of BAPIMEREQACCOUNTX,
wa_praccountx type BAPIMEREQACCOUNTX.
data: it_ret type table of BAPIRET2,
wa_ret type BAPIRET2.
data: it_prheader type table of BAPIMEREQHEADER,
wa_prheader type BAPIMEREQHEADER.
data: it_prheaderx type table of BAPIMEREQHEADERX,
wa_prheaderx type BAPIMEREQHEADERX.
data: it_ser_acc type table of BAPI_SRV_ACC_DATA,
wa_ser_acc type BAPI_SRV_ACC_DATA.
data: it_ser_accx type table of BAPI_SRV_ACC_DATAX,
wa_ser_accx type BAPI_SRV_ACC_DATAX.
*first item - material
wa_pritem-PREQ_ITEM = '00010'.
wa_pritem-PUR_GROUP = 'ITD'.
wa_pritem-preq_name = 'abcd'.
wa_pritem-SHORT_TEXT = 'ABC'.
wa_pritem-MATERIAL = 'NCAD100001'.
wa_pritem-PLANT = '1100'.
wa_pritem-TRACKINGNO = 'XXX'.
wa_pritem-MATL_GROUP = 'Z111'.
wa_pritem-QUANTITY = 1.
*wa_pritem-UNIT = 'AU'.
wa_pritem-PREQ_DATE = '20140430'.
wa_pritem-DELIV_DATE = '20140505'.
wa_pritem-PRICE_UNIT = 1.
*wa_pritem-ITEM_CAT = ' '.
wa_pritem-ACCTASSCAT = 'N'.
*wa_pritem-des_vendor = '0050000793'.
*wa_pritem-fixed_vend = '0050000793'.
wa_pritem-PURCH_ORG = '1000'.
append wa_pritem to it_pritem.
*2nd item - service
clear wa_pritem.
wa_pritem-PREQ_ITEM = '00020'.
wa_pritem-PUR_GROUP = 'ITD'.
wa_pritem-preq_name = 'abc'.
wa_pritem-SHORT_TEXT = 'ABC'.
*wa_pritem-MATERIAL = 'NCAD100002'.
wa_pritem-PLANT = '1100'.
wa_pritem-TRACKINGNO = 'XXX'.
wa_pritem-MATL_GROUP = 'S0010'.
wa_pritem-QUANTITY = 1.
*wa_pritem-UNIT = 'AU'.
wa_pritem-PREQ_DATE = '20140430'.
wa_pritem-DELIV_DATE = '20140505'.
wa_pritem-PRICE_UNIT = 1.
wa_pritem-ITEM_CAT = '9'.
wa_pritem-ACCTASSCAT = 'N'.
*wa_pritem-des_vendor = '0050000793'.
*wa_pritem-fixed_vend = '0050000793'.
wa_pritem-PURCH_ORG = '1000'.
wa_pritem-pckg_no = '0000000001'.
append wa_pritem to it_pritem.
*fields for 1st item - material
wa_pritemx-PREQ_ITEM = '00010'.
wa_pritemx-PREQ_ITEMX = 'X'.
wa_pritemx-PUR_GROUP = 'X'.
wa_pritemx-preq_name = 'X'.
wa_pritemx-SHORT_TEXT = 'X'.
wa_pritemx-MATERIAL = 'X'.
wa_pritemx-PLANT = 'X'.
wa_pritemx-TRACKINGNO = 'X'.
wa_pritemx-MATL_GROUP = 'X'.
wa_pritemx-QUANTITY = 'X'.
*wa_pritem-UNIT = 'AU'.
wa_pritemx-PREQ_DATE = 'X'.
wa_pritemx-DELIV_DATE = 'X'.
wa_pritemx-PRICE_UNIT = 'X'.
*wa_pritem-ITEM_CAT = ' '.
wa_pritemx-ACCTASSCAT = 'X'.
*wa_pritemx-des_vendor = 'X'.
*wa_pritemx-fixed_vend = 'X'.
wa_pritemx-PURCH_ORG = 'X'.
append wa_pritemx to it_pritemx.
*fields for 2nd item - service
clear wa_pritemx.
wa_pritemx-PREQ_ITEM = '00020'.
wa_pritemx-PREQ_ITEMX = 'X'.
wa_pritemx-PUR_GROUP = 'X'.
wa_pritemx-preq_name = 'X'.
wa_pritemx-SHORT_TEXT = 'X'.
wa_pritemx-MATERIAL = 'X'.
wa_pritemx-PLANT = 'X'.
wa_pritemx-TRACKINGNO = 'X'.
wa_pritemx-MATL_GROUP = 'X'.
wa_pritemx-QUANTITY = 'X'.
*wa_pritem-UNIT = 'X'.
wa_pritemx-PREQ_DATE = 'X'.
wa_pritemx-DELIV_DATE = 'X'.
wa_pritemx-PRICE_UNIT = 'X'.
wa_pritem-ITEM_CAT = 'X'.
wa_pritemx-ACCTASSCAT = 'X'.
*wa_pritemx-des_vendor = 'X'.
*wa_pritemx-fixed_vend = 'X'.
wa_pritemx-PURCH_ORG = 'X'.
wa_pritem-pckg_no = 'X'.
append wa_pritemx to it_pritemx.
*Account assignment data for 1st item - material
wa_praccount-PREQ_ITEM = '00010'.
wa_praccount-SERIAL_NO = '01'.
wa_praccount-QUANTITY = 1.
wa_praccount-DISTR_PERC = '1.00'.
wa_praccount-NET_VALUE = 1.
wa_praccount-GL_ACCOUNT = '0040100801'.
wa_praccount-UNLOAD_PT = 'ABC'.
wa_praccount-CO_AREA = '1000'.
wa_praccount-NETWORK = '000004011841'.
append wa_praccount to it_praccount.
*Account assignment data for 2nd item - service
clear wa_praccount.
wa_praccount-PREQ_ITEM = '00020'.
wa_praccount-SERIAL_NO = '02'.
*wa_praccount-QUANTITY = 1.
*wa_praccount-DISTR_PERC = '1.00'.
*wa_praccount-NET_VALUE = 1.
wa_praccount-GL_ACCOUNT = '0040100801'.
wa_praccount-UNLOAD_PT = 'ABC'.
wa_praccount-CO_AREA = '1000'.
wa_praccount-NETWORK = '000004011841'.
append wa_praccount to it_praccount.
*Account assignment fields for 1st item - material
wa_praccountx-PREQ_ITEM = '00010'.
wa_praccountx-SERIAL_NO = '01'.
wa_praccountx-PREQ_ITEMX = 'X'.
wa_praccountx-SERIAL_NOX = 'X'.
wa_praccountx-QUANTITY = 'X'.
wa_praccountx-DISTR_PERC = 'X'.
wa_praccountx-NET_VALUE = 'X'.
wa_praccountx-GL_ACCOUNT = 'X'.
wa_praccountx-UNLOAD_PT = 'X'.
wa_praccountx-CO_AREA = 'X'.
wa_praccountx-NETWORK = 'X'.
append wa_praccountx to it_praccountx.
*Account assignment fields for 2nd item - service
clear wa_praccountx.
wa_praccountx-PREQ_ITEM = '00020'.
wa_praccountx-SERIAL_NO = '02'.
wa_praccountx-PREQ_ITEMX = 'X'.
wa_praccountx-SERIAL_NOX = 'X'.
*wa_praccountx-QUANTITY = 'X'.
*wa_praccountx-DISTR_PERC = 'X'.
*wa_praccountx-NET_VALUE = 'X'.
wa_praccountx-GL_ACCOUNT = 'X'.
wa_praccountx-UNLOAD_PT = 'X'.
wa_praccountx-CO_AREA = 'X'.
wa_praccountx-NETWORK = 'X'.
append wa_praccountx to it_praccountx.
*2nd item Service details
wa_ser_acc-doc_item = '00020'.
wa_ser_acc-outline = '0000000001'.
wa_ser_acc-srv_line = '0000000010'.
wa_ser_acc-serial_no = '02'.
wa_ser_acc-serial_no_item = '02'.
wa_ser_acc-quantity = 10.
append wa_ser_acc to it_ser_acc.
*2nd item Service fields
wa_ser_accx-doc_item = '00020'.
wa_ser_accx-outline = '0000000001'.
wa_ser_accx-srv_line = '0000000010'.
wa_ser_accx-serial_no = '02'.
wa_ser_accx-serial_no_item = 'X'.
wa_ser_accx-quantity = 'X'.
append wa_ser_accx to it_ser_accx.
*Header details
wa_prheader-pr_type = 'PURE'.
wa_prheaderx-pr_type = 'X'.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
PRHEADER = wa_prheader
PRHEADERX = wa_prheaderx
* TESTRUN =
IMPORTING
NUMBER = lv_prnumber
* PRHEADEREXP =
TABLES
RETURN = it_ret
PRITEM = it_pritem
PRITEMX = it_pritemx
* PRITEMEXP = it_pritemexp
* PRITEMSOURCE =
PRACCOUNT = it_praccount
* PRACCOUNTPROITSEGMENT =
PRACCOUNTX = it_praccountx
* PRADDRDELIVERY =
* PRITEMTEXT =
* PRHEADERTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* PRVERSION =
* PRVERSIONX =
* ALLVERSIONS =
* PRCOMPONENTS =
* PRCOMPONENTSX =
* SERVICEOUTLINE =
* SERVICEOUTLINEX =
* SERVICELINES =
* SERVICELINESX =
* SERVICELIMIT =
* SERVICELIMITX =
* SERVICECONTRACTLIMITS =
* SERVICECONTRACTLIMITSX =
SERVICEACCOUNT = it_ser_acc
SERVICEACCOUNTX = it_ser_accx
* SERVICELONGTEXTS =
* SERIALNUMBER =
* SERIALNUMBERX =
IF sy-subrc eq 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = lv_return.
endif.Hi
Now i able to post PR. I DID BELOW CHANGE. I ADDED serrial no.
Ls_acct-SERIAL_NO = '01'.
Ls_acct-COSTCENTER = gs_psdata-kostl.
Ls_acct-WBS_ELEMENT = gs_psdata-wbs_element.
append ls_acct to lt_acct.
Ls_acctx-SERIAL_NO = '01'.
Ls_acctx-COSTCENTER = GC_X.
Ls_acctX-WBS_ELEMENT = GC_X.
append ls_acctx to lt_acctx.
But second issue i am facing
i am using item category 'L' subcontracting
i am trying to replace existing BOM with new material USING BELOW LOGIC.
LS_COMP-MATERIAL = gs_psdata-COMP_MATNR. " Ne material act as component of product
LS_COMP-PLANT = gs_psdata-werks.
LS_COMP-CHANGE_ID = 'I'. "gc_value_r.
LS_COMP-ENTRY_QUANTITY = gs_psdata-QUANTITY.
APPEND LS_COMP TO LT_COMP.
CLEAR LS_COMP.
*LS_COMPx-PREQ_ITEM = '00010'.
LS_COMPX-MATERIAL = GC_X.
LS_COMPx-PLANT = gc_x.
LS_COMPX-CHANGE_ID = GC_X.
LS_COMPX-ENTRY_QUANTITY = GC_X.
APPEND LS_COMPX TO LT_COMPX.
CLEAR LS_COMPX.
But i observed that old BOM is pulled into PR. and not appeared my material added in above logic.
Any advise.
Regards
Ramakrishnaiah Y -
BAPI_PR_CREATE error enter GL account
Hi All,
I a using babi BAPI_PR_CREATE to create a PR with two line items. but I am getting error 'Enter GL account'.
Please check below program and let me know if anything wrong in it.
data: lv_prnum type BAPIEBANC-PREQ_NO.
data: lv_prnumber type BAPIMEREQHEADER-PREQ_NO.
data: it_req_item type table of BAPIEBANC,
wa_req_item type BAPIEBANC.
data: it_req_item_new type table of BAPIEBAN,
wa_req_item_new type BAPIEBAN.
data: it_acc_assig type table of BAPIEBKN,
wa_acc_assig type BAPIEBKN.
data: it_req_ser type table of BAPIESLLC,
wa_req_ser type BAPIESLLC.
data: it_ser_val type table of BAPIESKLC,
wa_ser_val type BAPIESKLC.
data: it_return type table of BAPIRETURN,
lv_return type BAPIRET2.
data: lv_msg type char50.
data: it_change_return type table of BAPIRET2,
wa_change_return type BAPIRET2.
data: it_pritem type table of BAPIMEREQITEMIMP,
wa_pritem type BAPIMEREQITEMIMP.
data: it_pritemx type table of BAPIMEREQITEMX,
wa_pritemx type BAPIMEREQITEMX.
data: it_pritemexp type table of BAPIMEREQITEM,
wa_pritemexp type BAPIMEREQITEM.
data: it_praccount type table of BAPIMEREQACCOUNT,
wa_praccount type BAPIMEREQACCOUNT.
data: it_praccountx type table of BAPIMEREQACCOUNTX,
wa_praccountx type BAPIMEREQACCOUNTX.
data: it_ret type table of BAPIRET2,
wa_ret type BAPIRET2.
data: it_prheader type table of BAPIMEREQHEADER,
wa_prheader type BAPIMEREQHEADER.
data: it_prheaderx type table of BAPIMEREQHEADERX,
wa_prheaderx type BAPIMEREQHEADERX.
data: it_ser_acc type table of BAPI_SRV_ACC_DATA,
wa_ser_acc type BAPI_SRV_ACC_DATA.
data: it_ser_accx type table of BAPI_SRV_ACC_DATAX,
wa_ser_accx type BAPI_SRV_ACC_DATAX.
*first item - material
wa_pritem-PREQ_ITEM = '00010'.
wa_pritem-PUR_GROUP = 'ITD'.
wa_pritem-preq_name = 'abcd'.
wa_pritem-SHORT_TEXT = 'ABC'.
wa_pritem-MATERIAL = 'NCAD100001'.
wa_pritem-PLANT = '1100'.
wa_pritem-TRACKINGNO = 'XXX'.
wa_pritem-MATL_GROUP = 'Z111'.
wa_pritem-QUANTITY = 1.
*wa_pritem-UNIT = 'AU'.
wa_pritem-PREQ_DATE = '20140430'.
wa_pritem-DELIV_DATE = '20140505'.
wa_pritem-PRICE_UNIT = 1.
*wa_pritem-ITEM_CAT = ' '.
wa_pritem-ACCTASSCAT = 'N'.
*wa_pritem-des_vendor = '0050000793'.
*wa_pritem-fixed_vend = '0050000793'.
wa_pritem-PURCH_ORG = '1000'.
append wa_pritem to it_pritem.
*2nd item - service
clear wa_pritem.
wa_pritem-PREQ_ITEM = '00020'.
wa_pritem-PUR_GROUP = 'ITD'.
wa_pritem-preq_name = 'abc'.
wa_pritem-SHORT_TEXT = 'ABC'.
*wa_pritem-MATERIAL = 'NCAD100002'.
wa_pritem-PLANT = '1100'.
wa_pritem-TRACKINGNO = 'XXX'.
wa_pritem-MATL_GROUP = 'S0010'.
wa_pritem-QUANTITY = 1.
*wa_pritem-UNIT = 'AU'.
wa_pritem-PREQ_DATE = '20140430'.
wa_pritem-DELIV_DATE = '20140505'.
wa_pritem-PRICE_UNIT = 1.
wa_pritem-ITEM_CAT = '9'.
wa_pritem-ACCTASSCAT = 'N'.
*wa_pritem-des_vendor = '0050000793'.
*wa_pritem-fixed_vend = '0050000793'.
wa_pritem-PURCH_ORG = '1000'.
wa_pritem-pckg_no = '0000000001'.
append wa_pritem to it_pritem.
*fields for 1st item - material
wa_pritemx-PREQ_ITEM = '00010'.
wa_pritemx-PREQ_ITEMX = 'X'.
wa_pritemx-PUR_GROUP = 'X'.
wa_pritemx-preq_name = 'X'.
wa_pritemx-SHORT_TEXT = 'X'.
wa_pritemx-MATERIAL = 'X'.
wa_pritemx-PLANT = 'X'.
wa_pritemx-TRACKINGNO = 'X'.
wa_pritemx-MATL_GROUP = 'X'.
wa_pritemx-QUANTITY = 'X'.
*wa_pritem-UNIT = 'AU'.
wa_pritemx-PREQ_DATE = 'X'.
wa_pritemx-DELIV_DATE = 'X'.
wa_pritemx-PRICE_UNIT = 'X'.
*wa_pritem-ITEM_CAT = ' '.
wa_pritemx-ACCTASSCAT = 'X'.
*wa_pritemx-des_vendor = 'X'.
*wa_pritemx-fixed_vend = 'X'.
wa_pritemx-PURCH_ORG = 'X'.
append wa_pritemx to it_pritemx.
*fields for 2nd item - service
clear wa_pritemx.
wa_pritemx-PREQ_ITEM = '00020'.
wa_pritemx-PREQ_ITEMX = 'X'.
wa_pritemx-PUR_GROUP = 'X'.
wa_pritemx-preq_name = 'X'.
wa_pritemx-SHORT_TEXT = 'X'.
wa_pritemx-MATERIAL = 'X'.
wa_pritemx-PLANT = 'X'.
wa_pritemx-TRACKINGNO = 'X'.
wa_pritemx-MATL_GROUP = 'X'.
wa_pritemx-QUANTITY = 'X'.
*wa_pritem-UNIT = 'X'.
wa_pritemx-PREQ_DATE = 'X'.
wa_pritemx-DELIV_DATE = 'X'.
wa_pritemx-PRICE_UNIT = 'X'.
wa_pritem-ITEM_CAT = 'X'.
wa_pritemx-ACCTASSCAT = 'X'.
*wa_pritemx-des_vendor = 'X'.
*wa_pritemx-fixed_vend = 'X'.
wa_pritemx-PURCH_ORG = 'X'.
wa_pritem-pckg_no = 'X'.
append wa_pritemx to it_pritemx.
*Account assignment data for 1st item - material
wa_praccount-PREQ_ITEM = '00010'.
wa_praccount-SERIAL_NO = '01'.
wa_praccount-QUANTITY = 1.
wa_praccount-DISTR_PERC = '1.00'.
wa_praccount-NET_VALUE = 1.
wa_praccount-GL_ACCOUNT = '0040100801'.
wa_praccount-UNLOAD_PT = 'ABC'.
wa_praccount-CO_AREA = '1000'.
wa_praccount-NETWORK = '000004011841'.
append wa_praccount to it_praccount.
*Account assignment data for 2nd item - service
clear wa_praccount.
wa_praccount-PREQ_ITEM = '00020'.
wa_praccount-SERIAL_NO = '02'.
*wa_praccount-QUANTITY = 1.
*wa_praccount-DISTR_PERC = '1.00'.
*wa_praccount-NET_VALUE = 1.
wa_praccount-GL_ACCOUNT = '0040100801'.
wa_praccount-UNLOAD_PT = 'ABC'.
wa_praccount-CO_AREA = '1000'.
wa_praccount-NETWORK = '000004011841'.
append wa_praccount to it_praccount.
*Account assignment fields for 1st item - material
wa_praccountx-PREQ_ITEM = '00010'.
wa_praccountx-SERIAL_NO = '01'.
wa_praccountx-PREQ_ITEMX = 'X'.
wa_praccountx-SERIAL_NOX = 'X'.
wa_praccountx-QUANTITY = 'X'.
wa_praccountx-DISTR_PERC = 'X'.
wa_praccountx-NET_VALUE = 'X'.
wa_praccountx-GL_ACCOUNT = 'X'.
wa_praccountx-UNLOAD_PT = 'X'.
wa_praccountx-CO_AREA = 'X'.
wa_praccountx-NETWORK = 'X'.
append wa_praccountx to it_praccountx.
*Account assignment fields for 2nd item - service
clear wa_praccountx.
wa_praccountx-PREQ_ITEM = '00020'.
wa_praccountx-SERIAL_NO = '02'.
wa_praccountx-PREQ_ITEMX = 'X'.
wa_praccountx-SERIAL_NOX = 'X'.
*wa_praccountx-QUANTITY = 'X'.
*wa_praccountx-DISTR_PERC = 'X'.
*wa_praccountx-NET_VALUE = 'X'.
wa_praccountx-GL_ACCOUNT = 'X'.
wa_praccountx-UNLOAD_PT = 'X'.
wa_praccountx-CO_AREA = 'X'.
wa_praccountx-NETWORK = 'X'.
append wa_praccountx to it_praccountx.
*2nd item Service details
wa_ser_acc-doc_item = '00020'.
wa_ser_acc-outline = '0000000001'.
wa_ser_acc-srv_line = '0000000010'.
wa_ser_acc-serial_no = '02'.
wa_ser_acc-serial_no_item = '02'.
wa_ser_acc-quantity = 10.
append wa_ser_acc to it_ser_acc.
*2nd item Service fields
wa_ser_accx-doc_item = '00020'.
wa_ser_accx-outline = '0000000001'.
wa_ser_accx-srv_line = '0000000010'.
wa_ser_accx-serial_no = '02'.
wa_ser_accx-serial_no_item = 'X'.
wa_ser_accx-quantity = 'X'.
append wa_ser_accx to it_ser_accx.
*Header details
wa_prheader-pr_type = 'PURE'.
wa_prheaderx-pr_type = 'X'.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
PRHEADER = wa_prheader
PRHEADERX = wa_prheaderx
* TESTRUN =
IMPORTING
NUMBER = lv_prnumber
* PRHEADEREXP =
TABLES
RETURN = it_ret
PRITEM = it_pritem
PRITEMX = it_pritemx
* PRITEMEXP = it_pritemexp
* PRITEMSOURCE =
PRACCOUNT = it_praccount
* PRACCOUNTPROITSEGMENT =
PRACCOUNTX = it_praccountx
* PRADDRDELIVERY =
* PRITEMTEXT =
* PRHEADERTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* PRVERSION =
* PRVERSIONX =
* ALLVERSIONS =
* PRCOMPONENTS =
* PRCOMPONENTSX =
* SERVICEOUTLINE =
* SERVICEOUTLINEX =
* SERVICELINES =
* SERVICELINESX =
* SERVICELIMIT =
* SERVICELIMITX =
* SERVICECONTRACTLIMITS =
* SERVICECONTRACTLIMITSX =
SERVICEACCOUNT = it_ser_acc
SERVICEACCOUNTX = it_ser_accx
* SERVICELONGTEXTS =
* SERIALNUMBER =
* SERIALNUMBERX =
IF sy-subrc eq 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = lv_return.
endif.Hi
If you want to specify the G/L account for PR you have to transfer
it in field GL_ACCOUNT in PRACCOUNT and PRACCOUNTX structures.
This errornormally could occur because the SERIAL_NO in PRACCOUNT and PRACCOUNTX
was set to "00". It should be setto a value > 0, e.g. "01"
Kind regards,
Lorraine -
Bapi_pr_create,, error - convt_no_number
Hi expert !
i was trying to post pr docu by using bapi_pr_create, but i got dump error /;convt_no_number
searched notes , but didn't find related notes.
i did deleted some source not needed in the whole source, because convt_no_number comes up.
i hoped that return table from bapi_pr_create, but dump error came up with convt_no_number,
humm,,, very strange issue, please get back to me with good advise.
my source code is not complete to post docu ,, just hope not dump error comes up, but dump error as convt_no number.....
someone can execute this source whether dump error or return bapi return table with some error message ?
System environment
SAP-Release 700
SAP kernel....... 700
created (date)... "Aug 24 2008 21:47:28"
Patch level. 175
Database............. "ORACLE
SAP database version. 700
APPL SP 18
data : g_mereqheader like bapimereqheader,
g_mereqheaderx like bapimereqheaderx,
g_mereqitem like bapimereqitemimp occurs 0 with header line,
g_mereqitemx like bapimereqitemx occurs 0 with header line,
g_mereqacc like bapimereqaccount occurs 0 with header line,
g_mereqaccx like bapimereqaccountx occurs 0 with header line,
g_te_meqitem type bapi_te_mereqitem,
g_te_meqitemx type bapi_te_mereqitemx,
g_ext_in like bapiparex occurs 0 with header line,
g_ext_out like bapiparex occurs 0 with header line,
g_prnumber like bapimereqheader-preq_no,
gt_return like bapiret2 occurs 0 with header line,
wa_valuepart(960),
wa_valuepartx(960).
data : ex_value type me_max_container.
data : lv_item like eban-bnfpo,
lv_sn like bapimereqaccount-serial_no.
g_mereqheader-pr_type = 'NB'.
g_mereqheaderx-pr_type = 'X'.
lv_sn = '01'.
loop at gt_itab where check = 'X'.
clear : g_mereqitem, g_mereqitemx.
lv_item = lv_item + 10.
g_mereqitem-preq_item = lv_item.
g_mereqitem-acctasscat = '1'. " 1 is used for stock material
g_mereqitem-material = gt_itab-matnr. " valuse 00000123 or 123 both tried ,,
g_mereqitemx-preq_item = lv_item.
g_mereqitemx-preq_itemx = 'X'.
g_mereqitemx-acctasscat = 'X'.
g_mereqitemx-material = 'X'.
g_mereqacc-preq_item = lv_item.
g_mereqacc-serial_no = lv_sn.
g_mereqaccx-preq_item = lv_item.
g_mereqaccx-serial_no = lv_sn.
g_mereqaccx-serial_nox = 'X'.
append g_mereqacc. append g_mereqaccx.
append g_mereqitem. append g_mereqitemx.
endloop.
call function 'BAPI_PR_CREATE'
exporting
prheader = g_mereqheader
prheaderx = g_mereqheaderx
TESTRUN =
importing
number = g_prnumber
PRHEADEREXP =
tables
return = gt_return
pritem = g_mereqitem
pritemx = g_mereqitemx
PRITEMEXP =
PRITEMSOURCE =
praccount = g_mereqacc
PRACCOUNTPROITSEGMENT =
praccountx = g_mereqaccx
PRADDRDELIVERY =
PRITEMTEXT =
PRHEADERTEXT =
extensionin = g_ext_in
extensionout = g_ext_in
PRVERSION =
PRVERSIONX =
ALLVERSIONS =
Edited by: venjamin on Sep 10, 2010 10:15 AM
Edited by: venjamin on Sep 10, 2010 10:18 AMHi there
as you see the above source, there is no one you worry about.
could you test the above source if dump error comes up or get return table included error message without dump error?
Best & Regards;
venjamin -
Error on creation of PR using BAPI_PR_CREATE
Hello All,
while creating a PR using BAPI_PR_CREATE getting an error simultaneously a PR is creating
The error is Enter a G/L Account. Even when I am providing with the G/L Account number.
There is one input field as SERIAL_NO in tables PRACCOUNT and PRACCOUNTX. If I give SERIAL_NO as 00 in tables PRACCOUNT and PRACCOUNTX, then it gives the same error but and no PR is created but if i give 01 it gives the same error but and now PR is created simultaneouly .
Using the same details if I execute BAPI_REQUISITION_CREATE and SERIAL_NO as 00, the PR is successfully created.
Please let me know if anybody worked on it.
Thanks & Regards,
Ruchi TiwariHi,
you just need to populate the following fields:
praccount-preq_item = '10'. <--- this depends on how many items you have in your PR.
praccount-serial_no = '1'. <--- this one is required, in case you split the qty of the item by G/L or Cost Center.
dont forget to populate the ff. fields in the Purchase Requisition Change Parameter - Account Assignment table.
praccountx-preq_item = '10'.
praccountx-serial_no = '1'.
Thanks & regards,
ShreeMohan
Maybe you are looking for
-
For a while now I have been having trouble with pdf files in Mail. Sometimes I cannot even open them as they appear as a little black dot. The trouble came to a head recently when one of the pdf files I work with for some reason opened up without one
-
Error While Installing 7.6 Upgrade
Keep getting the following error while trying to install the 7.6 update... "Errors occured while installing the updates, if problems persist, chose Tools>Download only and try installing..." Any help and suggestions would be appreciated.
-
Example on one order framework using Guid and ref_guid on table level
Hi Forum, I am new to CRM can someone explain me the one order framework in header and item level tables with an example. I am unable to figure out what is the difference. crmd_orderadm_h and crmd_orderadm_i tables how do we connect them in which fie
-
ICal publication on IIS Website with SSL
Hi, Can i publish iCal calendars on IIS Webdav directory with SSL configuration on an other port than default 443 ??? I try to publish on this server and this work for: - "http" site - "https" site with ssl port 443 but no with "https" site with ssl
-
I can't get this to install. I installed bzr but when I try to install awn-extras-bzr it errors out saying "bzr: command not found"