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

Selection Criteria

Former Member
0 Likes
936

Hello friends,

I have to run the program in background and sometimes manually.

But the selection criteria changes based on the type ot run and also the selection screen changes.

When I run the program in background the Date field in the selection-screen should not be required field but when i run it manually it should be a required field.

Can i use a If statement for a selection screen and if so what condition should it be.

any Advice will be a great help.

Madhu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
896

Hi,

You don't have to declare two dates..

Check my reply for how to validate for the online processing..

THanks,

Naren

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
896

Yes, you can check Sy-Batch, if running in background, then SY-BATCH = 'X'.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
896

Hi,

Try this..

Check if the SY-BATCH is initial for online..

PARAMETERS: P_DATE TYPE SYDATUM.

AT SELECTION-SCREEN.

  • MAKE THE FIELD MANDATORY ONLY FOR ONLINE.

IF SY-BATCH IS INITIAL AND SY-UCOMM = 'ONLI'.

IF P_DATE IS INITIAL.

MESSAGE E208(00) WITH 'DATE IS REQUIRED FOR ONLINE'.

ENDIF.

ENDIF.

Thanks,

Naren

Read only

0 Likes
896

Thanks Naren and Rich,

I have my code in this way,

SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text.

IF sy-batch = 'X'.

PARAMETERS : <b>p_date</b> LIKE rlgrap-filename.

ELSE.

PARAMETERS : <b>p_date</b> LIKE rlgrap-filename OBLIGATORY.

ENDIF.

SELECTION-SCREEN : END OF BLOCK blk.

But it has errors because p_date is repeated. so I cahanged it to ,

SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text.

IF sy-batch = 'X'.

PARAMETERS : <b>p_date</b> LIKE rlgrap-filename.

ELSE.

PARAMETERS : <b>p1_date</b> LIKE rlgrap-filename OBLIGATORY.

ENDIF.

SELECTION-SCREEN : END OF BLOCK blk.

I hope this is correct.

let me know..

Madhu.

Read only

0 Likes
896

No, you can't do that like that, check Naren's response to see how to make the field required depending on SY-BATCH.

REgards,

Rich Heilman

Read only

Former Member
0 Likes
897

Hi,

You don't have to declare two dates..

Check my reply for how to validate for the online processing..

THanks,

Naren

Read only

0 Likes
896

Thanks Naren.

Works good for Online but is there a way that i could debug for the batch and check sy-batch = 'X'.

thanks again.

madhu.

Read only

0 Likes
896

What, you don't believe us, that SY-BATCH = 'X' in background, com'on, where's the faith? Just kidding, simply execute it in background, if it runs without giving you an error, then of course it is working.

Regards,

Rich Heilman

Read only

0 Likes
896

I believe in you guys.

Its not that...

Anyways thanks for all the help and advice.

Madhu.