‎2006 May 04 6:04 AM
Hi All,
I want to submit my program X data to Program Y and from there I want to pass the Y program data to spool can any one Please help me out .
Regards,
PAVAN.
‎2006 May 04 6:08 AM
Hi Pavan,
You can use the following syntax,
SUBMIT {rep|(name)} [selscreen_options]
[ list_options ]
[ job_options]
[AND RETURN].
with Regards,
Nelson
‎2006 May 04 6:08 AM
Hi Pavan,
You can use the following syntax,
SUBMIT {rep|(name)} [selscreen_options]
[ list_options ]
[ job_options]
[AND RETURN].
with Regards,
Nelson
‎2006 May 04 6:09 AM
Thanks for your Quick Response .
then how to submit that to Spool .
If there is any code available that will really help me
Regards,
Pavan.
‎2006 May 04 6:10 AM
HI pavan,
1.
I want to pass the Y program data to spool can
For that we have to use the extension of submit statement
EXPORTING LIST TO MEMORY
(just see F1 help on submit)
submit zprog exporting list to memory.
regards,
amit m.
‎2006 May 04 6:23 AM
‎2006 May 04 6:10 AM
Hi,
You can submit the program Y from X using the SUBMIT statement and you can also pass the selection parameters.
As you are doing this in the background, it will generate a spool for the output of program Y.
Regards,
Ravi
‎2006 May 04 6:40 AM
Hai Pavan
go through this document for Submit
SUBMIT rep.
Additions
1. ... LINE-SIZE col
2. ... LINE-COUNT lin
3. ... TO SAP-SPOOL
4. ... VIA SELECTION-SCREEN
5. ... AND RETURN
6. ... EXPORTING LIST TO MEMORY
7. ... USER user VIA JOB job NUMBER n
8. ... Various additions for parameter transfer to rep
9. ... USING SELECTION-SETS OF PROGRAM prog
Effect
Calls the report rep . Leaves the active program and starts the new report rep .
Addition 1
... LINE-SIZE col
Effect
Prints the report with the line width col .
Addition 2
... LINE-COUNT lin
Effect
Prints the report with lin lines (per page).
Addition 4
... VIA SELECTION-SCREEN
Effect
Displays the selection screen for the user. In this case, the selection screen is redisplayed after return from the report list display - the user's entries are retained.
Addition 5
... AND RETURN
Effect
Returns to the calling transaction or program after the called program has been executed. SUBMIT ... AND RETURN creates a new internal mode .
Addition 6
... EXPORTING LIST TO MEMORY
Effect
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 . Also, since the called report cannot be requested for printing, the addition ... TO SAP-SPOOL is not allowed here. 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' ... of the function group "SLST" .
Addition 7
... USER user VIA JOB job NUMBER n
Effect
Schedules the specified report in the job specified by the job name job and the job number n . The job runs under the user name user and you can omit the addition USER user . The assignment of the job number occurs via the function module JOB_OPEN (see also the documentation for the function modules JOB_CLOSE and JOB_SUBMIT . This addition can only be used with the addition ...AND RETURN .
Note
When scheduling a report with the SUBMIT ... VIA JOB job NUMBER n statement, you should always use the addition ...TO SAP-SPOOL to pass print and/or archive parameters. Otherwise, default values are used to generate the list and this disturbs operations in a production environment.
Addition 9
... USING SELECTION-SETS OF PROGRAM prog
Effect
Uses variants of the program prog when executing the program rep .
Note
Important
The programs prog and rep must have the same SELECT-OPTIONS and PARAMETER s. Otherwise, variants of the program prog may be destroyed.
Note
When using this addition, the specified variant vari of the program prog is taken in USING SELECTION-SET vari . On the other hand, all variant-related actions on the selection screen of rep (Get , Save as variant , Display , Delete ) refer to the variants of prog .
Example
SUBMIT REPORT01
VIA SELECTION-SCREEN
USING SELECTION-SET 'VARIANT1'
USING SELECTION-SETS OF PROGRAM 'REPORT00'
AND RETURN.
Effect
Executes the program REPORT01 with the variant VARIANT1 of the program REPORT00 .
Note
Runtime errors
LOAD_PROGRAM_NOT_FOUND : The specified program was not found.
SUBMIT_WRONG_TYPE : The specified program is not a report.
SUBMIT_IMPORT_ONLY_PARAMETER : Only one value passed to a report parameter.
SUBMIT_WRONG_SIGN : Invalid value passed to a selection with the addition SIGN .
SUBMIT_IN_ITAB_ILL_STRUCTURE : Table passed to a selection with WITH sel IN itab had an unexpected structure.
Try with this Example
Data: listobject like abaplist occurs 1 with header line.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1 .
IF sy-subrc <> 0.
message ID '61' TYPE 'E' NUMBER '731'
with 'LIST_FROM_MEMORY'.
ENDIF.
Thanks & regards
Sreenivasulu P
‎2006 May 04 7:45 AM
Iam ablr to export and import the data also but unable to get that value.
Means in Program X if I Export to memory id
then syst-subrc = 0.
while in Importing also the syst-subrc value is 0
after Import statement
but unable to copy that value for that variable.
I required Ur help.
With Regards,
PAVAN..
‎2006 May 04 7:56 AM
Hai Pavan
to export the data in some memory location and getting data from that memory location
calling Program
data : v_matnr like mara-matnr.
EXPORT V_matnr to memory id 'MATNR'.
this can be treated as a pointer to the variable v_matnr
Called Program
Import V_matnr from Memory id 'Matnr'.
this will return a sy-subrc.
before submit statement we use Export statement
Thanks & regards
Sreenivasulu P
‎2006 May 04 8:08 AM
Hi ,
S the same thing
What Iam doing is
Suppose Iam getting MATNR value from Program X
Iam Exporting that value to Memory-id
In Program Y
Iam using Submit and return statement then
the value of Matnr will be in Memory id right.
after this Submit and return .
Iam importing that MAtnr into a variable from Memory id .
In all thses cases Syst-subrc is equals to 0
but the value is not got copied into the variable ..
‎2006 May 04 8:23 AM
Hi Pavan,
how you are importing it to memory can you show. i think you are giving in quotes. remove the quotes and try.
Regards
Vijay
‎2006 May 04 9:26 AM
Hi ,
Iam passing it into memory like this
EXPORT pernr TO MEMORY ID 'TEST'.
‎2006 May 04 9:36 AM
Hai Pavan
check the syntax for Export & Import again
Export data
- EXPORT obj1 ... objn TO MEMORY.
- EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key.
- EXPORT obj1 ... objn TO DATASET dsn(ar) ID key.
Export a screen
- EXPORT DYNPRO h f e m ID id.
Export a structure description
- EXPORT NAMETAB h f ID id.
Get data
- IMPORT f itab FROM MEMORY.
- IMPORT f itab FROM DATABASE dbtab(ar) ID key.
- IMPORT DIRECTORY INTO itab FROM DATABASE dbtab(ar) ID key.
- IMPORT f itab FROM DATASET dsn(ar) ID key.
Get a screen
- IMPORT DYNPRO h f e m ID id.
Tanks & regards
Sreenivasulu P
Message was edited by: Sreenivasulu Ponnadi
‎2006 May 04 9:39 AM
Hi pavan,
1. is this correct, what i understood.
2. X program, has some value ABC (in variable)
u are using SUBMIT Y (in program X)
3. In program Y,
u want to get the value of ABC ?
regards,
amit m.
‎2006 May 04 9:49 AM
S Ur correct
I have X program and Y program
X program will give me one value thats all
I want to use that in Y program
for that what I did is
in Y program i used Submit X and return .
in X i wrote EXPORT p_pernr TO MEMORY ID 'TEST'.
and again in Y after submit
I wrote
IMPORT w_pernr FROM MEMORY ID 'TEST'.
then after some calculation I have to send this to Spool
that is my requirement
and I am requesting Ur help.
Regards,
PAVAN.
‎2006 May 04 9:55 AM
Hi again,
1. the problem is with the VARIABLE NAME.
2. MAKE SURE
THE VARIABLE NAME ARE
SAME
IN BOTH PROGRAMS.
3. THEN IT WILL WORK.
4. p_pernr
W_pernr
(DIFFFERENT WILL NOT WORK)
regards,
amit m.
‎2006 May 04 9:59 AM
Thank Q very much
now it is working fine
can U plz tell me how to pass it to spool
and how to get spool parameters .
Regards,
Pavan..
‎2006 May 04 10:03 AM
Hey Pavan ,
I am giving you a sample code . Here I have created two programs zkun_imp1 and zkun_imp2. I am passing data from the first prog to the second.
Apply the concept in your program .
The sample code is :
First Program .
REPORT ZKUN_IMP1 .
DATA : list LIKE TABLE OF abaplist WITH HEADER LINE.
DATA : BEGIN OF list_asc OCCURS 0,
msg(300) TYPE c,
END OF list_asc.
DATA : wa_c_filename(30) TYPE c.
RANGES: r_bukrs FOR vbkpf-bukrs.
RANGES: r_gjahr FOR vbkpf-gjahr.
RANGES: r_belnr FOR vbkpf-belnr.
r_bukrs-sign = 'I'.
r_bukrs-option = 'EQ'.
r_bukrs-low = '1000'.
APPEND r_bukrs.
r_gjahr-sign = 'I'.
r_gjahr-option = 'EQ'.
r_gjahr-low = '2006'.
APPEND r_gjahr.
r_belnr-sign = 'I'.
r_belnr-option = 'EQ'.
r_belnr-low = '0002000001'.
r_belnr-high ='1000000010'.
APPEND r_belnr.
<b>SUBMIT zkun_imp2 via selection-screen
WITH p_bukrs IN r_bukrs
WITH p_gjahr IN r_gjahr
WITH p_belnr IN r_belnr
EXPORTING LIST TO MEMORY
AND RETURN.</b>
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list
EXCEPTIONS
not_found = 1.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = -1 "LIST_INDEX SY-LSIND.
TABLES
listasci = list_asc
listobject = list.
LOOP AT list_asc.
WRITE : / list_asc.
ENDLOOP.
Second Program.
REPORT zkun_imp2 .
TABLES vbkpf.
DATA gt_vbkpf1 TYPE STANDARD TABLE OF vbkpf WITH HEADER LINE.
SELECT-OPTIONS:
p_bukrs FOR vbkpf-bukrs,
p_belnr FOR vbkpf-belnr,
p_gjahr FOR vbkpf-gjahr.
data : p_bukrs1 type vbkpf-bukrs,
p_belnr1 type vbkpf-belnr,
p_gjahr1 type vbkpf-gjahr.
p_bukrs1 = p_bukrs-low.
p_belnr1 = p_belnr-low.
p_gjahr1 = p_gjahr-low.
SELECT * FROM vbkpf INTO TABLE gt_vbkpf1
WHERE bukrs = p_bukrs1
AND gjahr = p_gjahr1
AND belnr = p_belnr1.
LOOP AT gt_vbkpf1.
WRITE : / gt_vbkpf1-bukrs.
ENDLOOP.
Copy the two programs , activate them and run the first one.
You will see the data is passed from the first prog to the second .
Hey Pawan <b>Regarding the spool</b> ,
I can give you thse details :
1. t-code for spool administration : SPAD
2. t- code for output controller : Spool Requests - SP01.
3. After you execute the program, you go to :
List - > Print.
give the specific details say , printer name as 'LOCL'.
You will see the message coming in the status bar :
Spool Request ( number 0000000xxx) created .
When you do give the command print , the data will automatically be passed to the printer ( spool).
<b>Pawan one more thing, when you click the
list - > Print , there you give the printer name. then click on Properties Tab. There you can see the various details, such as Spool Requests .when you double click on that, you can change the values .</b>
Regards,
Kunal.
Message was edited by: Kunal Kumar
Message was edited by: Kunal Kumar
Message was edited by: Kunal Kumar
‎2006 May 04 10:26 AM
Can u plz tell me how to pass it to spool
With regards,
PAVAN..
‎2006 May 04 10:41 AM
Can U plz tell me how to get pass this data into spool
Regards,
PAVAN..
‎2006 May 04 12:07 PM
hi again,
1. whenever we use
SUBMIT YPROG TO SAP-SPOOL
2. the yprog is executed,
and the listoutput is automatically
sent to spool.
regards,
amit m.
‎2006 May 04 12:25 PM
Hello Pavan,
You use lists to output structured, formatted data. By default, the system sends a list (basic list and secondary lists) to the output screen after creating it. This section describes how to send lists to the SAP spool system instead of the output screen.
Within ABAP, sending a list to the SAP spool system is generally called 'printing lists'. This, however, must not necessarily mean that the list is actually printed on a printer. You can also use the spool system to store a list temporarily, or to store lists in an optical archive instead of printing it.
ABAP offers two possibilities to print a list:
You can print a list after and while creating it.
Printing a List after Creating it
Printing a List while Creating it.
<b>Sample Code :</b>
REPORT SAPMZTST NO STANDARD PAGE HEADING LINE-COUNT 0(2).
PARAMETERS P TYPE I.
INITIALIZATION.
<b>CALL FUNCTION 'SET_PRINT_PARAMETERS'
EXPORTING
ARCHIVE_MODE = '2'
COPIES = '5'
DEPARTMENT = 'BASIS'
DESTINATION = 'LT50'
EXPIRATION = ' '
IMMEDIATELY = 'X'
LAYOUT = 'X_65_132'
LINE_COUNT = 54
LINE_SIZE = 20
LIST_NAME = 'Test'
LIST_TEXT = 'Test for User''s Guide'
NEW_LIST_ID = 'X'
RECEIVER = 'KELLERH'
RELEASE = ' '
SAP_COVER_PAGE = 'X'.</b>
START-OF-SELECTION.
DO P TIMES.
WRITE / SY-INDEX.
ENDDO.
TOP-OF-PAGE.
WRITE: 'Page', SY-PAGNO.
ULINE.
END-OF-PAGE.
ULINE.
WRITE: 'End of', SY-PAGNO.
After executing this program, the user can enter a value for parameter P on the selection screen (for example 100) and choose Execute .
The program will be sent to be archieve .
Regards,
Kunal.