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

Add Condition Record - Function Module

Former Member
0 Likes
1,379

Hi,

I have been asked to add condition record based on Sales Org / Material and would like to know if there is a function module available for this instead of coding BDC for the transaction VK11.

Thanks in advance for your help.

Regards

Bala

1 ACCEPTED SOLUTION
Read only

Vinod_Chandran
Active Contributor
0 Likes
1,317

Use BAPI_PRICES_CONDITIONS

10 REPLIES 10
Read only

Vinod_Chandran
Active Contributor
0 Likes
1,318

Use BAPI_PRICES_CONDITIONS

Read only

Former Member
0 Likes
1,317

Hi Vinod,

Thanks for your help.

can u tell me in which version BAPI_PRICES_CONDITIONS will work?

because here i am using 4.7 version, in this i am unable to find the FM.

points will be rewarded soon.

once again thanks in advance.

regards

KBS REDDY

Read only

0 Likes
1,317

Yes. It is in 4.7 as well as 5.0

Please check it again in SE37

Read only

0 Likes
1,317

Hi,

now i found the FM in 4.7.

i got this link. but i am unable to update the value in condition table.

if any one have the sample program to update the condition record please send it.

advanced thanks to all.

regards

kbs reddy

Read only

0 Likes
1,317

Hi Vinod,

Thanks for your info. now it is working fine.

i am giving full points to you.

here i am sending the code which i used to update.

i hope it will be useful for future for all.

wtable1-cond_usage = 'A'.

wtable1-table_no = '306'.

wtable1-applicatio = 'V'.

wtable1-cond_type = 'ZPR0'.

wtable1-operation = '009'.

wtable1-varkey = '13001001USD 000000000050068946'.

wtable1-valid_to = '99991231'.

wtable1-valid_from = '20051101'.

wtable1-cond_no = '$000000001'.

APPEND wtable1 TO table1.

wtable2-operation = '009'.

wtable2-cond_no = '$000000001'.

wtable2-created_by = sy-uname.

wtable2-creat_date = '20051022'.

wtable2-cond_usage = 'A'.

wtable2-table_no = '110'.

wtable2-applicatio = 'V'.

wtable2-cond_type = 'ZPR0'.

wtable2-varkey = '13001001USD 000000000050068946'.

wtable2-valid_from = '20051101'.

wtable2-valid_to = '99991231'.

APPEND wtable2 TO table2.

wtable3-operation = '009'.

wtable3-cond_no = '$000000001'.

wtable3-cond_count = '01'.

wtable3-applicatio = 'V'.

wtable3-cond_type = 'ZPR0'.

wtable3-scaletype = 'A'.

wtable3-scalebasin = 'C'.

wtable3-scale_qty = '1'.

wtable3-cond_p_unt = '1'.

wtable3-cond_unit = 'EA'.

wtable3-calctypcon = 'C'.

wtable3-cond_value = '454'.

wtable3-condcurr = 'USD'.

APPEND wtable3 TO table3.

CALL FUNCTION 'BAPI_PRICES_CONDITIONS'

  • EXPORTING

  • PI_initialmode = 'X'

  • PI_BLOCKNUMBER =

TABLES

ti_bapicondct = table1

ti_bapicondhd = table2

ti_bapicondit = table3

ti_bapicondqs = table4

ti_bapicondvs = table5

to_bapiret2 = table6

to_bapiknumhs = table7

to_mem_initial = table8

EXCEPTIONS

update_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

READ TABLE table6 WITH KEY type = 'E' TRANSPORTING NO FIELDS.

IF sy-subrc = 0.

loop at table6 into ret.

write: / ret-type, ret-message, ret-id, RET-LOG_NO, RET-LOG_MSG_NO,

RET-MESSAGE_V1, RET-MESSAGE_V2, RET-MESSAGE_V3, RET-MESSAGE_V4,

RET-PARAMETER,RET-ROW,RET-FIELD.

endloop.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

*EXPORTING

  • WAIT =

IMPORTING

return = ret

.

ENDIF.

Read only

0 Likes
1,317

Hi there,

Can this be used to effectively delete the conditions record?

Lucy

Read only

0 Likes
1,317

hi lucy,

i have used this to add only. it was worked fine.

Read only

0 Likes
1,317

You only included 3 of the tables used. Do you have a record of the others?

I noticed the condition number with $. This is a temporary number which causes the system to go into create mode ( I think ). Perhaps the way forward is to change the validity date.

Lucy

Read only

0 Likes
1,317

Where did you find this bapi? I also have v4.7, but I can't find this Fm using SE37. Do you know what module this BAPI belongs to?

Read only

0 Likes
1,317

Hi Levin,

even i have faced same problem. in my place i have 2 servers one is my company and another one is client. in client m/c i found that. but in my company server i didn't find it. both are 4.7 only. for this my manager told might be some patches are not added in our server. so, if you have any other server you can find it in v4.7

regards,

balu