Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Submit Program

Former Member
0 Likes
3,991

Hi ALL,

I am using the following code to call transaction MC.9 when a button is clicked on the ALV.

RANGES : r_werks FOR s031-werks,

r_matnr FOR s031-matnr.

if ucomm = '&MC.9'.

r_matnr[] = s_matrl[].

r_werks[] = s_plant[].

SUBMIT rmcb0300 AND RETURN

WITH sl_matnr IN r_matnr

WITH sl_werks IN r_werks.

where s_matrl and s_plant are the select options on the selection screen in my program. I want to execute the transaction MC.9 with these selection screen values. I am able to go to the transaction with the code mentioned above but it is getting executed with the blank values i.e. the values from the selection screen parameters are not being passed to the transaction.

Need your help to know if there is something wrong with the code.

Thanks

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,706

This sample program is actually working good. The select-options are being passed successfully. I have added the VIA SELECTION-SCREEN to the SUBMIT so that I can see the values being passed. Please implement, does this work for you?



report zrich_0001.

tables: marc.

select-options: s_matrl for marc-matnr,
                s_plant for marc-werks.

ranges : r_werks for marc-werks,
         r_matnr for marc-matnr.

start-of-selection.

  r_matnr[] = s_matrl[].
  r_werks[] = s_plant[].
  submit rmcb0300 via selection-screen and return
         with sl_matnr in r_matnr
         with sl_werks in r_werks.

Regards,

Rich Heilman

20 REPLIES 20
Read only

Former Member
0 Likes
2,706

Hi,

First, u don't need the ranges :

SUBMIT rmcb0300 AND RETURN

WITH sl_matnr IN s_matnr

WITH sl_werks IN s_werks.

Read only

0 Likes
2,706

Dieu Fr

This is not the answer of my question. Even passing the values of the select options directly doesnt solve my problem.

Read only

0 Likes
2,706

TABLES marc.

SELECT-OPTIONS : s_matnr FOR marc-matnr,

s_werks FOR marc-werks.

BREAK-POINT.

SUBMIT rmcb0300 AND RETURN

WITH sl_matnr IN s_matnr

WITH sl_werks IN s_werks.

-> sl_matnr is empty in INITIALIZATION, but is filled in PBO

=> it works, please try !

Read only

Former Member
0 Likes
2,706

Hii

dont pass the select options directly..

instead take the selection options value in another itab ..

then assign that itab to r_matnr

but itab and r_matnr should have the same structure

Regards

Naresh

Read only

0 Likes
2,706

Naresh,

When I am passing the values from select option to range table I am able to get all the values into range table. So there is no need to take another itab. I am facing the problem in passing the values from range table to transaction code. Please read the question carefully.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,707

This sample program is actually working good. The select-options are being passed successfully. I have added the VIA SELECTION-SCREEN to the SUBMIT so that I can see the values being passed. Please implement, does this work for you?



report zrich_0001.

tables: marc.

select-options: s_matrl for marc-matnr,
                s_plant for marc-werks.

ranges : r_werks for marc-werks,
         r_matnr for marc-matnr.

start-of-selection.

  r_matnr[] = s_matrl[].
  r_werks[] = s_plant[].
  submit rmcb0300 via selection-screen and return
         with sl_matnr in r_matnr
         with sl_werks in r_werks.

Regards,

Rich Heilman

Read only

0 Likes
2,706

Rich

I was using the following statement...

submit rmcb0300 and return

with sl_matnr in r_matnr

with sl_werks in r_werks.

when i add VIA SELECTION SCREEN in to this statement(as usggested by you), it helps me a little as it is passing all the values to the transaction code (that is what i want) but it has created another problem by not executing the transaction code, it stays on to the initial screen. What I want is to execute the transaction code with those values.

Read only

Former Member
0 Likes
2,706

Hi hemant,

instead of defining s_matrl and s_plant for selection screen and transferring them to r_matnr and r_werks,

u can directly useranges for selection screen.(without s_matrl and s_plant)

hope this helps,

keerthi.

Read only

0 Likes
2,706

Keerti,

It does not helps.

Read only

Former Member
0 Likes
2,706

Hi,

try this way..., use addition exporting list to memory

SUBMIT rmcb0300
<b>EXPORTING LIST TO MEMORY</b>
WITH sl_matnr IN r_matnr
WITH sl_werks IN r_werks.
AND RETURN.

regards

vijay

Read only

0 Likes
2,706

Vijay,

I have already tried it. EXPORTING LIST TO MEMORY is not meant for the purpose I am trying to solve.

Please read the help carefully which says "Does not display the output list of the called report, but saves it in ABAP memory and leaves the called report immediately.". This is not what my requirement is. I want to execute the called report with the passed values and display the output.

Read only

0 Likes
2,706

Hi,

The example code calls program zdealer_contacts_add_edit and gets the values being passed by program zdealer_contacts.

READ TABLE it_zts0001 WITH KEY kunnr = v_kunnr

cdseq = p_code.

IF sy-subrc EQ 0.

SUBMIT zdealer_contacts_add_edit AND RETURN

WITH p_kunnr = v_kunnr

WITH p_name1 = p_name1 "AVH

WITH p_cdseq = p_code

WITH p_flag = 'E'

WITH p_addr = it_zts0001-zaddress

WITH p_pers = it_zts0001-zcperson

WITH p_numb = it_zts0001-zcnumber

VIA SELECTION-SCREEN.

ELSE.

MESSAGE i008 WITH 'No record found.'.

ENDIF.

Regards!

Read only

0 Likes
2,706

@viraylab : so what ?

Read only

Former Member
0 Likes
2,706

Hi,

There is absolutely nothing wrong with this code - it works as a charm. When you say blank values are passed, did you see that in the debugger? Actually values sl_matnr and sl_werks will <u>remain blank untill the at selection-screen event</u> - once they reach it, they will be filled. If even then you don't get any result from your program, then I guess you don't have data in your T environment for the given sel. options...

Cheers!

P.S. Are your select-options (s_matrl and s_plant) filled?

Read only

0 Likes
2,706

Brako,

When I execute the transaction MC.9 without entering any vaues I am getting the same output which my program gives. It clearly shows that no values are being passed from my program. Yes my select-options are having data.

Read only

Former Member
0 Likes
2,706

Hai

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.

SUBMIT rmcb0300 AND RETURN

WITH sl_matnr IN s_matnr

WITH sl_werks IN s_werks.

Thanks & regards

Sreenivasulu P

Read only

0 Likes
2,706

I guess Hermant knows the <F1> key...

Read only

0 Likes
2,706

What do you mean by that Dieu fr. By the way my name is Hemant and not Hermant. Please read and spell the name properly.

Read only

0 Likes
2,706

Ok guys, lets keep it professional.

Hemant, I noticed that you have marked as solved, would you like to share with us the resolution? Thanks.

Regards,

Rich Heilman

Read only

0 Likes
2,706

Rich,

As mentioned by you in the first reply, the code I was writing was perfectly fine. But when I was executing the T-Code (MC.9) through my program the fields being displayed were ( Material No., Val.stk rec qty, Val.stk iss qty, Total usage)while executing the T-Code (MC.9) directly dispalys the fields (Material No., ValStockValue, Valuated stock, CnsgtStock). The only (stupid) mistake I was doing was matching the data and not looking at the displayed fields. If you have any idea why different fields were being displayed (by default, though we can manually choose the fields to be displayed) in two cases please let me know.

Thank You.