AT user command in interactive list(basic) is not calling smartform

Hi,
I am facing a problem, which will be strange for all i think.
in a basic list (not ALV) simple interactive report i am using
a at user-command. my concern is to collect the checked
box in the first output report display and store it into the
internal table and call a smart form when user
enter 'SHOW' command.
the problem is when i am entering a show command and
debugging it, it collects all the checked checkbox in the
internal table and it even call the smartform print popup
window, when i give print or printpreview it leave the
program with out throughing any error.
here is the code.
at user-command.
  case sy-ucomm.
    when 'SHOW'.
      do mline times.
        READ LINE SY-INDEX FIELD VALUE itab_item-chkbox.
        if itab_item-chkbox eq 'X'.
*          write:/ itab_item-banfn,30 itab_item-bnfpo.
          perform extract_final_data using itab_item-bnfpo itab_item-banfn.
        endif.
      enddo.
      refresh: itab, itab_ser.
      clear:   itab, itab_ser.
* move all data to structure (itab) of form .
      loop at iitab_wa1.
        Move :  iitab_wa1-matnr  to itab-matnr,
                iitab_wa1-meins  to itab-meins,
                iitab_wa1-ebeln  to itab-ebeln,
                iitab_wa1-ebelp  to itab-ebelp,
                iitab_wa1-menge  to itab-ktmng,
                iitab_wa1-lfdat  to itab-eindt,
                iitab_wa1-typ    to itab-typ.
        append itab.
        clear  itab.
      endloop.
* display the selected item in the report screen.
      if sy-subrc is initial.
* sorting the table according to RFQ no and item no.
        sort itab by ebeln ebelp.
* including sr.no in table itab
        clear icnt.
        loop at itab.
          icnt  =  icnt  +  1.
          itab-srno = icnt.
          modify itab.
          clear  itab.
        endloop.
* Call the output form.
* YSF_MEDRUCK_RFQ_PR_ser_SAE is in 300
* for pr to rfq material and service in single form.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            FORMNAME = 'YSF_MEDRUCK_RFQ_PR_MAT_SAE'
          IMPORTING
            FM_NAME  = V_FM.
        CALL FUNCTION '/1BCDWB/SF00000037'
          EXPORTING
            ser_flg          = ser_flag
            material         = p_mat
            services         = p_ser
          TABLES
            itab             = itab
          EXCEPTIONS
            FORMATTING_ERROR = 1
            INTERNAL_ERROR   = 2
            SEND_ERROR       = 3
            USER_CANCELED    = 4
            OTHERS           = 5.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      else.
        write: ' Some error has occurred'.
      endif.
  endcase.
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Aug 22, 2008 6:16 PM

hi...
this shouldnt be happening..ne ways.u may try this..
put the smartform calling code in a report porgram and then use submit program and return command.
write this part of code in the report program....you will get all ur variables from stack....
Report y_call_sf.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
         EXPORTING
            FORMNAME = 'YSF_MEDRUCK_RFQ_PR_MAT_SAE'
          IMPORTING
            FM_NAME  = V_FM.
        CALL FUNCTION v_fm
          EXPORTING
            ser_flg          = (calling_prog)ser_flag    --> declare like this fro stack access
            material         = (calling_prog)p_mat
            services         = (calling_prog)p_ser
          TABLES
            itab             = (calling_prog)itab
          EXCEPTIONS
            FORMATTING_ERROR = 1
            INTERNAL_ERROR   = 2
            SEND_ERROR       = 3
            USER_CANCELED    = 4
            OTHERS           = 5.
        IF SY-SUBRC  0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      else.
        write: ' Some error has occurred'.
      endif.
calling prog is program from where u r submitting.......
so ur code will look like this....
at user-command.
  case sy-ucomm.
    when 'SHOW'.
      do mline times.
        READ LINE SY-INDEX FIELD VALUE itab_item-chkbox.
        if itab_item-chkbox eq 'X'.
         write:/ itab_item-banfn,30 itab_item-bnfpo.
          perform extract_final_data using itab_item-bnfpo itab_item-banfn.
        endif.
      enddo.
      refresh: itab, itab_ser.
      clear:   itab, itab_ser.
move all data to structure (itab) of form .
      loop at iitab_wa1.
        Move :  iitab_wa1-matnr  to itab-matnr,
                iitab_wa1-meins  to itab-meins,
                iitab_wa1-ebeln  to itab-ebeln,
                iitab_wa1-ebelp  to itab-ebelp,
                iitab_wa1-menge  to itab-ktmng,
                iitab_wa1-lfdat  to itab-eindt,
                iitab_wa1-typ    to itab-typ.
        append itab.
        clear  itab.
      endloop.
display the selected item in the report screen.
      if sy-subrc is initial.
sorting the table according to RFQ no and item no.
        sort itab by ebeln ebelp.
including sr.no in table itab
        clear icnt.
        loop at itab.
          icnt  =  icnt  +  1.
          itab-srno = icnt.
          modify itab.
          clear  itab.
        endloop.
Call the output form.
YSF_MEDRUCK_RFQ_PR_ser_SAE is in 300
for pr to rfq material and service in single form.
       submit y_call_sf and return. -->plz check the syntax
  endcase.

