‎2008 Jun 28 10:53 AM
Hi,
I have 2 questions regarding selection-screens:
1. I have 2 select-options like this in my selection-screen:
Matnr: s_matnr
Vendor: s_lifnr
How can I make a check that if Matnr is filled then Vendor has to be filled as well and vice versa ?
2. I want to take the interval of data from a select-option and create the records in an internal table:
example
Contract no: From 45000000 To 45000025
All the records that are contracts (document cat. = K) from that interval have to be appended to an internal table.
‎2008 Jun 28 12:42 PM
hi,
The easiest way for u is to make both fiels OBLIGATORY.
For Second Part.
If s_itab is not initial.
select <fields>
from <table>
into table <itab>
where matnr in s_itab.
endif.reward if useful.
Regards
Sumit Agarwal
‎2008 Jun 28 10:57 AM
make both the field mandatory by using "obligatory" key word.
regards
Prakash Varun.
‎2008 Jun 28 11:03 AM
hi do like this..
tables: mara,lfa1.
select-options: s_matnr for mara-matnr,
s_lifnr for lfa1-lifnr.
at selection-screen.
if s_matnr is not initial.
select lifnr from lfa1 into s_lifnr where matnr in s_matnr.
endselect.
endif.
‎2008 Jun 28 11:07 AM
hi,
refer to the code,
if s_matnr is not initial and s_lifnr is intial.
message.....
elseif s_lifnr is not initial and s_matnr is intial.
message.....
endif.
select ....
.........
where matnr in s_matnr
and lifnr in s_lifnr.
with luck,
pritam.
‎2008 Jun 28 11:10 AM
Hi Peter ,
SELECTION-SCREEN :
BEGIN OF BLOCK b1 WITH FRAME TITLE tit.
parameters:
p_matnr TYPE marc-matnr,
P_WERKS TYPE MARC-WERKS,
p_lifnr TYPE lfa1-lifnr.
SELECTION-SCREEN END OF BLOCK b1.
WRITE: 10 p_lifnr.
INITIALIZATION.
MOVE 'Material-Plant' TO tit.
AT SELECTION-SCREEN ON p_matnr.
PERFORM validate_material.
AT SELECTION-SCREEN ON p_werks.
PERFORM validate_plant.
AT SELECTION-SCREEN." ON block b1.
PERFORM validate_material_plant_comb.
FORM validate_material .
DATA
lw_matnr TYPE matnr.
IF p_matnr IS NOT INITIAL.
SELECT SINGLE matnr
INTO lw_matnr
FROM mara
WHERE matnr EQ p_matnr.
IF sy-subrc NE 0.
MESSAGE e000(PP) WITH p_matnr.
ENDIF.
ENDIF.
ENDFORM. " validate_material
FORM validate_plant .
DATA
lw_werks TYPE werks.
IF p_werks IS NOT INITIAL.
SELECT SINGLE werks
INTO lw_werks
FROM t001w
WHERE werks EQ p_werks.
IF sy-subrc NE 0.
MESSAGE e272(61) WITH p_werks.
ENDIF.
ENDIF.
ENDFORM. " validate_plant
FORM validate_material_plant_comb .
DATA:
lw_matnr TYPE matnr,
lw_werks TYPE werks.
IF p_matnr IS NOT INITIAL
AND p_werks IS NOT INITIAL.
SELECT SINGLE matnr
INTO lw_matnr
FROM marc
WHERE werks EQ p_werks
AND matnr EQ p_matnr.
IF sy-subrc NE 0.
MESSAGE e707(12) WITH p_matnr p_werks.
ENDIF.
ENDIF.
ENDFORM. " validate_material_plant_comb
I have done it with parameters You just convert into select options.
This Validates the user before giving output
Regards
Swapna,
Edited by: NagaSwapna Thota on Jun 28, 2008 12:10 PM
Edited by: NagaSwapna Thota on Jun 28, 2008 12:11 PM
‎2008 Jun 28 11:11 AM
Plz see my answers marked in bold.
have 2 questions regarding selection-screens:
1. I have 2 select-options like this in my selection-screen:
Matnr: s_matnr
Vendor: s_lifnr
How can I make a check that if Matnr is filled then Vendor has to be filled as well and vice versa ?
Ans: in at selection-screen event you have to perform the check like:
at selection screen.
if s_matnr[ ] is not initial.
and s_lifnr[ ] is initial.
display error message*
endif.
if s_matnr[ ] is initial.
and s_lifnr[ ] is not initial.
display error message*
endif.
2. I want to take the interval of data from a select-option and create the records in an internal table:
example
Contract no: From 45000000 To 45000025
All the records that are contracts (document cat. = K) from that interval have to be appended to an internal table.
*Ans: select contract no from database table based on document cat. = K *
select Contract no
into table i_contract
from database table
where document cat = 'K'
and Contract no in s_Contract. << contract no: From 45000000 To 45000025
structure of i_contract contains one field i.e. Contract no.
Edited by: Joyjit Ghosh on Jun 28, 2008 12:12 PM
‎2008 Jun 28 11:13 AM
HI
1. the answer for your first question is make use of OBLIGATORY addition of select-options statement.
2. the answer for your second question is
condition is
IF s_matnr IS NOT INITIAL.
end if.
regards
pavan
‎2008 Jun 28 12:42 PM
hi,
The easiest way for u is to make both fiels OBLIGATORY.
For Second Part.
If s_itab is not initial.
select <fields>
from <table>
into table <itab>
where matnr in s_itab.
endif.reward if useful.
Regards
Sumit Agarwal
‎2008 Jun 29 1:03 PM
Hi,
Thanks you for all your answers !
However, I forgot one detail:
The program is to generate sourcelists in SRM on the basis of the input.
The 3 selections:
EKKO-EBELN
MARA-MATNR
LFA1-LIFNR
Either a sourcelist is generated by entering an existing EKKO-EBELN OR from a combination of MARA-MATNR and LFA1-LIFNR. If a valid EKKO-EBELN is found, MATNR and LIFNR is to be ignored. Only if EKKO-EBELN is empty or invalid the user has to enter the combination of MATNR and LIFNR, which then is the basis for creating the sourcelists.
Does that change your answers ?
‎2008 Jun 29 1:45 PM
Hi Peter,
Yes. There will be little change.
Check this out.
AT SELECTION-SCREEN.
CLEAR l_ebeln.
IF NOT p_ebeln IS INITIAL.
SELECT SINGLE ebeln INTO l_ebeln FROM ekko WHERE ebeln EQ p_ebeln.
ENDIF.
CHECK l_ebeln IS INITIAL.
IF s_matnr[] is not initial and s_lifnr[] is intial.
Error message
ELSEIF NOT s_lifnr[] is initial and s_matnr[] is intial.
Error message
ENDIF.
Paste above code. It will work fine.
Thanks,
Vinod.