06-23-2010 6:35 AM
Hi All,
I have included some code in USEREXIT_SAVE_DOCUMENT_PREPARE .
LOOP AT XVBAP.
clear v_vkorg.
select single vkorg from vbak
into v_vkorg
where vbeln = xvbap-vbeln.
IF sy-subrc = 0.
IF ( xvbap-matnr CS '_ET' and xvbap-spart = 'P1' )
OR
( xvbap-matnr CS '_ET' and xvbap-spart = 'M1' and v_vkorg = 'GB01' ).
xvbap-kztlf = 'A'.
MODIFY xvbap.
ENDIF.
ENDIF.
ENDLOOP.
The table xvbap is properly modified.
but the problem is, the kztlf(partial delivery field) in "VA02" is not populated with 'A'.
I debug the code, from xvbap, the db table vbap is properly updated with the value.
Strange thing is, in one of the enhancement points, the entire tables have been getting refreshed(enhancement point is of standard)
If this is the case, then what is the use of USER-EXIT.
Pls help me how to resolve the above issue.
Thank you,
Priya
06-23-2010 6:47 AM
Hi ,
Very first thing is , if that standard enhancement points is getting called after your user exit then , the exit you are using will not work for you. Find any other exit which would get called after that enhancement points execution.
See if enhancement points is really a standard one and really needed otherwise you can modufy it and make it deactivated. Then your user exit will work as that table will hold all of its value and will show that fields with A populated.
Whatever is happening currently is absolutely correct.,
The corresponding table gets populated as because table updates are happening after your exit but before enhancement point execution and when you finally have look to transaction , it does not show 'A' as because the table (XVBAP) from which this value will be provided to SAP transaction is getting refreshed by enhancement point.
I hope you understood it.
Regards,
Uma Dave
06-23-2010 6:53 AM
Hi Priya,
Replace Your code with the below code. The below code will take care of the every circumstance (VA01 / VA02 / VA03). Also, it is not required to select the sales organization from VBAK for the sales order (as it is already there in program structure field VBAK-VKORG).
if sy-tcode eq 'VA01' or sy-tcode eq 'VA02'.
if not xvbap[] is initial.
LOOP AT XVBAP.
IF ( xvbap-matnr CS '_ET' and xvbap-spart = 'P1' )
OR
( xvbap-matnr CS '_ET' and xvbap-spart = 'M1' and vbak-vkorg = 'GB01' ).
xvbap-kztlf = 'A'.
MODIFY xvbap.
vbap-kztlf = 'A'.
ENDIF.
ENDLOOP.
else.
IF ( vbap-matnr CS '_ET' and vbap-spart = 'P1' )
OR
( vbap-matnr CS '_ET' and vbap-spart = 'M1' and vbak-vkorg = 'GB01' ).
vbap-kztlf = 'A'.
ENDIF.
endif.
endif.
Regards,
Birendra
06-23-2010 7:13 AM
Hi Birender/Umadave,
Thanks for your replies.
@umadave, have understood what u told. Pls provide the solution to resolve the issue.
I want to update the field, "kztlf " with 'A' for the above mentioned condition.
Pls let me know is there any user exit to do so.
@Birender, the code which u have given looks almost same as i have done. Implemented urs but issue remains same.
Anyone pls help me with ur valuable inputs.
Regards,
Priya
06-23-2010 7:21 AM
Hi ,
Can you please try editing that enhancement point (I feel that it would not be a standard Enhancement point) , I hope youi know the process.
Click on the white colored circle provided at upper left hand side of editor and right click on that enhancement and edit. I thing you can edit and deactivate it.
Meanwhile I am looking for the Exit. Will let you know once I get.
Regards,
Uma Dave
06-23-2010 7:27 AM
Hi Priya,
I have used the same code and this works. There must be some other point where the value changes, You need to debug this and find out...
Regards,
Birendra
06-23-2010 7:34 AM
Hi,
In the following enhancement point, the value is getting refreshed.
enhancement-section beleg_sichern_23 spots es_sapmv45a.
if not ( call_activity eq gc_activity_lord and
gf_no_commit eq charx ).
if call_function = charx.
g_no_itob_buf_cleanup = charx.
perform beleg_initialisieren.
clear g_no_itob_buf_cleanup.
else.
perform beleg_initialisieren.
endif.
endif.
end-enhancement-section.
Once the control runs the perform: perform beleg_initialisieren, the values of vbap are getting refreshed.
another strange thing is xvbap-kztlf still holds the value 'A'.
Pls suggest.
Regards,
Priya
06-23-2010 7:42 AM
Hi
1 . another strange thing is xvbap-kztlf still holds the value 'A' : This is not some thing strange as explained by me in first post. Again , its just clearing VBAP not the XVBAP. so your value is in place.
2. If you are not able to edit and inactivate that Enhancement section , then you must need to Find some exit on SAVE event , because e at the time of saving you can easily override the actual value with A and no refresh related enhancements will appear on SAVE event path execution.
Regards,
Uma Dave
06-23-2010 7:43 AM
06-23-2010 12:49 PM
Hi Priya,
I had an idea, You were writing this in 'USEREXIT_SAVE_DOCUMENT'. Apologies, I did not read the subject carefully.
I wrote the code in 'USEREXIT_SAVE_DOCUMENT'. Copy and paste the code given by me earlier here, it will work...
Regards,
Birendra
06-23-2010 2:28 PM
Don't modify standard fields in USEREXIT_SAVE_DOCUMENT and don't use SY-TCODE if you intend the changes to work when a BAPI is called. Use the T180 fields instead. Why not use USEREXIT_MOVE_FIELD_TO_VBAP at the time the material is added to the document?
06-23-2010 2:37 PM
are you sure it's XVBAP at this point in the code? I think SAP has reverted to internal table VBAP at this point, but I can't check...my client doesn't run SAP logistics modules.... If it's still using XVBAP, set the UPDKZ field correctly for Insert, Update or Delete.
There's no need for enhancement points, badis, etc. This include is always active and intended to contain user code...it's the original user-exit method utilized by SAP. Insert your code (you may need activation key if this is first time the include has been changed).