Application Development 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: 

VA02 ,propose the value for VBAP-bedae and save

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.


13 REPLIES 13

Former Member
0 Kudos

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

0 Kudos

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.

0 Kudos

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.

0 Kudos

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

0 Kudos

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

0 Kudos

Hi ,

Then check with the below user exit s

User exits in the program FV45EFZ1

  • USEREXIT_CHANGE_SALES_ORDER

and

User exits in the program MV45AFZZ

  • USEREXIT_MOVE_FIELD_TO_VBAP

Regrds

Pitabash

bastinvinoth
Contributor
0 Kudos

Hi RUN SAP

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

0 Kudos

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

0 Kudos

Hi RUN SAP

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

0 Kudos

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 .

0 Kudos

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

data:g_proxy_cust_data    TYPE REF TO if_open_trtm_customer_data,

  CALL METHOD g_proxy_cust_data->set_cust_data

  EXPORTING

  pi_tab_fha_appends = pi_tab_fha_appends

Regards

Aradhya.J.M.

Former Member
0 Kudos

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.


Clemenss
Active Contributor
0 Kudos

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