2013 Aug 07 12:50 PM
H iAll,
I'm getting dump as shown below in using Pack statement ....it is much appreciated if someone can help...
my code is something like
Code
v_dxvbak-vkorg = '0A10'.
SELECT SINGLE vbund
INTO v_pcoes_vbund
FROM kna1
WHERE kunnr = '00000313' .
PACK v_dxvbak-vkorg TO v_pcoes_vkorg.
DUMP
Category ABAP Programming Error
Runtime Errors CONVT_NO_NUMBER
Except. CX_SY_CONVERSION_NO_NUMBER
ABAP Program Y_TEST
Application Component Not Assigned
Date and Time 08/07/2013 11:43:11
Short text
Unable to interpret "0A10" as a number.
What happened?
Error in the ABAP Application Program
The current ABAP program "Y_TEST" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Thanks in Advance,
Prem
2013 Aug 07 1:26 PM
Hi Prem Kumar,
PACK statement can only be used for numbers. The dump says it cannot interpret 'A' as a number. If you had tried Packing 0010 or so, it would not have dumped. Hope this helps!
2013 Aug 07 1:28 PM
You can also do an F1 on the PACK statement and understand its functionality better
2013 Aug 07 1:45 PM
Dear Prem,
Pack is an obselete statement.Instead,Try to use MOVE and SHIFT statements as shown below.
REPORT zyyytest.
DATA lvkorg TYPE vkorg.
DATA lvkorg1 TYPE string.
lvkorg = '0A10'.
SELECT SINGLE vbund INTO lvkorg1 FROM kna1 WHERE kunnr = '0000011628' .
*PACK lvkorg TO lvkorg1.
MOVE lvkorg TO lvkorg1.
SHIFT lvkorg1 LEFT DELETING LEADING '0'.
IF sy-subrc = 0 .
ENDIF.
Thanks
Katrice
2013 Aug 07 3:04 PM
Yes i know pack is obsolete... but it was old logic.....
I tried Move with destination as packed type even that went to dump...your logic with char/string worked..
2013 Aug 07 1:49 PM
You can handle the particular exception in order to avoid dump.
TRY.
PACK v_dxvbak-vkorg TO v_pcoes_vkorg.
CATCH cx_sy_conversion_no_number.
"do something on exception
ENDTRY.
2013 Aug 07 3:04 PM