05-07-2013 4:15 PM
Hello,
I am working on a change where I have the below requirement:
I have two fields on my FB70 screen i.e. BSEG-XREF1 and BSEG-XREF2, both these fields are character type. In my situation user will enter the number of units/quantity on XREF1 field and price per unit in XREF2 and then I will need to multiply XREF1 by XREF2 and store in BSEG-WRBTR filed which is a currency field. Now my issue is a user can enter any value on the XREF1 and XREF2 field like charachter value, decimal. How do I validate this because the amount field can only receive the value in this format '__,___,___,__. ' , so can you please help me on how should I validate user's input.
Thanks,
05-07-2013 4:24 PM
Hi Rajat,
'__,___,___,__. ' is external representation.
If you want to allow the user to enter in external representation, you may use FM
RS_CONV_EX_2_IN. Fill parameter TABLE_FIELD with adequate value, i.e. TABNAME = 'VBAP' and FIELDNAME = 'ZMENG' or another useful target field.
It will convert to internal representation and you should supply a field with matching type for OUTPUT_INTERNAL, i.e. lv_int type vbap-zmeng.
The generic FM RS_CONV_EX_2_IN is used by SAP in editable ALV - always useful!
Regards
Clemens
05-07-2013 4:31 PM
thanks for the reply Clemens,
What I want is a user should enter a valid value for both XREF1 and XREF2 and when I multiply these two I should be able to save the amount to the filed BSEG-WRBTR which is a currency filed length 13 and decimal 2.
05-08-2013 9:11 PM
Hi Rajat,
First convert the input values to any variable as explained above.
Then, on a screen you can chain the two input fields and multiply the results. The result should be written to a text field using WRITE ... TO DECIMALS 2. This text field can be converted using the same technique I already explained, us BSEG and WRBTR for TABLE_FIELD parameter.
Raise errors accordingly.
Regards
Clemens
05-08-2013 11:08 PM
Hi,
You can use the FM 'MOVE_CHAR_TO_NUM' to convert to num then do your calculation in an USER EXIT of transaction FB70. The list of exits are as given below
F050S001 FIDCMT, FIDCC1, FIDCC2: Edit user-defined IDoc segment
F050S002 FIDCC1: Change IDoc/do not send
F050S003 FIDCC2: Change IDoc/do not send
F050S004 FIDCMT, FIDCC1, FIDCC2: Change outbound IDoc/do not send
F050S005 FIDCMT, FIDCC1, FIDCC2 Inbound IDoc: Change FI document
F050S006 FI Outgoing IDoc: Reset Clearing in FI Document
F050S007 FIDCCH Outbound: Influence on IDoc for Document Change
F180A001 Balance Sheet Adjustment
FARC0002 Additional Checks for Archiving MM Vendor Master Data
FEDI0001 Function Exits for EDI in FI
RFAVIS01 Customer Exit for Changing Payment Advice Segment Text
RFEPOS00 Line item display: Checking of selection conditions
RFKORIEX Automatic correspondence
SAPLF051 Workflow for FI (pre-capture, release for payment)
Also check the below document to know how you can find an exit
Cheers,
Arindam
05-09-2013 6:22 AM
Hi Rajat,
First find the user exit using the link given by Arindam. In side this write the below logic for validation.
DATA: text(20) TYPE char,
int_value TYPE i.
FIND REGEX '[^[:digit:]]' IN text.
IF sy-subrc = 0.
" text has non-digit character
ELSE.
" Text has only digits
" Here copy text to some integer variable.
int_value = text.
ENDIF.
Regards,
Satish