Application Development and Automation 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: 
Read only

Assignment statement not working properly

Former Member
0 Likes
737

Hello Experts,

I am gettting an error, when executing the following code in my program:

DATA: it_bapiret TYPE TABLE OF bapiret2.

DATA: wa_bapiret TYPE bapiret2.

-


--

--

Logic for filling the internal table IT_BAPIRET

--

--

-


LOOP AT it_bapiret INTO wa_bapiret.

write: / wa_bapiret.

ENDLOOP.

When i check this, i am gettting the error WA_BAPIRET cannot be converted to a character type field.

I need all the possible solutions to resolve this error: like using FILL_CONTAINER_C, ASSIGN statement, or declaring equivalent structure of character type.

Please justify which solution will be best suited/more feasible, if possible.

Thanks and Best Regards,

Suresh

6 REPLIES 6
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
686

Try this

LOOP AT it_bapiret INTO wa_bapiret.

write: / wa_bapiret-type,wa_bapiret-message.

ENDLOOP.

Let me also know how do you fill you internal table.

Check whether you have used this type of code.

wa1 = wa2" This may not result as error in Non-Unicode system but an error in Unicode system

"To handle these cases, we need to explicitly move the fields like

wa1-field1 = wa2-field1.

wa1-field2 = wa2-field2.

Edited by: Keshu Thekkillam on Nov 6, 2009 7:54 PM

Read only

0 Likes
686

Hello Keshu,

The Internal table is filled via BAPI call. (Return message (errors) of BAPI).

I know the solution what you are proposing.

I need the justification of where we need to use:

1.) ASSIGN Statements (when i used assign only output length of 255 is visible. Not the entire workarea)

2.) FILL_CONTAINER_C and READ_CONTAINER_C methods

3.) Declaring a structure similar to WA_BAPIRET (defining each and every field but of character type)

4.) Writing each and every field seperately

Please justify the difference between these solutions.

Thanks and Best Regards,

Suresh

Read only

0 Likes
686

I dont know what you are asking.

Your Question was how to solve the error.

(when i used assign only output length of 255 is visible. Not the entire workarea)

It could more easy if you provide your code.

****

FILL_CONTAINER_C and READ_CONTAINER_C methods

I dont have a answer to this question.

Read only

Clemenss
Active Contributor
0 Likes
686

Hi Suresh,

continue like this:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
*   I_INTERFACE_CHECK                     = ' '
*   I_BYPASSING_BUFFER                    = ' '
*   I_BUFFER_ACTIVE                       = ' '
*   I_CALLBACK_PROGRAM                    = ' '
*   I_CALLBACK_PF_STATUS_SET              = ' '
*   I_CALLBACK_USER_COMMAND               = ' '
*   I_CALLBACK_TOP_OF_PAGE                = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE           = ' '
*   I_CALLBACK_HTML_END_OF_LIST           = ' '
     I_STRUCTURE_NAME                      = 'BAPIRET2'
*   I_BACKGROUND_ID                       = ' '
*   I_GRID_TITLE                          =
*   I_GRID_SETTINGS                       =
*      is_layout                           = l_alv_layout
*      it_fieldcat                         = pt_fieldcat
*   IT_EXCLUDING                          =
*   IT_SPECIAL_GROUPS                     =
*   IT_SORT                               =
*   IT_FILTER                             =
*   IS_SEL_HIDE                           =
*   I_DEFAULT                             = 'X'
*   I_SAVE                                = ' '
*   IS_VARIANT                            =
*   IT_EVENTS                             =
*   IT_EVENT_EXIT                         =
*   IS_PRINT                              =
*   IS_REPREP_ID                          =
      i_screen_start_column               = 10
      i_screen_start_line                 = 5
      i_screen_end_column                 = 100
      i_screen_end_line                   = 15
*   I_HTML_HEIGHT_TOP                     = 0
*   I_HTML_HEIGHT_END                     = 0
*   IT_ALV_GRAPHICS                       =
*   IT_HYPERLINK                          =
*   IT_ADD_FIELDCAT                       =
*   IT_EXCEPT_QINFO                       =
*   IR_SALV_FULLSCREEN_ADAPTER            =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER               =
*   ES_EXIT_CAUSED_BY_USER                =
    TABLES
      t_outtab                            = it_bapiret
    EXCEPTIONS
      program_error                       = 1
      OTHERS                              = 2
            .

This displays the table in an ALV grid as a popup.

Regards,

Clemens

P.S. And please post code as

code

Read only

Former Member
0 Likes
686

No Suitable answers found!

Read only

0 Likes
686

hi

LOOP AT it_bapiret INTO wa_bapiret.
write: / wa_bapiret.  "  Try to use its Component in the Write Statement
ENDLOOP.

In the above code you are trying to write wa_bapiret which is clearly a structure. Instead you need to use

wa_bapiret-COMPENT_NAME.

Hope this is clear to you.

I know you closed this thread.

still i felt it will be useful to you.

Cheerz

Ram