2008 Jul 28 12:09 PM
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
2008 Jul 28 12:33 PM
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.
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
2008 Jul 28 12:13 PM
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
2008 Jul 28 12:15 PM
2008 Jul 28 12:13 PM
2008 Jul 28 12:16 PM
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
2008 Jul 28 12:17 PM
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
2008 Jul 28 12:33 PM
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.
2008 Aug 11 11:21 AM
pls give a solution for get customer info (customer code is gived internal)
in BADI or BTE ??
2008 Aug 13 3:37 AM
2008 Aug 13 5:17 AM
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.
2008 Aug 14 9:50 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |