Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

ABAP Code Error

$
0
0

Hi Experts,

 

Please check and do the needful . I am getting the error as 

 

Error analysis

    An exception occurred that is explained in detail below.

    The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught

     and

    therefore caused a runtime error.

    The reason for the exception is:

    In a SELECT access, the read file could not be placed in the target

    field provided.

    Either the conversion is not supported for the type of the target field,

    the target field is too small to include the value, or the data does not

    have the format required for the target field.

 

 

ABAP Code:

 

*&---------------------------------------------------------------------*

*& Report  ZPROXY_MAT

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

 

 

REPORT  ZPROXY_MAT.

 

 

TABLES:ZMAT_TEST.

 

 

 

 

DATA:lt_mara TYPE STANDARD TABLE OF ZMAT_TEST ,

     ls_mara TYPE ZMAT_TEST.

DATA:client_proxy type REF TO ZCO_MATERIAL_SOURCE_SI,

     fs_mara TYPE ZMATERIAL_SOURCE_MATERIAL,

     t_mara TYPE ZMATERIAL_SOURCE_MATERIAL,

     ts_mara TYPE ZMATERIAL_SOURCE_MT,

     sys_fault TYPE REF TO cx_ai_system_fault.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE t1.

*.PARAMETERS:p_matnr TYPE ZMAT_TEST-MATERIAL_NMBER.

  Select-OPTIONS:s_matnr FOR ZMAT_TEST-MATERIAL_NMBER.

SELECTION-SCREEN end of BLOCK b1.

 

 

 

 

CREATE OBJECT client_proxy.

CREATE OBJECT sys_fault.

*t1='material'.

 

 

 

 

SELECT MATERIAL_NMBER

       MATERIAL_DESCRIP

       MAINTAIN_STATUS

       CREATEDBY

       CREATEDON

       from ZMAT_TEST into TABLE ls_mara where  MATERIAL_NMBER in s_matnr.

 

 

*  ENDSELECT.

  IF sy-subrc eq 0.

 

 

    LOOP AT lt_mara into ls_mara.

      WRITE:/ ls_mara-MATERIAL_NMBER,

              ls_mara-MATERIAL_DESCRIP,

              ls_mara-MAINTAIN_STATUS,

              ls_mara-CREATEDBY,

              ls_mara-CREATEDON.

    ENDLOOP.

  else.

 

 

    write:/'data not found'.

  ENDIF.

  sort lt_mara by MATERIAL_NMBER.

  READ TABLE lT_MARA  INTO ls_mara

    WITH KEY MATERIAL_NMBER = s_matnr BINARY SEARCH.

 

 

  fs_mara-MATERIAL_NUMBER = ls_mara-MATERIAL_NMBER.

  fs_mara-MATERIAL_DESCRIPtion = ls_mara-MATERIAL_DESCRIP.

  fs_mara-MAINTENANCE_STATUS = ls_mara-MAINTAIN_STATUS.

  fs_mara-CREATED_BY = ls_mara-CREATEDBY.

  fs_mara-CREATED_ON = ls_mara-CREATEDON.

 

 

  TRY.

      ts_mara-MATERIAL_SOURCE_MT-material = fs_mara.

      call method client_proxy->EXECUTE_ASYNCHRONOUS

              EXPORTING

          output = ts_mara.

      commit WORK.

      WRITE:/ 'data processed sucessfully'.

 

 

    CATCH  cx_ai_system_fault INTO sys_fault.

      write:/'system error'.

 

 

  ENDTRY.

 

Regards,

GIRIDHAR


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>