‎2012 Feb 13 8:39 AM
Dear Freinds,
I am changing customer contract by using BAPI_CUSTOMERCONTRACT_CHANGE.
Here i have change the Bill blocked status(02 -> space) has to changed to 'SPACE'
of material item of given date range (starting and ending date).
I am getting the data of billing block status '02' on given contract start date and end date.
but at last i am getting messages....
ORDER_HEADER_IN has been processed succefully.
ITEM_IN has been processed successfully
The sales document is not yet complete: Edit data.
Monthly Billing 40000003 has been saved
Can anyone kindly help me please.
Edited by: anurag.radha on Feb 13, 2012 9:40 AM
‎2012 Feb 13 9:04 AM
Hello,
"The sales document is not yet complete: Edit data." - reason would be there is some data required / entered in past in billing contract...
To know the details, please repeat the same activity manually in transaction VA42, and go to Edit -> Incompletion Log
Thanks
Krish
‎2012 Feb 13 9:14 AM
Dear Krish,
Thanks for YOUr reply.
Shold i need to pass billing plan number... i didn't find this field in any structure.
I think i should pass that number.
This is my code...
loop at it_final into wa_final.
bapisdh1-SALES_ORG = wa_final-vkorg.
bapisdh1-DISTR_CHAN = wa_final-vtweg.
bapisdh1x-updateflag = 'U'.
clear wa_item.
wa_item-itm_number = wa_final-posnr.
wa_item-material = wa_final-matnr.
wa_item-bill_block = ' '.
append wa_item to it_item.
clear wa_itemx.
wa_itemx-itm_number = wa_final-posnr.
wa_itemx-updateflag = 'U'.
* wa_itemx-material = 'X'.
wa_item-bill_block = ' '.
append wa_itemx to it_itemx.
clear wa_cntr.
wa_cntr-itm_number = wa_final-posnr.
wa_cntr-con_st_dat = wa_final-fkdat.
wa_cntr-con_en_dat = wa_final-nfdat.
append wa_cntr to it_cntr.
clear wa_cntrx.
* wa_cntrx-itm_number = 'X'.
wa_cntrx-updateflag = 'U'.
* wa_cntrx-con_st_dat = 'X'.
* wa_cntrx-con_en_dat = 'X'.
append wa_cntrx to it_cntrx.
refresh it_return.
call function 'BAPI_CUSTOMERCONTRACT_CHANGE'
exporting
salesdocument = wa_final-vbeln
contract_header_in = bapisdh1
contract_header_inx = bapisdh1x
* SIMULATION =
* BEHAVE_WHEN_ERROR = ' '
* INT_NUMBER_ASSIGNMENT = ' '
* LOGIC_SWITCH =
* NO_STATUS_BUF_INIT = ' '
tables
return = it_return
contract_item_in = it_item
contract_item_inx = it_itemx
* PARTNERS =
* PARTNERCHANGES =
* PARTNERADDRESSES =
* CONDITIONS_IN =
* CONDITIONS_INX =
* CONTRACT_CFGS_REF =
* CONTRACT_CFGS_INST =
* CONTRACT_CFGS_PART_OF =
* CONTRACT_CFGS_VALUE =
* CONTRACT_CFGS_BLOB =
* CONTRACT_CFGS_VK =
* CONTRACT_CFGS_REFINST =
* CONTRACT_TEXT =
contract_data_in = it_cntr
contract_data_inx = it_cntrx
* CONTRACT_KEYS =
* EXTENSIONIN =
.
LOOP AT IT_RETURN INTO WA_RETURN.
IF WA_RETURN-TYPE ne 'E'.
append wa_return-message to it_error.
* perform process_err_record.
ELSE.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
importing
return = wa_return1.
ENDIF.
ENDLOOP.
endloop.
Can you please help me.
Edited by: anurag.radha on Feb 13, 2012 10:36 AM
‎2012 Feb 13 9:50 AM
Hi,
Now i am not getting any error but those values are not updated.
i.e. the status is not changed from 02 to ' '.
kiNDLY help me
‎2012 Feb 13 10:14 AM
Hello Dear,
First of all BAPI_TRANSACTION_COMMIT is not require inside loop.
check out your code, because of small mistake it is not getting updated.
clear wa_itemx.
wa_itemx-itm_number = wa_final-posnr.
wa_itemx-updateflag = 'U'.
* wa_itemx-material = 'X'.
wa_item-bill_block = ' '. " it should be X instead of space
append wa_itemx to it_itemx.check below which should solve your probelm.
clear wa_itemx.
wa_itemx-itm_number = wa_final-posnr.
wa_itemx-updateflag = 'U'.
* wa_itemx-material = 'X'.
wa_item-bill_block = 'X'.
append wa_itemx to it_itemx.
‎2012 Feb 13 10:26 AM
Dear Shankar,
I made the change what you suggested.
Actually that value only i have to chage from 02(blcok) to space(Unblock).
But still the values are not updated and not getting any error message also.
Edited by: anurag.radha on Feb 13, 2012 11:27 AM
‎2012 Feb 13 10:46 AM
Dear Anurag,
I agree that you want to update the value from 02 to space, but you are correlating at wrong place.
clear wa_item.
wa_item-itm_number = wa_final-posnr.
wa_item-material = wa_final-matnr.
wa_item-bill_block = ' '. here you pass Space (here you are passing a new value )
append wa_item to it_item.
clear wa_itemx.
wa_itemx-itm_number = wa_final-posnr.
wa_itemx-updateflag = 'U'.
* wa_itemx-material = 'X'.
wa_item-bill_block = ' '. here you pass X (means you are Indicating BAPI to update only this fields)
append wa_itemx to it_itemx.
You need to pass wa_item-bill_block = 'X'. it will update your bill block from 02 to space.
‎2012 Feb 13 11:08 AM
Dear Shankar,
I chaged that field value to 'x'.
still those modifications are not feflected in va43 for that records.
But in the debugging mode i am getting the message 'Monthely billing <Document No> has been saved.
Is the problem at commit work.
Actually i have to chage status form 02 to space of records like 01.03.2012(str date) & 31.03.2012(end date).
Still the status in table is '02' only.
why thes billing plan values are not updated... some where i read that for billing plan values we have to use
some fm.. and those are not update directly form this bapi.. is it true. if so what is purpose of this bapi.
Can any one kindly explain and clear my doubt and make me to get solution.
Thanks in Advance.
Edited by: anurag.radha on Feb 13, 2012 12:11 PM
‎2012 Feb 13 12:04 PM
Dear Anurag,
As per your requirement I checked the BAPI with the data and it is updating Billing Block as line item wise in Billing document tab in VA43, and updated successfully contract start date and contract end date in contract data tab of same line item, so it is working fine.
Have you checked BAPI using BAPI sequence :
Create a Sequence using
1 : BAPI_CUSTOMERCONTRACT_CHANGE
2. BAPI_TRANSACTION_COMMIT
pass dummy entry in BAPI in fields you want to update, and than execute :
if everything will be fine you will get message
ORDER_HEADER_IN has been processed successfully
ITEM_IN has been processed successfully
SP Contract 40000206 (Contract No.) has been savedlet us see in this way are you able to update or not.
‎2012 Feb 13 12:47 PM
Dear Shankar,
i am getting the messages..
ORDER_HEADER_IN has been processed successfully
ITEM_IN has been processed successfully
Monthly Billing 40000003 has been saved
ORDER_HEADER_IN has been processed successfully
ITEM_IN has been processed successfully
ITEM_IN has been processed successfull
Monthly Billing 40000003 has been saved
ORDER_HEADER_IN has been processed successfully
ITEM_IN has been processed successfully
ITEM_IN has been processed successfully
ITEM_IN has been processed successfully
Monthly Billing 40000005 has been saved
in the above item_in not executed one for each doucment it is getting increased by one by the previous time.
i have also tried for one record by hard coding the values.
It is giving some the above message only.
But the chages are not reflected while seeing in va43 for that record.
I am changing only status not dates.
call function 'BAPI_CUSTOMERCONTRACT_CHANGE'
exporting
salesdocument = '0040000003' "wa_final-vbeln
contract_header_in = bapisdh1
contract_header_inx = bapisdh1x
tables
return = it_return
contract_item_in = it_item
contract_item_inx = it_itemx
contract_data_in = it_cntr
contract_data_inx = it_cntrx .
LOOP AT IT_RETURN INTO WA_RETURN.
IF WA_RETURN-TYPE eq 'E'.
append wa_return-message to it_error.
ELSE.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
importing
return = wa_return1.
* append wa_return1 to it_return1.
ENDIF.
ENDLOOP.
Kindly chek the above, if i have done any mistakes while commit work.
Edited by: anurag.radha on Feb 14, 2012 9:44 AM
‎2012 Feb 14 8:53 AM
First of all please make sure the following things.You are not clearing the internal table after each call of BAPI.
After each call of BAPI refresh it_return it_item it_itemx internal tables. Move the IT_RETURN data to another table IT_RETURN_TEMP. Secondly you dont need to call commit in loop.Just call only one commit.
Once document is created go to the document and check what do you see in error log.
‎2012 Feb 14 9:38 AM
Dear nabheeth,
I have done the changes what you suggested.
i am getting the following messages for three records.
ORDER_HEADER_IN has been processed successfully
ITEM_IN has been processed successfully
Monthly Billing 40000003 has been saved
ORDER_HEADER_IN has been processed successfully
ITEM_IN has been processed successfully
Monthly Billing 40000003 has been saved
ORDER_HEADER_IN has been processed successfully
ITEM_IN has been processed successfully
Monthly Billing 40000005 has been saved
after the endloop of Bapi. i have written the follwing code.
loop at it_return_temp into wa_return.
if wa_return-type eq 'E'.
append wa_return to it_error.
else.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
importing
return = wa_return1.
append wa_return to it_success.
endif.
endloop.
In the bapi transaction commit it is calling the fm..
CALL FUNCTION 'BUFFER_REFRESH_ALL'.
In side this it is calling some delete function.
what mistake i have done..
can you please help me.. i am very greatful to you.
‎2012 Feb 14 10:38 AM
Can you please tell what do you see in VA42, and go to Edit -> Incompletion Log ? As we are getting message like sales document not comlpete. Please go to above place for the document and let us know why it is incomplete.
Thanks
Nabheet
‎2012 Feb 14 11:34 AM
Dear Nabheet,
I checked that also...
in va42
But for those incomplete items it is througin an error like
ORDER_HEADER_IN has been processed successfully
ITEM_IN has been processed successfully
The sales document is not yet complete: Edit data "Here i am getting incomplete error log
Monthly Billing 40000004 has been saved
for completed data i am getting...
ORDER_HEADER_IN has been processed successfully
ITEM_IN has been processed successfully
Monthly Billing 40000004 has been saved
I think the problem at bapi_commit.
suppose if other incomplete baseline item which is not going to chage is there in that contract
it will effect the complete base line item which i am going to chage the status....
I think the above is not because when i do it manually 'i am getting an information there are unbilled dates in the past'.
but those chages are saved.
Can you please help me.
‎2012 Feb 14 12:03 PM
Hi ,
I think it will be good if you can get in touch with the functionalguys with both cases and ask them the reason.
Nabheet
‎2012 Feb 16 6:21 AM
I checked with fun consultant and make that contract completed.
i am noticing that i have to chage the billing plan item block status.
There are two billing blocks one is for material line item
another is for line items of that material item.
flow va43 -> select mat lineitem -> click on billing plan (below) ->then
the resultent screen displays the line items of that material item
Here i want to chage the billing block status.
what i have to chage the filed & the filed i am changing (bill_block) are same?
can anyone help me please.
loop at it_final into wa_final.
* bapisdh1-SALES_ORG = wa_final-vkorg.
* bapisdh1-DISTR_CHAN = wa_final-vtweg.
bapisdh1x-updateflag = 'U'.
refresh : it_return, it_item, it_itemx, it_cntr, it_cntrx.
loop at it_final1 into wa_final1 where vbeln = wa_final-vbeln
and kunnr = wa_final-kunnr.
clear wa_item.
wa_item-itm_number = wa_final-posnr. "'000010'.
wa_item-material = wa_final-matnr. "'AL1-001'.
wa_item-bill_block = ' '.
append wa_item to it_item.
clear wa_itemx.
wa_itemx-itm_number = wa_final-posnr. "'000010'.
wa_itemx-updateflag = 'U'.
* wa_itemx-material = 'X'.
wa_item-bill_block = 'X'.
append wa_itemx to it_itemx.
* clear wa_cntr.
wa_cntr-itm_number = wa_final-posnr.
* wa_cntr-con_st_dat = wa_final-fkdat. "'20100201'.
* wa_cntr-con_en_dat = wa_final-nfdat. "'20120229'.
append wa_cntr to it_cntr.
clear wa_cntrx.
wa_cntrx-itm_number = wa_final-posnr.
wa_cntrx-updateflag = 'U'.
* wa_cntrx-con_st_dat = 'X'.
* wa_cntrx-con_en_dat = 'X'.
append wa_cntrx to it_cntrx.
clear :wa_item, wa_itemx, wa_cntr, wa_cntrx, wa_final1.
endloop.
call function 'BAPI_CUSTOMERCONTRACT_CHANGE'
exporting
salesdocument = wa_final-vbeln "'0040000003'
contract_header_in = bapisdh1
contract_header_inx = bapisdh1x
* SIMULATION =
* BEHAVE_WHEN_ERROR = ' '
* INT_NUMBER_ASSIGNMENT = ' '
* LOGIC_SWITCH =
* NO_STATUS_BUF_INIT = ' '
tables
return = it_return
contract_item_in = it_item
contract_item_inx = it_itemx
* PARTNERS =
* PARTNERCHANGES =
* PARTNERADDRESSES =
* CONDITIONS_IN =
* CONDITIONS_INX =
* CONTRACT_CFGS_REF =
* CONTRACT_CFGS_INST =
* CONTRACT_CFGS_PART_OF =
* CONTRACT_CFGS_VALUE =
* CONTRACT_CFGS_BLOB =
* CONTRACT_CFGS_VK =
* CONTRACT_CFGS_REFINST =
* CONTRACT_TEXT =
contract_data_in = it_cntr
contract_data_inx = it_cntrx
* CONTRACT_KEYS =
* EXTENSIONIN =
.
append lines of it_return to it_return_temp.
refresh it_return.
endloop.
clear : wa_return, wa_return1.
loop at it_return_temp into wa_return.
if wa_return-type eq 'E'.
append wa_return to it_error.
else.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
importing
return = wa_return1.
append wa_return to it_success.
endif.
endloop.
Edited by: anurag.radha on Feb 16, 2012 7:27 AM
‎2012 Feb 23 12:09 PM
No bapi for changing billing plan as line item wise.
i have done using fm's which start with
sd_sales... and my issue is resolved.
i got the solution from sdn only..
Thnak you so much to all.