Application Development 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: 

selection screen.

Former Member
0 Kudos
182

Hi All,

My program runs in background with job scheduling it will work by variant. But for testing purpose I have to create one more selection screen with the some slection fileds.

So My program has to run like this . If I run with test selection fields it has to work and if I run in background job with other selection also has to work. There are two slections and program should understand this.

Thanks,

Vinay.

1 ACCEPTED SOLUTION

former_member217544
Active Contributor
0 Kudos
115

Hi Vinay,

I think when it runs in back ground, there is a system variable sy-batch which will be set to X.

Also, check if there is a seperate user name defined for scheduling back ground jobs. So, that you can try differentiating with normal user running the program or whetehr the program is running from back ground.

Regards,

Swarna Munukoti

7 REPLIES 7

Former Member
0 Kudos
115

hii,

please elaborate your question.

Former Member
0 Kudos
115

So u have 2 selection screens, that means 2 different includes right.

And you have one main or must say initial selection screen where u select the TEST mode or Batch Mode.

So why dont u make a call on the respective includes depending on the option chosen, plus you could avoid submittig the

job in background for a test mode and instead make a alv-display.

Have you thought about this approach?

-- Dedeepya

Former Member
0 Kudos
115

Hi Vinay,

If you are running for the particular variant use tcode SM36 otherwise use Tcode SM37 for background scheduling.

It will work witout any issues for both selection screens.

Regards,

Pravin

former_member217544
Active Contributor
0 Kudos
116

Hi Vinay,

I think when it runs in back ground, there is a system variable sy-batch which will be set to X.

Also, check if there is a seperate user name defined for scheduling back ground jobs. So, that you can try differentiating with normal user running the program or whetehr the program is running from back ground.

Regards,

Swarna Munukoti

0 Kudos
115

Hi ,

To give you more detail about my requirement, suppose if I have two selection screens as below.

1) Plant and material ( 1 selection )

2) date and time ( 2nd selection ) ( Using the date and time I will get plant and material from cdhdr table )

But finally I use same seelect statement for both the selections like

SELECT * FROM MAST INTO CORRESPONDING FIELDS OF IMAST WHERE matnr eq lv_matnr

AND werks eq lv_werks.

So in the selection screen ,a) If I select first selection , it has to directly use it for above and select query

b ) if I select 2nd selections then It has to check the cdhdr tables and get the values of matnr, werks and use above select query.

so please let me know how the programm will decide based on selection.

Thanks,

Vinay.

0 Kudos
115

Hi Vinay,

You can modify your selection screen at "AT SELECTION SCREEN" event based on the fact whether is is running in background or foreground. In your selection screen give two modif id's: one for Plant and material ( 1st selection) say BATCH and another one for date and time (2nd Selection) say TEST. Now try implementing the following logic:

At selection-screen OUTPUT.

IF SY-BATCH ne X.

LOOP AT SCREEN.

IF screen-group1 = 'TEST'. *You can provide the screen name for date and time to populate only the date and Time fields.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

0 Kudos
115

Hi Vinay,

You can dynamically modify the screen fields at run time based on whether it is processed in the background or foreground. For that you can assign a modif id to the selection screen items for testing i.e date and time say TEST.

Now try to implement the following logic:

AT SELECTION-SCREEN OUTPUT.

IF SY-BATCH ne 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'TEST'. * Also check with the name of the screen for date and time fields in order to diplay * them only.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

START-OF-SELECTION.

IF SY-BATCH ne 'X'.

Write the code to select the data from cdhdr table into your internal table.

ENDIF.