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 access other program's internal table

Former Member
0 Likes
3,087

Experts:

how to read other program ' s internal table ?

I use BTE to do some things. But i do not know how to access internal table in other program.

for example :

I use BTE 'CRM0_200' to get customer info , I can get kna1 ,but how to get adr6 and adrc ???

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,291

data : text(50).

field-symbols : <fs> type any.

text = '(SAPMF02D)ADRC'.

assign (text) to <fs>.

if sy-subrc = 0.

here <fs> will contain the value of ADRC.

endif.

Here the concept is '(PROG NAME)TABLE/STRUCTURE NAME of the program which you want to access'. So as per your requirement you may have to change the STRUCTURE or TABLE NAME as per your requirement.

data : text(50).

field-symbols : <fs> type any.

text = '(SAPMF02D)ADRC'.

assign (text) to <fs>.

if sy-subrc = 0.

here <fs> will contain the value of ADRC.

endif.

Here the concept is '(PROG NAME)TABLE/STRUCTURE NAME of the program which you want to access'. So as per your requirement you may have to change the STRUCTURE or TABLE NAME as per your requirement.

10 REPLIES 10
Read only

Former Member
0 Likes
2,291

hi,

Try this.

Export table <itab> to Memory ID 'ABC'.

In the Calling program use.

Import table <itab> from Memory id 'ABC'.

Regards

Sumit Agarwal

Read only

0 Likes
2,291

I can not edit SAP's program like 'xd01'

Read only

Former Member
0 Likes
2,291

pls help

Read only

Former Member
0 Likes
2,291

Hii!

Check out these two sample codes. Here I'm transferring table t_spfli to memory Id 'ABC'. and then I'm retrieving this table from same memory Id in program 2.

PROGRAM1


REPORT  z_abap_memory.
DATA:
  w_carrid TYPE spfli-carrid,
  BEGIN OF fs_spfli,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    fltime LIKE spfli-fltime,
  END OF fs_spfli.
DATA:
  t_spfli LIKE
    TABLE OF
          fs_spfli.

SELECT-OPTIONS:
  s_carrid FOR w_carrid.

START-OF-SELECTION.
  PERFORM get_spfli.
  PERFORM disp_spfli.
AT LINE-SELECTION.
  IF sy-lsind EQ 1.
    EXPORT t_spfli TO MEMORY ID 'ABC'.
    SUBMIT z_ABAP_MEMORY1 AND RETURN.
  ENDIF.
END-OF-SELECTION.
  PERFORM disp_spfli.
*&---------------------------------------------------------------------*
*&      Form  get_spfli
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_spfli .
  SELECT carrid
         connid
         fltime
    FROM spfli
    INTO TABLE t_spfli
   WHERE carrid IN s_carrid.

ENDFORM.                    " get_spfli
*&---------------------------------------------------------------------
*
*&      Form  disp_spfli
*&---------------------------------------------------------------------
*
*       text
*----------------------------------------------------------------------
*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------
*
FORM disp_spfli .
  LOOP AT t_spfli INTO fs_spfli.
    WRITE: / fs_spfli-carrid,
             fs_spfli-connid,
             fs_spfli-fltime.
  ENDLOOP.
  HIDE:
    fs_spfli-carrid,
    fs_spfli-connid.
ENDFORM.                    " disp_spfli

PROGRAM 2


REPORT  z_abap_memory1.

DATA:
  BEGIN OF fs_spfli,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    fltime LIKE spfli-fltime,
  END OF fs_spfli,
  fs_fl LIKE fs_spfli.
DATA:
  BEGIN OF fs_flight,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
  END OF fs_flight.

DATA:
  t_spfli LIKE
    TABLE OF
          fs_spfli.

DATA:
  t_fl LIKE t_spfli.

DATA:
  t_flight LIKE
     TABLE OF
           fs_flight.

IMPORT t_spfli FROM MEMORY ID 'ABC'.
t_fl = t_spfli.

SELECT carrid
       connid
       fldate
  FROM sflight
  INTO TABLE t_flight
  FOR ALL ENTRIES IN t_spfli
 WHERE carrid = t_spfli-carrid
   AND connid = t_spfli-connid.


LOOP AT t_flight INTO fs_flight.
  WRITE: / fs_flight-carrid,
           fs_flight-connid,
           fs_flight-fldate.
ENDLOOP.

Regards

Abhijeet

Read only

Former Member
0 Likes
2,291

Hi Geng,

You can achieve this by using Export and Import parameters:

Check this link:

http://www.sap-img.com/ab020.htm

check this link for sample program on Export:

http://saplab.blogspot.com/2007/10/sample-abap-program-to-export-list-to_18.html

Hope this helps you.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
2,292

data : text(50).

field-symbols : <fs> type any.

text = '(SAPMF02D)ADRC'.

assign (text) to <fs>.

if sy-subrc = 0.

here <fs> will contain the value of ADRC.

endif.

Here the concept is '(PROG NAME)TABLE/STRUCTURE NAME of the program which you want to access'. So as per your requirement you may have to change the STRUCTURE or TABLE NAME as per your requirement.

Read only

0 Likes
2,291

pls give a solution for get customer info (customer code is gived internal)

in BADI or BTE ??

Read only

0 Likes
2,291

pls

Read only

0 Likes
2,291

Hi,

For XD01 transaction u have user exit EXIT_SAPMF02D_001.

In this u have all the internal tables available.

In this user exit.

Export table <itab> to Memory ID 'ur (T-code)'.

In the Calling program use.

Import table <itab> from Memory id 'ur (T-code)'.

Instead of ITAB use internal table what ever u want.

and for memeory id try to use ur t-code so that it

will not over write with other.

Read only

Former Member
0 Likes
2,291

I use badi 'address_update'