‎2007 Apr 19 6:35 AM
Hi,
Can anyone please tell me what is the functionality of the FM ' CONVERSION_EXIT_ALPHA_INPUT '.
Regards
Santosh
‎2007 Apr 19 6:36 AM
Hi Santosh,
To remove leading zeros and leading blanks, use FM :
CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal
CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external
For ex :
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wf_version
IMPORTING
output = wf_version.
Example:
input = 123
output = 0000000000000...000000000000123
Hope this resolves your query.
Reward all the helpful answers.
Regards
‎2007 Apr 19 6:39 AM
It is well documented.
Check this:
Conversion exit ALPHA, external->internal
ALPHA conversion is used especially with account numbers. During conversion from the external to the internal format, the system checks to see if input in the INPUT field is purely numeric, that is, if this input consists only of numbers, possibly with spaces before and after them. If this is the case, then the number string is inserted right- justified in the display field OUTPUT and all spaces to the left of the value are filled with zeroes ('0'). If the input is not purely numeric, it is inserted in the display field from left to right and all extra spaces are filled with blanks.
Example:
(Input field and output field are both eight characters in length)
1. '1234 ' --> '00001234'
2. 'ABCD ' --> 'ABCD '
3. ' 1234 ' --> '00001234'
Conversion from the internal to the external format (function module CONVERSION_EXIT_ALPHA_OUTPUT) is undertaken in exactly the opposite manner.
Usage:
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = v_input
importing
output = v_output
exceptions
others = 1.
Kishi.
‎2007 Apr 19 6:39 AM
hi
check this code
Schedule Agreement Data Uploading
*& Report ZMM_ME31L_UPLOAD
*& Developed by : HARI
*& Description : Schedule agreement data uploading
*&----
REPORT ZMMA_ME31L_UPLOAD
NO STANDARD PAGE HEADING
LINE-SIZE 255.
----
Include for Types, WA, Itab, Constants, Global Variable declarations *
----
include ZMMA_ME31L_UPLOAD_TOP.
----
At Selection-screen event
----
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f_get_filename USING p_file.
----
Start-of-Selection event
----
START-OF-SELECTION.
Subroutine to upload the data into Internal table I_Upload.
PERFORM get_data.
i_ctu_params-defsize = 'X'.
i_ctu_params-NOBINPT = ''.
*i_ctu_params-DISMODE = p_mode.
i_ctu_params-UPDMODE = p_upd.
LOOP AT i_upload where lifnr is not initial.
v_index = sy-tabix.
Create Scheduling Agreement: Initial Screen
perform bdc_dynpro using 'SAPMM06E' '0200'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-LGORT'.
perform bdc_field using 'BDC_OKCODE'
'=KOPF'.
perform bdc_field using 'EKKO-LIFNR'
I_Upload-Lifnr.
perform bdc_field using 'RM06E-EVART'
I_Upload-evart.
perform bdc_field using 'RM06E-VEDAT'
i_upload-vedat.
perform bdc_field using 'EKKO-EKORG'
i_upload-ekorg.
perform bdc_field using 'EKKO-EKGRP'
i_upload-ekgrp.
perform bdc_field using 'RM06E-WERKS'
i_upload-werks.
perform bdc_field using 'RM06E-LGORT'
i_upload-lgort.
Create Scheduling Agreement: Header Data
perform bdc_dynpro using 'SAPMM06E' '0201'.
perform bdc_field using 'BDC_CURSOR'
'EKKO-KDATE'.
perform bdc_field using 'BDC_OKCODE'
'=AB'.
perform bdc_field using 'EKKO-KDATB'
i_upload-kdatb.
perform bdc_field using 'EKKO-KDATE'
i_upload-kdate.
cnt1 = 0.
j = 0.
i = 1.
DO.
this loop for item values.
cnt1 = cnt1 + 1.
g_count1 = cnt1.
*
*
filling the item details.
*
Begin of New changes
if j EQ 14.
v_ebelp = i - 1.
perform bdc_dynpro using 'SAPMM06E' '0220'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-EBELP'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
'/00'.
perform bdc_field using 'RM06E-EBELP'
v_ebelp.
j = 1.
cnt1 = 2.
cnt1 = cnt1 + 1.
g_count1 = cnt1.
PERFORM f_fill_item_details.
else.
cnt1 = cnt1 + 1.
g_count1 = cnt1.
PERFORM f_fill_item_details.
endif.
filling the item details.
i = i + 1.
j = j + 1.
Ended New changes
cnt2 = 0.
g_count2 = 0.
do.
this loop for item condition condition values.
cnt2 = cnt2 + 1.
g_count2 = cnt2.
filling the item conditions per each item value.
PERFORM f_fill_item_condns.
v_index = v_index + 1.
read table i_upload index v_index.
if sy-subrc eq 0.
if not i_upload-ematn is initial.
exit.
endif.
else.
exit.
endif.
enddo.
perform bdc_dynpro using 'SAPMV13A' '0201'.
perform bdc_field using 'BDC_CURSOR'
'RV13A-DATAB'.
perform bdc_field using 'BDC_OKCODE'
'=BACK '.
perform bdc_dynpro using 'SAPMM06E' '0211'.
read table i_upload index v_index.
if sy-subrc eq 0.
if not i_upload-lifnr is initial.
exit.
endif.
else.
exit.
endif.
ENDDO.
confirmation for each new vendor save yes/no.
perform bdc_dynpro using 'SAPMM06E' '0220'.
PERFORM f_get_field USING 'RM06E-EVRTP'
g_count1.
perform bdc_field using 'BDC_CURSOR'
g_field.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
'=BU'.
perform bdc_dynpro using 'SAPLSPO1' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
PERFORM bdc_transaction using 'ME31L'.
ENDLOOP.
clear i_upload.
refresh i_upload.
free i_upload.
PERFORM bdc_close_group.
----
End-of-Selection event
----
*
END-OF-SELECTION.
SKIP 2.
write:/ 'Total Number of Transactions : ' color 6, g_tot.
SKIP 1.
write:/ 'Total Number of Success Transactions : ' color 5, g_success.
SKIP 1.
write:/ 'Total Number of Error Transactions : ' color 1, g_error.
SKIP 1.
if g_error <> 0.
format color 3.
write:/ 'Please go to Transaction SM35 to process the errors' hotspot.
endif.
----
At line-Selection event
----
*
AT LINE-SELECTION.
if SY-LISEL = 'Please go to Transaction SM35 to process the errors'.
call transaction 'SM35'.
endif.
*
----
Start new screen *
----
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform.
----
Insert field *
----
form bdc_field using fnam fval.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endform.
----
Start new transaction according to parameters *
----
form bdc_transaction using tcode.
data: l_mstring(480).
data: l_subrc like sy-subrc.
refresh messtab.
CALL TRANSACTION TCODE USING BDCDATA
MODE p_mode
UPDATE p_upd
messages into messtab
OPTIONS FROM i_ctu_params.
counting for success records.
IF sy-SUBRC <> 0.
g_error = g_error + 1.
IF E_GROUP_OPENED = ' '.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = p_sesion
USER = sy-uname
KEEP = 'X'.
E_GROUP_OPENED = 'X'.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = TCODE
TABLES
DYNPROTAB = BDCDATA.
else.
counting for error records
g_success = g_success + 1.
ENDIF.
g_tot = g_tot + 1.
REFRESH BDCDATA.
*
l_subrc = sy-subrc.
write: / 'CALL_TRANSACTION',
tcode,
'returncode:'(i05),
l_subrc,
'RECORD:',
sy-index.
loop at messtab.
select single * from t100 where sprsl = messtab-msgspra
and arbgb = messtab-msgid
and msgnr = messtab-msgnr.
if sy-subrc = 0.
l_mstring = t100-text.
if l_mstring cs '&1'.
replace '&1' with messtab-msgv1 into l_mstring.
replace '&2' with messtab-msgv2 into l_mstring.
replace '&3' with messtab-msgv3 into l_mstring.
replace '&4' with messtab-msgv4 into l_mstring.
else.
replace '&' with messtab-msgv1 into l_mstring.
replace '&' with messtab-msgv2 into l_mstring.
replace '&' with messtab-msgv3 into l_mstring.
replace '&' with messtab-msgv4 into l_mstring.
endif.
condense l_mstring.
write: / messtab-msgtyp, l_mstring(250).
else.
write: / messtab.
endif.
endloop.
skip.
refresh bdcdata.
endform.
&----
*& Form Get_data
write the code to upload the file data in internal table I_UPLOAD.
----
form get_data .
clear i_upload.
refresh i_upload.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = p_file
FILETYPE = 'DAT'
TABLES
data_tab = i_upload
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " Get_data
&----
*& Form f_fill_item_details
----
form f_fill_item_details.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = g_count1
IMPORTING
output = g_count1.
Create Scheduling Agreement: Item overview
perform bdc_dynpro using 'SAPMM06E' '0220'.
PERFORM f_get_field USING 'EKPO-KTMNG'
g_count1.
perform bdc_field using 'BDC_CURSOR'
g_field.
perform bdc_field using 'BDC_OKCODE'
'=DETZ'.
'/00'.
PERFORM f_get_field USING 'RM06E-TCSELFLAG'
g_count1.
perform bdc_field using g_field
'X'.
Begin of changes on DEVK903540 Request by Hari.
PERFORM f_get_field USING 'EKPO-KNTTP'
g_count1.
perform bdc_field using g_field
i_upload-knttp.
End of changes on DEVK903540 Request by Hari.
PERFORM f_get_field USING 'EKPO-EMATN'
g_count1.
perform bdc_field using g_field
i_upload-ematn.
PERFORM f_get_field USING 'EKPO-KTMNG'
g_count1.
perform bdc_field using g_field
i_upload-ktmng.
PERFORM f_get_field USING 'EKPO-NETPR'
g_count1.
perform bdc_field using g_field
' 1'.
Begin of changes on DEVK903540 Request by Hari.
IF i_upload-knttp NE SPACE.
getting GL A/C Details.
perform bdc_dynpro using 'SAPMM06E' '0511'.
perform bdc_field using 'BDC_CURSOR'
'EKKN-SAKTO'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'EKKN-SAKTO'
i_upload-sakto.
getting Cost Center value.
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_CURSOR'
'COBL-KOSTL'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'COBL-KOSTL'
i_upload-kostl.
ENDIF.
Create Scheduling Agreement: Item detials
perform bdc_dynpro using 'SAPMM06E' '0220'.
PERFORM f_get_field USING 'RM06E-EVRTP'
g_count1.
perform bdc_field using 'BDC_CURSOR'
g_field.
perform bdc_field using 'BDC_OKCODE'
'=DETA'.
perform bdc_field using 'RM06E-EBELP'
'1'.
PERFORM f_get_field USING 'RM06E-TCSELFLAG'
g_count1.
perform bdc_field using g_field
'X'.
perform bdc_dynpro using 'SAPMM06E' '0211'.
perform bdc_field using 'BDC_CURSOR'
'EKPO-MWSKZ'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EKPO-BSTAE'
i_upload-bstae.
perform bdc_field using 'EKPO-MWSKZ'
i_upload-mwskz.
End of changes on DEVK903540 Request by Hari.
Create Scheduling Agreement: Item overview
*
perform bdc_dynpro using 'SAPMM06E' '0220'.
PERFORM f_get_field USING 'RM06E-EVRTP'
g_count1.
perform bdc_field using 'BDC_CURSOR'
g_field.
perform bdc_field using 'BDC_OKCODE'
'=DETZ'.
perform bdc_field using 'RM06E-EBELP'
'1'.
PERFORM f_get_field USING 'RM06E-TCSELFLAG'
g_count1.
perform bdc_field using g_field
'X'.
Create Scheduling Agreement: Additional data
perform bdc_dynpro using 'SAPMM06E' '0212'.
perform bdc_field using 'BDC_CURSOR'
'EKPO-ETFZ2'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EKPO-ETFZ1'
i_upload-etfz1.
perform bdc_field using 'EKPO-ETFZ2'
i_upload-etfz2.
Begin of Add DEVK903540 Request by Hari.
perform bdc_field using 'EKPO-KZSTU'
i_upload-kzstu.
End of Add on DEVK903540 Request by Hari.
Create Scheduling Agreement: Item overview
perform bdc_dynpro using 'SAPMM06E' '0220'.
PERFORM f_get_field USING 'RM06E-EVRTP'
g_count1.
perform bdc_field using 'BDC_CURSOR'
g_field.
perform bdc_field using 'BDC_OKCODE'
'=KO'.
perform bdc_field using 'RM06E-EBELP'
'1'.
PERFORM f_get_field USING 'RM06E-TCSELFLAG'
g_count1.
perform bdc_field using g_field
'X'.
perform bdc_dynpro using 'SAPMV13A' '0201'.
PERFORM f_get_field USING 'KONP-KBETR'
g_count1.
perform bdc_field using 'BDC_CURSOR'
g_field.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RV13A-DATAB'
i_upload-datab.
perform bdc_field using 'RV13A-DATBI'
i_upload-datbi.
endform. " f_fill_operation
&----
*& Form f_get_field
----
form f_get_field using p_name p_count1 .
CLEAR: g_field.
CONCATENATE p_name '(' p_count1 ')' INTO g_field.
endform. " f_get_field
&----
*& Form f_fill_item_condns
----
form f_fill_item_condns .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = g_count2
IMPORTING
output = g_count2.
PERFORM f_get_field2 USING 'KONP-KSCHL'
g_count2.
perform bdc_field using g_field2
i_upload-kschl.
PERFORM f_get_field2 USING 'KONP-KBETR'
g_count2.
perform bdc_field using g_field2
i_upload-kbetr.
Begin of changes on DEVK903540 Request by Hari.
PERFORM f_get_field2 USING 'KONP-KPEIN'
g_count2.
perform bdc_field using g_field2
i_upload-kpein.
End of changes on DEVK903540 Request by Hari.
endform. " f_fill_item_condns
&----
*& Form f_get_field2
----
form f_get_field2 using p_name2 p_count2.
clear: g_field2.
CONCATENATE p_name2 '(' p_count2 ')' INTO g_field2.
endform. " f_get_field2
&----
*& Form f_get_filename
----
form f_get_filename using p_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = ' '
mask = ',.,..'
mode = 'O'
title = ' '
IMPORTING
filename = p_file
RC =
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5 .
endform. " f_get_filename
&----
*& Form bdc_close_group
----
form bdc_close_group .
close batchinput group
IF E_GROUP_OPENED = 'X'.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDIF.
endform. " bdc_close_group
praveen
‎2007 Apr 19 6:41 AM
Hi,
CONVERSION_EXIT_ALPHA_INPUT ..
This function module converts , say for example MATNR , converts MATNR value to internal format value,
If the external value is a number,then the number string is inserted right- justified in the display field OUTPUT and all spaces to the left of the value are filled with zeroes ('0').
If the input is not purely numeric, it is inserted in the display field from left to right and all extra spaces are filled with blanks.
Example:
(Input field and output field are both eight characters in length)
1. '1234 ' --> '00001234'
2. 'ABCD ' --> 'ABCD '
3. ' 1234 ' --> '00001234'
reward if useful,
regards,
nazeer
‎2007 Apr 19 6:42 AM
hi,
It is used to convert external account numbers to internal format depending on the number. if the number is purely numeric zeros are added to the remaining spaces on the left side of the number. If the number contains characters spaces are remained as it is.
Example:
(Input field and output field
1. '1234 ' > '00001234'
2. 'ABCD ' > 'ABCD '
3. ' 1234 ' > '00001234'
‎2007 Apr 19 6:43 AM
Hi,
This CONVERSION_EXIT_ALPHA_INPUT ' FM is used for adding 0's in ur variables.
Regards
Santosh.
‎2007 Apr 19 6:44 AM
CONVERSION_EXIT_ALPHA_INPUT This function module is used to append leading zeroes...
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = 123
IMPORTING
OUTPUT =
‎2007 Apr 19 6:46 AM
hi,
CONVERSION_EXIT_ALPHA_INPUT
CONVERSION_EXIT_ALPHA_OUTPUT
These function modules convert the value of an external represntation of a field into an internal format or vice versa.(Meaning for some fields like MATNR, then value which you see is not the way it is stored in the database. The value that you see is the external format, and the value which is stored inside the database id the internal format. These function modules convert the values of such fields from internal to external and vice versa.
for example
The customer number is stored '0001005000' in the database.
...
DATA: WA_KUNAG LIKE KNA1-KUNNR.
WA_KUNAG = '1005000'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = WA_KUNAG
IMPORTING
OUTPUT = WA_KUNAG.
E1BPPARNR-PARTN_NUMB = WA_KUNAG.
E1BPPARNR-PARTN_ROLE = 'AG'.
E1BPPARNR-ITM_NUMBER = '000000'.
‎2007 Apr 19 6:49 AM