Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

problems with RFC

Former Member
0 Kudos
94

hi

i have created a RFC wherein i submit my report program thru "SUBMIT" command. Pls refer the below code:

DATA: ITHEADER LIKE TABLE OF abaplist WITH HEADER LINE.

submit zrpt_mm_045 EXPORTING LIST TO MEMORY

with s_werks-low = s_werks

with s_mtart-low = s_mtart_low

with s_mtart-high = s_mtart_high

with s_matnr-low = s_matnr_low

with s_matnr-high = s_matnr_high

with s_budat-low = s_budat_low

with s_budat-high = s_budat_high

with s_lgort-low = s_lgort

with rb1 = rb1

with rb2 = rb2

with rb3 = rb3

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = ITHEADER

  • EXCEPTIONS

  • 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 FUNCTION 'LIST_TO_ASCI'

  • EXPORTING

  • LIST_INDEX = -1

  • WITH_LINE_BREAK = ' '

TABLES

listasci = ITHEADER

  • LISTOBJECT =

  • EXCEPTIONS

  • EMPTY_LIST = 1

  • LIST_INDEX_INVALID = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFUNCTION.

In TABLES option of the FM i have declare a table

ITHEADER1 like a structure of some abap dictionary table.

I want to retrieve the desired output into the internal table ITHEADER1 so that i can use that table for EP.

Could you pls tell me how to get the data in readable format, bcos when i run the above code it it giving me run-time errors.

Thanks

2 REPLIES 2

Former Member
0 Kudos
58

Hi,

When calling 'LIST_TO_ASCI' you should also provide an ITAB for getting the output (input to this FM is LISTOBJECT, and output should be an ITAB for LISTASCI). You are instead providing listobject to listasci field which I think is incorrect.

(You will also need to pass LISTINDEX = -1 which is commented currently). For more, please see the documentation of this FM.

cheers.

Former Member
0 Kudos
58

Hi Deepak,

Try it this way:

DATA: BEGIN OF I_LISTKEY OCCURS 0,

ZEILE(256) TYPE C.

DATA: END OF I_LISTKEY.

DATA : i_DUMMY_OUTPUT1 type standard table of DUMMY_OUTPUT1,

w_DUMMY_OUTPUT1 LIKE LINE OF I_DUMMY_OUTPUT1.

where:

TYPES : BEGIN OF DUMMY_OUTPUT1,

ur internal table fields.

END OF DUMMY_OUTPUT1.

Now:

*To Convert the list into an internal table

CALL FUNCTION 'LIST_TO_ASCI'

TABLES

LISTASCI = I_LISTKEY

LISTOBJECT = i_LISTOBJECT

EXCEPTIONS

EMPTY_LIST = 1

LIST_INDEX_INVALID = 2

OTHERS = 3.

CLEAR I_DUMMY_OUTPUT1. REFRESH I_DUMMY_OUTPUT1.

delete i_listkey from 1 to 3.

DESCRIBE TABLE I_LISTKEY LINES LV_LIN.

delete i_listkey index lv_lin.

LOOP AT I_LISTKEY.

SPLIT I_LISTKEY-ZEILE AT '|'

INTO W_DUMMY_OUTPUT1-field1

W_DUMMY_OUTPUT1-field2.

CONDENSE W_DUMMY_OUTPUT1-field1 NO-GAPS.

CONDENSE W_DUMMY_OUTPUT1-field2 NO-GAPS.

  • append w_dummy_output to i_dummy_output.

MOVE w_dummy_output_field1 TO

w_ur_warea_of_table -field1.

MOVE w_dummy_foutput_field2 TO

w_ur_warea_of_table-field2.

APPEND lw_ur_warea_of_table TO li_ur_itab_of_table .

ENDLOOP.

CALL FUNCTION 'LIST_FREE_MEMORY'

TABLES

LISTOBJECT = i_LISTOBJECT.

CLEAR I_DUMMY_OUTPUT1.

REFRESH I_DUMMY_OUTPUT1.

Once u go into debugg mode u wil understand why we are using the split and condense.

Hope this is how u want it.

Regards,

Anjali.