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

how to pass the internal table value to method

Former Member
0 Likes
946

hi friends

how to pass the internal table value to method .

regards

pauldharma

hi friends

how to pass the internal table value to method .

regards

pauldharma

7 REPLIES 7
Read only

Former Member
0 Likes
925

Are you looking for this??

Loop at itab.

call method class=>method exporting value = itab-field1

importing xxxx = xxxx.

endloop.

Read only

0 Likes
925

how to pass the internal table value to method but not used with in the loop statement

Read only

Former Member
0 Likes
925

Hi,

To pass the values to a function or variable or what ever it is from internal table means we want to use loop/endloop.

Loop at <internal table>

inside u can trnsfer the values

endloop.

REWARd if useFUL

Read only

0 Likes
925

how to pass the internal table value to method but not used with in the loop statement

Read only

Former Member
0 Likes
925

Hi,

See this example coding..

data : IT_PARTMP LIKE ZGLGRPDEF OCCURS 0 WITH HEADER LINE,
 IT_GLMTMP LIKE ZGLMASTER OCCURS 0 WITH HEADER LINE.

PERFORM UPLOAD_MAST TABLES IT_GLTEMP .

    PERFORM UPLOAD_MAST TABLES IT_PARTEMP.

FORM UPLOAD_MAST  TABLES ITAB .
  CALL FUNCTION 'UPLOAD'
    EXPORTING
      FILENAME                = 'c:\'
      FILETYPE                = 'DAT'
    TABLES
      DATA_TAB                = ITAB
    EXCEPTIONS
      CONVERSION_ERROR        = 1
      INVALID_TABLE_WIDTH     = 2
      INVALID_TYPE            = 3
      NO_BATCH                = 4
      UNKNOWN_ERROR           = 5
      GUI_REFUSE_FILETRANSFER = 6
      OTHERS                  = 7.
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV
endif.

Regards,

Balakumar.G.

Reward Points if Helpful.

Read only

Former Member
0 Likes
925

Hi,

see this example.


CLASS cls DEFINITION.
  PUBLIC SECTION.
  TYPES:t_mara TYPE TABLE OF mara.
  METHODS:meth IMPORTING mats TYPE t_mara.
ENDCLASS.

CLASS cls IMPLEMENTATION.
  METHOD meth.
    DATA:wa_mara TYPE mara.
    LOOP AT mats INTO wa_mara.
      write:/ wa_mara-matnr.
    ENDLOOP.
  ENDMETHOD.
ENDCLASS.


START-OF-SELECTION.
DATA:obj TYPE REF TO cls.
CREATE OBJECT obj.

DATA:itab like TABLE OF mara.
SELECT * from mara into table itab UP TO 10 rows.
CALL METHOD obj->meth
  EXPORTING mats = itab.

rgds,

bharat.

Read only

0 Likes
925

thanks friend

regards

pauldharma