Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_CONTRACT_CREATEFROMDATA not generate contract no.

Former Member
0 Likes
3,307

Hi,

I use BAPI_CONTRACT_CREATEFROMDATA to generate contract no. but when i execute report

display following error like


SALES_HEADER_IN has been processed successfully 
Condition PR00 is missing in pricing procedure A V ZESE41
The sales document is not yet complete: Edit data
Sales document  was not changed      

Edited by: kk.adhvaryu on Apr 17, 2010 12:14 PM

24 REPLIES 24
Read only

vinod_vemuru2
Active Contributor
0 Likes
2,773

Hi,

PR00 is the mandatory pricing condition. Configuration is missing for the pricing procedure. Ask your functional to configure the respective pricing procedure to have PR00 condition. Then it works fine.

FYI...

You will get the same error even if you try to create the contract manually.

Thanks,

Vinod.

Read only

Former Member
0 Likes
2,773

if possible then can u pl give sample code without passing patnar details.

Read only

Former Member
0 Likes
2,773

Pricing condition "PR00" which you are passing in Bapi is not defined in pricing procedure "ZESE41".

Regards

Vinod

Read only

0 Likes
2,773

Hi vinod,

now i got following error


 SALES_HEADER_IN has been processed successfully                        
 Condition ZSPS is not allowed as header condition                      
 The sales document is not yet complete: Edit data                       
 Sales document  was not changed                                       

Read only

0 Likes
2,773

Set

CONTRACT_CONDITIONS_IN-ITM_NUMBER = <item_number>
CONTRACT_CONDITIONS_INX-ITM_NUMBER = <item_number>

uncomment the line

move '000010' to w_conds-itm_number,

I think you have to fill CONTRACT_CONDITIONS_INX structure also.

Regards

Vinod

*

Edited by: Vinod Kumar on Apr 17, 2010 4:13 PM

Read only

0 Likes
2,773

as u told i do this but again error like



 Condition ZSPS is not allowed as header condition 

why this error i not assign in header then?

Read only

0 Likes
2,773

Try this code

move '000010' to w_conds-itm_number.
move 'ZSPS' to w_conds_cond_type.
move '34.00' to w_conds-cond_value,
move 'INR' to w_conds-currency,
append w_conds to t_conds.

move '000010' to w_conds-itm_number.
move 'ZSPS' to w_conds_cond_type.
move 'X' to w_conds-cond_value.
move 'X' to w_conds-currency.
move 'I' to w_conds-updateflag.
append w_condsx to t_condsx.

Fill both the structures CONTRACT_CONDITIONS_IN & CONTRACT_CONDITIONS_INX using the structures T_CONDS & T_CONDSX.

Regards

Vinod

Read only

0 Likes
2,773

i do as u told but agian error


 SALES_HEADER_IN has been processed successfully                          <
 Sales unit D is not defined for item 000010                              <
 Error in SALES_ITEM_IN 000010                                            <
 Condition ZSPS is not allowed as header condition                        <

Read only

0 Likes
2,773

Paste the Code part where you have filled the Conditions & conditionsx structure.

Regards

Vinod

Read only

0 Likes
2,773

w_conds like bapicond,

t_conds like bapicond occurs 0,

t_condsx like BAPICONDITIONX occurs 0,

w_condsx type BAPICONDITIONX,


move '000010' to w_conds-itm_number.
move 'ZSPS' to w_conds-cond_type.
move '34.00' to w_conds-cond_value.
move 'INR' to w_conds-currency.
append w_conds to t_conds.

move '000010' to w_condsx-itm_number.
move 'ZSPS' to w_condsx-cond_type.
move 'X' to w_condsx-cond_value.
move 'X' to w_condsx-currency.
move 'I' to w_condsx-updateflag.
append w_condsx to t_condsx.

have gmail id?

Edited by: kk.adhvaryu on Apr 17, 2010 1:27 PM

Read only

0 Likes
2,773

Item level i already pass sales unit see


***** ITEMS *****

move: 'Q1512' to w_items-material,

'2601' to w_items-PLANT,

'2601' to w_items-SHIP_POINT,

*p_charg to w_items-BATCH,
*
*p_werds to w_items-S_PROC_IND,
*
*p_pstyv to w_items-ITEM_CATEG,
*
'10.000' to w_items-target_qty,

'10' to w_items-target_qu,

'PC' TO w_items-SALES_UNIT,
*p_brgew1 to w_items-gross_wght,

*p_ntgew1 to w_items-net_weight,
*
*p_gewei1 to w_items-untof_wght,
*
*p_gewei1 to w_items-unof_wtiso,

'000010' to w_items-itm_number.

* p_netwr1 to w_items-target_val,

* 'USD' to w_items-currency,

* 'USD' to w_items-curr_iso.

append w_items to t_items.

Read only

0 Likes
2,773

This error occurs only when you pass the pricing condition with position no '000000', where as this condition is defined at item level in pricing procedure.

Regards

Vinod

Read only

0 Likes
2,773

now where i change my code?

Read only

0 Likes
2,773

How to pass condition type in item level?

Read only

Former Member
0 Likes
2,773

See this is my code


REPORT zr_and_d .


data: w_header like bapisdhd1,

v_order like bapivbeln-vbeln,

w_return like bapiret2,

t_return like bapiret2 occurs 0,

w_items like bapisditm,

t_items like bapisditm occurs 0,

w_partners like bapiparnr,

t_partners like bapiparnr occurs 0,

w_conds like bapicond,

t_conds like bapicond occurs 0,

w_sched like bapischdl,

t_sched like bapischdl occurs 0,

w_texts like bapisdtext,

t_texts like bapisdtext occurs 0,

v_exit.



selection-screen begin of block b1 with frame.

