cancel
Showing results for 
Search instead for 
Did you mean: 

FM problem again (list_to_asci)

Former Member
0 Kudos

pls look into the below code which i wrote it in FM to create an RFC for EP.

FUNCTION ZFM_ZMM45.

*"----


""Local interface:

*" IMPORTING

*" VALUE(S_WERKS) LIKE ZMARA_MARC-WERKS OPTIONAL

*" VALUE(S_MTART_LOW) LIKE ZMARA_MARC-MTART OPTIONAL

*" VALUE(S_MTART_HIGH) LIKE ZMARA_MARC-MTART

*" VALUE(S_MATNR_LOW) LIKE ZMARA_MARC-MATNR OPTIONAL

*" VALUE(S_MATNR_HIGH) LIKE ZMARA_MARC-MATNR

*" VALUE(S_BUDAT_LOW) LIKE ZS_MKPF_MSEG-BUDAT OPTIONAL

*" VALUE(S_BUDAT_HIGH) LIKE ZS_MKPF_MSEG-BUDAT OPTIONAL

*" VALUE(S_LGORT) LIKE MARD-LGORT OPTIONAL

*" VALUE(RB1) LIKE Z_MKPF_MSEG-SOBKZ DEFAULT 'A'

*" VALUE(RB2) LIKE Z_MKPF_MSEG-SOBKZ

*" VALUE(RB3) LIKE Z_MKPF_MSEG-SOBKZ

*" TABLES

*" ITHEADER1 STRUCTURE ZSTRU1_ZMM45

*"----


DATA: ITHEADER LIKE TABLE OF abaplist WITH HEADER LINE.

DATA: ITAB LIKE TABLE OF ITHEADER1 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.

*EXPORT ITHEADER TO INTERNAL TABLE ITHEADER1.

CALL FUNCTION 'LIST_TO_ASCI'

EXPORTING

LIST_INDEX = -1

  • WITH_LINE_BREAK = ' '

TABLES

listasci = itab

LISTOBJECT = itheader

  • 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.

but when i execute this it gives me the following run-time error

Only flat, character-type data objects are supported at the argument

position "LISTASCI" for the statement

"DESCRIBE".

In this case, the operand "LISTASCI" has the non-character-type or deep type

"ZSTRU1_ZMM45". The current program is flagged as a Unicode program. In the

Unicode

context, type X fields are seen as non-character-type, as are

structures that contain non-character-type components.

pls sugges me what should i do.

Thanx

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

*To Convert the list into an internal table

CALL FUNCTION 'LIST_TO_ASCI'

TABLES

LISTASCI = itab

LISTOBJECT = itheader

EXCEPTIONS

EMPTY_LIST = 1

LIST_INDEX_INVALID = 2

OTHERS = 3.

Check the declaration for itab:

DATA: BEGIN OF itab OCCURS 0,

ZEILE(256) TYPE C.

DATA: END OF itab.

Please reply if u have any more issues on this.

Regards,

Anjali

athavanraja
Active Contributor
0 Kudos

please avoid creating many threads for the same topic.

also reward the answers that were helpful to you.

/people/mark.finnern/blog/2004/08/10/spread-the-love

Regards

Raja

Former Member
0 Kudos

Hi Raja

Thank you very much for helping me.

But two more things pls.

1. The output of the FM i am getting only few entries .i.e 152 entries only. but there are more than 500 entries in the report. How to display all the entries in the FM. I tried to increase the size of the internal table but even then it is not working.

2. I am also anticipating selection-screen of the report when when i execute the function module. Whereas i need to supress the selection-screen of the report, how should i do that.

pls help me

Anjali even you have been helpful.

Thank you

athavanraja
Active Contributor
0 Kudos

1. as i said before remove the list_index = '-1' from the function ('LIST_TO_ASCI'). i mean dont pass any value.

2. with the submit stt. unless you specified via-selection screen the screen wont show up. (providere there are no errors in the values passed.)

Regards

Raja

Former Member
0 Kudos

hi raja

I have typed the code as you instructed but even then it giving me limited entries only. i have displayed the code below:

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.

*EXPORT ITHEADER TO INTERNAL TABLE ITHEADER1.

CALL FUNCTION 'LIST_TO_ASCI'

  • EXPORTING

  • LIST_INDEX = -1

  • WITH_LINE_BREAK = ' '

TABLES

listasci = ITAB

LISTOBJECT = ITHEADER

  • 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.

2. To supress the selection-screen: i have also checked my code in submit command where LHS is my fields which i have declared in report and RHS are the fields which i declared in FM.

the sme thing with radiobuttons but still i get the screen when i execute my FM.

Answers (2)

Answers (2)

christian_wohlfahrt
Active Contributor
0 Kudos

Hi!

Your internal table itheader1 has the structure ZSTRU1_ZMM45 (defined in import parameter of ZFM_ZMM45.

Export parameter of LIST_TO_ASCI expects a table of structure ABAPLIST.

You have to convert the internal table / use a different defnition in function ZFM_ZMM45.

I'm not sure, if it was already mentioned: list to memory will handle the <i>spool-output</i>.

Regards,

Christian

athavanraja
Active Contributor
0 Kudos

change your <b>itab</b> declaration from

DATA: ITAB LIKE TABLE OF ITHEADER1 WITH HEADER LINE.

to

<b>DATA: ITAB type standard table of SOLISTI1 .</b>

Also comment "<b>LIST_INDEX = -1</b>" you dont need this.

Regards

Raja