Similar Messages

  • USER COMMAND FOR INTERACTIVE ALV REPORT

    Hi Frens
    I am making an interactive alv report showing a cost center hierarchy. I could scuccessfully capture the first click event in the user command using  '&IC1'. Now i want to capture the second click event for the third hierarchy.
    When i try to do that, the program flow keeps hitting the same user command time n again. I want to put in a different code for the different click events. What is the way to achieve this?
    I searched ....there is nothing like '&IC2'. It does not work.

    hi,
    You can try this for the first click
    READ TABLE IST_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY IST_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-NAME.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = G_REPID
          I_CALLBACK_PF_STATUS_SET = C_PF         "'SET_PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          I_CALLBACK_TOP_OF_PAGE   = 'TOP_OF_PAGE'
          I_GRID_TITLE             = G_TITLE
          IS_LAYOUT                = IST_LAYOUT
          IT_FIELDCAT              = IST_FIELDCAT[]
          IT_SORT                  = IST_SORT
          I_SAVE                   = 'A'
          IT_EVENTS                = IST_EVENTS
          IS_PRINT                 = IST_PRNT
        IMPORTING
          E_EXIT_CAUSED_BY_CALLER  = G_EXIT
          ES_EXIT_CAUSED_BY_USER   = IST_EXIT
        TABLES
          T_OUTTAB                 = IST_FINAL "sodtl
        EXCEPTIONS
          PROGRAM_ERROR            = 1
          OTHERS                   = 2.
    FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM
      RS_SELFIELD TYPE SLIS_SELFIELD.
    your code....
    ENDFORM.
    for second click
    READ TABLE IST_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND1'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND1'.
        MODIFY IST_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-NAME.
      ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = G_REPID
          I_CALLBACK_PF_STATUS_SET = C_PF "'SET_PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND1'
          I_CALLBACK_TOP_OF_PAGE   = 'TOP_OF_PAGE'
          I_GRID_TITLE             = G_TITLE
          IS_LAYOUT                = IST_LAYOUT
          IT_FIELDCAT              = IST_FIELDCAT[]
          I_SAVE                   = 'A'
        TABLES
          T_OUTTAB                 = IST_FINAL1.
    hope this solves.

  • User command in hierarchical list

    hi, i have displayed data in hierarchical list using oo prog.
    i made use of classes like cl_salv_herseq_table
    i wanted a functionality which in non OO prog using 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' can be done by sending
    the parameter in I_CALLBACK_USER_COMMAND.
    the function that we send to I_CALLBACK_USER_COMMAND has two parameters of type sy-ucomm and slis_selfield .
    using object oriented prog  i found a method get_events with the help of which i could trigger the even on mouseclicks
    and getting appropriate functionkey in the parameter i_ucomm. But i want the slis_selffield option as well using OO prog
    that could get the details of the item clicked.

    Check out this code:
    REPORT ztest_sourav16. TYPE-POOLS: slis. TYPES: BEGIN OF x_mara, matnr TYPE matnr, ersda TYPE ersda, ernam TYPE ernam, laeda TYPE laeda, aenam TYPE aenam, vpsta TYPE vpsta, pstat TYPE pstat_d, lvorm TYPE lvoma, check TYPE char1, END OF x_mara, BEGIN OF x_marc, matnr TYPE matnr, werks TYPE werks_d, END OF x_marc. DATA: i_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0, i_marc TYPE STANDARD TABLE OF x_marc INITIAL SIZE 0, wa_alv_keyinfo TYPE slis_keyinfo_alv, i_fieldcat TYPE slis_t_fieldcat_alv, wa_layout TYPE slis_layout_alv. START-OF-SELECTION. SELECT matnr werks FROM marc INTO TABLE i_marc UP TO 100 ROWS. IF sy-subrc = 0. SELECT matnr ersda ernam laeda aenam vpsta pstat lvorm FROM mara INTO TABLE i_mara FOR ALL ENTRIES IN i_marc WHERE matnr = i_marc-matnr. IF sy-subrc = 0. ENDIF. ENDIF. END-OF-SELECTION. DATA: i_callback_program TYPE syrepid VALUE sy-repid. PERFORM sub_populate_fcat. wa_alv_keyinfo-header01 = 'MATNR'. wa_alv_keyinfo-item01 = 'MATNR'. wa_alv_keyinfo-item02 = 'WERKS'. wa_layout-box_fieldname = 'CHECK'. wa_layout-box_tabname = 'I_MARA'. CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' EXPORTING * I_INTERFACE_CHECK = 'X' i_callback_program = i_callback_program i_callback_pf_status_set = 'SUB_SET_PF_STATUS' i_callback_user_command = 'SUB_USER_COMMAND' is_layout = wa_layout it_fieldcat = i_fieldcat * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = i_tabname_header = 'I_MARA' i_tabname_item = 'I_MARC' * I_STRUCTURE_NAME_HEADER = * I_STRUCTURE_NAME_ITEM = is_keyinfo = wa_alv_keyinfo * IS_PRINT = * IS_REPREP_ID = * I_BYPASSING_BUFFER = * I_BUFFER_ACTIVE = * IR_SALV_HIERSEQ_ADAPTER = * IT_EXCEPT_QINFO = * I_SUPPRESS_EMPTY_DATA = ABAP_FALSE * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab_header = i_mara t_outtab_item = i_marc 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. *&---------------------------------------------------------------------* *& Form sub_populate_fcat *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM sub_populate_fcat. DATA: l_wa_fieldcat TYPE slis_fieldcat_alv. l_wa_fieldcat-ref_tabname = 'MARA'. l_wa_fieldcat-tabname = 'I_MARA'. l_wa_fieldcat-fieldname = 'MATNR'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'ERSDA'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'ERNAM'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'LAEDA'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'AENAM'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'VPSTA'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'PSTAT'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'LVORM'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat. l_wa_fieldcat-fieldname = 'MATNR'. l_wa_fieldcat-ref_tabname = 'MARC'. l_wa_fieldcat-tabname = 'I_MARC'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat. l_wa_fieldcat-fieldname = 'WERKS'. l_wa_fieldcat-ref_tabname = 'MARC'. l_wa_fieldcat-tabname = 'I_MARC'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat. ENDFORM. "sub_populate_fcat' *&---------------------------------------------------------------------* *& Form SUB_USER_COMMAND *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM sub_user_command USING rf_ucomm TYPE syucomm rs TYPE slis_selfield. DATA: l_i_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0, l_lines TYPE i, l_wa_mara TYPE x_mara. CASE rf_ucomm. WHEN 'DETA'. l_i_mara[] = i_mara. DELETE l_i_mara WHERE check = space. l_lines = LINES( l_i_mara ). IF l_lines EQ 0. MESSAGE i001(00) WITH 'No lines selected.'. ELSEIF l_lines GT 1. MESSAGE i001(00) WITH 'More than one lines selected.'. ELSEIF l_lines EQ 1. READ TABLE l_i_mara INTO l_wa_mara INDEX 1. IF sy-subrc = 0. MESSAGE i001(00) WITH 'You have selected material:' l_wa_mara-matnr. ENDIF. ENDIF. * WHEN . * WHEN OTHERS. ENDCASE. ENDFORM. "sub_user_command *&---------------------------------------------------------------------* *& Form sub_set_pf_status *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->RT_EXTAB text *----------------------------------------------------------------------* FORM sub_set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'ZSTANDARD'. ENDFORM. "sub_set_pf_status
    Hope this helps

  • Pf status and user-command

    hi
    can any one explain me about pf-status and user-command?  what is the difference between this two and how to display icons in it.
    max reward points for good answer
    thanks
    alka

    Hi alka ritu  ,
    Check the following websites for good documentation o n pf status and user-command
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba34635c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba99935c111d1829f0000e829fbfe/content.htm
    1. How to set pf-status
    set pf-status ‘ZZBILSTA’.
    2. How to set pf-status excluding/including single menu items
    You can exclude menus by using exclude :
    set pf-status ‘ZZBILSTA’ excluding ‘PST’.
    Note: Can also be used with include instead of exclude
    3. How to set pf-status excluding/including several menu items
    You have to use an internal table to store the status you wan’t to ex- or include:
    DATA:BEGIN OF I_PF_STATUS_TAB OCCURS 10,
    FCODE,
    END OF I_PF_STATUS_TAB.
    FORM SET_PF_STATUS_POSTER.
    REFRESH I_PF_STATUS_TAB. MOVE ‘PST’ TO I_PF_STATUS_TAB. APPEND I_PF_STATUS_TAB. MOVE ‘ART’ TO I_PF_STATUS_TAB. APPEND I_PF_STATUS_TAB. SET PF-STATUS ‘ZZBILSTA’ EXCLUDING I_PF_STATUS_TAB.
    ENDFORM.
    4. Setting PF status to the (SAP) system default
    set pf-status ‘BASIC’.
    5. How to check for pf-status
    AT USER-COMMAND.
    CASE SY-UCOMM. WHEN ‘ART’. PERFORM STYR_ARTSKONTI. WHEN ‘PST’. PERFORM STYR_POSTER. WHEN ‘BIL’. PERFORM VIS_BILAG. ENDCASE.
    6. Use of SY-PFKEY
    You can use the system variable sy-pfkey to retrieve the name of the current pf status
    USER-COMMAND:
    If the user chooses a function code during list processing that is neither processed by the system, or PICK or PFnn, the system triggers the event AT USER-COMMAND. For this event, you must define your own GUI status for a list. To react to your own function codes in a program, you must define the following event block:
    AT USER-COMMAND.
      statements.
    In this event block, you can use an IF or CASE structure to differentiate between the function codes. They are available in the system field sy-ucomm. There are further system fields that are filled in list events, such as sy-lsind and sy-pfkey, that allow you to make further case distinctions.
    Triggering a List Event from the Program
    You can trigger a list event from the program as follows:
    SET USER-COMMAND fc.
    This statement takes effect after the current list is completed. Before the list is displayed, the event assigned to function code fc is triggered, regardless of the dialog status you are using.
    The effect is the same as when the user chooses the function. In other words, predefined list function codes are trapped and processed by the runtime environment, the function codes PICK and PFnn trigger the AT LINE-SELECTION and AT PFnnevents, and user-defined function codes trigger the AT USER-COMMAND event block.
    Function code PICK triggers an event only if the cursor is located on a list line.
    Using this statement in conjunction with the function codes reserved for system functions, you can call the system functions from the program. For example, you can use SET USER-COMMAND '%SC' to call the Find dialog box directly, or to position the list correctly before it is displayed.
    If you use several SET USER-COMMAND statements while creating a list, the system executes only the last one.
    Example of AT USER-COMMAND.
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      WRITE: 'Basic List',
           / 'sy-lsind:', sy-lsind.
    TOP-OF-PAGE.
      WRITE 'Top-of-Page'.
      ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      CASE sy-pfkey.
        WHEN 'TEST'.
          WRITE 'Self-defined GUI for Function Codes'.
          ULINE.
      ENDCASE.
    AT LINE-SELECTION.
      SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
      PERFORM out.
      sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'FC1'.
          PERFORM out.
          WRITE / 'Button FUN 1 was pressed'.
        WHEN 'FC2'.
          PERFORM out.
          WRITE / 'Button FUN 2 was pressed'.
        WHEN 'FC3'.
          PERFORM out.
          WRITE / 'Button FUN 3 was pressed'.
        WHEN 'FC4'.
          PERFORM out.
          WRITE / 'Button FUN 4 was pressed'.
        WHEN 'FC5'.
          PERFORM out.
          WRITE / 'Button FUN 5 was pressed'.
      ENDCASE.
      sy-lsind = sy-lsind - 1.
    FORM out.
      WRITE: 'Secondary List',
           / 'sy-lsind:', sy-lsind,
           / 'sy-pfkey:', sy-pfkey.
    ENDFORM.
    Example of AT USER-COMMAND.
    REPORT demo_list_set_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      SET USER-COMMAND 'MYCO'.
      WRITE 'Basic List'.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'MYCO'.
          WRITE 'Secondary List from USER-COMMAND,'.
          WRITE: 'sy-lsind', sy-lsind.
          SET USER-COMMAND 'PF05'.
      ENDCASE.
    AT pf05.
      WRITE 'Secondary List from PF05,'.
      WRITE: 'sy-lsind', sy-lsind.
      SET CURSOR LINE 1.
      SET USER-COMMAND 'PICK'.
    AT LINE-SELECTION.
      WRITE 'Secondary List from LINE-SELECTION,'.
      WRITE: 'sy-lsind', sy-lsind.
      SET USER-COMMAND '%SC'.
    http://maxdb.sap.com/currentdoc/94/90ee41c334c717e10000000a155106/content.htm
    cheers!
    gyanaraj
    ****Pls reward points if u find this helpful

  • Interactive list in ALV

    Hi All,
    Is there any sample program for an interactive list in ALV? I would like to try an interactive ALV list option for one of my reports
    Thanks

    One more example - ALV Interactive ( two times REUSE_ALV_GRID_DISPLAY )
    REPORT  ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838                      .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
       LIST_TYPE_WRONG       = 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.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        TABLES
          T_OUTTAB                          = IT_EKKO
    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.                    "display_alv_report
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    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.

  • Regarding Interactive  list in alv

    Hi Experts,
    I want to know how to do a inteactive report in alv.
    For example: First i will display a alv list. Then when i double click on a field of a line or click on button (Details) by selecting  a line ,  then it will navigate me to the alv list with corresponding records where i clicked previously.
    How to use buttons in this case as we r using in simple interactive report.
    Can anyone pls help me in creating a simple example for the above???
    Thanks
    Sudhansu

    Hi,
    Example for Interactive ALV report.
    Please reward if useful.
    report  zreport no standard page heading
                                    message-id zw.
    Type Pools                                                           *
    type-pools: icon, slis.
    Tables                                                               *
    tables: tvst,
            likp,
            t30b,
            vekp,
            zpallettr,
            zvantr.
    Types                                                                *
    types:
      begin of ty_data,
         lgtor       like likp-lgtor,             " door
         vbeln       like likp-vbeln,             " delivery
         wbstk       like vbuk-wbstk,             " Goods movement status
         kostk       like vbuk-kostk,             " Picking status
         posnr       like lips-posnr,             " item
         route       like likp-route,             " route
         wadat       like likp-wadat,             " goods issue date
         lvsta       like vbup-lvsta,             " warehouse status
         packvorschr like vekp-packvorschr,       " pack mnemonic
         exidv       like vekp-exidv,             " handling unit
         zpallet_no(10),  "like zpallettr-zpallet_no,   " pallet no
         zcount_check like zpallettr-zcount_check," count check flag
         zvan_no(10),     "like zvantr-zvan_no,         " van no
         zvan_print  like zvantr-zvan_print,      " van manifest print
         zeod_print  like zvantr-zeod_print,      " eod manifest print
         zzpackclass like vekp-zzpackclass,       " package class
         zzti        like vekp-zzti,              " T.I. value
      end of ty_data.
    Data                                                                 *
    ranges: r_del   for likp-vbeln,
            r_lgtor for likp-lgtor.
    ranges: r_vanno for zvantr-zvan_no,
            r_palno for zpallettr-zpallet_no.
    data: begin of number_range occurs 0,
             mark(1),
             id(3),
             num(10) type n,
             desc like zpalletmd-zdesc,
          end of number_range.
    data: t_disp_tab  type standard table of zpickdisp,
          t_data_tab  type ty_data  occurs 0 with header line,
          t_disp_head type standard table of zpickhead.
    data: w_numrnge like number_range,
          w_number(10) type n.
    data: t_likp     like likp      occurs 0 with header line,
          t_lips     like lips      occurs 0 with header line,
          t_vbuk     like vbuk      occurs 0 with header line,
          t_vbup     like vbup      occurs 0 with header line,
          t_vepo     like vepo      occurs 0 with header line,
          t_vekp     like vekp      occurs 0 with header line,
          t_vantr    like zvantr    occurs 0 with header line,
          t_pallettr like zpallettr occurs 0 with header line,
          w_likp     like likp,
          w_lips     like lips,
          w_vbuk     like vbuk,
          w_vbup     like vbup,
          w_vepo     like vepo,
          w_vekp     like vekp.
    ALV DATA *****
    data:
         g_grid             type ref to cl_gui_alv_grid,
         g_sort             type slis_t_sortinfo_alv,
         g_custom_container type ref to cl_gui_custom_container,
         g_layout           type slis_layout_alv,
         gt_fieldcat        type slis_t_fieldcat_alv,
         t_fldcat           like line of gt_fieldcat,
         g_keyinfo          type slis_keyinfo_alv,
         gt_events          type slis_t_event,
         gs_event           type slis_alv_event,
         w_sy_repid         like sy-repid.
    data: begin of seltab occurs 0.
            include structure rsparams.
    data: end of seltab.
    SYSTEM GENERATED TABLE CONTROL DATA ********
    DECLARATION OF TABLECONTROL 'TC_TABCON' ITSELF
    controls: tc_tabcon type tableview using screen 0100.
    LINES OF TABLECONTROL 'TC_TABCON'
    data:     g_tc_tabcon_lines  like sy-loopc.
    data:     ok_code like sy-ucomm.
    Constants                                                            *
    constants: c_data_class like klah-class value 'DG_DATA',
               c_mat_class  like rmclf-klart value '001',
               c_pack       like lips-mtart value 'VERP',
               c_a(1)            value 'A',
               c_b(1)            value 'B',
               c_c(1)            value 'C',
               c_yes(1)          value 'X',
               c_no(1)           value ' '.
    Selection screen                                                     *
    standard report select options block
    selection-screen begin of block a with frame title text-002.
    select-options:
      s_wadat for likp-wadat no-extension obligatory.  " Goods Issue Date
    *parameters:                                           "TR01-
    p_vstel like tvst-vstel obligatory. " Shipping Point "TR01-
    select-options:                                             "TR01+
      p_vstel for tvst-vstel.            " Shipping Point  "TR01+
    select-options:
      s_lfart for likp-lfart,            " Delivery type
      s_lgtor for t30b-lgtor,            " Door selection
      s_exidv for vekp-exidv,            " Handling Unit
      s_vbeln for likp-vbeln.            " Delivery
    parameters:
      p_exdata as checkbox.              " Show extra columns flag
    selection-screen end of block a.
    van/pallet specific select options block
    selection-screen begin of block b with frame title text-001.
    select-options:
      s_palno for zpallettr-zpallet_no, " no-extension,
      s_vanno for zvantr-zvan_no.       " no-extension.
    selection-screen end of block b.
    Value Request Events                                                 *
    at selection-screen on value-request for s_palno-low.
      clear: number_range, w_number .
      refresh number_range.
    select numbers and display pop up screen for selection
      perform select_pal_nos.
      s_palno-low = w_number.
    at selection-screen on value-request for s_palno-high.
      clear: number_range, w_number .
      refresh number_range.
    select numbers and display pop up screen for selection
      perform select_pal_nos.
      s_palno-high = w_number.
    at selection-screen on value-request for s_vanno-low.
      clear: number_range, w_number .
      refresh number_range.
    select numbers and display pop up screen for selection
      perform select_van_nos.
      s_vanno-low = w_number.
    at selection-screen on value-request for s_vanno-high.
      clear: number_range, w_number .
      refresh number_range.
    select numbers and display pop up screen for selection
      perform select_van_nos.
      s_vanno-high = w_number.
    At Selection Screen                                                  *
    at selection-screen.
      perform validate_selections.
    Initialization                                                       *
    initialization.
    Start of selection                                                   *
    start-of-selection.
    clear all data tables
      clear: t_likp,
             t_lips,
             t_vbuk,
             t_vbup,
             t_vepo,
             t_vantr,
             t_pallettr,
             w_likp,
             w_lips,
             w_vbuk,
             w_vbup,
             w_vepo,
             w_vekp.
      refresh: t_likp,
               t_lips,
               t_vbuk,
               t_vbup,
               t_vepo,
               t_vantr,
               t_pallettr.
    select data for ALV
    due to different input parameters being used, to streamline the data
    selection process, different selection methods are required
      if not s_vanno is initial
      or not s_palno is initial.
      if selecting by van/pallet number, need to select the data from the
      handling unit upwards to delivery
        perform select_data_up.
      else.
      otherwise the data can be selected from the delivery downwards
        perform select_data_down.
      endif.
    End of selection                                                     *
    end-of-selection.
    call hierarchical ALV display function module
      call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
           exporting
                i_callback_program       = 'ZWMR_PICK_STATUS_REPORT'
                i_callback_pf_status_set = 'SET_STATUS'
                i_callback_user_command =
                   'USER_COMMAND' "custom gui status form
                is_layout                = g_layout  "user command form
                it_fieldcat              = gt_fieldcat
                it_sort                  = g_sort
                it_events                = gt_events
                i_tabname_header         = 't_disp_head'
                i_tabname_item           = 't_disp_tab'
                i_structure_name_header  = 'ZPICKHEAD'
                i_structure_name_item    = 'ZPICKDISP'
                is_keyinfo               = g_keyinfo
           tables
                t_outtab_header          = t_disp_head
                t_outtab_item            = t_disp_tab.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
                                FORMS                                    *
    Includes inserted by Screen Painter Wizard. DO NOT CHANGE THIS LINE!
      include zwmr_pick_status_reporto01 .
      include zwmr_pick_status_reporti01 .
      include zwmr_pick_status_reportf01 .
    *&      Form  select_pal_nos
          select pallet numbers for search help
    form select_pal_nos.
      data: begin of t_palno occurs 0,
              zpallet_no like zpallettr-zpallet_no,
            end of t_palno.
    select all available pallet numbers
      select distinct zpallet_no from zpallettr
                      into corresponding fields of table t_palno.
      loop at t_palno.
      get pallet id
        select single zpallet_id from zpallettr
                      into number_range-id
                      where zpallet_no = t_palno-zpallet_no.
      get pallet description
        select single zdesc from zpalletmd
                      into number_range-desc
                      where zpallet_id = number_range-id.
        number_range-num = t_palno-zpallet_no.
      append to search help table
        append number_range.
      endloop.
    call pop up dialog box
      call screen 0100 starting at 5 5.
    endform.                    " select_pal_nos
    *&      Form  select_van_nos
          select van numbers for search help
    form select_van_nos.
      data: begin of t_vanno occurs 0,
              zvan_no like zvantr-zvan_no,
            end of t_vanno.
    select available van numbers
      select distinct zvan_no from zvantr
                      into corresponding fields of table t_vanno.
      loop at t_vanno.
      select van id
        select single zvan_id from zvantr
                      into number_range-id
                      where zvan_no = t_vanno-zvan_no.
      select van description (maintained in pallet tables)
        select single zdesc from zpalletmd
                      into number_range-desc
                      where zpallet_id = number_range-id.
        number_range-num = t_vanno-zvan_no.
      append to search help table
        append number_range.
      endloop.
    call pop up dialog box
      call screen 0100 starting at 5 5.
    endform.                    " select_van_nos
    *&      Form  select_data_down
          select data if selecting from delivery down
    form select_data_down.
    select all deliveries from LIKP that fulfill selection criteria
      select * from likp into table t_likp
                         where vbeln in s_vbeln
                       and   vstel eq p_vstel                 "TR01-
                         and   vstel in p_vstel
                         and   lgtor in s_lgtor
                         and   wadat in s_wadat
                         and   lfart in s_lfart.
      if sy-subrc ne 0.
      no data found
        message i007.
        exit.
      endif.
      if not t_likp[] is initial.
      select sales document headers from VBUK
        select * from vbuk into table t_vbuk
                      for all entries in t_likp
                      where vbeln eq t_likp-vbeln.
      select all relevant delivery items from LIPS
        select * from lips into table t_lips
                      for all entries in t_likp
                      where vbeln eq t_likp-vbeln
                      and   pstyv ne 'ZPAC'
                      and   pstyv ne 'ZGDP'                     "TR02+
                      and   lfimg gt 0.                         "TR01+
      endif.
      if not t_lips[] is initial.
      select all sales document line items from VBUP
        select * from vbup into table t_vbup
                      for all entries in t_lips
                      where vbeln eq t_lips-vbeln
                      and   posnr = t_lips-posnr.
      select corresponding handling unit ID's (venum)
    TR03 Replace start
       select * from vepo appending corresponding fields of table t_vepo
                     for all entries in t_lips
                     where vbeln = t_lips-vbeln
                     and   posnr = t_lips-posnr
                     and   matnr = t_lips-matnr
                     and   charg = t_lips-charg.
        select * from vepo
                      inner join vekp on vepovenum = vekpvenum
                      appending corresponding fields of table t_vepo
                      for all entries in t_lips
                      where vepo~vbeln = t_lips-vbeln
                      and   vepo~posnr = t_lips-posnr
                      and   vepo~matnr = t_lips-matnr
                      and   vepo~charg = t_lips-charg
                      and   vekp~exidv in s_exidv.
    TR03 Replace end
      endif.
    build process table
      perform move_to_table.
    endform.   "select_data_down
    *&      Form  select_data_up
          select data if selecting from van/pallet up
    form select_data_up.
      if not s_vanno is initial.
      if van then select van numbers and hence pallet numbers
        select * from zvantr into table t_vantr
                              where zvan_no in s_vanno.
                            and   vstel   eq p_vstel."TR01-
        if not t_vantr[] is initial.
          select * from zpallettr into table t_pallettr
                                  for all entries in t_vantr
                                  where zpallet_no eq t_vantr-zpallet_no.
                                and   vstel      eq p_vstel."TR01-
        endif.
      else.
      otherwise can get pallet numbers directly
        select * from zpallettr into table t_pallettr
                                where zpallet_no in s_palno.
                              and   vstel      eq p_vstel."TR01-
      endif.
      if not t_pallettr[] is initial.
      from the pallet nos. we can select the handling units
        select * from vekp into table t_vekp
                           for all entries in t_pallettr
                           where exidv eq t_pallettr-exidv
                           and   exidv ne space
                           and   exidv in s_exidv               "TR03+
                           and ( exida = 'E'                    "TR01+
                           or    exida = 'F' ).                 "TR01+
      endif.
      if not t_vekp[] is initial.
      build vbeln range from t_vekp.
        loop at t_vekp.
          r_del-sign = 'I'.
          r_del-option = 'EQ'.
          r_del-low = t_vekp-vpobjkey.
          append r_del.
        endloop.
      select all deliveries from LIKP that correspond to HU's
        select * from likp into table t_likp
                           where vbeln in r_del
                           and   wadat in s_wadat
                           and   lfart in s_lfart.
      endif.
      if not t_likp[] is initial.
      select sales document headers from VBUK
        select * from vbuk into table t_vbuk
                      for all entries in t_likp
                      where vbeln eq t_likp-vbeln.
      select all relevant delivery items from LIPS
        select * from lips into table t_lips
                      for all entries in t_likp
                      where vbeln eq t_likp-vbeln
                      and   pstyv ne 'ZPAC'
                      and   pstyv ne 'ZGDP'                     "TR02+
                      and   lfimg gt 0.                         "TR01+
      endif.
      if not t_lips[] is initial.
      select all sales document line items from VBUP
        select * from vbup into table t_vbup
                      for all entries in t_lips
                      where vbeln eq t_lips-vbeln
                      and   posnr = t_lips-posnr.
      select corresponding handling unit ID's (venum)
        select * from vepo appending corresponding fields of table t_vepo
                      for all entries in t_lips
                      where vbeln = t_lips-vbeln
                      and   posnr = t_lips-posnr
                      and   matnr = t_lips-matnr
                      and   charg = t_lips-charg.
      endif.
    build process table
      perform move_to_table.
    endform.   "select_data_up
    *&      Form  move_to_table
          move data to processing table
    form move_to_table.
      loop at t_vepo.
        clear t_data_tab.
      delivery lines.
        clear w_lips.
        read table t_lips with key vbeln = t_vepo-vbeln
                                   posnr = t_vepo-posnr
                                   into w_lips.
        move-corresponding w_lips to t_data_tab.
      sales document line items
        clear w_vbup.
        read table t_vbup with key vbeln = t_vepo-vbeln
                                   posnr = t_vepo-posnr
                                   into w_vbup.
      if w_vbup-kosta = space.                   "TR01-
        not relevant for picking
        delete t_vepo.                           "TR01-
        continue.                                "TR01-
      else.                                      "TR01-
        move-corresponding w_vbup to t_data_tab.
      endif.                                     "TR01-
      sales doc header
        clear w_vbuk.
        read table t_vbuk with key vbeln = t_vepo-vbeln
                               into w_vbuk.
        move-corresponding w_vbuk to t_data_tab.
      delivery header
        clear w_likp.
        read table t_likp with key vbeln = t_vepo-vbeln
                               into w_likp.
        move-corresponding w_likp to t_data_tab.
      select handling unit info using vepo entry
        clear w_vekp.
        if t_vekp[] is initial.
          select single * from vekp into w_vekp
                                    where venum = t_vepo-venum.
        else.
          read table t_vekp with key venum = t_vepo-venum
                                     into w_vekp.
          if sy-subrc ne 0.
            select single * from vekp into w_vekp
                            where venum = t_vepo-venum.
          endif.
        endif.
        move-corresponding w_vekp to t_data_tab.
      select pallet / van load information
        select single zpallet_no zcount_check from zpallettr
                                 into (t_data_tab-zpallet_no,
                                       t_data_tab-zcount_check)
                                 where exidv eq w_vekp-exidv.
        if not t_data_tab-zpallet_no in s_palno.                "TR01+
          continue.                                             "TR01+
        endif.                                                  "TR01+
        if sy-subrc = 0.
          select single zvan_no zvan_print zeod_print from zvantr
                        into (t_data_tab-zvan_no,
                              t_data_tab-zvan_print,
                              t_data_tab-zeod_print)
                        where zpallet_no eq t_data_tab-zpallet_no.
          if not t_data_tab-zvan_no in s_vanno.                 "TR01+
            continue.                                           "TR01+
          endif.                                                "TR01+
        endif.
        append t_data_tab.
      endloop.
    *-----> TR01+ start
    If the delivery has yet to be packed, then need to include in report
    Thus delete t_lips here and if any entries left after looping through
    t_vepo, these will also need to be added to t_data_tab
    if the selection is by handling unit though we do not want these"TR03+
      if s_exidv is initial.                                          "TR03+
        loop at t_vepo.
          read table t_lips with key vbeln = t_vepo-vbeln
                                     posnr = t_vepo-posnr.
          if sy-subrc = 0.
            delete t_lips index sy-tabix.
          endif.
        endloop.
        if not t_lips[] is initial.
      move any unpacked items to the data table
          perform move_lips_to_table.
        endif.
      endif.                                                          "TR03+
    *<---- TR01+ End
    get relevant status icons
      perform select_icons.
    prepare ALV data
      perform prepare_alv.
    endform.                    " select_data
    *&      Form  select_icons
          select icons for display and move data to display table
    form select_icons.
      data: w_disp_tab like zpickdisp,
            w_disp_head like zpickhead,
            w_color like zpickdisp-color,
            ov_icon like zpickdisp-ov_icon,
            gi_icon like zpickdisp-gi_icon,
            to_icon like zpickdisp-to_icon,
            lp_icon like zpickdisp-lp_icon,
            pc_icon like zpickdisp-pc_icon,
            lv_icon like zpickdisp-lv_icon,
            vm_icon like zpickdisp-vm_icon,
            em_icon like zpickdisp-em_icon,
            t_ovst_tab like t_disp_tab with header line.
      constants: c_col1(3) value 'C10',
                 c_col2(3) value 'C20'.
      sort t_data_tab by lgtor vbeln.
      w_color = c_col2.
      loop at t_data_tab.
        at new lgtor.
        fill ALV header table
          clear w_disp_head.
          w_disp_head-lgtor = t_data_tab-lgtor.
          append w_disp_head to t_disp_head.
        endat.
      goods issue status & overall amber/green only
        case t_data_tab-wbstk.
          when c_c.
            move icon_green_light to gi_icon.
            move icon_green_light to ov_icon.
          when others.
            move icon_red_light to gi_icon.
            move icon_yellow_light to ov_icon.
        endcase.
      transfer order status
        case t_data_tab-lvsta.
          when c_a.
            move icon_red_light to to_icon.
          when c_b.
            move icon_yellow_light to to_icon.
          when c_c.
            move icon_green_light to to_icon.
          when space.
          write N/A
            to_icon = 'N/A'.
        endcase.
      loaded to pallet status
        if not t_data_tab-zpallet_no is initial.
          move icon_green_light to lp_icon.
        else.
          move icon_red_light to lp_icon.
        endif.
      pallet count status
        if not t_data_tab-zcount_check is initial.
          move icon_green_light to pc_icon.
        else.
          move icon_red_light to pc_icon.
        endif.
      loaded to van status
        if not t_data_tab-zvan_no is initial.
          move icon_green_light to lv_icon.
        else.
          move icon_red_light to lv_icon.
        endif.
      van manifest status
        if not t_data_tab-zvan_print is initial.
          move icon_green_light to vm_icon.
        else.
          move icon_red_light to vm_icon.
        endif.
      end of day manifest status
        if not t_data_tab-zeod_print is initial.
          move icon_green_light to em_icon.
        else.
          move icon_red_light to em_icon.
        endif.
      move working data table to display table
        move-corresponding t_data_tab to w_disp_tab.
        w_disp_tab-ov_icon = ov_icon.
        w_disp_tab-gi_icon = gi_icon.
        w_disp_tab-to_icon = to_icon.
        w_disp_tab-lp_icon = lp_icon.
        w_disp_tab-pc_icon = pc_icon.
        w_disp_tab-lv_icon = lv_icon.
        w_disp_tab-vm_icon = vm_icon.
        w_disp_tab-em_icon = em_icon.
        w_disp_tab-color = w_color.
      fill N/A values for initial fields for display
        if w_disp_tab-packvorschr is initial.
          w_disp_tab-packvorschr = 'N/A'.
        endif.
        if w_disp_tab-exidv is initial.
          w_disp_tab-exidv = 'N/A'.
        endif.
        if w_disp_tab-zpallet_no is initial.
          write 'N/A' to w_disp_tab-zpallet_no.
        endif.
        if w_disp_tab-zvan_no is initial.
          write 'N/A' to w_disp_tab-zvan_no.
        endif.
      display different color for new doc number
        at end of vbeln.
          if w_color = c_col1.
            w_color = c_col2.
          elseif w_color = c_col2.
            w_color = c_col1.
          endif.
        endat.
        append w_disp_tab to t_disp_tab.
        clear w_disp_tab.
      endloop.
    we have all the icons in display but need to check the overall status
    as this refers to the line items
    green and amber statuses already set and use the same criteria as the
    goods issue status unless detected as red here
      data: ov_stat_red(1).
      clear w_disp_tab.
      sort t_disp_tab by vbeln.
      loop at t_disp_tab into w_disp_tab.
        at new vbeln.
        check all line items for delivery
          loop at t_data_tab where vbeln = w_disp_tab-vbeln.
            if t_data_tab-lvsta = c_a.
            set overall status to red
              ov_stat_red = c_yes.
              exit.
            else.
            leave green/amber status icon as previosly determined
            endif.
          endloop.
          if ov_stat_red = c_yes.
          set overall status to red for all items in that delivery
            clear ov_stat_red.
            move icon_red_light to w_disp_tab-ov_icon.
            modify t_disp_tab from w_disp_tab transporting ov_icon
                              where vbeln = w_disp_tab-vbeln.
          endif.
        endat.
      endloop.
    endform.                    " select_icons
    *&      Form  fill_layout
          fill ALV layout parameters
    form fill_layout.
      clear g_layout.
      g_layout-colwidth_optimize = c_yes.   " column width optimisation
      g_layout-zebra = space.               " alternate line colors
      g_layout-box_fieldname = 'MARK'.      " checkbox fieldname
      g_layout-info_fieldname = 'COLOR'.    " highlight row indicator
      g_layout-no_vline = space.            " vertical line
      g_layout-key_hotspot = space.         " hotspot field
      g_layout-f2code = 'PICK'.             " F2 ok_code
      g_layout-numc_sum = c_yes.            " sum numc fields
      g_layout-box_tabname = 't_disp_head'. " checkbox table name
      g_layout-expand_fieldname = 'EXPAND'. " expand field name
    endform.                    " fill_layout
    *&      Form  fill_sort
          fill ALV sort table
    form fill_sort.
      data: w_g_sort type slis_sortinfo_alv.
      w_g_sort-spos      = 1.
      w_g_sort-fieldname = 'LGTOR'.
      w_g_sort-tabname   = 't_disp_tab'.
      w_g_sort-up        = c_yes.
      append w_g_sort to g_sort.
      w_g_sort-spos      = 2.
      w_g_sort-fieldname = 'VBELN'.
      w_g_sort-tabname   = 't_disp_tab'.
      w_g_sort-up        = c_yes.
      append w_g_sort to g_sort.
      w_g_sort-spos      = 3.
      w_g_sort-fieldname = 'POSNR'.
      w_g_sort-tabname   = 't_disp_tab'.
      w_g_sort-up        = c_yes.
      append w_g_sort to g_sort.
      w_g_sort-spos      = 4.
      w_g_sort-fieldname = 'WADAT'.
      w_g_sort-tabname   = 't_disp_tab'.
      w_g_sort-up        = c_yes.
      append w_g_sort to g_sort.
    endform.                    " fill_sort
    *&      Form  fill_fieldcat
          Fill field category structure for ALV
    form fill_fieldcat.
      clear t_fldcat.
    create field catalogue for header table
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name         = 'ZWMR_PICK_STATUS_REPORT'
                i_internal_tabname     = 't_disp_head'
                i_structure_name       = 'ZPICKHEAD'
                i_client_never_display = c_yes
           changing
                ct_fieldcat            = gt_fieldcat[].
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    ceate field catalogue for items table
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name         = 'ZWMR_PICK_STATUS_REPORT'
                i_internal_tabname     = 't_disp_tab'
                i_structure_name       = 'ZPICKDISP'
                i_client_never_display = c_yes
           changing
                ct_fieldcat            = gt_fieldcat[].
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    modify field catalogue for this report
    set no display flag if not requested on selection screen
      if p_exdata ne c_yes.
        t_fldcat-no_out    =  c_yes.
        modify gt_fieldcat from t_fldcat transporting no_out
                           where fieldname eq 'PACKVORSCHR'
                           or    fieldname eq 'EXIDV'
                           or    fieldname eq 'ZPALLET_NO'
                           or    fieldname eq 'ZVAN_NO'
                           or    fieldname eq 'ZZPACKCLASS'
                           or    fieldname eq 'ZZTI'.
      endif.
    set no display flag for item level LGTOR field
      t_fldcat-no_out    =  c_yes.
      modify gt_fieldcat from t_fldcat transporting no_out
                         where fieldname eq 'LGTOR'
                         and   tabname   eq 't_disp_tab'.
    prevent display of technical fields
      t_fldcat-tech = c_yes.
      modify gt_fieldcat from t_fldcat transporting tech
                         where fieldname eq 'EXPAND'
                         or    fieldname eq 'SELKZ'.
    set vbeln as key
      t_fldcat-key = c_yes.
      modify gt_fieldcat from t_fldcat transporting key
                         where fieldname eq 'VBELN'.
    prevent scrolling for info fields
      t_fldcat-fix_column = c_yes.
      modify gt_fieldcat from t_fldcat transporting fix_column
                         where fieldname eq 'VBELN'.
    endform.                    " fill_fieldcat
    *&      Form  prepare_ALV
          Fill ALV parameters
    form prepare_alv.
    fill ALV key info
      g_keyinfo-header01 = 'LGTOR'.
      g_keyinfo-item01   = 'LGTOR'.
    fill ALV events
      gs_event-name = 'TOP_OF_PAGE'.
      gs_event-form = 'TOP_OF_PAGE'.
      append gs_event to gt_events.
    fill ALV sort table
      perform fill_sort.
    fill ALV layout structure
      perform fill_layout.
    fill ALV field category
      perform fill_fieldcat.
    endform.                    " prepare_ALV
    *&      Form  user_command
          form called on user command from ALV list
    form user_command using r_ucomm     like sy-ucomm
                            rs_selfield type slis_selfield.
      data: index type i,
            w_disp_head like line of t_disp_head,
            w_door like likp-lgtor.
      clear r_lgtor. refresh r_lgtor.
      case r_ucomm.
        when 'PICK'. " Double click line
        when 'VANM'. " Van Manifest button
        read the header table where has been selected
          loop at t_disp_head into w_disp_head where mark = c_yes.
            r_lgtor-sign   = 'I'.
            r_lgtor-option = 'EQ'.
            r_lgtor-low    = w_disp_head-lgtor.
            append r_lgtor.
          endloop.
        print the van manifest
          perform print_van_manifest tables r_lgtor.
        when 'EODM'. " EOD Manifest button
        read the header table where has been selected
          loop at t_disp_head into w_disp_head where mark = c_yes.
            r_lgtor-sign   = 'I'.
            r_lgtor-option = 'EQ'.
            r_lgtor-low    = w_disp_head-lgtor.
            append r_lgtor.
          endloop.
        print the end of day manifest
          perform print_eod_manifest tables r_lgtor.
        when 'REFR'. "Refresh
        refresh display
          w_sy_repid = sy-repid.
          call function 'RS_REFRESH_FROM_SELECTOPTIONS'
               exporting
                    curr_report     = w_sy_repid
               tables
                    selection_table = seltab.
              exceptions
                  not_found       = 1
                  no_report     

  • At line-selection & at user-command event issue

    hi
    i am working on a interactive report,with at line & at user command event,on list 3 i have used a pf status,to trigger the at user command event,till that i was working with at line selection,which are working fine,but on list 3,i am able to see my pf status,but at user command event is not working properly,its still working like at line selection event,if i clk on record,it take to for nxt action,which i want to do through the action button of pf status.
    In debugging i checked that it coming to at user command,but the action in sy-user is 'PICK' & its doing the operation.
    WHEN '3'.
          IF itab4[] IS NOT INITIAL.
            SET PF-STATUS 'Z203'.
            LOOP AT itab4.
              AT FIRST.
                WRITE:/1 'Material' ,18 'Name'.
              ENDAT.
              WRITE:/1 itab4-matnr,8 itab4-maktx.
              HIDE:itab4-matnr.
            ENDLOOP.
          ELSE.
            WRITE:/ 'No Data Found'.
          ENDIF.
      ENDCASE.
      BREAK-POINT.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'CALL'.
          PERFORM bdc_mm02.
      ENDCASE.
    pls tel me how to use at line selection & at user command in same report to make both events working efficiently.
    regds
    vipin

    Check whether you have assigned Function Key F2 to your function code 'CALL'. If so change that function key. The function key F2 is always linked to function code 'PICK'.
    Regards
    Sathar

  • *when we use at user -command and give smaple code fro at user-command*

    Hi experts,
    i am new to abap can any body tell me when we use AT USER-COMMAND and give a sample code for that.
    point will be rewarded.
    thanks.

    Hi,
    AT USER-COMMAND  is a list Event.This Event is triggered when user make an action on the Application Toolber Or Menubar.
    Here is the Program.
    START-OF-SELECTION.
      SET PF-STATUS 'TEST'.
      WRITE:  'Basic list, SY-LSIND =', sy-lsind.
    AT LINE-SELECTION.
      WRITE:  'LINE-SELECTION, SY-LSIND =', sy-lsind.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'TEST'.
          WRITE:  'TEST, SY-LSIND =', sy-lsind.
      ENDCASE.
    This program uses a status TEST, defined in the Menu Painter.
    Function key F5 has the function code TEST and the text Test for demo.
    Function code TEST is entered in the List menu.
    The function codes PICK and TEST are assigned to pushbuttons.
    The user can trigger the AT USER-COMMAND event either by pressing F5 , or by choosing List -> Test for demo, or by choosing the pushbutton 'Test for demo'.The user can trigger the AT LINE-SELECTION event by selecting a line.
    Hopr This Will help You.
    Regards,
    Sujit

  • Simple ALV interactive list...

    <b><b>hi i am a fresh Learner in ABAP and i am doing a small program in simple ALV interactive report in SD module that  gives me::
    1. SALES and then the invoice details of one particular value i click ,when delivery document number is given.
    2. Deivery and invoice details of one particular value i click ,when sales order number is given.
    3. Sales and delivery details of one particular value i click , when invoice order details are given.
    so i need a clear code for the above. i can input any one of the three inputs to get the correct solution.. please give me a valid solution and not useless ones..
    .. please help me with the same at the earliest !!!!!!!!!!!</b></b>
    Message was edited by: ashokkumar ramkumar, please urgent replies...........

    An Interactive ALV Report
    *& Report  ZZ_22038_22098_002                                          *
    *& This is an Interactive ALV report, where on line slection we can see
    *&  the secondry list
    REPORT  ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838                      .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
       LIST_TYPE_WRONG       = 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.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        TABLES
          T_OUTTAB                          = IT_EKKO
    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.                    "display_alv_report
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    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.

  • AT USER COMMAND is not getting triggerd

    Hi Techie's
    I have two fields on the selection screen
    1) Name:   ___________
    2) Id:         ___________
    I have some buttons say on the Application toolbar say::
    Save            Delete            Modify           Exit
    I have created these buttons in the INITIALIZATION event.
    I am using AT Selection Screen OUTPUT for some logic purpose.
    Later I am writing AT USER COMMAND and pressing  SAVE The function code for SAVE is "SAV".
    But the drama is that AT USER COMMAND is not getting triggered at all.
    It goes first to Initialization--->At selection Screen OUTPUT>Then screen appears> I give the values and press the SAVE button--
    again it goes to the At Selection screen OUTPUT.
    Not even getting the hang of it. Please help if anybody know the story of it.
    ITS SO URGENT.

    At user command is for list processing, you need something like this:
    Pushbuttons in the Application Toolbar
    In the application toolbar of the standard GUI status of the selection screen, five pushbuttons are predefined with the function codes FC01 to FC05, but are inactive by default. You can activate them during the definition of the selection screen as follows:
    SELECTION-SCREEN FUNCTION KEY i.
    The numbering i must be between 1 and 5. The individual function texts must be assigned to the functxt_0i components of structure sscrfields before the selection screen is called. You must declare this structure as an interface work area using the TABLES statement.
    If the user chooses one of these buttons, the runtime environment triggers the AT SELECTION-SCREEN event and the function code FC0i is placed into the component ucomm of the structure sscrfields.
    After the AT SELECTION-SCREEN event has been processed, the system displays the selection screen again. The only way to exit the selection screen and carry on processing the program is to choose Execute (F8). Consequently, the pushbuttons on the application toolbar are more suitable for controlling dynamic modifications of the selection screen than for controlling the program flow.
    REPORT demo_sel_screen_function_key.
    TABLES sscrfields.
    PARAMETERS: p_carrid TYPE s_carr_id,
                p_cityfr TYPE s_from_cit.
    SELECTION-SCREEN: FUNCTION KEY 1,
                      FUNCTION KEY 2.
    INITIALIZATION.
      sscrfields-functxt_01 = 'LH'.
      sscrfields-functxt_02 = 'UA'.
    AT SELECTION-SCREEN.
      CASE sscrfields-ucomm.
          WHEN'FC01'.
          p_carrid = 'LH'.
          p_cityfr = 'Frankfurt'.
        WHEN 'FC02'.
          p_carrid = 'UA'.
          p_cityfr = 'Chicago'.
      ENDCASE.
    START-OF-SELECTION.
      WRITE / 'START-OF-SELECTION'.
    This defines a standard selection screen with two parameters. In the application toolbar, two pushbuttons are assigned the texts LH and UA and activated.
    When the user clicks one of the buttons, the AT SELECTION-SCREEN event is triggered and there the input fields are preassigned correspondingly.

  • User command is not getting triggered in interactive ALV with LIST display

    Hi experts,
    I have developed an interactive ALV report with LIST display. Here, the issue is, when i double click a record in the primary ALV list, the control must go to the USER COMMAND event which i have written in my report. But the user command event is not getting triggered at all when i double click any record.
    It gives the following information instead.
    "Choose a valid function".
    (My user command name and its respective form name are same.)
    Here is my code..
    START-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'TST1'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    FORM tst1 USING r_ucomm LIKE sy-ucomm
                    rs_selfield TYPE slis_selfield.
    * Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.
    * Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.
    * Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.
    * Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.  CASE r_ucomm.
    *   When a record is selected
        WHEN '&IC1'.
    *     Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.      IF sy-subrc = 0.
    *       Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.
    *       Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
    Please advice what is the msitake i have done here..

    Read the following code:
    pass the  i_callback_user_command = g_user_command to the ALV function module and write the FORM user_command USING ucomm    LIKE sy-ucomm
                            selfield TYPE slis_selfield.
    as shown below.
    thanx
    Data for ALV display
    DATA  : gt_fieldcat TYPE slis_t_fieldcat_alv,
            gt_events           TYPE slis_t_event,
            g_variant LIKE disvariant,
            g_user_command      TYPE slis_formname VALUE 'USER_COMMAND',
            g_status            TYPE slis_formname VALUE 'SET_PF_STATUS',
            gt_list_top_of_page TYPE slis_t_listheader,
            g_repid LIKE sy-repid,
            gf_pos TYPE i
    Data for ALV display
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
               EXPORTING
              i_callback_program      = g_repid
                 i_callback_program      = sy-repid
                 it_fieldcat             = gt_fieldcat[]
           it_events               = gt_events[]
              i_callback_user_command = g_user_command
                 i_save                  = 'A'
                 is_variant              = g_variant
               TABLES
                 t_outtab                = it_print.
    FORM user_command USING ucomm    LIKE sy-ucomm
                            selfield TYPE slis_selfield.
      CASE ucomm.
        WHEN '&IC1'.
          CASE selfield-sel_tab_field.
            WHEN '1-KUNNR'.
              READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
              IF sy-subrc = 0.
                SET PARAMETER ID 'BPA' FIELD wa_print-kunnr.
                CALL TRANSACTION 'BP'.
              ENDIF.
            WHEN '1-MATNR'.
              READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
              IF sy-subrc = 0.
                SET PARAMETER ID 'JP_ISS' FIELD wa_print-matnr.
                CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN..
               GET PARAMETER ID 'WRK' FIELD wa_zprint-werks.
               SET PARAMETER ID 'VKO' FIELD wa_zprint-vkorg.
               SET PARAMETER ID 'VTW' FIELD wa_zprint-vtweg.
               CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN.
              ENDIF.
    Endcase.
    Endform.

  • Interactive report basic list concept

    Suppose in a basic list i have 7 parallel detail list.i am in basic list is there any way to go directly to 7 th detail list from basiclist or from 1st detail list to 7 th detail list vice-versa.
    plz tell me..i am waiting.. for reply
    thanx
    arya

    Hi...
        Just go through following code.... its for normal interactive reports...
    TYPES : BEGIN OF st_kna1,
    kunnr TYPE kna1-kunnr, "CUSTOMER NUMBER
    name1 TYPE kna1-name1, "CUSTOMER NAME
    END OF st_kna1.
    TYPES : BEGIN OF st_vbak,
    kunnr TYPE kna1-kunnr,
    vbeln TYPE vbak-vbeln, "SALES DOCUMENT NUMBER
    erdat TYPE vbak-erdat, "DATE ON WHICH THE RECORD WAS CREATED
    audat TYPE vbak-audat, "DOCUMENT DATE
    auart TYPE vbak-auart, "SALES DOCUMENT TYPE
    ernam TYPE vbak-ernam, "NAME OF PERSON WHO CREATED THE OBJECT.
    augru TYPE vbak-augru, "ORDER REASON
    END OF st_vbak.
    TYPES : BEGIN OF st_vbap,
    vbeln TYPE vbak-vbeln,
    posnr TYPE vbap-posnr, "SALES DOCUMENT ITEM
    matnr TYPE vbap-matnr, "MATERIAL NUMBER
    charg TYPE vbap-charg, "BATCH NUMBER
    matkl TYPE vbap-matkl, "MATERIAL GROUP
    posar TYPE vbap-posar, "ITEM TYPE
    END OF st_vbap.
    DATA : it_kna1 TYPE STANDARD TABLE OF st_kna1,
    it_vbak TYPE STANDARD TABLE OF st_vbak,
    it_vbap TYPE STANDARD TABLE OF st_vbap,
    wa_kna1 TYPE st_kna1,
    wa_vbak TYPE st_vbak,
    wa_vbap TYPE st_vbap.
    DATA : v_fld(15),
    v_kunnr TYPE kna1-kunnr,
    v_vbeln TYPE vbak-vbeln.
    SELECT-OPTIONS
    PARAMETERS
    SELECT-OPTIONS so_kunnr FOR v_kunnr. "CUSTOMER NUMBER
    PARAMETERS : p_max TYPE i. "NUMBER OF HITS
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM get_customerdata.
    SET PF-STATUS 'MENU1'.
    AT LINE-SELECTION
    AT LINE-SELECTION.
    IF sy-lsind = 1.
    PERFORM get_salesheader.
    ELSEIF sy-lsind = 2.
    PERFORM get_salesitemdata.
    ENDIF.
    AT USER-COMMAND
    AT USER-COMMAND.
    CASE sy-ucomm.
    WHEN 'DISP'.
    PERFORM get_salesheader.
    WHEN 'ITEM'.
    PERFORM get_salesitemdata.
    WHEN 'VA03'.
    SET PARAMETER ID 'AUN' FIELD wa_vbak-vbeln.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    ENDCASE.
    TOP-OF-PAGE
    TOP-OF-PAGE.
    ULINE AT /1(56).
    WRITE : /1 sy-vline ,
    2(15) text-004 COLOR 1 ,
    sy-vline ,
    20(35) text-005 COLOR 1 ,
    sy-vline.
    ULINE AT /1(56).
    TOP-OF-PAGE DURING LINE-SELECTION.
    TOP-OF-PAGE DURING LINE-SELECTION.
    CASE sy-lsind.
    WHEN 1.
    PERFORM get_topofpage1.
    WHEN 2.
    PERFORM get_topofpage2.
    ENDCASE.
    FORM GET_CUSTOMERDATA
    FORM get_customerdata.
    SELECT kunnr name1
    FROM kna1
    INTO TABLE it_kna1
    UP TO p_max ROWS
    WHERE kunnr IN so_kunnr.
    IF sy-subrc EQ 0.
    LOOP AT it_kna1 INTO wa_kna1.
    WRITE : / sy-vline,
    2(15) wa_kna1-kunnr ,
    sy-vline ,
    20 wa_kna1-name1,
    sy-vline.
    HIDE : wa_kna1-kunnr , wa_kna1-name1.
    CLEAR wa_kna1.
    ENDLOOP.
    ULINE AT : /1(56).
    ELSE.
    MESSAGE w000(z50871msg).
    ENDIF.
    ENDFORM. "GET_CUSTOMERDATA
    FORM GET_SALESHEADER
    FORM get_salesheader.
    SET PF-STATUS 'MENU2'.
    GET CURSOR FIELD v_fld VALUE v_kunnr.
    IF v_fld = 'WA_KNA1-KUNNR'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = v_kunnr
    IMPORTING
    output = v_kunnr.
    SELECT kunnr vbeln erdat audat auart ernam augru
    FROM vbak
    INTO TABLE it_vbak
    WHERE kunnr = v_kunnr.
    IF sy-subrc EQ 0.
    LOOP AT it_vbak INTO wa_vbak.
    WRITE : / sy-vline ,
    2(22) wa_vbak-vbeln ,
    sy-vline,
    27(25) wa_vbak-erdat ,
    sy-vline ,
    55(15) wa_vbak-audat ,
    sy-vline ,
    73(15) wa_vbak-auart ,
    sy-vline,
    91(16) wa_vbak-ernam ,
    sy-vline,
    109(13) wa_vbak-augru,
    123 sy-vline.
    HIDE : wa_vbak-vbeln.
    CLEAR wa_vbak.
    ENDLOOP.
    ULINE AT : /1(123).
    ELSE.
    MESSAGE i015(z50871msg).
    ENDIF.
    ELSE.
    MESSAGE i013(z50871msg).
    ENDIF.
    ENDFORM. "GET_SALESHEADER
    FORM GET_SALESITEMDATA
    FORM get_salesitemdata.
    SET PF-STATUS space.
    GET CURSOR FIELD v_fld VALUE v_vbeln.
    IF v_fld = 'WA_VBAK-VBELN'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = v_vbeln
    IMPORTING
    output = v_vbeln.
    SELECT vbeln posnr matnr charg matkl posar
    FROM vbap
    INTO TABLE it_vbap
    WHERE vbeln = v_vbeln.
    LOOP AT it_vbap INTO wa_vbap.
    WRITE : /1 sy-vline,
    2(13) wa_vbap-posnr ,
    sy-vline,
    18(18) wa_vbap-matnr ,
    sy-vline,
    40(13) wa_vbap-charg ,
    sy-vline,
    56(16) wa_vbap-matkl ,
    sy-vline,
    75 wa_vbap-posar,
    112 sy-vline.
    CLEAR wa_vbap.
    ENDLOOP.
    ULINE AT : /1(112).
    ELSE.
    MESSAGE i014(z50871msg).
    ENDIF.
    ENDFORM. "GET_SALESITEMDATA
    FORM GET_TOPOFPAGE1
    FORM get_topofpage1.
    ULINE AT : /1(123).
    WRITE : / sy-vline ,
    2 text-000 ,
    wa_kna1-kunnr ,
    75 text-001 ,
    wa_kna1-name1,
    123 sy-vline.
    ULINE AT : /1(123).
    WRITE : / sy-vline ,
    2(22) text-006 COLOR 1,
    sy-vline,
    27(25) text-007 COLOR 1 ,
    sy-vline ,
    55(15) text-008 COLOR 1 ,
    sy-vline ,
    73(15) text-009 COLOR 1 ,
    sy-vline,
    91(16) text-010 COLOR 1 ,
    sy-vline,
    109(13) text-011 COLOR 1,
    123 sy-vline.
    ULINE AT : /1(123).
    ENDFORM. "GET_TOPOFPAGE1
    FORM GET_TOPOFPAGE2
    FORM get_topofpage2.
    ULINE AT : /1(112).
    WRITE : / sy-vline ,
    2 text-000 ,
    wa_kna1-kunnr ,
    35 text-001 ,
    wa_kna1-name1 ,
    85 text-003 ,
    wa_vbak-vbeln ,
    112 sy-vline.
    ULINE AT : /1(112).
    WRITE : /1 sy-vline,
    2(13) text-012 COLOR 1,
    sy-vline,
    18(18) text-013 COLOR 1 ,
    sy-vline,
    40(13) text-014 COLOR 1 ,
    sy-vline,
    56(16) text-015 COLOR 1 ,
    sy-vline,
    75 text-016 COLOR 1 ,
    112 sy-vline.
    ULINE AT : /1(112).
    ENDFORM. "GET_TOPOFPAGE2
    Thanks,
    Naveen.I

  • AT USER COMMAND event in interactive reports

    hi experts,
    Can anyone explain me about AT USER COMMAND event with one practical ex.
    thanks in advance
    R.vijai

    Hi vijaya kumar,
        If the user chooses a function code during list processing that is neither processed by the system, or PICK or PF<nn>, the system triggers the event AT USER-COMMAND. For this event, you must define your own GUI status for a list. To react to your own function codes in a program, you must define the following event block:
    AT USER-COMMAND.
    <statements>.
    In this event block, you can use an IF or CASE structure to tell the function codes apart. They are available in the system field SY-UCOMM. There are further system fields that are filled in list events, such as SY-LSIND and SY-PFKEY, that allow you to make further case distinctions.
    REPORT Test_program.
    START-OF-SELECTION.
      SET PF-STATUS 'TEST'.
      WRITE:  'Basic list, SY-LSIND =', sy-lsind.
    AT LINE-SELECTION.
      WRITE:  'LINE-SELECTION, SY-LSIND =', sy-lsind.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'TEST'.
          WRITE:  'TEST, SY-LSIND =', sy-lsind.
      ENDCASE.
    With this code double click on 'TEST' and define your own PF status and give user command as TEST and check out this useful programe.
    All the very best to you.
    Regards,
    Mohan Vamsi Krishna.A

  • How to add user command to drop down list in output screen for OALV Report

    Hi Experts,
    I have created a report by using OALV.
    in Output screen i have  added drop down for one filed with 2 values.
    when i select  value from the drop down list the  program should trigger and the next field should be update.
    so it is possiable to add a user command for the drop down list in output screen.
    if so please help me .
    Regards,
    Rathan

    HI,
    Check the Demo program BCALV_EDIT_06 with having the DATA_CHANGED event still you can capture the changed data. This event will help you.
    or you can go for this code..
    data: it_f4 type lvc_t_f4,
            wa_f4 type lvc_s_f4.
            wa_f4-FIELDNAME = 'CONNID'.
            wa_f4-REGISTER = 'X'.
            wa_f4-GETBEFORE = 'X'.
            wa_f4-CHNGEAFTER = 'X'.
            append wa_f4 to it_f4.
    "register F4 event
      CALL METHOD g_alv_grid_ref->register_f4_for_fields
        EXPORTING
          it_f4  = it_f4.
    "Once you try to pick the value HANDLE_DATA_CHANGED event will be triggered
    "Definition
         methods:
         handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
                                  IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after,
    "Implementation
    METHOD handle_data_changed .
        DATA: ls_mod_cells TYPE lvc_s_modi.
        IF e_onf4_before = 'X'.
          MESSAGE 'Data changed before F4' TYPE 'I'.
        ENDIF.
        IF e_onf4 = 'X'.   "if event triggered by F4
          MESSAGE 'Data changed on F4' TYPE 'I'.
        ENDIF.
        IF e_onf4_after = 'X'.
          MESSAGE 'Data changed after F4' TYPE 'I'.
        ENDIF.
       "here you know which cell was modified
        LOOP AT er_data_changed->mt_mod_cells INTO ls_mod_cells.
         "just example test case, here you can implement your code for modified cells
          IF ls_mod_cells-value >=5.
            CALL METHOD er_data_changed->add_protocol_entry
              EXPORTING
                i_msgid     = 'SABAPDOCU'
                i_msgty     = 'E'
                i_msgno     = '888'
                i_msgv1     = 'Only numbers below 5 are possibe'
                i_msgv2     = 'Please correct'
                i_fieldname = ls_mod_cells-fieldname
                i_row_id    = ls_mod_cells-row_id.
            CALL METHOD er_data_changed->modify_cell
              EXPORTING
                i_fieldname = ls_mod_cells-fieldname
                i_row_id    = ls_mod_cells-row_id
                i_value     = space.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.                    "handle_data_changed
    Edited by: sum_it2 on Nov 21, 2011 10:07 AM

  • Interactive and basic lists

    Hi Gurus
    What are the differences between Interactive and basic lists.When and where we using those.
    Regards,
    Venkat.

    Hi,
    Basic list is the first list what we get after we execute a report or program , which will have the list index 0.
    The lists what we get in at line selection are called as Interactive lists or detail lists,
    we can have maximum of 20 secondray lists(detail lists) and always there will be one basic list (if list is generated)
    Cheers,
    Babu.

