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

current statement is not supported for deep internal structures

Former Member
0 Likes
2,460

Hello,

Iam Using abap objects in alv report , when i run ..it is goin to dump giving me the error <current statement is not supported to deep internal structures>

DATA:BEGIN OF itab OCCURS 0,

vbeln LIKE likp-vbeln,

posnr LIKE lips-posnr,

lfdat LIKE lips-vfdat,

box(1),

handle_style TYPE lvc_t_styl,

END OF itab.

SELECT vbeln

posnr

FROM lips

INTO CORRESPONDING FIELDS OF TABLE itab

UP TO 20 ROWS.

please advise.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,239

nothing seems to be working.plz help

16 REPLIES 16
Read only

Former Member
0 Likes
2,239

Hi ,

You need to comment line --- handle_style TYPE lvc_t_styl, .

Try the following code -


DATA:BEGIN OF itab OCCURS 0,
vbeln LIKE likp-vbeln,
posnr LIKE lips-posnr,
lfdat LIKE lips-vfdat,
box(1),
*handle_style TYPE lvc_t_styl,           " Commented
END OF itab. 

SELECT vbeln
posnr
FROM lips
INTO CORRESPONDING FIELDS OF TABLE itab
UP TO 20 ROWS.

Regards

Pinaki

Read only

0 Likes
2,239

thanks for your reply....if i comment that iam getting an error<data object "ls_outatb> doesnt have a component called handle_style.

Read only

Former Member
0 Likes
2,239

Hi,

I think the logic is bit wrong...please go thr the below documentation and modify ur code accordingly...

... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE itab [PACKAGE SIZE n]

Effect

If the result set consists of multiple lines, an internal table itab of any table type can be specified after INTO or APPENDING. The row type of the internal table must meet the prerequisites.

The result set is inserted into the internal table itab line-by-line; a sorting process is executed in the case of a sorted table. If INTO is used, the internal table is initialized before the first line is inserted. Previous lines remain intact if APPENDING is used.

Before any assignment of a line of the result set, an initial row of the internal table itab is created and the line of the result set is assigned to this row. When assigning a line of the result set to a row of the internal table with or without CORRESPONDING FIELDS, the same rules apply as when assigning to an individual work area wa (see above).

If the PACKAGE SIZE addition is not used, all lines of the result set are inserted in the internal table itab and the ENDSELECT statement must not be specified after SELECT.

If you specify the PACKAGE SIZE addition, all lines of the result set for SELECT are processed in a loop, which must be closed with ENDSELECT. The lines are inserted in the internal table itab in packages of n lines. n must be a type i data object that contains the number of lines. If the value of n is smaller than 0, an exception that cannot be handled occurs. If n is equal to 0, all lines of the result set are inserted in the internal table itab. If used in the FETCH statement, n lines are extracted from the current cursor position.

If INTO is used, the internal table is initialized before each insertion and, in the SELECT loop, it only contains the lines of the current package. If APPENDING is used, a further package is added to the existing rows of the internal table for each SELECT loop or for each extraction using FETCH.

After ENDSELECT, the content of itab is not defined if INTO is used - that is, the table can either contain the lines of the last package or it can be initial. If APPENDING is used, the content of itab retains the state of the last loop pass.

Hope this will help.

Regards,

Rohan.

Read only

Former Member
0 Likes
2,239

Hi

You could



DATA:BEGIN OF itab1 OCCURS 0,
vbeln LIKE likp-vbeln,
posnr LIKE lips-posnr,
lfdat LIKE lips-vfdat,
box(1),
END OF itab1.

SELECT vbeln
posnr
FROM lips
INTO CORRESPONDING FIELDS OF TABLE itab1
UP TO 20 ROWS.

LOOP AT itab1.
MOVE CORRESPONDING itab1 TO itab.
APPEND itab.
ENDLOOP.

Pushpraj

Read only

Former Member
0 Likes
2,239

Hi,

The dump is not because of the code that you have pasted in your thread. Please see the dump analysis to see where exactly you are getting this dump. If you can't solve the problem then get back with the dump analysis and the code snippet where the dump is.

regards,

Advait

Read only

faisalatsap
Active Contributor
0 Likes
2,239

HI,

Please Change the Code Like the following Hope will Solve out your problem,

DATA:BEGIN OF itab OCCURS 0,
vbeln LIKE likp-vbeln,
posnr LIKE lips-posnr,
lfdat LIKE lips-vfdat,
box(1).
        INCLUDE STRUCTURE lvc_s_styl.
