Skip to Content
author's profile photo Former Member
Former Member

Casting error...

Hi All,

Thers a method that has only one parameter:

it_guids importing type BBP_T_SUS_GUIDS

Till now it_guids was having only one record but now we need to process multiple record so

we need to LOOP at it_guids for processing all records in this internal table .

for that i defined a workarea in this method:

data: wa_guids like line of it_guids .

within this method , another method is called:

IF it_guids IS NOT INITIAL.

loop at it_guids into wa_guids .

lo_app ?= application.

CREATE OBJECT : lo_services,

lo_dnload_text.

CALL METHOD lo_dnload_text->build_text_stream

EXPORTING

it_doc_guid = it_guids

IMPORTING

er_sus_u_services = lo_services

et_messages = lt_messages.

endloop.

when i try to replace the exporting parameter it_guids in the method

lo_dnload_text->build_text_stream , i get a syntax error wa_guids is not type compitable with formal

parameter it_doc_guid .

it_doc_guid is also of type BBP_T_SUS_GUIDS .

My question is since wa_guids and it_guids are of the same line type then why am i getting this syntax error .

How can i solve this error.

Regards,

Vikky.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Apr 09, 2008 at 09:11 AM

    >

    >

    > My question is since wa_guids and it_guids are of the same line type then why am i getting this syntax error .

    As the error says: wa_guids is not type compitable with formal parameter it_doc_guid. So wa_guids and it_guids being the same is irrelevant. Look at the defintion of method "build_text_stream" and see what type its paramater it_doc_guid has.

    matt

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 10, 2008 at 08:25 AM

    So,

    CALL METHOD lo_dnload_text->build_text_stream
        EXPORTING
          it_doc_guid = it_guids 
        IMPORTING
          er_sus_u_services = lo_services
          et_messages = lt_messages.

    works, but now you want to replace it with:

    CALL METHOD lo_dnload_text->build_text_stream
        EXPORTING
          it_doc_guid = wa_guids 
        IMPORTING
          er_sus_u_services = lo_services
          et_messages = lt_messages.

    >

    > But BBP_T_SUS_GUIDS is a Table Type.

    Exactly. And wa_guids isn't a table. It's not of type BBP_T_SUS_GUIDS. You are getting the error message because wa_guids is like a LINE of BBP_T_SUS_GUIDS. The method build_text_stream requires a table - not a record with the same structure as the table.

    You need to do something like:

    DATA: lt_temp_guids TYPE bbp_t_sus_guids.
    ...
    REFRESH lt_temp_guids.
    INSERT wa_guids INTO TABLE lt_temp_guids.
    CALL METHOD lo_dnload_text->build_text_stream
        EXPORTING
          it_doc_guid = lt_temp_guids 
        IMPORTING
          er_sus_u_services = lo_services
          et_messages = lt_messages.

    matt

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.