‎2013 Jul 11 4:01 PM
Hello to all,
I was facing a peculiar problem which I tried to solve but failed. Whenever I am creating an ALV report it's getting activated but at the time of execution an error message Unable to Determine Host from Address: NiAddrTo Host Failed.
Can anyone please tell me about this error? what is this actually specifying? Why is it coming? and how can I solve this?
For your convenience I am sending the program I've written as a file named Program.txt and also the error page as a file named Final_error_page.jpg along with this post.
Thanking you in advance. Hope to get the solution soon.
‎2013 Jul 11 4:52 PM
Hi RituParna, you see this messsage because you have the follow sentence
select vbeln matnr matkl arktx from vbap
into table it_vbap
where vbeln in s_vbeln and matnr in s_matnr.
if sy-subrc <> 0.
* write: "No record to display.".
message e498(00) with 'No Records to Dislay.'.
leave list-processing.
......
Change
message e498(00) with 'No Records to Dislay.'
by
MESSAGE e888(sabapdocu) with 'No Records to Display'.
You shouldn't use the message class 00 and number 498, look at this ID message in SE91
Message Class: 00
| 495 | Error in CPIC conversion table |
| 496 | Error in modification values for CPIC conversion table |
| 497 | Unable to determine host address: NiHostToAddr failed |
| 498 | Unable to determine host from address: NiAddrTo Host failed |
| 499 | THOST table read failed |
| 500 | Entry & in work area & with language key & not supported |
Other mistake is:
select vbeln erdat ernam lifsk faksk netwr waerk
from vbak into
INTO TABLE it_vbak
for all entries in it_vbap
where vbeln = it_vbap-vbeln.
Because your internal table (it_vbak) dont have the fields in order, look at your definition
BEGIN OF TY_VBAK,
VBELN TYPE VBAK-VBELN, -> OK
ERDAT TYPE VBAK-ERDAT, ->OK
ERZET TYPE VBAK-ERZET, -> ERROR
ERNAM TYPE VBAK-ERNAM,
LIFSK TYPE VBAK-LIFSK,
FAKSK TYPE VBAK-FAKSK,
NETWR TYPE VBAK-NETWR,
WAERK TYPE VBAK-WAERK,
END OF TY_VBAK,
You can replace the sentence
select vbeln erdat erzet ernam lifsk faksk netwr waerk
from vbak into
INTO TABLE it_vbak
for all entries in it_vbap
where vbeln = it_vbap-vbeln.
or this
select vbeln erdat ernam lifsk faksk netwr waerk
from vbak into
INTO CORRESPONDING TABLE it_vbak
for all entries in it_vbap
where vbeln = it_vbap-vbeln.
Regards.
DCC
‎2013 Jul 11 4:23 PM
There are couple of issues in this code .First of all, loop through your internal tables when you are appending data into it_final.
loop at it_vbap into wa_vbap.
move: wa_vbap-vbeln to wa_final-vbeln,
wa_vbap-matnr to wa_final-matnr,
wa_vbap-matkl to wa_final-matkl,
wa_vbap-arktx to wa_final-arktx,
read table it_vbak into wa_vbak with key vbeln = wa_vbap-vbeln.
if sy-subrc = 0.
wa_vbak-erdat to wa_final-erdat,
wa_vbak-ernam to wa_final-ernam,
wa_vbak-lifsk to wa_final-lifsk,
wa_vbak-faksk to wa_final-faksk,
wa_vbak-netwr to wa_final-netwr,
wa_vbak-waerk to wa_final-waerk.
endif.
append wa_final to it_final.
clea:r wa_fina,wa_vbak,wa_vbapl.
endloop.
Then, while building fieldcatlog, you don't need to increment row position.
clear wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 1. "Comment this line
wa_fcat-fieldname = 'vbeln'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Sales Order No.'.
append wa_fcat to it_fcat.
clear wa_fcat.
wa_fcat-col_pos = 2.
*wa_fcat-Row_pos = 2. "Comment this line
wa_fcat-fieldname = 'matnr'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Matrl No.'.
append wa_fcat to it_fcat.
clear wa_fcat.
wa_fcat-col_pos = 3.
*wa_fcat-Row_pos = 3. "Comment this line
wa_fcat-fieldname = 'matkl'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Matrl Group'.
append wa_fcat to it_fcat.
‎2013 Jul 11 4:52 PM
Hi RituParna, you see this messsage because you have the follow sentence
select vbeln matnr matkl arktx from vbap
into table it_vbap
where vbeln in s_vbeln and matnr in s_matnr.
if sy-subrc <> 0.
* write: "No record to display.".
message e498(00) with 'No Records to Dislay.'.
leave list-processing.
......
Change
message e498(00) with 'No Records to Dislay.'
by
MESSAGE e888(sabapdocu) with 'No Records to Display'.
You shouldn't use the message class 00 and number 498, look at this ID message in SE91
Message Class: 00
| 495 | Error in CPIC conversion table |
| 496 | Error in modification values for CPIC conversion table |
| 497 | Unable to determine host address: NiHostToAddr failed |
| 498 | Unable to determine host from address: NiAddrTo Host failed |
| 499 | THOST table read failed |
| 500 | Entry & in work area & with language key & not supported |
Other mistake is:
select vbeln erdat ernam lifsk faksk netwr waerk
from vbak into
INTO TABLE it_vbak
for all entries in it_vbap
where vbeln = it_vbap-vbeln.
Because your internal table (it_vbak) dont have the fields in order, look at your definition
BEGIN OF TY_VBAK,
VBELN TYPE VBAK-VBELN, -> OK
ERDAT TYPE VBAK-ERDAT, ->OK
ERZET TYPE VBAK-ERZET, -> ERROR
ERNAM TYPE VBAK-ERNAM,
LIFSK TYPE VBAK-LIFSK,
FAKSK TYPE VBAK-FAKSK,
NETWR TYPE VBAK-NETWR,
WAERK TYPE VBAK-WAERK,
END OF TY_VBAK,
You can replace the sentence
select vbeln erdat erzet ernam lifsk faksk netwr waerk
from vbak into
INTO TABLE it_vbak
for all entries in it_vbap
where vbeln = it_vbap-vbeln.
or this
select vbeln erdat ernam lifsk faksk netwr waerk
from vbak into
INTO CORRESPONDING TABLE it_vbak
for all entries in it_vbap
where vbeln = it_vbap-vbeln.
Regards.
DCC
‎2013 Jul 13 3:26 AM
Thank you David for your elaborate and to the point advice.
Thanks again.
‎2013 Jul 11 4:52 PM
In your code, from where are you appending data into it_final. Cannot see you looping through the internal table? wa_vbup will not contain any values unless you loop through it_vbup.
So actually the error is coming because no records have been selected. And message number you have given corresponds to what you see here in the screen shot.
‎2013 Jul 12 6:05 AM
Hi Rituparna,
I executed your code. Query to VBAP table is failing and hence the error. Kindly check whether the values which u are passing exists in the table.
Second point: The sequence of the fields written in the second query and in the internal table it_vbak are not correct. Field ERZAT is missing in the query and hence it gives run time error.
Third point: While populating fields in Field catalogue pass the values in Upper Case.
Hope this solves your problem.
Thanks and Regards,
Vinay Mutt
‎2013 Jul 12 6:22 AM
Hi,
you can use
message e050(HREFIGB).
if found in your system with SE91 or
message e000(38) with 'No Records to Dislay.'.
instead of
message e498(00) with 'No Records to Dislay.'.
Regards,
Klaus
‎2013 Jul 12 6:44 AM
Hi Rituparna,
Try this code...
TABLES: vbap, vbak.
TYPE-POOLS: slis.
TYPES:
BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln,
matnr TYPE vbap-matnr,
matkl TYPE vbap-matkl,
arktx TYPE vbap-arktx,
END OF ty_vbap,
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
erzet TYPE vbak-erzet,
ernam TYPE vbak-ernam,
lifsk TYPE vbak-lifsk,
faksk TYPE vbak-faksk,
netwr TYPE vbak-netwr,
waerk TYPE vbak-waerk,
END OF ty_vbak,
BEGIN OF ty_final,
vbeln TYPE vbap-vbeln,
matnr TYPE vbap-matnr,
matkl TYPE vbap-matkl,
arktx TYPE vbap-arktx,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
lifsk TYPE vbak-lifsk,
faksk TYPE vbak-faksk,
netwr TYPE vbak-netwr,
waerk TYPE vbak-waerk,
END OF ty_final.
DATA: it_vbap TYPE TABLE OF ty_vbap,
wa_vbap TYPE ty_vbap,
it_vbak TYPE TABLE OF ty_vbak,
wa_vbak TYPE ty_vbak,
it_final TYPE TABLE OF ty_final,
wa_final TYPE ty_final.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv.
SELECT-OPTIONS: s_vbeln FOR vbap-vbeln,
s_matnr FOR vbap-matnr.
SELECT vbeln
matnr
matkl
arktx
FROM vbap INTO TABLE it_vbap WHERE vbeln IN s_vbeln AND matnr IN s_matnr.
IF sy-subrc <> 0.
* write: "No record to display.".
MESSAGE e498(00) WITH 'No Records to Dislay.'.
LEAVE LIST-PROCESSING.
ELSE.
SELECT vbeln
erdat
erzet
ernam
lifsk
faksk
netwr
waerk
FROM vbak INTO TABLE it_vbak FOR ALL ENTRIES IN it_vbap WHERE vbeln = it_vbap-vbeln.
IF sy-subrc <> 0.
WRITE 'No Records to display.'.
LEAVE LIST-PROCESSING.
else.
CLEAR wa_final.
LOOP AT it_vbap INTO wa_vbap.
MOVE: wa_vbap-vbeln TO wa_final-vbeln,
wa_vbap-matnr TO wa_final-matnr,
wa_vbap-matkl TO wa_final-matkl,
wa_vbap-arktx TO wa_final-arktx.
READ TABLE it_vbak INTO wa_vbak WITH KEY vbeln = wa_vbap-vbeln.
IF sy-subrc = 0.
MOVE: wa_vbak-erdat TO wa_final-erdat,
wa_vbak-ernam TO wa_final-ernam,
wa_vbak-lifsk TO wa_final-lifsk,
wa_vbak-faksk TO wa_final-faksk,
wa_vbak-netwr TO wa_final-netwr,
wa_vbak-waerk TO wa_final-waerk.
ENDIF.
APPEND wa_final TO it_final.
CLEAR wa_final.
endloop.
ENDIF.
endif.
PERFORM create_fieldcat.
PERFORM display_alv.
*&---------------------------------------------------------------------*
*& Form create_fieldcat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM create_fieldcat .
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 1.
wa_fcat-fieldname = 'VBELN'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Sales Order No.'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 2.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Matrl No.'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 3.
wa_fcat-fieldname = 'MATKL'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Matrl Group'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 4.
wa_fcat-fieldname = 'ARKTX'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Description'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 5.
wa_fcat-fieldname = 'ERDAT'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Date of Creation'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 6.
wa_fcat-fieldname = 'ERNAM'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Created By'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 7.
wa_fcat-fieldname = 'LIFSK'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Delivery Block'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 8.
wa_fcat-fieldname = 'FAKSK'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Billing Block'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
*wa_fcat-Row_pos = 9.
wa_fcat-fieldname = 'NETWR'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Net Value'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
wa_fcat-row_pos = 10.
wa_fcat-fieldname = 'waerk'.
wa_fcat-tabname = 'it_final'.
wa_fcat-reptext_ddic = 'Currency'.
APPEND wa_fcat TO it_fcat.
ENDFORM. " create_fieldcat
*&---------------------------------------------------------------------*
*& Form display_alv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_alv .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-cprog
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
it_fieldcat = it_fcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2
.
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. " display_alv
‎2013 Jul 12 4:51 PM
Hi Rituparna Duttagupta,
use capital letters for fields name it is 'case sentitive'.
FORM create_fieldcat .
clear wa_fcat.
wa_fcat-col_pos = 1.
wa_fcat-Row_pos = 1.
wa_fcat-fieldname = 'VBELN'.
wa_fcat-tabname = 'IT_FINAL'.
wa_fcat-reptext_ddic = 'Sales Order No.'.
append wa_fcat to it_fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FCAT
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
may this solve your problem.
‎2013 Jul 13 3:29 AM
Thank you all. Finally with your help I've solved my problem.
Thanks again to all of you again.