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

how to display data using pushbuttons ?

Former Member
0 Likes
1,335

Hi all,

Please help me to understand that how to display data using pushbuttons .Have checked on every website regarding mentioned query but not able to understand how my code wil get executed and have mentioned only one or two examples .

Please go through below code and if possible correct it and reply me .

tables : sscrfields, lfa1.      " TABLE DECLARATION

data : begin of ty_lfa1 occurs 0 ,

               lifnr like lfa1-lifnr,

               name1 like lfa1-name1

                sortl like lfa1-sortl,

           end of ty_lfa1.          " STRUCTURE DECLARATION

data : it_lfa1 like standard table of ty_lfa1,         " INTERNAL TABLE

          wa_lfa1 like ty_lfa1.                                    " WORK AREA

SELECTION-SCREEN BEGIN OF BLOCK b_2 WITH FRAME TITLE text-000.

SELECT-OPTIONS : vendor FOR lfa1-lifnr.

selection-screen skip 3.

SELECTION-SCREEN PUSHBUTTON /1(24) name USER-COMMAND disp.      " 1ST PUSHBUTTON

SELECTION-SCREEN PUSHBUTTON /1(24) name USER-COMMAND exit.       " 2ND PUSHBUTTON

SELECTION-SCREEN END OF BLOCK b_2.

INITIALIZATION.

DISP = 'DISPLAY'.

EXIT = 'EXIT'.

AT SELECTION-SCREEN.

CASE

7 REPLIES 7
Read only

RaymondGiuseppi
Active Contributor
0 Likes
928

Have checked on every website regarding mentioned query

Apparently not on google, scn.sap.com or help.sap.com ?

This is a very basic requirement, Press F1 on some statements and look at statements definitions, function code in statement SELECTION-SCREEN PUSHBUTTON are not variables but already constants that you will check in SSCRFIELDS-UCOMM in AT SELECTION-SCREEN, you missed a "," in your internal table (old fashioned syntax too), etc...

Regards,

Raymond

Read only

0 Likes
928

Hi , thanks for your reply .

i know how to display pushbuttons but will you please help to correct my code as i am not able to view data for table lfa1 when pressed display pushbutton .

Please will you please elaborate 'new style' to create pushbutton .

please go through below code and help me to rectify error as why am not able to display data.

tables : sscrfields , lfa1.

data : begin of ty_lfa1 OCCURS 0,

        LIFNR like lfa1-lifnr,

        LAND1 like lfa1-land1,

        NAME1 like lfa1-name1,

        ORT01 like lfa1-ort01,

       end of ty_lfa1.

data : it_lfa1 LIKE STANDARD TABLE OF ty_lfa1,

       wa_lfa1 like ty_lfa1.

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

  SELECT-OPTIONS : vendor for lfa1-lifnr.

SELECTION-SCREEN SKIP .

  SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON 5(20) BUT1 USER-COMMAND DISP.

SELECTION-SCREEN PUSHBUTTON 5(20) BUT2 USER-COMMAND EXIT.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B1.

INITIALIZATION .

BUT1 = 'display'.

BUT2 = 'exit'.

AT SELECTION-SCREEN .

 

  CASE SSCRFIELDS-UCOMM.

   

    WHEN 'DISP'.

     

      SELECT LIFNR  LAND1  NAME1  ORT01

      FROM LFA1

      INTO TABLE IT_LFA1

      WHERE LIFNR IN VENDOR.

       

      LOOP AT IT_LFA1 INTO WA_LFA1.

       

        WRITE : / WA_LFA1-LIFNR,

                  WA_LFA1-LAND1,

                  WA_LFA1-NAME1,

                  WA_LFA1-ORT01.

      ENDLOOP.   

          

      WHEN 'EXIT'.

       

        LEAVE PROGRAM .

       

ENDCASE.           

thanks and regards.

prasad krishna naralkar

Read only

0 Likes
928

Hi , thanks for your reply .

