Calling a report from function module

Hi Friends,
I have requirement for Function Module i.e. we will add the button to the standard T-code and ( Function added in config ) then
Function to be called from Customizing
Program A called from customizing function
CalculationPDFFunction  is called from program A.
So can any one help me the logic for "calling a report from function module  ".
Thanks in Advance.
Regards,
OSReddy.
Edited by: OSReddy on Sep 23, 2011 7:31 AM

Hi Jaya,
Yes. It is possible to call ur custom program using SUBMIT statement.
1. If u have data to pass then build table type RSPARAMS and use below statement.
data:
      rspar_tab  TYPE TABLE OF rsparams,
      rspar_line LIKE LINE OF rspar_tab,
SUBMIT report1 WITH SELECTION-TABLE rspar_tab
               AND RETURN.
1. If u want to create variant to the program and use that. use the below statement .
SUBMIT report1 USING SELECTION-SET 'VAR1' "variant
               AND RETURN.
Regards,
Venkat.O

Similar Messages

  • Calling Web Service from Function Module

    dear all
    i am new to SAP.
    i have a web Service developed with .net and C#.
    i want to call this web Service from inside a function module.
    how can i do this ?
    thanks,

    Hi Ramzy,
    Please browse through chrome or sdn , there is a lot of documents and discussions, any how find the below URL, which might be helpful.
    Create an SAP Web Service Consumer (calling External Web Service from ABAP)
    Create a Function Module and full the below Code :
    Sample code :
    DATA: http_client TYPE REF TO if_http_client,
          host_str TYPE string VALUE 'www.myservice.in',
          service_str TYPE string,
          path TYPE string VALUE  'my path',
          errortext TYPE string. "used for error handling
    DATA  : wf_string1 TYPE string,
             lw_inputs TYPE string,
             error_text type string,
             subrc TYPE SY-SUBRC,
             lw_outputs TYPE  string.
    CALL METHOD cl_http_client=>create_by_url
      EXPORTING
        url                = 'myurl'
      IMPORTING
        client             = http_client
      EXCEPTIONS
        argument_not_found = 1
        plugin_not_active  = 2
        internal_error     = 3
        OTHERS             = 4.
      IF sy-subrc <> 0.
    *  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = '~request_method'
        value = 'POST'.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = '~server_protocol'
        value = 'HTTP/1.1'.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = '~request_uri'
        value = 'mypath'.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = 'Content-Type'
        value = 'application/soap+xml; charset=utf-8'."'text/xml; charset=utf-8'.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = 'Content-Length'
        value = '19000'."txlen.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = 'SOAPAction'
        value = 'myURL'.
    concatenate 'data u need sned' into wf_string
    CALL METHOD http_client->request->set_cdata
      EXPORTING
        data   = wf_string1
        offset = 0
        length = '19000'.
    Regards,
    Lokeswar.

  • Calling a ztransaction from function module not working

    Hi experts,
    I have made a ztransaction through SE93 called Z_TRANS.When I am calling this transaction from a program in SE38, it is giving the screen corresponding to the transaction. But when same
    Call Transaction 'z_TRANS' is used in SE37 in a function module, program is abending.
    Please help...

    Hi ,
    Also check the 3 check boxes for GUI support.
    Regards.

  • Calling a report from module pool program

    Hi all,
            I had a requirement where I need to call a report from the module pool program where in when we click REPORT button, it should display the report output in the another screen.
    Can we do by calling screen after pushing REPORT button. If so, where we should write that code ( In pbo or pai). Please give me an idea.
    Thanking you,
    Regards,
    Murali Krishna T

    Use submit syntax.
    Press F1 on submit, Donot use return statement with it.
    If so, where we should write that code ( In pbo or pai).
    Please understand about these two events before doing the requirement.

  • Calling a report from Module Pool

    While calling a report from the module pool I'm not able to display th alv. The skeleton of the ALV is coming. But the data and headings are also not displayed.
    But where as calling the same program from a report it is coming properly. can somebody please guide me where did I go wrong?

    MODULE user_command_1001 INPUT.
      w_ok_code = ok_code.
      CLEAR ok_code.
      CASE w_ok_code.
        WHEN 'BACK'.
          LEAVE PROGRAM .
        WHEN 'CREATE'.
          CALL TRANSACTION 'Z_FIRST_TIME'.
        WHEN 'SYNC'.
          CALL TRANSACTION 'Z_SYNC'.
        WHEN 'APPROVE'.
         SUBMIT zds_xx_approval_status WITH po_aname EQ sy-uname AND RETURN.
        WHEN 'OVERVIEW'.
          PERFORM show_all_reqids.
      ENDCASE.
    ENDMODULE.

  • How to get data from function module in crystal report

    Hi,
    I installed Crystal Reports 2008 and BO SAP Integration kit for CR.
    I connected successfully to SAP system from CR but unable to get the data into Report ...
    But data is present in function module.
    Could you please tell me what may be the reason ...!!
    Thanks
    Raghavendra

    Hi,
    I connected successfully to SAP system from CR but unable to get the data into Report with all the Input parameters and data is present in function module.
    Note: - If we take Start date as input parameter in Crystal report data is coming for single parameter, whereas we take input parameters like Partner function, Region and Customer - we are not getting data. (These fields we created parameters in Crystal report)
    In Function Module IMPORT Parameters are below mentioned and Export parameter is Blank
                                                                                    Start Date (Mandatory field)
                                                                                    Partner Function (Mandatory)
                                                                                    Region
                                                                                    Customer
    Please let us know if required any information.
    Regards,
    Raghavendra

  • Is it possible to call custom designed RFC function module, apart from BAPI

    Hi Friends,
    1.     Is it possible to call custom designed RFC function module, apart from BAPI.
    2.     Why we call it Adaptive RFC layer, Since every time the JCO layer updated with SAP, Why can’t be dynamic.
    Thanx for Ur time.
    Cheers,
    Sam

    Also check <a href="http://help.sap.com/saphelp_nw04/helpdata/en/41/38bc8f813719488ddc9d9b21251ec3/frameset.htm">here</a> for more information on aRFC. Here you can find why it is called adaptive.
    Regards,
    Christophe

  • How can I call a Report From database function

    Hi all,
    I want to call a Report from a database function. Could you hel
    me???
    Rgds

    Hello there!
    There is a solution for executing an executable like RWRUN60
    from PL/SQL on http://asktom.oracle.com/pls/ask/f?
    p=4950:8:227101::NO::F4950_P8_DISPLAYID,F4950_P8_B:150612348067,Y
    Or you can invoke the CGI from the Reports-Server through
    UTL_HTTP
    Hope this helps
    Dannys

  • How to call Custom RFC enabled Function Module in R/3 From XI

    Hi Experts,
    I want to call custom RFC enabled Function Module by sending some input parameters from XI.
    How to do this
    Thnx
    RAMS

    Hi RAMS,
    1. Under the SWCV Go to the Imported Objects.
    2. Right click on the RFC and click on the Import of SAP object.
    3. Give the logon server name, system number the user name and pasword.
    4. Select the RFC u want to import.
    5. Execute the import and the RFC is imported under the SWCV.
    Now u can use this Imported RFC in the scenarios of that SWCV.
    Regards
    Santhosh
    Remember to set the thread to solved when you have received a solution

  • Call report in function module

    Hi All,
    Please tell me how to call report in function module. i want input parameters of function module with same selection screen parameters of report. please tell to me .if possible provide the code.
    Thanks,
    Raju.

    Hi Kumar,
    Incorporate the below logic in the FM that you have developed.
    SUBMIT zreport WITH s_vbeln  IN t_saleorder_range
                                WITH p_file         EQ w_file
                                AND RETURN.
    Note: Here, t_salerder_range is an internal table of type range. It has four fields just like selection-options...SIGN,OPTION, LOW and HIGH. Whatever the values that you pass here would be taken as the selection screen values for the report that you are calling.
    Hope this is helpful
    Thanks,
    Babu Kilari

  • Calling a Report from Bapi

    Dear  all,
    I am trying to create a customer from external system through bapi. For this is i have to follow these steps.
    1)  I am trying to call a report from external system through bapi.
    2)  I want to pass data from bapi to a bdc program and run it to create a customer.
    3) After creating a customer I need to send the  ceated customer no again to the bapi from where i passed the data to bdc.
    is it possible .
    Give me a good idea on this how to work with it.
    Regards,
    Madhu.

    Hi Madhu,
    SAP has already given standard BAPI to create customer creation "BAPI_CUSTOMER_CREATEFROMDATA". So there is no need for you to create any thing new. Jut test this BAPI first whether this suit your requirement or not. If it satisfy your requirement then call it directly from external system. On how to call this BAPI or other BAPis searc google or SDn you will definetaly find something.
    second approach is if nothing works for you( No BAPI satisfy your requirement) then only go for BDC aapproach. To do that, create a RFC function module( BAPi and RFC FM are diff thing, they looks same  but they are not ). Inside your RFC FM directly write the BDC code to create customer.
    Regards
    Anurag

  • Example of  a Simple ALV Report using Function Modules (not OO)

    Hi,
    I am new to ABAP. Where can I get a proper Example of  a Simple ALV Report using Function Modules?  I searched the forum but did not find a proper solution. Kindly help.
    Smruthi.
    Edited by: Smruthi Acharya on Jan 29, 2009 7:13 PM

    Hi,
    Use this demo code:-
    REPORT  z_alv01 MESSAGE-ID zmsg.
    *          TABLES
    TABLES : ekpo.
    *          TYPE POOLS
    TYPE-POOLS : slis.
    *          TYPE DECLARATION
    TYPES : BEGIN OF t_ekpo,
              ebeln TYPE ekpo-ebeln,
              ebelp TYPE ekpo-ebelp,
              matnr TYPE ekpo-matnr,
              werks TYPE ekpo-werks,
              menge TYPE ekpo-menge,
            END OF t_ekpo.
    *          PARAMETERS
    PARAMETERS : s_var TYPE disvariant-variant.
    *          DATA DECLARATION
    *VARIABLES
    DATA : check(1),
           rep_id TYPE sy-repid.
    *INTERNAL TABLE TYPE OF ZEKPO
    DATA : it_ekpo TYPE STANDARD TABLE OF t_ekpo WITH HEADER LINE.
    *FIELD CATALOG
    DATA : it_field TYPE slis_t_fieldcat_alv,
           wa_field TYPE slis_fieldcat_alv.
    *SORTING
    DATA : it_sort TYPE slis_t_sortinfo_alv,
           wa_sort TYPE slis_sortinfo_alv.
    *FOR TOP OF THE PAGE
    DATA : it_top TYPE slis_t_listheader,
           wa_top TYPE slis_listheader.
    *FOR END OF THE PAGE
    DATA : it_end TYPE slis_t_listheader,
           wa_end TYPE slis_listheader.
    *TO CAPTURE EVENTS AND HANDLE
    DATA : it_event TYPE slis_t_event,
           wa_event TYPE slis_alv_event.
    *FOR GRID TITLE
    DATA : wa_title TYPE lvc_title.
    *FOR LAYOUT
    DATA : wa_layout TYPE slis_layout_alv.
    *FOR EXCLUDING STANDARD BUTTON FROM ALV TOOLBAR
    DATA : it_exclude TYPE slis_t_extab,
           wa_exclude TYPE slis_extab.
    *FOR VARIANT
    DATA : wa_variant TYPE disvariant.
    *          INITIALIZATION
    INITIALIZATION.
      check = 'X'.
      rep_id = sy-repid.
      wa_variant-report = sy-repid.
    *GET DEFUALT ON THE SELECTION SCREEN FOR DEFAULT DISPLAY
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save        = 'A'
        CHANGING
          cs_variant    = wa_variant
        EXCEPTIONS
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          OTHERS        = 4.
      IF sy-subrc = 0.               " IF DEFAULT VARIANT FOUND
        s_var = wa_variant-variant.  " PASS THE DEFAULT VARIANT TO THE SELECTION SCREEN FIELD
      ENDIF.
    *          AT-SELECTION SCREEN ON VALUE REQUEST
    *          TO GET THE F4 HELP FOR VARIANT
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_var.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant                = wa_variant
    *   I_TABNAME_HEADER          =
    *   I_TABNAME_ITEM            =
    *   IT_DEFAULT_FIELDCAT       =
         i_save                    = 'A'
    *   I_DISPLAY_VIA_GRID        = ' '
       IMPORTING
    *   E_EXIT                    =
         es_variant                = wa_variant
       EXCEPTIONS
         not_found                 = 1
         program_error             = 2
         OTHERS                    = 3.
      IF sy-subrc = 0.
        s_var = wa_variant-variant. " PASS THE SELECTED VARIANT TO THE SELECTION SCREEN FIELD
      ENDIF.
    *          AT-SELECTION SCREEN
    *          TO CHECK THE EXISTENCE FOR VARIANT
    AT SELECTION-SCREEN.
      wa_variant-variant = s_var.
      CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
        EXPORTING
          i_save        = 'A'
        CHANGING
          cs_variant    = wa_variant
        EXCEPTIONS
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          OTHERS        = 4.
      IF sy-subrc <> 0.
        MESSAGE w001.
      ENDIF.
    *          START OF SELECTION
    START-OF-SELECTION.
      SELECT ebeln
             ebelp
             matnr
             werks
             menge
             FROM ekpo
             INTO TABLE it_ekpo.
    *          FIELD CATALOG
      wa_field-fieldname = 'EBELN'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 10.
      wa_field-seltext_l = 'PO #'.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
      wa_field-fieldname = 'EBELP'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 10.
      wa_field-seltext_l = 'Line Item'.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
      wa_field-fieldname = 'MATNR'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 15.
      wa_field-seltext_l = 'Material'.
    *  wa_field-input = check.
    *  wa_field-edit = check.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
      wa_field-fieldname = 'WERKS'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 6.
      wa_field-seltext_l = 'Plant'.
    *  wa_field-input = check.
    *  wa_field-edit = check.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
      wa_field-fieldname = 'MENGE'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 10.
      wa_field-seltext_l = 'Qty.'.
    *  wa_field-input = check.
    *  wa_field-edit = check.
      wa_field-do_sum = check.
      APPEND wa_field TO it_field.
      CLEAR wa_field.
    *          SORT W.R.T. PURCHASE ORDER NUMBER
      wa_sort-spos = 1.
      wa_sort-fieldname = 'EBELN'.
      wa_sort-tabname = 'IT_EKPO'.
      wa_sort-up = check.
      wa_sort-subtot = check.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
    *          FOR GRID TITLE
      wa_title = 'Hello'.
    *          FOR LAYOUT
      wa_layout-zebra = check.
    *          FOR EXCLUDING STANDARD BUTTONS FROM ALV TOOLBAR
      wa_exclude-fcode = '&OUP'.
      APPEND wa_exclude TO it_exclude.
      CLEAR wa_exclude.
      wa_exclude-fcode = '&ODN'.
      APPEND wa_exclude TO it_exclude.
      CLEAR wa_exclude.
      wa_exclude-fcode = '&OAD'.
      APPEND wa_exclude TO it_exclude.
      CLEAR wa_exclude.
    *  wa_exclude-fcode = '&AVE'.
    *  APPEND wa_exclude TO it_exclude.
    *  CLEAR wa_exclude.
      wa_exclude-fcode = '&INFO'.
      APPEND wa_exclude TO it_exclude.
      CLEAR wa_exclude.
    *          POPULATE ALL EVENTS INTO INTERNAL TABLE
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = it_event
        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.
      READ TABLE it_event INTO wa_event WITH KEY name = 'END_OF_LIST'.
      wa_event-form = 'END'.
      MODIFY it_event FROM wa_event INDEX sy-tabix.
      CLEAR wa_event.
    *          DISPLAY RECORDS IN ALV GRID
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
       i_callback_program                = rep_id
    *   i_callback_pf_status_set          = 'PF'
       i_callback_user_command           = 'COMMAND'
       i_callback_top_of_page            = 'TOP'
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
       i_grid_title                      = wa_title
    *   I_GRID_SETTINGS                   =
       is_layout                         = wa_layout
       it_fieldcat                       = it_field
       it_excluding                      = it_exclude
    *   IT_SPECIAL_GROUPS                 =
       it_sort                           = it_sort
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
       i_save                            = 'A'
       is_variant                        = wa_variant
       it_events                         = it_event
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_ekpo
    EXCEPTIONS
       program_error                     = 1
       OTHERS                            = 2.
      IF sy-subrc <> 0.
      ENDIF.
    *&      Form  top
    *       TO WRITE THE HEADER
    FORM top.
      REFRESH it_top.
      wa_top-typ = 'S'.
      wa_top-key = text-001.
      wa_top-info = rep_id.
      APPEND wa_top TO it_top.
      CLEAR wa_top.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = it_top
    *   I_LOGO                   =
    *   I_END_OF_LIST_GRID       =
    *   I_ALV_FORM               =
    ENDFORM.                    "top
    *&      Form  end
    *       TO WRITE THE FOOTER
    FORM end.
      REFRESH it_end.
      wa_end-typ = 'S'.
      wa_end-key = text-001.
      wa_end-info = rep_id.
      APPEND wa_end TO it_end.
      CLEAR wa_end.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = it_end
    *   I_LOGO                   =
    *   I_END_OF_LIST_GRID       =
    *   I_ALV_FORM               =
    ENDFORM.                    "end
    *&      Form  pf
    *       FOR PF-STATUS WITH USER DEFINED BUTTONS
    *      -->RT_EXTAB   text
    FORM pf USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZTG_PF_ALV'.
    ENDFORM.                    "pf
    *&      Form  command
    *       TO HANDLE USER ACTIONS AGAINST PF-STATUS
    *      -->UCOMM      text
    *      -->SELFIELD   text
    FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
      DATA : ok_code TYPE sy-ucomm.
      ok_code = ucomm.
      CASE ok_code.
        WHEN 'T_DOWN'.
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = 'HELLO'
              txt1  = 'USER COMMAND'
              txt2  = 'TOTAL DOWN'.
        WHEN 'DOWN'.
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = 'HELLO'
              txt1  = 'USER COMMAND'
              txt2  = 'DOWN'.
        WHEN 'UP'.
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = 'HELLO'
              txt1  = 'USER COMMAND'
              txt2  = 'UP'.
        WHEN 'T_UP'.
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = 'HELLO'
              txt1  = 'USER COMMAND'
              txt2  = 'TOTAL UP'.
      ENDCASE.
    ENDFORM.                    "command
    Hope this helps you.
    Thanks & Regards,
    Tarun Gambhir

  • Regarding calling 1 report from another

    Hello Friends,
       Can u plz tell me how to call one report from another report.
    Regards,
    Drashana

    hi,
    Use SUBMIT program statement
    SUBMIT ZFIR001
    chk this.
    *Code used to populate 'select-options' & execute report 
    DATA: seltab type table of rsparams,
          seltab_wa like line of seltab.
      seltab_wa-selname = 'PNPPERNR'.
      seltab_wa-sign    = 'I'.
      seltab_wa-option  = 'EQ'.
    load each personnel number accessed from the structure into
    parameters to be used in the report
      loop at pnppernr.
        seltab_wa-low = pnppernr-low.
        append seltab_wa to seltab.
      endloop.
      SUBMIT zreport with selection-table seltab
                                    via selection-screen.
    *Code used to populate 'parameters' & execute report 
    SUBMIT zreport with p_param1 = 'value'
                    with p_param2 = 'value'.
    Other additions for SUBMIT
    *Submit report and return to current program afterwards
    SUBMIT zreport AND RETURN.
    *Submit report via its own selection screen
    SUBMIT zreport VIA SELECTION-SCREEN.
    *Submit report using selection screen variant
    SUBMIT zreport USING SELECTION-SET 'VARIANT1'.
    *Submit report but export resultant list to memory, rather than
    *it being displayed on screen
    SUBMIT zreport EXPORTING LIST TO MEMORY.
    Once report has finished and control has returned to calling
    program, use function modules LIST_FROM_MEMORY, WRITE_LIST and
    DISPLAY_LIST to retrieve and display report.
    \[removed by moderator\]
    rEGARDS
    Edited by: Jan Stallkamp on Jul 29, 2008 5:25 PM

  • How to edit ALV report using function modules

    I have a ALV report , i want to edit the report
    using function modules.
    how can i do that...
    Edited by: ms kumar on Mar 6, 2008 3:24 PM

    hi i had used this report with the check box,
    using the fm of alvs.....
    *& Report  ZZZ00
    REPORT  ZPR_02.
    TYPE-POOLS: SLIS.
    TABLES:pa0002,pa0008.
    data:begin of it_pa0002 occurs 0,
         checkbox,
         pernr like pa0002-pernr,
         begda like pa0002-begda,
         endda like pa0002-endda,
         vorna like pa0002-vorna,
         nachn like pa0002-nachn,
         end of it_pa0002.
    data:begin of it_pa00021 occurs 0,
         pernr like pa0002-pernr,
         begda like pa0002-begda,
         endda like pa0002-endda,
         vorna like pa0002-vorna,
         nachn like pa0002-nachn,
         expand TYPE xfeld value 'X',
         end of it_pa00021.
    data:begin of it_pa0008 occurs 0,
         pernr like pa0008-pernr,
         begda like pa0008-begda,
         endda like pa0008-endda,
         ANSAL like pa0008-ANSAL,
         LGA01 like pa0008-LGA01,
         BET01 LIKE PA0008-BET01,
         end of it_pa0008.
    DATA: IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
          IT_FIELD_CAT1 TYPE SLIS_T_FIELDCAT_ALV,
          IT_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
          WA_FIELD_CAT TYPE SLIS_FIELDCAT_ALV,
          WA_FIELD_CAT1 TYPE SLIS_FIELDCAT_ALV,
          IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
          IT_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENTS TYPE SLIS_ALV_EVENT,
          IT_HEADER TYPE SLIS_T_LISTHEADER,
          WA_HEADER TYPE SLIS_LISTHEADER,
          wa_keyinfo TYPE slis_keyinfo_alv.
    CONSTANTS:c VALUE 'X'.
    SELECT-OPTIONS: S_pernr FOR pa0002-pernr.
    START-OF-SELECTION.
      SET PF-STATUS 'DATA' .
      PERFORM GET_DATA.
      PERFORM BUILD_FIELD_CAT.
      PERFORM GET_EVENTS.
      PERFORM DISPLAY_DATA.
    *&      Form  get_data
          text
    FORM GET_DATA .
      SELECT pernr
             begda
             endda
             vorna
             nachn
             FROM pa0002
             INTO CORRESPONDING FIELDS OF TABLE IT_pa0002
             WHERE pernr IN S_pernr.
    ENDFORM.                    " get_data
    *&      Form  build_field_cat
          text
    FORM BUILD_FIELD_CAT .
        wa_field_cat-tabname = 'PA0002'.
      WA_FIELD_CAT-FIELDNAME = 'CHECKBOX'.
      wa_field_cat-ref_tabname = 'IT_PA0002'.
      WA_FIELD_CAT-REPTEXT_DDIC = 'Check Box'.
      APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
      CLEAR WA_FIELD_CAT.
        wa_field_cat-tabname = 'PA0002'.
      WA_FIELD_CAT-FIELDNAME = 'PERNR'.
        wa_field_cat-ref_tabname = 'IT_PA0002'.
      WA_FIELD_CAT-REPTEXT_DDIC = 'Personnel no'.
      APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
      CLEAR WA_FIELD_CAT.
        wa_field_cat-tabname = 'PA0002'.
      WA_FIELD_CAT-FIELDNAME = 'BEGDA'.
      wa_field_cat-ref_tabname = 'IT_PA0002'.
      WA_FIELD_CAT-REPTEXT_DDIC = 'Start date'.
      APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
      CLEAR WA_FIELD_CAT.
        wa_field_cat-tabname = 'PA0002'.
      WA_FIELD_CAT-FIELDNAME = 'ENDDA'.
      wa_field_cat-ref_tabname = 'IT_PA0002'.
      WA_FIELD_CAT-REPTEXT_DDIC = 'End date'.
      APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
      CLEAR WA_FIELD_CAT.
        wa_field_cat-tabname = 'PA0002'.
      WA_FIELD_CAT-FIELDNAME = 'VORNA'.
      wa_field_cat-ref_tabname = 'IT_PA0002'.
      WA_FIELD_CAT-REPTEXT_DDIC = 'First name'.
      APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
      CLEAR WA_FIELD_CAT.
        wa_field_cat-tabname = 'PA0002'.
      WA_FIELD_CAT-FIELDNAME = 'NACHN'.
        wa_field_cat-ref_tabname = 'IT_PA0002'.
      WA_FIELD_CAT-REPTEXT_DDIC = 'Last name'.
      APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
      CLEAR WA_FIELD_CAT.
        wa_field_cat1-tabname = 'PA0002'.
      WA_FIELD_CAT1-FIELDNAME = 'PERNR'.
        wa_field_cat1-ref_tabname = 'IT_PA00021'.
      WA_FIELD_CAT1-REPTEXT_DDIC = 'Personnel no'.
      APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
      CLEAR WA_FIELD_CAT1.
        wa_field_cat1-tabname = 'PA0002'.
      WA_FIELD_CAT1-FIELDNAME = 'BEGDA'.
        wa_field_cat1-ref_tabname = 'IT_PA00021'.
      WA_FIELD_CAT1-REPTEXT_DDIC = 'Start date'.
      APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
      CLEAR WA_FIELD_CAT1.
        wa_field_cat1-tabname = 'PA0002'.
      WA_FIELD_CAT1-FIELDNAME = 'ENDDA'.
        wa_field_cat1-ref_tabname = 'IT_PA00021'.
      WA_FIELD_CAT1-REPTEXT_DDIC = 'End date'.
      APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
      CLEAR WA_FIELD_CAT1.
        wa_field_cat1-tabname = 'PA0002'.
      WA_FIELD_CAT1-FIELDNAME = 'VORNA'.
        wa_field_cat1-ref_tabname = 'IT_PA00021'.
      WA_FIELD_CAT1-REPTEXT_DDIC = 'First name'.
      APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
      CLEAR WA_FIELD_CAT.
        wa_field_cat1-tabname = 'PA0002'.
      WA_FIELD_CAT1-FIELDNAME = 'NACHN'.
        wa_field_cat1-ref_tabname = 'IT_PA00021'.
      WA_FIELD_CAT1-REPTEXT_DDIC = 'Last name'.
      APPEND WA_FIELD_CAT1 TO IT_FIELD_CAT1.
      CLEAR WA_FIELD_CAT1.
        wa_field_cat1-tabname = 'PA0008'.
        wa_field_cat1-fieldname = 'PERNR'.
          wa_field_cat-ref_tabname = 'IT_PA0008'.
        wa_field_cat1-REPTEXT_DDIC = 'personnelno'.
        APPEND wa_field_cat1 TO it_field_cat1.
       CLEAR WA_FIELD_CAT1.
        wa_field_cat1-tabname = 'PA0008'.
        wa_field_cat1-fieldname = 'BEGDA'.
          wa_field_cat-ref_tabname = 'IT_PA0008'.
        wa_field_cat1-REPTEXT_DDIC = 'begindate'.
        APPEND wa_field_cat1 TO it_field_cat1.
        CLEAR WA_FIELD_CAT1.
        wa_field_cat1-tabname = 'PA0008'.
        wa_field_cat1-fieldname = 'ENDDA'.
          wa_field_cat-ref_tabname = 'IT_PA0008'.
        wa_field_cat1-REPTEXT_DDIC = 'enddate'.
        APPEND wa_field_cat1 TO it_field_cat1.
        CLEAR WA_FIELD_CAT1.
        wa_field_cat1-tabname = 'PA0008'.
        wa_field_cat1-fieldname = 'ANSAL'.
          wa_field_cat-ref_tabname = 'IT_PA0008'.
        wa_field_cat1-REPTEXT_DDIC = 'annualsalary'.
        APPEND wa_field_cat1 TO it_field_cat1.
        CLEAR WA_FIELD_CAT1.
        wa_field_cat1-tabname = 'PA0008'.
        wa_field_cat1-fieldname = 'LGA01'.
          wa_field_cat-ref_tabname = 'IT_PA0008'.
        wa_field_cat1-REPTEXT_DDIC = 'wagetype'.
        APPEND wa_field_cat1 TO it_field_cat1.
        CLEAR WA_FIELD_CAT1.
        wa_field_cat1-tabname = 'PA0008'.
        wa_field_cat1-fieldname = 'BET01'.
          wa_field_cat-ref_tabname = 'IT_PA0008'.
        wa_field_cat1-REPTEXT_DDIC = 'Amount'.
        APPEND wa_field_cat1 TO it_field_cat1.
        CLEAR WA_FIELD_CAT1.
    ENDFORM.                    " build_field_cat
    *&      Form  display_data
          text
    FORM DISPLAY_DATA .
    it_layout-box_fieldname = 'CHECKBOX'.
    it_layout-EDIT = 'X'.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM             = SY-REPID
          I_CALLBACK_PF_STATUS_SET       = 'PF_STATUS'
          I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
          IT_FIELDCAT                    = IT_FIELD_CAT
          IS_LAYOUT                      = IT_LAYOUT
          IT_EVENTS                      = IT_EVENTS
        TABLES
          T_OUTTAB           = IT_pa0002.
    ENDFORM.                    " display_data
    *&      Form  get_events
          text
    FORM GET_EVENTS .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       IMPORTING
         ET_EVENTS             = IT_EVENTS .
      READ TABLE IT_EVENTS INTO WA_EVENTS
                           WITH KEY NAME = SLIS_EV_TOP_OF_PAGE.
      IF SY-SUBRC = 0.
        WA_EVENTS-FORM = 'TOP_OF_PAGE'.
        MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
      ENDIF.
    ENDFORM.                    " get_events
    *&      Form  top_of_page
          text
    FORM TOP_OF_PAGE.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = 'EMPLOYEE DATA'.
      APPEND WA_HEADER TO IT_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_HEADER
    ENDFORM. "top_of_page
    *&      Form  GUI_SET
    FORM GUI_SET USING RT_EXTAB TYPE SLIS_T_EXTAB .
      SET PF-STATUS 'DATA' .
    ENDFORM.                    "GUI_SET
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                            R_SELFIELD TYPE SLIS_SELFIELD.
    DATA:V_PERNR LIKE PA0002-PERNR.
      CASE R_UCOMM.
        WHEN 'DET'.
    DATA: V_FLAG.
      clear : v_flag.
    LOOP AT IT_PA0002.
         if it_PA0002-checkbox =  'X'.
                   v_flag = 'X'.
              v_pernr = IT_PA0002-PERNR.
    SELECT  PERNR
            BEGDA
            ENDDA
            VORNA
            NACHN
            FROM PA0002
            INTO CORRESPONDING FIELDS OF TABLE IT_PA00021
            WHERE PERNR = V_PERNR.
    SORT IT_PA00021 BY PERNR.
    DELETE ADJACENT DUPLICATES FROM IT_PA00021 COMPARING PERNR.
    READ TABLE IT_PA00021 INDEX 1.
    SELECT PERNR
           BEGDA
           ENDDA
           ANSAL
           LGA01
           BET01
           FROM PA0008
           INTO TABLE IT_PA0008
           FOR ALL ENTRIES IN IT_PA00021
           WHERE PERNR = IT_PA00021-PERNR.
              if not it_PA0008[] Is initial.
              SORT IT_PA0008 BY PERNR.
             delete adjacent duplicates from  it_PA0008 comparing pernr.
              READ TABLE IT_PA0008 INDEX 1.
              endif.
            endif.
         enddo.
      it_layout1-group_change_edit = c.
      it_layout1-colwidth_optimize = c.
      it_layout1-zebra             = c.
      it_layout1-detail_popup      = c.
      it_layout1-get_selinfos      = c.
      it_layout-expand_fieldname  = 'EXPAND'.
      wa_keyinfo-header01 = 'PERNR'.
      wa_keyinfo-item01 = 'PERNR'.
    IF NOT V_FLAG IS INITIAL.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
      EXPORTING
       I_CALLBACK_PROGRAM             = SY-REPID
        IS_LAYOUT                      = IT_LAYOUT1
       IT_FIELDCAT                    =  IT_FIELD_CAT1
        I_TABNAME_HEADER               = 'PA0002'
        I_TABNAME_ITEM                 = 'PA0008'
        IS_KEYINFO                     = wa_keyinfo
        TABLES
        T_OUTTAB_HEADER                = IT_PA00021
        T_OUTTAB_ITEM                  = IT_PA0008.
    ENDIF.
    CLEAR: IT_PA00021,IT_PA0002,IT_PA0008.
    ENDLOOP.
    WHEN 'BACK'.
    EXIT.
    ENDCASE.
    ENDFORM.                    "USER_COMMAND
    reward points if useful,
    venkat.

  • Calling a remote enabled function module which does not exist in caller sys

    Hi,
    I have a a system ABC from which I am trying call a rfc enabled fm(Test) present in system XYZ.
    The fm(Test) does not exist in the system ABC so I am getting generation errors and dumps.
    Is there a way for me to call these remote enabled function modules which does not exist in the caller system without the obvious errors etc.
    Is there any special way.
    Thanks

    Hi,
    please check this sample:
    REPORT  zcallfm                                 .
    DATA: xv_return TYPE sysubrc.
    CALL FUNCTION 'DOESNOTEXIST'
    DESTINATION   'NOWHERE'
    EXPORTING     caller                = sy-sysid
    IMPORTING     return                = xv_return
    EXCEPTIONS    system_failure        = 1
                  communication_failure = 2
                  OTHERS                = 4.
    It shouldn't throw any generation errors in your system!
    Regards,
    Klaus