Maybe you are looking for

  • SAP Content Server 6.40 on Windows 2003, IIS 6, filesystem storage

    Hello: We have installed SAP Content Sever 6.40 on Windows Server 2003, IIS 6, and using the filesystem as storage, not SAPDB. The installation goes without any issues and completes successfully, but the test URL http://<host>:<port>/ContentServer/Co

  • I can't read in a date from a txt file

    Im not sure of the code needed to read in a date from the text file, this is an example of the text file: 1 2 2003 ie, day month year I have to read in this date, this is the set method for the date: public void setPurchaseDate (int d, int m, int y)

  • Best practice - applying Filters

    What's the best practice in terms of performance versus code reuse, when applying filters? Right now, I see 3 ways to specify a filter: 1. as a <mx:filter> or <s:filter> 2. in actionscript: var glowFilter:GlowFilter = new GlowFilter(); --OR-- 3. in S

  • Upgrade to os x 10.8.5 on macbook air made youtube choppy

    The youtube started playing choppy and jerky and never truly full screen ever since i upgraded to OS X 10.8.5 on macbook air 2013 Any one can help with that pls.

  • Flash 16 Keeps Crashing

    I'm running Windows 7 Pro, 64-bit, with Firefox as my main browser. My processor is an Intel i7-3740QM CPU @ 2.7GHz, and it is very unusual for any process to keep it continually working at over 10%. Recently, Adobe Flash Player has been eating up CP