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: 

HI ABAP GURU's

Former Member
0 Kudos

My requirement is from selection screen i have to selecting vbeln .

using this function module REUSE_ALV_POPUP_TO_SELECT,

I populated the checkbox and the three more fields in the popupscreen.

here you have 13 buttons will be displayed i need to close the popscreen without checking the checkbox.

i tried by using this code

if rs_selfield-tabindex is initial.

set screen 0.

leave screen.

else.

case r_ucomm.

when '&ETA'.

read table it_vbap2 with key zcheck = 'X'.

if sy-subrc <> 0.

message i001(00) with 'Please select at least one line item'.

r_ucomm = space. "Clear UCOMM, so STD funct doesn't fire

  • else.

  • rs_selfield-exit = 'X'.

endif.

  • when '&AC1'.

when 'CANCEL'.

set screen '1000'.

leave screen.

endcase.

endif.

please help me this solutions .points will be awarded.

after the selection screen i need to display the Smartforms line item.

if i close the button in the selection screen it goes into the printer attriubutes before to smartform displays.

please this is very urget help me , points will be awarded if any gives solutions.

Thanks in advance

2 REPLIES 2

Former Member
0 Kudos

Hi

Try likje this

 *&---------------------------------------------------------------------*
*& Report  ZALV_SAMPLE                                                *
*&                                                                     *
*&---------------------------------------------------------------------*
*& Program for displaying data using function modules :                *
*& REUSE_ALV_LIST_DISPLAY                                              *
*& REUSE_ALV_POPUP_TO_SELECT                                           *
*& REUSE_ALV_GRID_DISPLAY                                              *
*&                                                                     *
*&---------------------------------------------------------------------*
 
REPORT  ZALV_SAMPLE                            .
 
TABLES VBAK.
 
DATA it_vbak LIKE VBAK OCCURS 0 WITH HEADER LINE.
 
SELECTION-SCREEN uline.
 
 
PARAMETERS: ALV1 RADIOBUTTON GROUP ALV,       "REUSE_ALV_LIST_DISPLAY
            ALV2 RADIOBUTTON GROUP ALV,       "REUSE_ALV_POPUP_TO_SELECT
            ALV3 RADIOBUTTON GROUP ALV,       "REUSE_ALV_GRID_DISPLAY
            ALV4 RADIOBUTTON GROUP ALV.       " NORMAL DISPLAY
SELECTION-SCREEN uline.
 
 
SELECT * FROM  VBAK
         INTO CORRESPONDING FIELDS OF TABLE it_vbak
         UP TO 10 ROWS.
 
IF ALV1 = 'X'.
   PERFORM ALV_FUNC1.
 
ELSEIF ALV2 = 'X'.
   PERFORM ALV_FUNC2.
 
ELSEIF ALV3 = 'X'.
  PERFORM ALV_FUNC3.
 
ELSEIF ALV4 = 'X'.
  PERFORM NORM.
 
ENDIF.
 
 
 
*&---------------------------------------------------------------------*
*&      Form  ALV_FUNC1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM ALV_FUNC1 .
 
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    I_STRUCTURE_NAME               = 'VBAK'
  TABLES
    T_OUTTAB                       = it_vbak
   EXCEPTIONS
     PROGRAM_ERROR                  = 1
     OTHERS                         = 2
          .
IF SY-SUBRC <> 0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
 
 
ENDFORM.                    " ALV_FUNC1
 
 
 
*&---------------------------------------------------------------------*
*&      Form  ALV_FUNC2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM ALV_FUNC2 .
 
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
  EXPORTING
    I_TITLE                       = 'SALES ORDER INFO'
    I_ZEBRA                       = 'X'
    I_TABNAME                     = 1
    I_STRUCTURE_NAME              = 'vbak'
  TABLES
    T_OUTTAB                      = it_vbak
   EXCEPTIONS
     PROGRAM_ERROR                 = 1
     OTHERS                        = 2
          .
IF SY-SUBRC <> 0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
 
 
ENDFORM.                    " ALV_FUNC2
 
 
 
*&---------------------------------------------------------------------*
*&      Form  ALV_FUNC3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM ALV_FUNC3 .
 
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    I_STRUCTURE_NAME                  = 'vbak'
    I_GRID_TITLE                      = 'SALES ORDER INFO'
  TABLES
    T_OUTTAB                          = it_vbak
   EXCEPTIONS
     PROGRAM_ERROR                     = 1
     OTHERS                            = 2
          .
IF SY-SUBRC <> 0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
 
 
ENDFORM.                    " ALV_FUNC3
 
 
 
 
*&---------------------------------------------------------------------*
*&      Form  NORM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM NORM .
format intensified.
skip 1.
WRITE: /'SALES DOC.',
        '    Created on ',
        '    Time',
        '      Created by',
        '       Valid from ',
        '     Sold-to party'.
format intensified off.
skip 2.
 
LOOP AT it_vbak.
 
write: / it_vbak-vbeln,'   ',
         it_vbak-erdat,'   ',
         it_vbak-erzet,'   ',
         it_vbak-ERNAM,'   ',
         it_vbak-ANGDT,'       ',
         it_vbak-KUNNR.
 
endloop.
 
ENDFORM.                    " NORM

Look at the below link for more info

Regards

Pavan

Former Member
0 Kudos

HI pavan,

what you say it is correct , but my requirement is like this

i have used the function module like this....

call function 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

i_title = title1

i_checkbox_fieldname = 'ZCHECK'

i_tabname = 'IT_VBAP'

it_fieldcat = ifldc

it_excluding = iex

i_callback_program = repid

i_callback_user_command = 'HANDLE_USER_COMMAND'

TABLES

t_outtab = it_vbap

EXCEPTIONS

program_error = 1

others = 2.

after i am using the user_command by this i am handling the buttons.

form handle_user_command1 using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

if rs_selfield-tabindex is initial.

set screen 0.

leave screen.

else.

case r_ucomm.

when '&ETA'.

read table it_vbap2 with key zcheck = 'X'.

if sy-subrc <> 0.

message i001(00) with 'Please select at least one line item'.

r_ucomm = space. "Clear UCOMM, so STD funct doesn't fire

  • else.

  • rs_selfield-exit = 'X'.

endif.

  • when '&AC1'.

when 'CANCEL'.

set screen '1000'.

leave screen.

  • leave to screen 0.

endcase.

endif.

if rs_selfield-exit = 'X'.

set screen '1000'.

leave screen.

endif.

endform. "handle_user_command1

From this after selecting line item i am moving to the next smartforms screen

w_form_name = 'ZSMARTFORM'.

screen will display.

after populating value in the popupscreen in this screen if i will close it is not moving to the selection screen.

it is display the smartform printpriview.

Please helpme in this case.

Thanks in advance.