i know how to display pushbuttons but will you please help to correct my code as i am not able to view data for table lfa1 when pressed display pushbutton .

Please will you please elaborate 'new style' to create pushbutton .

please go through below code and help me to rectify error as why am not able to display data.

tables : sscrfields , lfa1.

data : begin of ty_lfa1 OCCURS 0,

        LIFNR like lfa1-lifnr,

        LAND1 like lfa1-land1,

        NAME1 like lfa1-name1,

        ORT01 like lfa1-ort01,

       end of ty_lfa1.

data : it_lfa1 LIKE STANDARD TABLE OF ty_lfa1,

       wa_lfa1 like ty_lfa1.

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

  SELECT-OPTIONS : vendor for lfa1-lifnr.

SELECTION-SCREEN SKIP .

  SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON 5(20) BUT1 USER-COMMAND DISP.

SELECTION-SCREEN PUSHBUTTON 5(20) BUT2 USER-COMMAND EXIT.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B1.

INITIALIZATION .

BUT1 = 'display'.

BUT2 = 'exit'.

AT SELECTION-SCREEN .

 

  CASE SSCRFIELDS-UCOMM.

   

    WHEN 'DISP'.

     

      SELECT LIFNR  LAND1  NAME1  ORT01

      FROM LFA1

      INTO TABLE IT_LFA1

      WHERE LIFNR IN VENDOR.

       

      LOOP AT IT_LFA1 INTO WA_LFA1.

       

        WRITE : / WA_LFA1-LIFNR,

                  WA_LFA1-LAND1,

                  WA_LFA1-NAME1,

                  WA_LFA1-ORT01.

      ENDLOOP.   

          

      WHEN 'EXIT'.

       

        LEAVE PROGRAM .

       

ENDCASE.           

Read only

Former Member
0 Likes
928

This message was moderated.

Read only

0 Likes
928

Hi , thanks for your reply .

i know how to display pushbuttons but will you please help to correct my code as i am not able to view data for table lfa1 when pressed display pushbutton .

Please will you please elaborate 'new style' to create pushbutton .

please go through below code and help me to rectify error as why am not able to display data.

tables : sscrfields , lfa1.

data : begin of ty_lfa1 OCCURS 0,

        LIFNR like lfa1-lifnr,

        LAND1 like lfa1-land1,

        NAME1 like lfa1-name1,

        ORT01 like lfa1-ort01,

       end of ty_lfa1.

data : it_lfa1 LIKE STANDARD TABLE OF ty_lfa1,

       wa_lfa1 like ty_lfa1.

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

  SELECT-OPTIONS : vendor for lfa1-lifnr.

SELECTION-SCREEN SKIP .

  SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON 5(20) BUT1 USER-COMMAND DISP.

SELECTION-SCREEN PUSHBUTTON 5(20) BUT2 USER-COMMAND EXIT.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B1.

INITIALIZATION .

BUT1 = 'display'.

BUT2 = 'exit'.

AT SELECTION-SCREEN .

 

  CASE SSCRFIELDS-UCOMM.

   

    WHEN 'DISP'.

     

      SELECT LIFNR  LAND1  NAME1  ORT01

      FROM LFA1

      INTO TABLE IT_LFA1

      WHERE LIFNR IN VENDOR.

       

      LOOP AT IT_LFA1 INTO WA_LFA1.

       

        WRITE : / WA_LFA1-LIFNR,

                  WA_LFA1-LAND1,

                  WA_LFA1-NAME1,

                  WA_LFA1-ORT01.

      ENDLOOP.   

          

      WHEN 'EXIT'.

       

        LEAVE PROGRAM .

       

ENDCASE.           

Read only

0 Likes
928

Hi Prasad,

why you are making your program as so much tough.go with simple

based on vendor number ,you have to display vendor details right  ?

try with SQVI (Quick Viewer).

if u want push button mandatory means in your selection screen,

Go with Module pool program. you will get it easily.

Regards,

Bastin.G