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

HELP IN PERFORM

Former Member
0 Likes
515

HI,

I Do this perform like below and i have to do the same perform exactly except the structre name that is cahnging.

do i have to build another Perform or i can avoid that with some technique ?

this is my perform :

PERFORM add_nodid TABLES node_tab pr_table cost_id.

*&---------------------------------------------------------------------*
*&      Form  ADD_NODID
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_NODE_TAB  text
*      -->P_PREVIOS_TABLE  text
*      -->P_COST_ID  text
*----------------------------------------------------------------------*
FORM add_nodid  TABLES   p_node_tab TYPE  zco_level2_ttype
                         p_pr_table STRUCTURE   zhr_level_2_month_str
                         p_cost_id LIKE  cost_id .

  FIELD-SYMBOLS: <fs_id> LIKE LINE OF cost_id ,<fs_node> LIKE LINE OF p_node_tab.
  DATA: wa_cost_id LIKE LINE OF cost_id.
  FIELD-SYMBOLS: <fs_add> TYPE zhr_level_2_month_str.


  LOOP AT p_node_tab ASSIGNING <fs_node>.
    SELECT SINGLE *
      FROM /bi0/hctcenter
      INTO CORRESPONDING FIELDS  OF wa_cost_id
      WHERE nodename = <fs_node>-znodename .
    IF sy-subrc = 0.
      APPEND wa_cost_id TO p_cost_id.
      CLEAR wa_cost_id.
    ENDIF.
  ENDLOOP.



  SORT p_previos_table BY dim0calmonth nodeid.
ENDFORM.    

What is changing is the :STRUCTURE zhr_level_2_month_str**

i wont to change it to zhr_level_2_quarter_str

and not build other perform.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
490

may be you can try this...

types: cost_t_id type standard table of cost_id,
          zhr_level_2_t_month_str type standard table of  zhr_level_2_t_month_str.

FORM add_nodid  USING   p_node_tab TYPE  zco_level2_ttype
                                        p_cost_id  type  cost_t_id            <====create a table type
                         changing p_pr_table  type   zhr_level_2_t_month_str.
                           "<=========table type 




ENDFORM.

3 REPLIES 3
Read only

Former Member
0 Likes
491

may be you can try this...

types: cost_t_id type standard table of cost_id,
          zhr_level_2_t_month_str type standard table of  zhr_level_2_t_month_str.

FORM add_nodid  USING   p_node_tab TYPE  zco_level2_ttype
                                        p_cost_id  type  cost_t_id            <====create a table type
                         changing p_pr_table  type   zhr_level_2_t_month_str.
                           "<=========table type 




ENDFORM.

Read only

0 Likes
490

Hi Vijay ,

thanks, but i think u miss understood me ,

i wont to change just the structure type (the are different) in the form ,

i can build another perform but maybe there is other way?

i fm 1

PERFORM add_nodid TABLES node_tab pr_table cost_id.

FORM add_nodid TABLES p_node_tab TYPE zco_level2_ttype

p_pr_table STRUCTURE zhr_level_2_month_str

p_cost_id LIKE cost_id .

exactly same code

in fm 2

PERFORM add_nodid TABLES node_tab pr_table cost_id.

FORM add_nodid TABLES p_node_tab TYPE zco_level2_ttype

p_pr_table STRUCTURE zhr_level_3_month_str

p_cost_id LIKE cost_id .

exactly same code

Regards

Read only

0 Likes
490

ok, in that case inside routine implementation how you going to handle differently the same internal table.

FORM add_nodid TABLES p_node_tab TYPE zco_level2_ttype
                                       p_pr_table         "Don't refer any structure here..
                                       p_cost_id LIKE cost_id .


endform.