DATA:
END OF itab.

SELECT vbeln posnr
FROM lips
INTO CORRESPONDING FIELDS OF TABLE itab
UP TO 20 ROWS.

Kind Regards,

Faisal

Read only

Former Member
0 Likes
2,240

nothing seems to be working.plz help

Read only

0 Likes
2,239

Hi,

Can you paste the dump analysis.

Do not comment the style field in the itab. It wont make any difference.

Your declaration and select statement are correct.

regards,

Advait

Read only

0 Likes
2,239

Hi,

Try this...

SELECT vbeln

posnr

FROM lips

appending CORRESPONDING FIELDS OF TABLE itab1

UP TO 20 ROWS.

endselect.

Regards,

Rohan.

Read only

0 Likes
2,239

With the statement

"SELECT ... INTO TABLE itab"

internal tables with a deep line type are not supported at the argument

position "itab".

Internal tables with a deep line type are internal tables

with lines that are themselves either internal tables or

structurese that contain internal tables directly or indirectly as

components.

In this case, the internal table "itab" has the non-flat

line type "v".

Read only

0 Likes
2,239

Hi,

Have you tested my Sample Code with INCLUDE STRUCTURE may it will solve out your problem.

after this you will be able to use the Field like this.

itab-STYLE

Mean to use the Field of the STRUCTURE.

Kind Regards,

Faisal

Edited by: Faisal Altaf on Feb 18, 2009 3:57 PM

Read only

0 Likes
2,239

I tried but it aint working.but i dont know what you meant by

itab-STYLE

Mean to use the Field of the STRUCTURE.

Thanks

Read only

0 Likes
2,239

Hi,

Test the Sample Code Bellow Hope you will understand.

DATA:BEGIN OF itab OCCURS 0,
vbeln LIKE likp-vbeln,
posnr LIKE lips-posnr,
lfdat LIKE lips-vfdat,
box(1).
        INCLUDE STRUCTURE lvc_s_styl.
DATA:
END OF itab.

SELECT vbeln posnr
FROM lips
INTO CORRESPONDING FIELDS OF itab
UP TO 20 ROWS.
  itab-fieldname = 'Field Name'.
  APPEND itab to itab.
ENDSELECT.

Kind Regards,

Faisal

Read only

0 Likes
2,239

Hi there,

Ive changed it but its still bugging me with errors.Im p

asting my code please help.

REPORT ztest_alv_oo MESSAGE-ID zz .

DATA: g_grid TYPE REF TO cl_gui_alv_grid, "First

g_grid1 TYPE REF TO cl_gui_alv_grid. "Second

DATA: l_valid TYPE c,

v_flag,

v_data_change,

v_row TYPE lvc_s_row,

v_column TYPE lvc_s_col,

v_row_num TYPE lvc_s_roid.

DATA: ok_code LIKE sy-ucomm,

save_ok LIKE sy-ucomm,

g_container1 TYPE scrfname VALUE 'TEST', "First Container

g_container2 TYPE scrfname VALUE 'TEST1',"Second container

gs_layout TYPE lvc_s_layo.

DATA:BEGIN OF itab OCCURS 0,

vbeln LIKE likp-vbeln,

posnr LIKE lips-posnr,

lfdat LIKE lips-vfdat,

box(1).

INCLUDE STRUCTURE lvc_s_styl.

*handle_style type lvc_t_styl.

DATA: END OF itab.

----


  • CLASS lcl_event_handler DEFINITION

----


CLASS lcl_event_handler DEFINITION .

PUBLIC SECTION .

METHODS:

**Hot spot Handler

handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id e_column_id es_row_no,

**Handler to Check the Data Change

handle_data_changed FOR EVENT data_changed

OF cl_gui_alv_grid

IMPORTING er_data_changed

e_onf4

e_onf4_before

e_onf4_after,

**Double Click Handler

handle_double_click FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column es_row_no.

ENDCLASS. "lcl_event_handler DEFINITION

----


  • CLASS lcl_event_handler IMPLEMENTATION

----


CLASS lcl_event_handler IMPLEMENTATION.

*Handle Hotspot Click

METHOD handle_hotspot_click .

CLEAR: v_row,v_column,v_row_num.

v_row = e_row_id.

v_column = e_column_id.

v_row_num = es_row_no.

MESSAGE i000 WITH v_row 'clicked'.

ENDMETHOD. "lcl_event_handler

*Handle Double Click

METHOD handle_double_click.

CLEAR: v_row,v_column,v_row_num.

v_row = e_row.