Maybe you are looking for

  • Can someone pls help me to change AS3 code to AS2 code

    Hello! Dear All, I dont understand why with AS3 code my swf file is not working smooth at all. I would like to try it with AS2. In publish setting when I am selecting Flash Player 8, AS2 my swf is running good but showing lots of code errors. I dont

  • Need latest  SLD and NWDI version for PI 7.1 EHP1

    Can any one update me the latest  SLD and NWDI version for PI 7.1 EHP1? Kindly provide me the path of implementation guides for SLD, NWDI  which can be used with PI 7.1 EHP1. For PI 7.1 EHP1, can we use the same version of  SLD and  NWDI which used I

  • Question about synchronize() statement and thread scheduling?

    I have threads accessing a shared LinkedList in the main thread. I made use of the Collections.synchronizedList() to avoid concurrent modifications. one of the threads is a timer thread and it has a priority of 5 and the other threads are message rec

  • Regexp_like [[:space:]]

    Hi, I wonder can you help, I have XML in a CLOB (I dont want to covert to XMLType), I want to find data that matches between XML tags e.g. <List1> to </List2>, the .* doesnt work when there are line returns in the clob, while the following works, sel

  • Corrupted Background Layer - Any way to rescue this project??

    So I've been heartbroken by Photoshop once again. I was three days' work into an enormous t-shirt design, probably the best painting I'd ever almost finished. But I went in to continue work on it, and all I found was this: Every other layer is in per