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: 

Related to internaltable operation.

Former Member
0 Kudos

Hi all

Iam writing the code here help me please

REPORT ZEXERCISE10 .

tables sscrfields .

data: begin of itab occurs 100 ,

regno(20) type c ,

name(20) type c,

fname(20) type c ,

class(3) type c ,

gender(10) type c ,

address(100) type c ,

games1(20) type c ,

games2(20) type c ,

games3(20) type c ,

end of itab .

parameters : p1(20) type c ,

p2(20) type c ,

p3(20) type c.

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

parameters: r1 radiobutton group gr1,

r2 radiobutton group gr1 ,

r3 radiobutton group gr1 ,

r4 radiobutton group gr1 ,

r5 radiobutton group gr1 ,

r6 radiobutton group gr1 .

selection-screen end of block block1 .

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

parameters: r7 radiobutton group gr2,

r8 radiobutton group gr2 .

selection-screen end of block block2 .

selection-screen begin of block block3 with frame title text-003.

parameters: p4(20) type c.

selection-screen end of block block3 .

selection-screen begin of block block4 with frame title text-004.

parameters: c1 as checkbox ,

c2 as checkbox ,

c3 as checkbox .

selection-screen end of block block4.

selection-screen:

begin of line,

pushbutton 15(10) but1 user-command cli1,

pushbutton 30(10) but2 user-command cli2,

pushbutton 45(10) but3 user-command cli3,

pushbutton 60(10) but4 user-command cli4 ,

pushbutton 75(10) but5 user-command cli5,

end of line.

initialization.

but1 = 'ADD' .

but2 = 'CANCEL' .

but3 = 'DELETE' .

but4 = 'MODIFY' .

but5 = 'EXIT' .

At selection-screen .

if sscrfields-ucomm = 'CLI1' .

itab-regno = p1 .

itab-name = p2 .

itab-fname = p3 .

if r1 = 'x' .

itab-class = 'I'.

elseif r2 = 'x' .

itab-class = 'II'.

elseif r3 = 'x'.

itab-class = 'III'.

elseif r4 = 'x'.

itab-class = 'IV'.

elseif r5 = 'x'.

itab-class = 'V'.

elseif r6 = 'x'.

itab-class = 'VI'.

endif.

if r6 = 'X'.

itab-gender = 'MALE' .

else .

itab-gender = 'FEMALE' .

endif .

itab-address = p4 .

if c1 = 'X'.

itab-games1 = 'chess' .

endif .

if c2 = 'X'.

itab-games2 = 'chess' .

endif .

if c3 = 'X'.

itab-games3 = 'chess' .

endif .

endif .

start-of-selection.

loop at itab.

write: / itab-regno ,

/ itab-name ,

/ itab-fname ,

/ itab-class ,

/ itab-gender ,

/ itab-address ,

/ itab-games1 ,

/ itab-games2 ,

/ itab-games3 .

endloop.

here if iam executing the pgm for the first time only the ADD button , REFRESH button and CANCEL button should be visible all the other buttons like DELETE buuton and MODIFY should be invisible.Based on the code give me the reply. please help me

Message was edited by:

subin cb

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Here is the code ... just write an query in the table control ... so that

REPORT demo_dynpro_modify_simple.

DATA: ok_code TYPE sy-ucomm,
      save_ok TYPE sy-ucomm.

DATA flag(1) TYPE c.

CALL SCREEN 100.

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
LOOP AT SCREEN.
    IF screen-group1 = 'MOD'.
        screen-input = '1'.
      ELSEif  screen-group1 = 'DEL'.
      screen-input = '0'.
      ENDIF.
     MODIFY SCREEN.

ENDLOOP.
ENDMODULE.

MODULE cancel.
  LEAVE PROGRAM.
ENDMODULE.

MODULE user_command_0100 INPUT.
      IF SY-TABIX  GT 1.
    LOOP AT SCREEN.
        IF screen-group1 = 'DEL'.
        screen-input = '1'.
         ENDIF.
         MODIFY SCREEN.
    ENDLOOP.
ENDIF.
ENDMODULE.

4 REPLIES 4

Former Member
0 Kudos

hi,

Use

LOOP AT SCREEN.

screen-active = 0.

modify screen.

endloop.

0 Kudos

When using the LOOP AT SCREEN you need to use the screen name also.

LOOP AT SCREEN.

CASE SCREEN-NAME.

WHEN <your field>.

screen-active = 0.

modify screen.

ENDCASE

endloop.

Message was edited by:

Martin Shinks

Former Member
0 Kudos

hi subin,

while declaring internal table instead occus 0 give occurs 1 then automatically required memory space is assigned for your internal table.

for enabling the delete button.

while displaying the output to user and after 1st record displayed to user then enable delete button as follows

loop at itab.

write:/10 itab-fld1,

20 itab-fld2,

..............

90 itab-fldn.

IF ITAB[] IS NOT INITIAL.

LOOP AT SCREEN.

IF SCREEN-NAME = 'DELETE'

screen-active = 1.

modify screen.

ENDIF.

ENDIF.

endloop.

IF HELPFUL REWARD SOMEPOINTS.

WITH REGARDS,

SURESH.A

20 itab-fld-2.

IF ITAB[] IS NOT INITIAL.

Former Member
0 Kudos

Here is the code ... just write an query in the table control ... so that

REPORT demo_dynpro_modify_simple.

DATA: ok_code TYPE sy-ucomm,
      save_ok TYPE sy-ucomm.

DATA flag(1) TYPE c.

CALL SCREEN 100.

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
LOOP AT SCREEN.
    IF screen-group1 = 'MOD'.
        screen-input = '1'.
      ELSEif  screen-group1 = 'DEL'.
      screen-input = '0'.
      ENDIF.
     MODIFY SCREEN.

ENDLOOP.
ENDMODULE.

MODULE cancel.
  LEAVE PROGRAM.
ENDMODULE.

MODULE user_command_0100 INPUT.
      IF SY-TABIX  GT 1.
    LOOP AT SCREEN.
        IF screen-group1 = 'DEL'.
        screen-input = '1'.
         ENDIF.
         MODIFY SCREEN.
    ENDLOOP.
ENDIF.
ENDMODULE.