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

problem with perform on passing internal table

Former Member
0 Likes
2,565

hi ,

i have this code .

TYPES: BEGIN OF zt_temp,
        vbeln TYPE vbeln_va,  "Sales Document
        posnr TYPE posnr_va,  "Sales Document Item
       END OF zt_temp.

DATA : ist_temp2 TYPE TABLE OF ZT_temp.
PERFORM get_so_char_alt TABLES ist_temp2.

form GET_SO_CHAR_ALT  tables p_ist_temp2 structure zt_temp .
  
    abd..
endform .

in the perform i gets error structure zt_temp is unknown . also i have to pass 2 internal tables to this perform how can i do it ?

Plz help ...... is there any other way to do it ? can i sue changing on internal tables ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,388

Hi,

Use the below declartion for FORM and ENDFROM

form GET_SO_CHAR_ALT tables p_ist_temp2 TYPE zt_temp .

abd..

endform .

Instead of structure define it as a TYPE it will solve ur problem.

hi ,

i have this code .

TYPES: BEGIN OF zt_temp,
        vbeln TYPE vbeln_va,  "Sales Document
        posnr TYPE posnr_va,  "Sales Document Item
       END OF zt_temp.

DATA : ist_temp2 TYPE TABLE OF ZT_temp.
PERFORM get_so_char_alt TABLES ist_temp2.

form GET_SO_CHAR_ALT  tables p_ist_temp2 structure zt_temp .
  
    abd..
endform .

in the perform i gets error structure zt_temp is unknown . also i have to pass 2 internal tables to this perform how can i do it ?

Plz help ...... is there any other way to do it ? can i sue changing on internal tables ?

14 REPLIES 14
Read only

Former Member
0 Likes
2,388

Try sommenthing like following

TYPES: BEGIN OF zt_temp,
        vbeln TYPE vbeln_va,  "Sales Document
        posnr TYPE posnr_va,  "Sales Document Item
       END OF zt_temp.
TYPES : tbl_zt_termp    TYPE TABLE OF zt_temp.
DATA  : ist_temp2       TYPE          tbl_zt_termp,
              ist_temp3       TYPE          tbl_zt_termp.

PERFORM get_so_char_alt TABLES        ist_temp2
                                      ist_temp3.                                                       

form GET_SO_CHAR_ALT  tables p_ist_temp2 TYPE  tbl_zt_termp 
                             p_ist_temp3 TYPE  tbl_zt_termp.


endform .

Read only

Former Member
0 Likes
2,389

Hi,

Use the below declartion for FORM and ENDFROM

form GET_SO_CHAR_ALT tables p_ist_temp2 TYPE zt_temp .

abd..

endform .

Instead of structure define it as a TYPE it will solve ur problem.

Read only

0 Likes
2,388

will it change my internal table according to changes done in perform .?

I mean im using tables statement so whether it will change my internal table or will keep as it is .?

Read only

0 Likes
2,388

Generally changes to TABLES, CHANGING parameters will reflect in the passed parameter, unless it is passed by VALUE and form executes incorrectly.

But in your case this is similar to writting CHANGES with correct table typing.

Regards

Marcin

Read only

0 Likes
2,388

so what i should do ? what to use ? i need to change the contents of internal table im passing .....

plz write some statements for my code.

Regards .

Read only

0 Likes
2,388

Hi,

Report ztest.
" Just Execute this and Check
DATA : carrid TYPE sflight-carrid VALUE 'AA',
       connid TYPE sflight-connid VALUE '0017'.

DATA : itab TYPE TABLE OF sflight WITH HEADER LINE.
DATA : jtab TYPE TABLE OF spfli WITH HEADER LINE.


PERFORM get_data TABLES itab 
               jtab " U can add second table like this
                 USING carrid " Two Parameters like this
                       connid.

FORM get_data  TABLES   p_itab STRUCTURE sflight
                        p_jtab STRUCTURE spfli
                       USING    p_carrid
                        p_connid.
  SELECT * FROM sflight INTO TABLE itab
    WHERE carrid = carrid
    AND   connid = connid.
  IF sy-subrc = 0.
    LOOP AT itab.
      WRITE :/ itab-carrid,
               itab-connid.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " get_data

Cheerz

Ram

Read only

Former Member
0 Likes
2,388

Hi,

You can use 'Changing' and you can pass 2 tables separated by a space.

Thanks

Mani

Read only

MarcinPciak
Active Contributor
0 Likes
2,388

These statements are equal, meaning there is no difference in using one of them


TYPES: BEGIN OF zt_temp,
        vbeln TYPE vbeln_va,  "Sales Document
        posnr TYPE posnr_va,  "Sales Document Item
       END OF zt_temp.
TYPES: ztt_temp type table of zt_temp.

"First call with TABLES


PERFORM get_so_char_alt TABLES ist_temp2.
 
form GET_SO_CHAR_ALT  tables p_ist_temp2 type ztt_temp.
...
endform .

"Second call with CHANGING


PERFORM get_so_char_alt CHANGING ist_temp2.
 
form GET_SO_CHAR_ALT  changing p_ist_temp2 type ztt_temp.
...
endform .

Regards

Marcin

Read only

0 Likes
2,388

its giving error at form GET_SO_CHAR_ALT tables p_ist_temp2 type ztt_temp.

Read only

0 Likes
2,388

as it is not table

of type standard table of

so getting error what to do ?

Read only

0 Likes
2,388

You are not too specific about what the error says and how your code looks like. Do you really expect we can help you based on shred of information you provide each time.

Read only

0 Likes
2,388

Thanks all for your replies !! Marcin gave very helpful suggestion .

Read only

Former Member
0 Likes
2,388

hi ujjwal,

in perform yuo can pass parameters in three ways-- using,changing and tables.

if you only want to use the parameter and dont want to change it then you can pass it with using,

if you wnt to change it then you have to pass it with changing , u can also pass table in changing parameter,

if you want to work with table,then you can pass it with tables also you can change the value of table with table

you can pass as many table as you want.


TYPES: BEGIN OF zt_temp,
        vbeln TYPE vbeln_va,  "Sales Document
        posnr TYPE posnr_va,  "Sales Document Item
       END OF zt_temp.
 
DATA : wa_temp2 TYPE  ZT_temp,
            ist_temp2 like standard  TABLE OF wa_temp2.
PERFORM get_so_char_alt TABLES ist_temp2  ist_temp3.
 
form GET_SO_CHAR_ALT  tables p_ist_temp2 like ist_temp2
                                                       p_ist_temp3 like ist_temp2.
  
    abd..
endform .

you can pass as many tables you want.

hope this post helps you.

thanks

Tanmaya

Read only

Former Member
0 Likes
2,388

thanks all for posts !