parameters:
p_sp type kunnr,
p_sh type kunnr,
p_auart type AUART,

p_vkorg type vkorg,

p_vtweg type vtweg,

p_spart type spart,
p_gueen type gueen,

p_guebg type guebg.


selection-screen end of block b1.


start-of-selection.



Edited by: kk.adhvaryu on Apr 17, 2010 12:28 PM

Read only

0 Likes
2,773

Check the pricing procedure definition in t-code V/08. Check whether pricing condition PR00 is availbale in the pricing procedure ZESE41.

Regards

Vinod

Edited by: Vinod Kumar on Apr 17, 2010 3:59 PM

Read only

Former Member
0 Likes
2,773

***** HEADER *****

move:
p_auart to w_header-doc_type,


p_guebg to w_header-CT_VALID_F,

p_gueen to w_header-CT_VALID_T,

p_vkorg to w_header-sales_org,

p_vtweg to w_header-distr_chan,

p_spart to w_header-division.


*
*
***** ITEMS *****

move: 'Q1512' to w_items-material,

'2601' to w_items-PLANT,

'2601' to w_items-SHIP_POINT,

'10.000' to w_items-target_qty,

'1' to w_items-target_qu,

'000010' to w_items-itm_number.



append w_items to t_items.



clear w_items.
Read only

Former Member
0 Likes
2,773

***** PRICING *****

move: 'ZSPS' to w_conds-cond_type,

'34.00' to w_conds-cond_value,

* p_netwr1 to w_conds-conbaseval,

'INR' to w_conds-currency,

*p_unit1 to w_conds-cond_unit,

'1' to w_conds-cond_p_unt,

'C' to w_conds-calctypcon.

*'000010' to w_conds-itm_number,
*
*'011' to w_conds-cond_st_no,
*
*'00' to w_conds-cond_count.

append w_conds to t_conds.

Read only

0 Likes
2,773

Hi,

Don't post the entire code. Check the pricing procedure first (V/08).

Regards

Vinod

Read only

0 Likes
2,773

How can i pass Condition ZSPS in item level ?pl chek my code and tell

Read only

Former Member
0 Likes
2,773

***** SCHEDULE LINES *****

move: '000010' to w_sched-itm_number,

'0001' to w_sched-sched_line,

'20050112' to w_sched-req_date,

'1' to w_sched-date_type,

sy-uzeit to w_sched-req_time,

'10.000' to w_sched-req_qty.

append w_sched to t_sched.




***** PARTNERS *****

move: 'AG' to w_partners-partn_role,

p_sp to w_partners-partn_numb.

append w_partners to t_partners.



move: 'RE' to w_partners-partn_role,

p_sh to w_partners-partn_numb.

append w_partners to t_partners.


***** TEXTS *****

move: '0002' to w_texts-text_id,

'000010' to w_texts-itm_number,

'E' to w_texts-langu,

'EN' to w_texts-langu_iso,

'*' to w_texts-format_col,

'fff' to w_texts-text_line.

append w_texts to t_texts.

*
move: '0002' to w_texts-text_id,

'000010' to w_texts-itm_number,

'E' to w_texts-langu,

'EN' to w_texts-langu_iso,

'*' to w_texts-format_col,

'hh' to w_texts-text_line.

append w_texts to t_texts.
Read only

Former Member
0 Likes
2,773

move: '0002' to w_texts-text_id,

'000010' to w_texts-itm_number,

'E' to w_texts-langu,

'EN' to w_texts-langu_iso,

'*' to w_texts-format_col,

'hhh' to w_texts-text_line.

append w_texts to t_texts.

break developer.

call function 'BAPI_CONTRACT_CREATEFROMDATA'

exporting

CONTRACT_HEADER_IN = w_header

* ORDER_HEADER_INX
* BEHAVE_WHEN_ERROR
* LOGIC_SWITCH
* TESTRUN
convert = 'X'

importing

salesdocument = v_order

tables

return = t_return

CONTRACT_items_in = t_items

* ORDER_ITEMS_INX
CONTRACT_partners = t_partners

CONTRACT_schedules_in = t_sched

* ORDER_SCHEDULES_INX
CONTRACT_conditions_in = t_conds

* ORDER_CONDITIONS_INX
CONTRACT_text = t_texts

* ORDER_KEYS
* EXTENSIONIN
* PARTNERADDRESSES
.
break developer.


if t_return[] is initial.

call function 'BAPI_TRANSACTION_COMMIT'.

write: 'Sales document', v_order, 'has been created'.

else.

loop at t_return into w_return.

case w_return-type.

when 'E'.

message id w_return-id type 'I' number w_return-number

with w_return-message_v1

w_return-message_v2

w_return-message_v3

w_return-message_v4.

v_exit = 'X'.

when 'A'.

message id w_return-id type 'I' number w_return-number

with w_return-message_v1

w_return-message_v2

w_return-message_v3

w_return-message_v4.

v_exit = 'X'.

when 'I'.

message id w_return-id type 'I' number w_return-number

Read only

0 Likes
2,773

with w_return-message_v1

w_return-message_v2

w_return-message_v3

w_return-message_v4.

when 'W'.

message id w_return-id type 'W' number w_return-number

with w_return-message_v1

w_return-message_v2

w_return-message_v3

w_return-message_v4.

when 'S'.

message id w_return-id type 'S' number w_return-number

with w_return-message_v1

w_return-message_v2

w_return-message_v3

w_return-message_v4.

endcase.

endloop.



endif.



if v_exit = 'X'.

exit.

else.

call function 'BAPI_TRANSACTION_COMMIT'.

endif.

but not generate contract no. can u pl tell what is my mistake now pricing procedure already config.

Read only

Former Member
0 Likes
2,773

solve my issue i just pass details into contract_data_in and contract_conditions_in