‎2009 Feb 06 4:45 AM
Hi All,
I am using an IMPORT statement to get all the data from other report's internal table. Now whenever this (the other report's internal table) is changed (for field addition, etc), my report throws a dump. Hence, everytime I have to add these fields in my program as well.
Is there any way by which I can include the whole internal table of that report in my program just like
'INCLUDE STRUCTURE VBRK'.
Thanks in advance
‎2009 Feb 06 4:49 AM
Hi,
Well you can create a Z structure same like the internal table.
Modify the 1st program to define internal table of type Z structure & similarly modify your program to define internal table of type Z structure.
Best regards,
Prashant
‎2009 Feb 06 4:49 AM
Hi,
Well you can create a Z structure same like the internal table.
Modify the 1st program to define internal table of type Z structure & similarly modify your program to define internal table of type Z structure.
Best regards,
Prashant
‎2009 Feb 06 4:55 AM
Hi,
Inorder to keep those values it' better to use an select-options or ranges statement in your program.
Means whenever u trying to import the values u just use these ranges statement to append those values in to your program...then u wont get any problems like dump...
Regards
Kiran
‎2009 Feb 06 4:57 AM
Hi,
Either you can create the Z structure for this and use in bith the programs or you can create the common TOP include where you can declare all the common declaration between both the program.
Any change in the declaration will effect the both programs.
‎2009 Feb 06 4:58 AM
‎2009 Feb 06 5:00 AM
‎2009 Feb 06 5:00 AM
HI,
Types:
T_STRUCT TYPE SPFLI.
Data:
ITAB TYPE STANDARD TABLE OF T_STRUCT.
This will solve the issue.
Regards,
Gurpreet
‎2009 Feb 06 5:02 AM
Hi, CHeck this code related to your problem..This will helpful to you...
I have done this program earlier..I hope it will helpful to u..
This programa calling the other program to import the data..
Check it out...
*" Tables declarations.................................................
TABLES:
spfli.
*" Type declarations...................................................
"----
Type declaration of the structure to hold data from table SPFLI *
"----
TYPES:
BEGIN OF type_s_spfli,
carrid LIKE spfli-carrid, " Carrier Id
connid LIKE spfli-connid, " Connection Number
cityfrom LIKE spfli-cityfrom, " City from
cityto LIKE spfli-cityto, " City to
airpfrom LIKE spfli-airpfrom, " Airport from
airpto LIKE spfli-airpto, " Airport to
countryfr LIKE spfli-countryfr, " Country from
countryto LIKE spfli-countryto, " Country to
END OF type_s_spfli.
Data Declaration...................................................*
----
Field String To Hold Flight Details Record from SPFLI *
----
DATA
fs_spfli TYPE type_s_spfli.
Data Declaration...................................................*
----
Internal Table To Hold Flight Details Records from SPFLI *
----
DATA
t_spfli LIKE STANDARD TABLE OF fs_spfli.
TYPES:
BEGIN OF types_s_itab,
carrid LIKE sflight-carrid, " Carrier id
connid LIKE sflight-connid, " Connection number
fldate LIKE sflight-fldate, " Flight date
END OF types_s_itab.
Data Declaration...................................................*
----
Field String To Hold Flight Details Record from SFLIGHT *
----
DATA
fs_itab TYPE types_s_itab.
Data Declaration...................................................*
----
Internal Table To Hold Flight Details Records from SFLIGHT *
----
DATA
t_itab LIKE STANDARD TABLE OF fs_itab.
*" Type declarations...................................................
"----
Type declaration of the structure to hold data from table SBOOK *
"----
TYPES:
BEGIN OF type_s_sbook,
carrid LIKE sbook-carrid, " Carrier Id
connid LIKE sbook-connid, " Connection Number
fldate LIKE sbook-fldate, " Flight date
bookid LIKE sbook-bookid, " Booking number
loccuram LIKE sbook-loccuram, " Local currency
loccurkey LIKE sbook-loccurkey,
order_date LIKE sbook-order_date, " Booking date
END OF type_s_sbook.
Data Declaration...................................................*
----
Field String To Hold Flight Details Record from BOOK *
----
DATA
fs_sbook TYPE type_s_sbook.
Data Declaration...................................................*
----
Internal Table To Hold Flight Details Records from SBOOK *
----
DATA
t_sbook LIKE STANDARD TABLE OF fs_sbook.
DATA
w_checkbox. " Checkbox
SELECT-OPTIONS:
s_carr FOR spfli-carrid. " Carrier id range
"----
START-OF-SELECTION EVENT *
"----
START-OF-SELECTION.
PERFORM selectq.
"----
END-OF-SELECTION EVENT *
"----
END-OF-SELECTION.
SET PF-STATUS 'YH1314_030502'.
PERFORM display_basic.
AT USER-COMMAND.
PERFORM ucomm.
&----
*& Form selectq
&----
This subroutine retreive data from SPFLI table
----
There are no interface parameters to be passed to this subroutine.
----
FORM selectq .
SELECT carrid " Carrier id
connid " Connection number
cityfrom " City from
cityto " City to
airpfrom " Airport from
airpto " Airport to
countryfr " Country from
countryto " Country to
INTO CORRESPONDING FIELDS OF TABLE t_spfli
FROM spfli
WHERE carrid IN s_carr.
ENDFORM. " Selectq
&----
*& Form display_basic
&----
This subroutine displays data from internal table
----
There are no interface parameters to be passed to this subroutine.
----
FORM display_basic .
LOOP AT t_spfli INTO fs_spfli.
WRITE:
/ w_checkbox AS CHECKBOX,
fs_spfli-carrid,
fs_spfli-connid,
fs_spfli-cityfrom,
fs_spfli-cityto,
fs_spfli-airpfrom,
fs_spfli-airpto,
fs_spfli-countryfr,
fs_spfli-countryto.
ENDLOOP. " LOOP AT T-SPFLI INTO...
ENDFORM. " Display_basic
&----
*& Form UCOMM
&----
This subroutine for at user-command event
----
There are no interface parameters to be passed to this subroutine.
----
FORM ucomm .
RANGES :
r_carr FOR spfli-carrid,
r_conn FOR spfli-connid,
r_carrid FOR sflight-carrid,
r_connid FOR sflight-connid,
r_fldate FOR sflight-fldate.
CASE sy-ucomm.
WHEN 'DISPLAY'.
DATA:
lw_lines TYPE i,
lw_lineno TYPE i VALUE 3.
DESCRIBE TABLE t_spfli LINES lw_lines.
DO lw_lines TIMES.
READ LINE lw_lineno FIELD
VALUE w_checkbox INTO w_checkbox
fs_spfli-carrid INTO fs_spfli-carrid
fs_spfli-connid INTO fs_spfli-connid.
IF sy-subrc = 0.
IF w_checkbox = 'X'.
r_carr-sign = 'I'.
r_carr-option = 'EQ'.
r_carr-low = fs_spfli-carrid.
APPEND r_carr.
r_conn-sign = 'I'.
r_conn-option = 'EQ'.
r_conn-low = fs_spfli-connid.
APPEND r_conn.
ENDIF. " IF W_CHECKBOX = 'X'
ENDIF. " IF SY-SUBRC = 0
ADD 1 TO lw_lineno.
ENDDO. " DO LW_LINES TIMES
SUBMIT yh1314_030502_call
WITH s_carr IN r_carr
WITH s_conn IN r_conn
AND RETURN.
IMPORT t_itab FROM MEMORY ID 'YH1314'.
LOOP AT t_itab INTO fs_itab.
r_carrid-sign = 'I'.
r_carrid-option = 'EQ'.
r_carrid-low = fs_itab-carrid.
APPEND r_carrid.
r_connid-sign = 'I'.
r_connid-option = 'EQ'.
r_connid-low = fs_itab-connid.
APPEND r_connid.
r_fldate-sign = 'I'.
r_fldate-option = 'EQ'.
r_fldate-low = fs_itab-fldate.
APPEND r_fldate.
ENDLOOP. " LOOP AT T_ITAB INTO.....
SELECT carrid " Carriee Id
connid " Connection number
fldate " Flight date
bookid " Booking number
loccuram " Local Currency
order_date " Booking date
INTO CORRESPONDING FIELDS OF TABLE t_sbook
FROM sbook
WHERE carrid IN r_carrid AND
connid IN r_connid AND
fldate IN r_fldate.
IF SY-SUBRC NE 0.
MESSAGE 'NO RECORDS FOUND'(006) TYPE 'S'.
ENDIF. " IF SY-SUBRC NE 0
LOOP AT t_sbook INTO fs_sbook.
AT FIRST.
WRITE: /5 'Carrier Id'(001),
20 'Conn Id'(002),
35 'Flight date'(003),
50 'Book Id'(004),
65 'Local Currency'(005).
ENDAT. " AT FIRST
WRITE: /5 fs_sbook-carrid,
20 fs_sbook-connid,
35 fs_sbook-fldate,
50 fs_sbook-bookid,
65 fs_sbook-loccuram CURRENCY fs_sbook-loccurkey.
ENDLOOP. " LOOP AT T_SBOOK INTO.....
ENDCASE. " CASE SY-UCOMM
ENDFORM. " UCOMM
Regards
Kiran
‎2009 Feb 06 5:07 AM
Hi,
Whenever u are using export ,import make sure that the internal table which you are using in both reports are same in name,datatype and structure.
Copy the same structure from report into another report.
This works fine.
‎2009 Feb 06 5:18 AM
Guys, you are not understanding my problem. Import/Export is working absolutly fine in my case. What I am saying is instead of changing MY program's internal table everytime the other gets changed, is it possible in realtime where I don't need to add/change the fields in my report's internal table everytime.
Kiran Saka - Your report is good, but what if in 'YH1314' one more field is added? You'll have to add it in 'types_s_itab' yourself right?
TOP Include makes more sense
Thanks anyways guys
‎2009 Feb 06 5:21 AM
null
Edited by: Viquar Iqbal on Feb 6, 2009 6:23 AM
Edited by: Viquar Iqbal on Feb 6, 2009 6:23 AM
‎2009 Feb 06 5:37 AM
Hi,
Try by declaring the types in the program of standard table type.
Regards,
Rajani
‎2009 Feb 06 10:13 AM
hi ,
You hv to maintain the same structure of table in both calling program and called one.
the other way u can do is to create a ztable structure in se11 and declare tables of that type in both the programs and each time u cn modify the ztable structure.
Regards,
Mdi.Deeba Najam.