2014 Feb 05 3:57 PM
Hi All,
I need some help with field symbols.
I try to submit a dynamic program name but I have problems.
I do a LOOP on a table witch contain a list of program and variant to be submitted by job.
So Y try to assign my program name to a field symbol but it is not assigned.
Please advice.
Thanks.
Here is the code I use :
DATA l_programme(40) TYPE c.
FIELD-SYMBOLS: <prog> TYPE program.
MOVE w_sel_prog-report TO l_programme.
ASSIGN (l_programme) TO <prog>.
IF <prog> IS ASSIGNED.
SUBMIT <prog> TO SAP-SPOOL
USING SELECTION-SET w_sel_prog-variant
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
2014 Feb 05 4:00 PM
A small question why do you need a field symbol in this case you can directly pass the variable name containing program
A small question why do you need a field symbol in this case you can directly pass the variable name containing program
2014 Feb 05 4:00 PM
A small question why do you need a field symbol in this case you can directly pass the variable name containing program
2014 Feb 05 4:22 PM
Hi,
When I pass directly the variable name the program is not find as it try to run the variable name program.
2014 Feb 05 4:31 PM
Hi Marie
Do as shown below. Put a bracket around variable name then it will take value
DATA:lv_prog TYPE sy-cprog VALUE 'ZTMP_NA2'.
BREAK-POINT.
SUBMIT (lv_prog) AND RETURN.
Nabheet
2014 Feb 05 4:52 PM
2014 Feb 05 4:17 PM
Hello,
I think you have a problem with Assigning right? So, please check the assign statement .
You declare your field symbol as TYPE ANY . Or Make both declaration as same.
Thanks & Regards,
Abhijit
2014 Feb 05 4:23 PM
Hello Abhijit,
I try to use a type any but my firld symbol ius not assigned too.
Thanks and regards.
Marie.
2014 Feb 05 4:32 PM
Hi Marie,
The problem is in your code, you have to use this code:
DATA l_programme(40) TYPE c.
FIELD-SYMBOLS: <prog> TYPE any.
MOVE w_sel_prog-report TO l_programme.
ASSIGN l_programme TO <prog>.
IF <prog> IS ASSIGNED.
SUBMIT <prog> TO SAP-SPOOL
USING SELECTION-SET w_sel_prog-variant
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
When you do the ASSIGN you don't need brackets.
Best Regards
2014 Feb 05 4:35 PM
Yes either this way or simply put brackets around variable name
2014 Feb 05 4:37 PM
Hi Adrian,
Here is the code I use now
DATA l_programme(40) TYPE c.
FIELD-SYMBOLS: <prog> TYPE any.
MOVE w_sel_prog-report TO l_programme.
ASSIGN l_programme TO <prog>.
IF <prog> IS ASSIGNED.
SUBMIT <prog> TO SAP-SPOOL
USING SELECTION-SET w_sel_prog-variant
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
And when I run my program I have the following dump :
Analyse des erreurs
On account of a branch in the program
(CALL FUNCTION/DIALOG, external PERFORM, SUBMIT)
or a transaction call, another ABAP/4 program
is to be loaded, namely "<PROG>".
However, program "<PROG>" does not exist in the library.
Possible reasons:
a) Wrong program name specified in an external PERFORM or
SUBMIT or, when defining a new transaction, a new
dialog module or a new function module.
b) Transport error
Thanks and regards
Marie.
2014 Feb 05 4:45 PM
Hi Marie,
To avoid this dump you should do the submit like this:
SUBMIT (<fs_prog>) .................
But If you notice, you don't need the FIELD-SYMBOL.
You can do this:
| DATA l_programme(40) TYPE c. | |
| FIELD-SYMBOLS: <prog> TYPE program. |
| MOVE w_sel_prog-report TO l_programme. | |
| SUBMIT (l_programme) TO SAP-SPOOL " You can call SUBMIT (w_sel_prog-report) | |
| USING SELECTION-SET w_sel_prog-variant | |
| SPOOL PARAMETERS print_parameters | |
| WITHOUT SPOOL DYNPRO | |
| VIA JOB name NUMBER number | |
| AND RETURN. |
Best regard
2014 Feb 05 4:54 PM
2014 Feb 05 4:55 PM
Hi Marie,
I think the conclusion here is that the SUBMIT command does not accept a field-symbol as input. As others have mentioned (and as seems a viable approach in your code) using varable l_programme in brackets is the necessary approach;
MOVE w_sel_prog-report TO l_programme.
SUBMIT (l_programme) TO SAP-SPOOL
USING SELECTION-SET w_sel_prog-variant
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
Or possibly;
SUBMIT (w_sel_prog-report) TO SAP-SPOOL
USING SELECTION-SET w_sel_prog-variant
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
Regards,
Nick
Edit: Started typing this post before the question was closed. Arrived at the party late, just as everyone else was leaving!
2014 Feb 05 5:01 PM
Hi Nick,
You can use a FIELD-SYMBOL but you need to put it in brackets.
Despite this fact, the best way in my opinion would be using one of your examples.
Best Regards.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |