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: 

help me in coding..

Former Member
0 Kudos

Hi all..

Pls check the following program..If we click first radio button matnr and werks fields should display..if we click second radiobutton ebeln and aedat fields should display...

how to use events for this program.

REPORT ZNEW1_EVENTS.

tables: mara , marc , ekko.

data : begin of it occurs 0,

matnr like mara-matnr,

ebeln like ekko-ebeln,

werks like marc-werks,

aedat like ekko-aedat,

end of it.

selection-screen : begin of block b1 with frame title text-001.

select-options : s_matnr for mara-matnr modif id s1,

s_ebeln for ekko-ebeln modif id s2,

s_werks for marc-werks modif id s3,

s_aedat for ekko-aedat modif id s4.

selection-screen end of block b1.

selection-screen begin of block b2 with frame title text-002.

selection-screen begin of line.

parameters : r1 radiobutton group rg1 default 'X' user-command uc1.

selection-screen comment 5(20) text-003 for field r1.

selection-screen end of line.

selection-screen begin of line.

parameters : r2 radiobutton group rg1.

selection-screen comment 5(20) text-004 for field r2.

selection-screen end of line.

selection-screen end of block b2.

at selection-screen.

IF r1 = 'X'. "If Active Vendor is selected selects data from BSIK

SELECT a~matnr

b~werks

INTO CORRESPONDING FIELDS OF TABLE it

FROM mara AS a

INNER JOIN marc AS b

ON amatnr = bmatnr

WHERE a~matnr IN s_matnr

AND b~werks IN s_werks.

ELSEIF r2 = 'X'. "If Inactive Vendor is selected selects data from BSAK

SELECT ebeln aedat from ekko INTO CORRESPONDING FIELDS OF TABLE it where ebeln in s_ebeln and aedat in s_aedat.

ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Change the code as follows

TABLES: mara , marc , ekko.

DATA : BEGIN OF it OCCURS 0,

matnr LIKE mara-matnr,

ebeln LIKE ekko-ebeln,

werks LIKE marc-werks,

aedat LIKE ekko-aedat,

END OF it.

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

SELECT-OPTIONS : s_matnr FOR mara-matnr MODIF ID s1,

s_ebeln FOR ekko-ebeln MODIF ID s2,

s_werks FOR marc-werks MODIF ID s3,

s_aedat FOR ekko-aedat MODIF ID s4.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : r1 RADIOBUTTON GROUP rg1 DEFAULT 'X' USER-COMMAND uc1.

SELECTION-SCREEN COMMENT 5(20) text-003 FOR FIELD r1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : r2 RADIOBUTTON GROUP rg1.

SELECTION-SCREEN COMMENT 5(20) text-004 FOR FIELD r2.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK b2.

DATA: g_f_flag TYPE c.

AT SELECTION-SCREEN.

IF r1 = 'X'. "If Active Vendor is selected selects data from BSIK

g_f_flag = 'X'.

ELSEIF r2 = 'X'. "If Inactive Vendor is selected selects data from BSAK

CLEAR: g_f_flag.

ENDIF.

START-OF-SELECTION.

IF g_f_flag = 'X'.

SELECT amatnr bwerks

INTO CORRESPONDING FIELDS OF TABLE it

FROM mara AS a

INNER JOIN marc AS b

ON amatnr = bmatnr

WHERE a~matnr IN s_matnr

AND b~werks IN s_werks.

LOOP AT it.

WRITE: / it-matnr, it-werks.

ENDLOOP.

ELSE.

SELECT ebeln aedat FROM ekko INTO CORRESPONDING FIELDS OF TABLE it

WHERE ebeln IN s_ebeln AND aedat IN s_aedat.

LOOP AT it.

WRITE: / it-ebeln, it-aedat.

ENDLOOP.

ENDIF.

END-OF-SELECTION.

You didn't use WRITE statement to display the data. Internal table data must be displayed between START-OF-SELECTION & END-OF-SELECTION.

Edited by: Ramesh Hirial on Dec 19, 2007 4:07 PM

7 REPLIES 7

former_member404244
Active Contributor
0 Kudos

Hi,

The code seems to be fine..it should be working correctly.

Reagrds,

Nagaraj

0 Kudos

But I couldn't able to see the output when i press F8.

Thanks,

Mahathi

Former Member
0 Kudos

Hi,

at selection-screen output.

if w_flag eq 'X'.

loop at screen.

if screen-name cp 's_matnr' or 's_werks'.

screen-active = 0.

modify screen

endif.

endloop.

else.

loop at screen.

if screen-name cp 's_ebeln' or 's_aedat'.

screen-active = 0.

modify screen.

endif.

if screen-name cp 's_matnr' or 's_werks'.

screen-active =1.

modify screen

endif.

endloop.

at selection-screen.

if r1 eq 'X'.

w_flag eq 'x'.

else.

clear w_falg.

Plzz reward points if it helps.

0 Kudos

Thank you..but can u please explain me the logic..

0 Kudos

Hi,

in the selection-screen output u r using loop at screen and modifying according to the radiobuttons.

if u have given the value then that value is validated in at selection-screen. and then it goes to at selection-screen output and displays the screen according to it.

Plzz reward points if it helps.

Former Member
0 Kudos

Hi,

Change the code as follows

TABLES: mara , marc , ekko.

DATA : BEGIN OF it OCCURS 0,

matnr LIKE mara-matnr,

ebeln LIKE ekko-ebeln,

werks LIKE marc-werks,

aedat LIKE ekko-aedat,

END OF it.

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

SELECT-OPTIONS : s_matnr FOR mara-matnr MODIF ID s1,

s_ebeln FOR ekko-ebeln MODIF ID s2,

s_werks FOR marc-werks MODIF ID s3,

s_aedat FOR ekko-aedat MODIF ID s4.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : r1 RADIOBUTTON GROUP rg1 DEFAULT 'X' USER-COMMAND uc1.

SELECTION-SCREEN COMMENT 5(20) text-003 FOR FIELD r1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS : r2 RADIOBUTTON GROUP rg1.

SELECTION-SCREEN COMMENT 5(20) text-004 FOR FIELD r2.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK b2.

DATA: g_f_flag TYPE c.

AT SELECTION-SCREEN.

IF r1 = 'X'. "If Active Vendor is selected selects data from BSIK

g_f_flag = 'X'.

ELSEIF r2 = 'X'. "If Inactive Vendor is selected selects data from BSAK

CLEAR: g_f_flag.

ENDIF.

START-OF-SELECTION.

IF g_f_flag = 'X'.

SELECT amatnr bwerks

INTO CORRESPONDING FIELDS OF TABLE it

FROM mara AS a

INNER JOIN marc AS b

ON amatnr = bmatnr

WHERE a~matnr IN s_matnr

AND b~werks IN s_werks.

LOOP AT it.

WRITE: / it-matnr, it-werks.

ENDLOOP.

ELSE.

SELECT ebeln aedat FROM ekko INTO CORRESPONDING FIELDS OF TABLE it

WHERE ebeln IN s_ebeln AND aedat IN s_aedat.

LOOP AT it.

WRITE: / it-ebeln, it-aedat.

ENDLOOP.

ENDIF.

END-OF-SELECTION.

You didn't use WRITE statement to display the data. Internal table data must be displayed between START-OF-SELECTION & END-OF-SELECTION.

Edited by: Ramesh Hirial on Dec 19, 2007 4:07 PM

former_member404244
Active Contributor
0 Kudos

Hi,

ur functionality is wwhen u check RB1 the fields below it should be enabled and the otehr fields in RB2 should be disabled ryt..

so u have to d like this'

at selection-screen output.

IF RB1 IS INITIAL.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'MATNR'.

screen-input = 0.

MODIFY SCREEN.

WHEN 'WERKS'.

screen-input = 0.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'EBELN'.

screen-input = 0.

MODIFY SCREEN.

WHEN 'AEDAT'.

screen-input = 0.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ENDIF.

Regards,

Nagaraj