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: 

Move-corresponding

Former Member
0 Kudos

HI guys,

I have created a dynamic internal table using CALL METHOD cl_alv_table_create=>create_dynamic_table and assigning to <FS>.

At the end of nested select statement , move-corresponding table to <itab> is used. It is giving me syntac error telling that <itab> does not have header line.

I am attaching my code. please help.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = it_fcat

IMPORTING

ep_table = it_content.

IF sy-subrc = 0.

ASSIGN it_content->* TO <i_tab>.

  • ASSIGN it_content->* TO <n_tab>.

ELSE.

WRITE: 'Error creating internal table'.

STOP.

ENDIF.

  • CREATE DATA new_line LIKE LINE OF <i_tab>.

  • Assign

SELECT * FROM jhaea CLIENT SPECIFIED

WHERE mandt = sy-mandt

AND e_termin IN s_termin

AND (where_jhaea-where_tab).

CHECK sy-subrc = 0.

SELECT SINGLE * FROM jhak CLIENT SPECIFIED

WHERE mandt = sy-mandt

AND avm_nr = jhaea-avm_nr

AND vkorg IN p_vkorg

AND (where_jhak-where_tab).

CHECK sy-subrc = 0.

MOVE-CORRESPONDING jhak TO new_line.

MOVE-CORRESPONDING jhaea TO <itab>.

APPEND <itab>.

7 REPLIES 7

Former Member
0 Kudos

Hi Harsha Then Do one thing,

Just SAy Append <itab> to <itab>[].

Bye

Murthy

Former Member
0 Kudos

What r u trying to move??

where is internal table?

u said select single * from Jhak??

i hope iam not wrong

Former Member
0 Kudos

HI,

give the declaration for itab like this...

field-symbols :<itab> type table.

Madhavi

Former Member
0 Kudos

Hi

Your code should be:

DATA: it_content TYPE REF TO DATA,
            new_line   TYPE REF  TO DATA.

FIELD-SYMBOLS: <i_tab> TYPE TABLE,
               <w_tab> TYPE ANY. 

CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
        it_fieldcatalog = it_fcat
    IMPORTING
        ep_table = it_content.
    IF sy-subrc = 0.
      ASSIGN it_content->* TO <i_tab>.
      CREATE DATA new_line LIKE LINE OF <i_tab>.
      ASSIGN new_line->*   TO <w_tab>.
   ELSE.
     WRITE: 'Error creating internal table'.
     STOP.
   ENDIF.

   SELECT * FROM jhaea CLIENT SPECIFIED
               WHERE mandt = sy-mandt
                     AND e_termin IN s_termin
                      AND (where_jhaea-where_tab).
   CHECK sy-subrc = 0.
   SELECT SINGLE * FROM jhak CLIENT SPECIFIED
               WHERE mandt = sy-mandt
                     AND avm_nr = jhaea-avm_nr
                     AND vkorg IN p_vkorg
                     AND (where_jhak-where_tab).

   CHECK sy-subrc = 0.
   MOVE-CORRESPONDING jhak  TO <w_itab>.
   MOVE-CORRESPONDING jhaea TO <w_itab>.
   APPEND <w_itab> TO <i_tab>.

Max

0 Kudos

HI Max,

Thanks for reply. I am having same problem as before, this I had tried earlier too.

See the sample code again.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = it_fcat

IMPORTING

ep_table = it_content.

IF sy-subrc = 0.

ASSIGN it_content->* TO <i_tab>.

CREATE DATA new_line LIKE LINE OF <i_tab>.

ASSIGN new_line->* TO <w_tab>.

ELSE.

WRITE: 'Error creating internal table'.

STOP.

ENDIF.

SELECT * FROM jhaea CLIENT SPECIFIED

WHERE mandt = sy-mandt

AND e_termin IN s_termin

AND (where_jhaea-where_tab).

CHECK sy-subrc = 0.

SELECT SINGLE * FROM jhak CLIENT SPECIFIED

WHERE mandt = sy-mandt

AND avm_nr = jhaea-avm_nr

AND vkorg IN p_vkorg

AND (where_jhak-where_tab).

CHECK sy-subrc = 0.

MOVE-CORRESPONDING jhak TO <w_tab>.

We have to make <w_tab> with header line.

Please help.

Harsha

former_member283648
Participant
0 Kudos

Hi,

You first define itab as any table. also declare a table line for this table. then try to move JHAEA values by using ASSIGN statement. then try to append the values to itab.

0 Kudos

Thanks,

It does not work as <i_tab> as any , it has to declared

FIELD-SYMBOLS: <i_tab> TYPE table ,

<n_tab> TYPE table ,

<w_tab> TYPE ANY.

Regards,

Harsha