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

Return the value in Generic table in RFC

$
0
0

Hi All,

 

The 'HR_READ_INFOTYPE' function module will read the records of particular Infotype.

 

As per the requirement, the HR_READ_INFOTYPE is need to be used as BAPI. Hence we developed a RFC as below.

 

FUNCTION zbapi_hr_read_infotype.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(IM_PERNR) TYPE  PRELP-PERNR
*"     VALUE(IM_INFTY) TYPE  PRELP-INFTY
*"  EXPORTING
*"     VALUE(ED_XMLSTRING) TYPE  XSTRING
*"----------------------------------------------------------------------
   DATA: w_infty TYPE char5.

   FIELD-SYMBOLS: <i_tab> TYPE STANDARD TABLE.

   DATA w_dref TYPE REF TO data.

   CONCATENATE 'P' im_infty INTO w_infty.

   CREATE DATA w_dref TYPE TABLE OF (w_infty).

   ASSIGN w_dref->* TO <i_tab>.

   CALL FUNCTION 'HR_READ_INFOTYPE'
     EXPORTING
*   TCLAS                 = 'A'
       pernr                 = im_pernr
       infty                 = im_infty
*   BEGDA                 = '18000101'
*   ENDDA                 = '99991231'
*   BYPASS_BUFFER         = ' '
*   LEGACY_MODE           = ' '
* IMPORTING
*   SUBRC                 =
     TABLES
       infty_tab             = <i_tab>
* EXCEPTIONS
*   INFTY_NOT_FOUND       = 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.

*  CALL TRANSFORMATION id
*     SOURCE itab = <i_tab>
*     RESULT XML ed_xmlstring.


ENDFUNCTION.

 

The problem is, we need to return the generic table <i_tab> value in RFC. But Generic type are not allowed in RFC.

 

As per the guidance given in some links, I tried to convert data to XSTRING.

 

*  CALL TRANSFORMATION id
*     SOURCE itab = <i_tab>
*     RESULT XML ed_xmlstring.

 

But again if we want to move XSTRING data to an internal table, it should also be

 

a generic table. Hence guide me on how to handle this.

 

Regards,

Gurulakshmi


Viewing all articles
Browse latest Browse all 8332

Trending Articles