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

Append ITAB

Former Member
0 Likes
780

hi,

I am trying to append username after reading FM

into a extra field of FM output.

I only see last field in output table.

TYPES: BEGIN OF out_data .
        INCLUDE STRUCTURE bxmnodes.
TYPES:      uname LIKE XTAB-uname.
TYPES: END OF out_data.
 
DATA: output_nodes_tbl LIKE bxmnodes OCCURS 0 WITH HEADER LINE .

T_ITAB has list of users..

LOOP AT t_ITAB.


      CALL FUNCTION 'FMODULE'
        EXPORTING
          user_name                = t_users-uname
          language                 = t_users-langu_p
          sort_nodes               = ' '
          generate_url             = ' '
          replace_rfc_variables    = ' '
          get_rfc_destination_type = ' '
          usage_mode               = ' '
          device                   = ' '
        TABLES
          output_nodes_and_texts   = output_nodes_tbl.
*         GENERATED_URLS                 =  .

      MOVE output_nodes_tbl[] TO t_out_data[].
      MOVE t_ITAB-uname TO t_out_data-uname.

      APPEND t_out_data.

    ENDLOOP.

Edited by: PRAVEEN s on Oct 23, 2008 9:52 PM

7 REPLIES 7
Read only

Former Member
0 Likes
744

you tryin gto append or to modify all rows with user name


MOVE t_ITAB-uname TO t_out_data-uname.
 
      APPEND t_out_data.

change to


loop at t_out_data.
MOVE t_ITAB-uname TO t_out_data-uname.
 
      modify t_out_data.
endloop.

Read only

Former Member
0 Likes
744

change the logic like this..

MOVE output_nodes_tbl[] TO t_out_data[].
"here you need to loop the t_out_data and modify the uname
 loop at t_out_data .
    t_out_data-uname =  t_ITAB-uname .
   modify t_outdata.
endloop.

Read only

0 Likes
744

I did modifications as per you recommendations.

I see only 1 user -id everytime..

I changed like this..

MOVE output_nodes_tbl[] TO t_out_data[].

      LOOP AT t_out_data.
        MOVE t_users-uname TO t_out_data-uname.

        MODIFY t_out_data TRANSPORTING uname.
      ENDLOOP.

      APPEND t_out_data.

    ENDLOOP.

Rgds

Praveen

Edited by: PRAVEEN s on Oct 23, 2008 10:35 PM

Read only

0 Likes
744
LOOP AT t_ITAB.
 
 
      CALL FUNCTION 'FMODULE'
        EXPORTING
          user_name                = t_users-uname

is it t_users or t_itab?

and also check you have duplicate entries in t_itab (you mentioned it consits of users) check it once.

Read only

0 Likes
744

Sorry my mistake ..

It is T_ITAB and it consists of list of users.

I don't have duplicate entries in this table.

Rgds

Praveen

Read only

0 Likes
744

thats what code is doing, it is nested loop, so it will show you last user id in the last row of t_ITAB. that will be the final one left in t_out_data.

you have 2 internal tables t_ITAB and t_out_data. You need to find how you wan tto update t_out_data deepnding on which entry in t_itab,

then move loop at itab statement after FM call


--
FM call
--
loop at t_itab.
loop at  t_out_data where key1 = t_itab-key1  <---condition
  MOVE t_users-uname TO t_out_data-uname.
 
        MODIFY t_out_data TRANSPORTING uname.
      ENDLOOP.
endloop

No need to for append t_out_data at the end

Read only

Former Member
0 Likes
744

Your logic appears to be faulty. The program clears out t_out_data and reloads it for each loop pass. Is that what you want?

Rob