05-16-2013 8:08 AM
Hi experts,
I have a situation, when i goto va02 transaction the field vbap-bedae should show a value based on the requirement, if the user saves the document then it should save the proposed value if user does not save the value revert to the precious value.
I can propose the required value by making the changes in userexit_MOVE_TO_VBAK and modify xvbap[] but if the user doesnt save proposed then it should restore to its old value.
Please let me know how to accomplish this requirement.
05-17-2013 7:58 AM
Hello Bastin and Pitabash,
Thanks for your help in solving this.
Actually when Order is saved , r185d-dataloss field is checked
if r185d-dataloss = 'X' it indicates data is changed and it will avoid the message 'NO DATA WAS CHANGED' .
So while your saving the newly changed value,
add the below code at the value changing place.
IF SY-UCOMM = "SICH'. "SAVED
then make
r185d-dataloss = 'X'
ENDIF.
05-16-2013 10:56 AM
HI,
The field VBAP-BEDAE is refer the field Requirement type . Which determined automatically bases on setting ( like based on Strategic group or Item category and MRP type,)
So once we create with some Requirement type in sales order according to that it will transfer the MRP . and if we change the value in VA02 and save then it ll save else it will be the previous value.
What enhancement you want here. And why it needed.
Can you please describe your requirement briefly.
Regards
Pitabash
05-16-2013 11:09 AM
Pitabash,
My requirement is i need to show the value of VBAP-BEDAE based on some requirement, i did that by making some code changes in USEREXIT_MOVE_VBAK. Now i can see the values populated into VBAP_BEDAE field.
Now if i try to save the new value through va02 which is populated, it says "No data change".
For example Requirement type is automatically KSV, but i will change it to 041 through my code not maually and i will save it. it says No data was changed.
When you goto display mode it shows KSV.
Why VBAP-BEDAE is not saving after replacement.
05-16-2013 11:19 AM
Hi Run SAP,
Are you updating the correct internal table?
YVBAP - Contains the line item data from the Database VBAP
XVBAP - Contains the Current changes on the Line Items
I hope this helps.
05-17-2013 4:03 AM
Hi,
It may happen in "Determination Of Requirement Types Using Transaction" you have not maintain 041 for that combination.
means KSV has been determined on basis of material master strategy group. but 041 will be determines on basis of Item category and MRP type. so the entry does not match . In normal case it does not allow you to save . because it give you error that it is not valid. so where you are changing by user exit it may happen does not allow to save. because the value is not match to the entry of the table.
So first check if you are able to change in sales order to 041, then try in user exit. else change the logic in determination of Requirement type .
Check the below screen shot.
Hope it will help you.
Regards
Pitabash
05-17-2013 4:15 AM
Hello pitabash,
Both KSV and 041 are configured, if I change manually I can save both but not by programming.
is there a chance where VA02 detects only manual changes to save. if so are there any indicators which I have to set other than XVBAP-UPDKZ.
and user exit USEREXIT_SAVE_DOCUMENT or USEREXIT_SAVE_DOCUMENT_PREPARE will not trigger if you save without making any changes manually.
please let me know if there is any thing wrong
05-17-2013 7:46 AM
Hi ,
Then check with the below user exit s
User exits in the program FV45EFZ1
and
User exits in the program MV45AFZZ
Regrds
Pitabash
05-16-2013 11:25 AM
for example if the value is already there in BEDAE field,
now user going to change the value then it has to update while saving right ?
then use XVBAP-UPDKZ( Table for Update Indicators) field in XVBAP internal table.
if any update going to happen means,it will automatically bring 'U' mode .
LOOP AT XVBAP INTO WA_VBAP WHERE UPDKZ EQ 'U'.
wa_vbap-bedae = ******** ( pass your value).
MODIFY xvbap FROM wa_vbap TRANSPORTING BEDAE.
endloop.
user doesnt make changes means it takes the old values only which you have placed already. because in loop we have mentioned update indicator.
correct me if am wrong hope it helps
Regards,
Bastin.G
05-16-2013 11:38 AM
Hi Bastin,
User does not make changes to line item, But through programming i will replace the value of VBAP-BEDAE if the replaced value is correct then user will save without changing anything in VA02 so when saves we will get the message NO data was changed.
I followed as you said also but invain.
So even i have replaced the value programmatically and after saving why it is not saving and it says NO DATA WAS CHANGED
05-16-2013 12:20 PM
so your changing values before user sees data in VA02.
my question is , why cant you change the values while creating sales order itself in VA01.
while saving below two exits will trigger, so add the code there ,
you need to modify in USEREXIT_SAVE_DOCUMENT or USEREXIT_SAVE_DOCUMENT_PREPARE is XVBAP[] internal table.
if anything wrong data means again user make the changes in va02 right ?
there you use XVBAP-UPDKZ( Table for Update Indicators)
make sure you have to mention the code like if sy-tcode eq 'VA02' in particular exit which you have used earlier.
Regards,
Bastin.G
05-16-2013 12:41 PM
Hi Bastin,
Yes, while creating (VA01) i do not have any problem.
Its while using VA02 only.
I update the value internally through program, and when user sees that value , if he agrees to it and he will save. Then this new value should be saved permanently.
Now the problem is since user is not editing manually and value is populating automatically. So if the user saves it, then the VA02 says no data was changed .
05-17-2013 5:52 AM
Hello,
After driving value to the screen from your custom program, push the value to a memory id and compare it when SAVE is triggered if both are same,then force feed your value to changing parameter inside USER EXIT which is triggered when saved.
you refer to below method
CALL METHOD g_proxy_cust_data->set_cust_data
EXPORTING
pi_tab_fha_appends = pi_tab_fha_appends
Regards
Aradhya.J.M.
05-17-2013 7:58 AM
Hello Bastin and Pitabash,
Thanks for your help in solving this.
Actually when Order is saved , r185d-dataloss field is checked
if r185d-dataloss = 'X' it indicates data is changed and it will avoid the message 'NO DATA WAS CHANGED' .
So while your saving the newly changed value,
add the below code at the value changing place.
IF SY-UCOMM = "SICH'. "SAVED
then make
r185d-dataloss = 'X'
ENDIF.
05-17-2013 8:53 AM
Hi,
if the user doesnt save, no changes in the database will be done.
That means: Just propose your desired value a you explained - and nothing else.
This will work without any further maneuvers.
Regards
Clemens