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: 

Hot to provide Period and Year in Selection Options(mm/yyyyy)

Former Member
0 Kudos

Hi Guys,

Can anybody tell me how to provide a Selection option Field with combined Period and Year in MM/YYYY Format?

Thanks,

Gopi.

14 REPLIES 14

Former Member
0 Kudos

Try:

PARAMETERS: per TYPE rscalmonth.

Rob

Former Member
0 Kudos

Hi

Use the S031-SPMON or S021-SPTAG field for this

check the fields correctly in the S031 and SO21

Regards

Anji

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
data: x_spbup type spbup.

select-options s_spbup for x_spbup.

Regards,

Rich Heilman

0 Kudos

Hi Rich,

How to Validate this one can u tell me?

Thanks,

Gopi.

0 Kudos

Hi Rich,

when i had done Validation for s_spbup ,i was not able to find any values in the structure even after entering the data in it?

Can u tell me how to solve this one?

here is the code.

SELECTION-SCREEN: BEGIN OF LINE.

SELECTION-SCREEN COMMENT 2(20) TEXT-003 for field s_BUDAT.

SELECT-OPTIONS : s_BUDAT for MKPF-BUDAT .

SELECTION-SCREEN: END OF LINE.

SELECTION-SCREEN: BEGIN OF LINE.

SELECTION-SCREEN COMMENT 2(20) TEXT-004 for field s_SPBUP.

SELECT-OPTIONS : s_SPBUP for OIAQB-spbup .

SELECTION-SCREEN: END OF LINE.

At Selection-Screen on s_BUDAT.

Perform Validate_GRDATE.

Form Validate_GRDATE.

If ( s_BUDAT[] is Initial ) and ( s_SPBUP[] is Initial ).

MESSAGE e999 WITH

'Either GR Date or GR Period must be Entered'(058).

Endif.

EndForm.

I am filling the data in the selection option s_SPBUP even after filling when i kept the code in Debug mode i was not able to see the data in the selectio option s_SPBUP.

Thanks,

Gopi.

0 Kudos

Hi Gopi,

Change your below code and see the result

At Selection-Screen on s_BUDAT.

to

<b>At Selection-Screen.</b>

Regards,

Atish

0 Kudos

You need to put

<b>At Selection-Screen .</b>

instead of the

<b>

At Selection-Screen on s_BUDAT.

</b>

Regards,

Naimesh Patel

0 Kudos

Hi Atish,

Can u tell me How to validate this Selection-Option field s_SPBUP?

Thanks,

Gopi.

0 Kudos

Hi Gopi,

Do you want to validate it against some table or want to validate for some value?

Regards,

Atish

0 Kudos

Hi Atish,

I have to Validate with respect to MKPF-BUDAT field .

Thanks,

Gopi.

0 Kudos

Hi Gopi,

In real life scenarios you generally don't validate all the entries in the select options. Even SAP don't validate them. Either you check it for initial value or you validate any one entry. As in your case it is a period which can be any period . For eg material has there master table MARA. For period you don't have such table. It can be any period.

So I don't think you need to validate it. If you still want to validate, validate for the values that any one entry should be valid period, that to if SAP is not taking care of the same.

Regards,

Atish

0 Kudos

You can do like this

SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) TEXT-003 for field s_BUDAT.
SELECT-OPTIONS : s_BUDAT for MKPF-BUDAT .
SELECTION-SCREEN: END OF LINE.

SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) TEXT-004 for field s_SPBUP.
SELECT-OPTIONS : s_SPBUP for OIAQB-spbup .
SELECTION-SCREEN: END OF LINE.

* At Selection-Screen on s_BUDAT. " << Commented
AT SELECTION-SCREEN.  " << ADDED
Perform Validate_GRDATE.

Form Validate_GRDATE.

If ( s_BUDAT[] is Initial ) and ( s_SPBUP[] is Initial ).

MESSAGE e999 WITH
'Either GR Date or GR Period must be Entered'(058).

Endif.

EndForm.

Regards,

Naimesh Patel

0 Kudos

Hi Satish,

Can u tell me atleast how to Validate The Period and Year of this field

S_SPBUP .somebody may enter invlalid Period and Invalid Year then i have to validate so in this type of cases how to cvalidate?

Thanks,

Gopi.

naimesh_patel
Active Contributor
0 Kudos

I found something similar..

REPORT  ZTEST_NP.

parameters: p_mon type AD01PERIOD.

write: p_mon.

Internally P_MON holds like 2007011 current period.

and prints like 011/2007.

May it will helpful to you..!!

Regards,

Naimesh Patel