v_column = e_column.

v_row_num = es_row_no.

IF e_column = 'VBELN'.

SET PARAMETER ID 'VL' FIELD itab-vbeln.

CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.

ENDIF.

IF e_column = 'POSNR'.

MESSAGE i000 WITH 'Click on POSNR row number ' e_row.

"with this row num you can get the data

ENDIF.

ENDMETHOD. "handle_double_click

**Handle Data Change

METHOD handle_data_changed.

DATA:stable TYPE lvc_s_stbl.

stable-row = 'X'.

stable-col = 'X'.

CALL METHOD g_grid->refresh_table_display

EXPORTING

is_stable = stable

EXCEPTIONS

finished = 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.

ENDMETHOD. "HANDLE_DATA_CHANGED

ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION

&----


*& Global Definitions

&----


DATA: g_custom_container TYPE REF TO cl_gui_custom_container,

"Container1

g_handler TYPE REF TO lcl_event_handler, "handler

g_custom_container1 TYPE REF TO cl_gui_custom_container.

"Container2

*- Fieldcatalog for First and second Report

DATA: it_fieldcat TYPE lvc_t_fcat,

x_fieldcat TYPE lvc_s_fcat,

ls_vari TYPE disvariant.

*----


  • START-OF_SELECTION

*----


START-OF-SELECTION.

SELECT vbeln

posnr

FROM lips

INTO CORRESPONDING FIELDS OF TABLE itab

UP TO 20 ROWS.

END-OF-SELECTION.

IF NOT itab[] IS INITIAL.

CALL SCREEN 100.

ELSE.

MESSAGE i002 WITH 'NO DATA FOR THE SELECTION'(004).

ENDIF.

&----


*& Form CREATE_AND_INIT_ALV

&----


  • text

----


FORM create_and_init_alv .

DATA: lt_exclude TYPE ui_functions.

"First Grid

CREATE OBJECT g_custom_container

EXPORTING container_name = g_container1.

CREATE OBJECT g_grid

EXPORTING i_parent = g_custom_container.

"Second Grid

CREATE OBJECT g_custom_container1

EXPORTING container_name = g_container2.

CREATE OBJECT g_grid1

EXPORTING i_parent = g_custom_container1.

  • Set a titlebar for the grid control

CLEAR gs_layout.

gs_layout-grid_title = text-003.

gs_layout-zebra = space.

gs_layout-cwidth_opt = 'X'.

gs_layout-no_rowmark = 'X'.

gs_layout-box_fname = 'BOX'.

gs_layout-ctab_fname = 'CELLCOLOR'.

gs_layout-stylefname = 'HANDLE_STYLE'.

CALL METHOD g_grid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

CREATE OBJECT g_handler.

SET HANDLER g_handler->handle_double_click FOR g_grid.

  • SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.

SET HANDLER g_handler->handle_data_changed FOR g_grid.

DATA: ls_outatb LIKE LINE OF itab,

v_index TYPE sy-tabix.

DATA: ls_edit TYPE lvc_s_styl,

lt_edit TYPE lvc_t_styl.

LOOP AT itab INTO ls_outatb WHERE posnr = '000010'.

v_index = sy-tabix.

ls_edit-fieldname = 'VBELN'.

ls_edit-style = cl_gui_alv_grid=>mc_style_disabled.

ls_edit-style2 = space.

ls_edit-style3 = space.

ls_edit-style4 = space.

ls_edit-maxlen = 8.

INSERT ls_edit INTO TABLE lt_edit.

INSERT LINES OF lt_edit INTO TABLE ls_outatb-handle_style.

MODIFY itab INDEX v_index FROM ls_outatb TRANSPORTING

handle_style.

ENDLOOP.

  • setting focus for created grid control

CALL METHOD cl_gui_control=>set_focus

EXPORTING

control = g_grid.

  • Build fieldcat and set editable for date and reason code

  • edit enabled. Assign a handle for the dropdown listbox.

PERFORM build_fieldcat.

  • Optionally restrict generic functions to 'change only'.

  • (The user shall not be able to add new lines).

PERFORM exclude_tb_functions CHANGING lt_exclude.

**Vaiant to save the layout

ls_vari-report = sy-repid.

ls_vari-handle = space.

ls_vari-log_group = space.

ls_vari-username = space.

ls_vari-variant = space.

ls_vari-text = space.

ls_vari-dependvars = space.

CALL METHOD g_grid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

**Calling the Method for ALV output for First Grid

CALL METHOD g_grid->set_table_for_first_display

EXPORTING

