on 04-27-2006 6:32 PM
Hi,
I have create a program that needs to call a second program sending it an internal table.
Is this possible? I know that I can use SUBMIT but I can't find the way to send it an IT to that second program.
Any Idea?
See command export.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just changed
EXPORT (IT_TABLA1) TO MEMORY ID 'TABLA'.
to
EXPORT IT_TABLA1 TO MEMORY ID 'TABLA'.
and it works now.
Thanx to all
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm trying to do this...
-
REPORT ZPRUEBA_TABLA1.
DATA: BEGIN OF IT_TABLA1 OCCURS 0,
NOMBRE(20) TYPE C,
EDAD TYPE I,
END OF IT_TABLA1.
START-OF-SELECTION.
IT_TABLA1-NOMBRE = 'JOSE'.
IT_TABLA1-EDAD = 25.
APPEND IT_TABLA1.
IT_TABLA1-NOMBRE = 'MANUEL'.
IT_TABLA1-EDAD = 18.
APPEND IT_TABLA1.
EXPORT (IT_TABLA1) TO MEMORY ID 'TABLA'.
SUBMIT ZPRUEBA_TABLA2 AND RETURN.
-
*&---------------------------------------------------------------------*
*& Report ZPRUEBA_TABLA2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Report ZPRUEBA_TABLA1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZPRUEBA_TABLA2.
DATA: BEGIN OF IT_TABLA1 OCCURS 0,
NOMBRE(20) TYPE C,
EDAD TYPE I,
END OF IT_TABLA1.
START-OF-SELECTION.
IMPORT IT_TABLA1 FROM MEMORY ID 'TABLA'.
LOOP AT IT_TABLA1.
WRITE:/ IT_TABLA1-NOMBRE.
ENDLOOP.
And it is not working, I want to receive the it_tabla1 in the second program to loop it and work with it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
I had worked on a program very similar long time back
DATA: abaplist LIKE abaplist OCCURS 0 WITH HEADER LINE.
----
*Report variant layout structure
----
*Work Area
DATA: BEGIN OF wa_iw47,
dummy TYPE c,
rmzhl(8) TYPE c, " LIKE rihafvr-rmzhl,
ernam LIKE rihafvr-ernam,
aufnr LIKE rihafvr-aufnr,
vornr LIKE rihafvr-vornr,
aueru LIKE rihafvr-aueru,
ltxa1 LIKE rihafvr-ltxa1,
grund LIKE rihafvr-grund,
SUKA SIR 10-54742 03/10/2005 Add a Creation Date field
ersda LIKE rihafvr-ersda,
END OF wa_iw47.
*Internal table
DATA i_iw47 LIKE TABLE OF wa_iw47.
----
*Temporary work area to store the information into ascii format
DATA: BEGIN OF wa,
name(3000) TYPE c,
END OF wa,
itab LIKE TABLE OF wa.
----
*Work area to have the header information
DATA: BEGIN OF wa_header,
f1(20) TYPE c VALUE 'Counter',
f2(20) TYPE c VALUE 'Created',
f3(20) TYPE c VALUE 'Order',
f4(20) TYPE c VALUE 'Operation',
f5(10) TYPE c VALUE 'FC',
f6(20) TYPE c VALUE 'Confirmation Text',
f7(20) TYPE c VALUE 'Rsn',
SUKA SIR 10-54742 03/10/2005 Add a Creation Date field
f8(20) TYPE c VALUE 'Creation Date',
END OF wa_header.
----
*Other Variables
DATA: zzlv_filename(100) TYPE c,
zzlv_tabix TYPE sytabix,
zzlv_slen TYPE i,
zzlv_datarec(3000) TYPE c,
w_event LIKE tbtco-eventid,
w_grid TYPE c.
*BEGIN: SIR 10-55315
Commented out unused code
*DATA: BEGIN OF i_rihafvr OCCURS 0.
INCLUDE STRUCTURE rihafvr.
*DATA END OF i_rihafvr.
*END: SIR 10-55315
----
*Constants
----
CONSTANTS: c_event(25) TYPE c VALUE 'ZIW47_TRANSFER_FILE',
c_grid TYPE c VALUE '1',
c_quotes TYPE c VALUE '"',
c_comma TYPE c VALUE ','.
*SIR:
PARAMETERS: p_fn(100) TYPE c LOWER CASE,
p_var(50) TYPE c,
p_event(25) TYPE c.
----
*START OF SELECTION
----
START-OF-SELECTION.
GET PARAMETER ID 'Q_ALV_GRID_INACTIVE' FIELD w_grid.
IF w_grid <> '1'.
SET PARAMETER ID 'Q_ALV_GRID_INACTIVE' FIELD c_grid.
ENDIF.
*----
*File Name Construction
*----
*CONCATENATE '/usr/sap/interface/' sy-sysid '/PlantMaintenance/IW47.CSV'
INTO zzlv_filename.
zzlv_filename = p_fn.
*Call Report and pass variant.
SUBMIT riafru20 AND RETURN
EXPORTING LIST TO MEMORY
USING SELECTION-SET p_var.
SUBMIT riafru20 AND RETURN
EXPORTING LIST TO MEMORY
USING SELECTION-SET p_var.
*Call function to read memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = abaplist
EXCEPTIONS
not_found = 1.
IF sy-subrc NE 0.
" leave program.
IF sy-batch = ''. "SIR 10-55315
WRITE: / 'RC = ', sy-subrc.
*BEGIN: SIR 10-55315
WRITE: / 'No data meets variant criteria'.
EXIT.
ELSE.
MESSAGE i398(00) WITH 'No data meets variant criteria'.
LEAVE PROGRAM.
ENDIF.
*END: SIR 10-55315
ENDIF.
*
*Convert the Memory into Ascii format
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
list_index = -1
with_line_break = ' '
TABLES
listasci = itab
listobject = abaplist
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Check data for output exists:
DESCRIBE TABLE itab LINES zzlv_tabix.
IF zzlv_tabix EQ 0.
MESSAGE i398(00) WITH 'No data to export'.
EXIT.
ENDIF.
.
----
*End Of Selection
----
END-OF-SELECTION.
PERFORM open_dataset.
*IF p_var = 'IW47_BACK' OR p_var = 'IW47_TBACK' .
IF p_var <> 'IW47_All'.
PERFORM iw47_back_header.
----
*Read data from internal table, concatenate all fields separated by a
*comma and then transfer data
----
LOOP AT i_iw47 INTO wa_iw47.
*Concatenate all fields seperated by a comma to create a CSV file
CONCATENATE : wa_iw47-rmzhl c_comma
wa_iw47-ernam c_comma
wa_iw47-aufnr c_comma
wa_iw47-vornr c_comma
wa_iw47-aueru c_comma
c_quotes wa_iw47-ltxa1 c_quotes c_comma
c_quotes wa_iw47-grund c_quotes c_comma
SUKA SIR 10-54742 03/10/2005 Add a Creation Date field
wa_iw47-ersda
INTO : zzlv_datarec.
"SEPARATED BY: ','.
PERFORM transfer_dataset.
ENDLOOP.
ELSE.
----
*Read data from internal table, concatenate all fields separated by a
*comma and then transfer data
----
LOOP AT itab INTO wa.
IF sy-tabix > 3 AND sy-tabix < zzlv_tabix .
zzlv_datarec = wa.
PERFORM transfer_dataset.
ENDIF.
ENDLOOP.
ENDIF.
----
*Close the file
CLOSE DATASET zzlv_filename.
PERFORM raise_event.
*Setting the ALV Grid
IF w_grid <> '1'.
SET PARAMETER ID 'Q_ALV_GRID_INACTIVE' FIELD w_grid.
ENDIF.
&----
*& Form IW47_BACK
&----
text
----
--> p1 text
<-- p2 text
----
FORM iw47_back_header.
----
*Concatenate header first
----
*Read the memory into internal table IW47 Report Structure
LOOP AT itab INTO wa.
IF sy-tabix > 3 AND sy-tabix < zzlv_tabix .
SPLIT wa-name AT '|' INTO wa_iw47-dummy
wa_iw47-rmzhl
wa_iw47-ernam
wa_iw47-aufnr
wa_iw47-vornr
wa_iw47-aueru
wa_iw47-ltxa1
wa_iw47-grund
SUKA SIR 10-54742 03/10/2005 Add a Creation Date field
wa_iw47-ersda.
APPEND wa_iw47 TO i_iw47.
ENDIF.
CLEAR wa.
CLEAR wa_iw47.
ENDLOOP.
*Header
CONCATENATE wa_header-f1
wa_header-f2
wa_header-f3
wa_header-f4
wa_header-f5
wa_header-f6
wa_header-f7
SUKA SIR 10-54742 03/10/2005 Add a Creation Date field
wa_header-f8 INTO zzlv_datarec SEPARATED BY ','.
PERFORM transfer_dataset.
ENDFORM. " IW47_BACK
&----
*& Form Open_dataset
&----
text
----
--> p1 text
<-- p2 text
----
FORM open_dataset.
----
*Download file onto application server
*open file
----
CATCH SYSTEM-EXCEPTIONS file_access_errors = 1.
OPEN DATASET zzlv_filename FOR OUTPUT IN TEXT MODE.
ENDCATCH.
IF sy-subrc NE 0.
MESSAGE e041(a4) WITH zzlv_filename sy-host.
ENDIF.
ENDFORM. " Open_dataset
&----
*& Form transfer_IW47_Back
&----
text
----
--> p1 text
<-- p2 text
----
FORM transfer_dataset.
zzlv_slen = strlen( zzlv_datarec ).
*Transfer header information
IF sy-batch = ''.
WRITE:/ zzlv_datarec .
ENDIF.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 1.
TRANSFER zzlv_datarec TO zzlv_filename LENGTH zzlv_slen.
IF sy-batch = ''.
WRITE:/ zzlv_datarec .
ENDIF.
ENDCATCH.
CLEAR zzlv_datarec.
CLEAR zzlv_slen.
ENDFORM. " transfer_IW47_Back
&----
*& Form Raise_event
&----
text
----
--> p1 text
<-- p2 text
----
FORM raise_event.
----
Raise Event - to execute job that will execute a shell scrip that
*will transfer the downloaded file from the SAP application server to a
*local network server.
----
w_event = c_event.
CALL FUNCTION 'BP_EVENT_RAISE'
EXPORTING
eventid = p_event
EVENTPARM = w_param
TARGET_INSTANCE = ' '
EXCEPTIONS
bad_eventid = 1
eventid_does_not_exist = 2
eventid_missing = 3
raise_failed = 4
OTHERS = 5.
*BEGIN: SIR 10-55315
Add exception check
IF sy-subrc NE 0.
IF sy-batch = ''.
WRITE: / 'File not transferred.',
'FM BP_EVENT_RAISE exception raised:',
'RC = ', sy-subrc.
ELSE.
MESSAGE e398(00) WITH 'File not transferred'
'FM BP_EVENT_RAISE exception raised: '
'RC = ' sy-subrc.
ENDIF.
ENDIF.
*END: SIR 10-55315
ENDFORM. " Raise_event
Hi Jose,
You can use SUBMIT with EXPORT option.
The syntax is as follows.
SUBMIT REPORT EXPORTING LIST TO MEMORY.
Does not display the output list of the called report, but saves it in SAP memory and leaves the called report immediately. Since the calling program can read the list from memory and process it further, you need to use the addition ... AND RETURN .
You can read the saved list from SAP memory with the function module 'LIST_FROM_MEMORY' and then (for example) store it in the database with EXPORT . You can process this list further with the function modules 'WRITE_LIST' , 'DISPLAY_LIST' .
Thanks,
Vinay
Message was edited by: Vinaykumar Gorrela
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Export the table using 'EXPORT'.
Regards,
Tanveer.
Mark helpful answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Export from calling Program and import in the called program
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
try to use export internal table to memory,and import it from memory in your submit your program.
Regards
vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There are two ways in which you can do it.
1. Easier one - EXPORT and IMPORT.
2. USe the SELECTION SCREEN of the second program to pass the data if the table contains only one field. IF you have SELECT OPTION for that field, you can declare a RANGES variable in the calling program fill it and send it to the selection screen, while calling the SUBMIT program.
If it has multiple columns, EXPORT / IMPORT is the way to go.
regards,
Ravi
Note - Please mark the helpful answers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.