‎2007 Feb 15 4:51 AM
Hi all,
iam having small doubt regarding writing if condition for adding leading zero in a string.my requirement was iam having a purchase org. field in the selection screen. so if user clicks on its F4 help it is taking the existing value in it which contains 0 123456 of 8 characters length. but if user enters pur.org manually it has to add zero by default to that value.
plz help me .
Regards,
Kumar.
‎2007 Feb 15 4:54 AM
Hi,
Assign the field to character type variable.
Unpack the variable and then assign it ot the field.
Eg.
variable = field.
unpack variable to variable.
field = variable.
‎2007 Feb 15 4:54 AM
Hi,
Even if the user is using F4 or manually enters..
you can fill with leading zeroes..
DATA: V_CHAR(8) VALUE '1234567'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = V_INPUT
IMPORTING
OUTPUT = V_INPUT.
WRITE: / V_INPUT.
Thanks,
Naren
‎2007 Feb 15 4:54 AM
Hi
Before using that value entered by use. Call FM
CONVERSION_EXIT_ALPHA_INPUT
for your purpose.
Regards,
kumar
‎2007 Feb 15 4:54 AM
‎2007 Feb 15 4:55 AM
hi Kumar,
do this way
go to se11 -> give the table name -> double click on the data element -> double click on the domain -> in Output Characteristics tab double click on conversion Routine-> you will find a FM use it before the select statement ..
regards,
santosh
‎2007 Feb 15 4:59 AM
Kumar ,
AT SELECTION OUTPUT.
p_org
use FM CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = p_org
IMPORTING
OUTPUT = o_org
EXCEPTIONS
OTHERS = 1.
(OR).
You know that it is having 8 chars.
data : v_len type i,
v_diff type i.
v_len = strlen (p_org).
v_diff = 8 - v_len.
if v_diff ne 0.
do v_diff times.
concatenate '0' p_org into p_org.
enddo.
endif.
Pls. mark if useful
‎2007 Feb 15 5:21 AM
and murali plz have a look at my code and solve this.
fill range table sel_proc_org for purchase organisation
IF is_criteria-purchase_org IS NOT INITIAL.
lt_search_proc_org-sign = 'I'. " inlcuding
find /sapsrm/if_pdo_aoms_c=>gc_org_type in is_criteria-purchase_org.
if sy-subrc = 0.
MOVE IS_CRITERIA-PURCHASE_ORG to LT_SEARCH_PROC_ORG-LOW.
else.
if is_criteria-purchase_org .(need code here).................................
CONCATENATE
/sapsrm/if_pdo_aoms_c=>gc_org_type " O like Type Organisation
is_criteria-purchase_org " Org.ID
INTO lt_search_proc_org-low
SEPARATED BY space.
endif.
endif.
FIND /sapsrm/if_pdo_aoms_c=>gc_asterix IN lt_search_proc_org-low.
IF sy-subrc = 0.
lt_search_proc_org-option = 'CP'. " generic search
ELSE.
lt_search_proc_org-option = 'EQ'. " only single value
ENDIF.
APPEND lt_search_proc_org TO et_search_proc_org.
ENDIF.
‎2007 Feb 15 5:10 AM
Hi Kumar,
use FM <b>CONVERSION_EXIT_ALPHA_INPUT</b>
reward if useful.