2010 Dec 06 8:30 PM
Hello Friends.
I am trying to use READ_KNA1 function module in a program to get some detials fom KNA1 table. However the following code does not give any results, just giving a blank screen.
I do not understand what am I doing wrong?
Can any one help me.
Regards,
Murali.
**********************************************************************************
REPORT ZTX1910.
PARAMETERS: PKUNNR(10).
DATA: YKNA1 LIKE KNA1 OCCURS 0 WITH HEADER LINE,
XKUNNR LIKE KNA1-KUNNR.
XKUNNR = PKUNNR.
CALL FUNCTION 'READ_KNA1'
EXPORTING
XKUNNR = XKUNNR
IMPORTING
XKNA1 = YKNA1
EXCEPTIONS
KEY_INCOMPLETE = 1
NOT_AUTHORIZED = 2
NOT_FOUND = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
ENDIF.
READ TABLE YKNA1 INDEX 1.
WRITE: / YKNA1-NAME1.
2010 Dec 06 9:05 PM
Hello Murali
Your negative result is the consequence of poor programming.
A simple change in your program would have solved this (answer of Rob):
...
" PARAMETERS: PKUNNR(10).
PARAMETERS: p_kunnr TYPE kunnr.
...
Using the correct type for your PARAMETER the system would "know" that is has to use the conversion-exit assigned to the domain of data element kunnr.
Regards
Uwe
2010 Dec 06 8:54 PM
You have to left pad PKUNNR with zeroes.
This sort of question has been asked and answered many times before - please search before posting.
Rob
2010 Dec 06 9:05 PM
Hello Murali
Your negative result is the consequence of poor programming.
A simple change in your program would have solved this (answer of Rob):
...
" PARAMETERS: PKUNNR(10).
PARAMETERS: p_kunnr TYPE kunnr.
...
Using the correct type for your PARAMETER the system would "know" that is has to use the conversion-exit assigned to the domain of data element kunnr.
Regards
Uwe
2010 Dec 07 8:42 AM
My question was very basic, as I am beginner in ABAP programming.
Thanks Rob and Uwe.
Problem solved.