it_toolbar_excluding = lt_exclude

is_variant = ls_vari

is_layout = gs_layout

i_save = 'A'

CHANGING

it_fieldcatalog = it_fieldcat

it_outtab = itab[].

**Calling the Method for ALV output for Second Grid

CALL METHOD g_grid1->set_table_for_first_display

  • EXPORTING

  • IT_TOOLBAR_EXCLUDING = LT_EXCLUDE

CHANGING

it_fieldcatalog = it_fieldcat

it_outtab = itab[].

  • Set editable cells to ready for input initially

CALL METHOD g_grid->set_ready_for_input

EXPORTING

i_ready_for_input = 1.

ENDFORM. "CREATE_AND_INIT_ALV

&----


*& Form EXCLUDE_TB_FUNCTIONS

&----


  • text

----


  • -->PT_EXCLUDE text

----


FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.

  • Only allow to change data not to create new entries (exclude

  • generic functions).

DATA ls_exclude TYPE ui_func.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.

APPEND ls_exclude TO pt_exclude.

ENDFORM. " EXCLUDE_TB_FUNCTIONS

&----


*& Form build_fieldcat

&----


  • Fieldcatalog

----


FORM build_fieldcat .

DATA: l_pos TYPE i.

l_pos = l_pos + 1.

x_fieldcat-scrtext_m = 'Delivery'(024).

x_fieldcat-fieldname = 'VBELN'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = l_pos.

x_fieldcat-no_zero = 'X'.

x_fieldcat-edit = 'X'.

x_fieldcat-outputlen = '10'.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

l_pos = l_pos + 1.

x_fieldcat-scrtext_m = 'Item'(025).

x_fieldcat-fieldname = 'POSNR'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = l_pos.

x_fieldcat-outputlen = '5'.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

l_pos = l_pos + 1.

x_fieldcat-scrtext_m = 'Del Date'(015).

x_fieldcat-fieldname = 'LFDAT'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = l_pos.

x_fieldcat-outputlen = '10'.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

l_pos = l_pos + 1.

ENDFORM. " build_fieldcat

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'MAIN100'.

SET TITLEBAR 'MAIN100'.

IF g_custom_container IS INITIAL.

**Initializing the grid and calling the fm to Display the O/P

PERFORM create_and_init_alv.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

CASE sy-ucomm.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

Read only

0 Likes
2,239

Well , that is strange, i ran your code in my system by it went through fine without any dump.

Anyways you can try this :


DATA:BEGIN OF itab OCCURS 0,
vbeln LIKE likp-vbeln,
posnr LIKE lips-posnr,
lfdat LIKE lips-vfdat,
END OF itab.


DATA:BEGIN OF out_itab OCCURS 0,
vbeln LIKE likp-vbeln,
posnr LIKE lips-posnr,
lfdat LIKE lips-vfdat,
box(1),
handle_style TYPE lvc_t_styl,
END OF out_itab.

SELECT vbeln
posnr
FROM lips
APPENDING CORRESPONDING FIELDS OF TABLE itab
UP TO 20 ROWS.

LOOP AT itab.
  MOVE-CORRESPONDING itab TO out_itab.
  APPEND out_itab.
ENDLOOP.

It is the same effect of your earlier code, but now the target table in the select statement is more specifiic.

regards,

Advait

Read only

0 Likes
2,239

Hi

U need to use 2 different tables: one to select the data and one to be transfered to ALV:

DATA:BEGIN OF itab OCCURS 0,
            vbeln LIKE likp-vbeln,
            posnr LIKE lips-posnr,
            lfdat LIKE lips-vfdat,
            box(1),
            handle_style type lvc_t_styl,
DATA: END OF itab.

DATA: BEGIN OF T_ITAB2 OCCURS 0,
            vbeln  LIKE likp-vbeln,
            posnr LIKE lips-posnr,
            lfdat   LIKE lips-vfdat,
          END   OF T_ITAB2.

SELECT vbeln posnr vfdat UP TO 20 ROWS FROM lips INTO TABLE T_ITAB2.


LOOP AT T_ITAB2.
  ITAB-vbeln  = T_ITAB2-vbeln,
  ITAB-posnr = T_ITAB2-posnr.
  ITAB-lfdat   = T_ITAB2-vfdat.

  REFRESH ITAB-handle.
  
  lvc_s_styl-FIELDNAME = .....
  ..............................................
  APPEND  lvc_s_styl TO ITAB-HANDLE.
  APPEND ITAB-
  
ENDLOOP.

Max