Kindly write some sample code for this scenario

Kindly write some sample code for the below Logic.
For a set of Deliveries entered on the selection screen get the relevant data from LIKP & LIPS.
for all the deliveries selected get the sales order data from VBAK & VBAP based on the VGBEL & VGPOS in LIPS.
The Output internal table should contain only deliveries which are created with reference to a sales order.
Thanx in Advance.
Akshitha.

Hi,
Select avbeln bposnr bmatnr blfimg bvgbel bvgpos into table ITAB
   from likp as a join lips as b on Avbeln =  bvbeln
   where a~vbeln in s_vbeln..
if not itab[] is initial.
   select avbeln bposnr b~matnr ... into table itab1 from vbak as a join vbap as b
   on avbeln = bvbeln
   for all entries in itab where avbeln = itab-vgbel and bposnr = itab-vgpos.
endif.
loop at itab.
read table itab1 with key vbeln = itab-vgbel posnr = itab-vgpos.
  if sy-subrc <> 0.
      delete itab index sy-tabix.
   endif.
endloop.
Now ITAB will have only deliveries created against Sales orders.
reward points if useful
regards,
Anji

Similar Messages

  • Sample code for this!!

    Hi all! Plz go through this!! Hope you understood this
    material no     item no          description
    1          10          abc
    1          80          cde
    1          35          fgh
    1          50          ijk
    1          95          lmn
    2               52              xyz
    Now for the same material we have to concatenate the description only for the least 3 of the item no(10,35,50)      how to write a code for this?
    Plz send me to [email protected]

    sort itab by matnr item.
    loop at itab.
    lv_tabix = sy-tabix.
    at new matnr.
    read itab index lv_tabix.
    loop at itab where matnr = itab-matnr.
    if count < 3.
    count = count + 1.
    concatenate desc itab-desc into desc separated by space.
    else.
    clear count.
    clear desc.
    exit.
    endif.
    itab_new-matnr = itab-matnr.
    itab_new-desc = desc.
    append itab_new.
    clear itab_new.
    endloop.
    endat.
    endloop.
    Regards,
    Ravi

  • How to write the pl/sql code for this scenario

    Hi,
    Here is the data in a Table with below colums
    id firstname lastname code
    1 scott higgins 001
    2 Mike Ferrari 001
    3 Tom scottsdale 002
    4 Nick pasquale 003
    1 scott higgins 004
    I want to trap the following exceptions into an error table using pl/sql
    1. same person having multiple code
    example
    id first last Code
    1 scott higgins 001
    1 scott higgins 004
    2. Multiple persons having same code
    id first last Code
    1 scott higgins 001
    2 Mike Ferrari 001
    Could you please help me how to capture the exceptions above using pl/sql
    and what will be the structure of error table. it should capture eff date & end date

    or using analytic functions like this:
    select id, fname, lname, code from (
    with t as(
        select 1 id, 'scott' fname, 'higgins' lname, 001 code from dual
        union all
        select 2 id,'Mike ' fname, 'Ferrari' lname,  001  code from dual
        union all
        select 3 id,'Tom' fname, 'scottsdale' lname, 002  code from dual
        union all
        select 4 id,'Nick' fname, 'pasquale' lname, 003  code from dual
        union all
        select 5 id,'scott' fname, 'higgins' lname, 004  code from dual
        select t.*, count(*) over (partition by fname) row_count from t)
    where row_count > 1;
    select id, fname, lname, code from (
    with t as(
        select 1 id, 'scott' fname, 'higgins' lname, 001 code from dual
        union all
        select 2 id,'Mike ' fname, 'Ferrari' lname,  001  code from dual
        union all
        select 3 id,'Tom' fname, 'scottsdale' lname, 002  code from dual
        union all
        select 4 id,'Nick' fname, 'pasquale' lname, 003  code from dual
        union all
        select 5 id,'scott' fname, 'higgins' lname, 004  code from dual
        select t.*, count(*) over (partition by code) row_count from t)
    where row_count > 1;

  • Routine sample code for reading 2 fields from existing DSO

    Hi Gurus,
                 I am a monkey when it comes to write ABAP code. I have one DSO-A where we store accounting info of purchading (from DS 2lis_02_acc) and one DSO-B getting data from 2lis_02_scl data source.
    We need to write a rountine to read DSO-A for G/L account and populate DSO-B G/L account field.
    Please provide me the sample code for this.
    Warm Regards,
    Anil

    Hi anil,
    Create a local table this is type of you source,
    Data : LV_table  TYPE  XXXX
    use the select statement to read the table of DSO .You have to use th active table for the dso that you want to read data from.
    Select xxxfieldxxx FROM  /BIC/A..........50
    into lv_table where
    filed name of of scheule line probably order no and item no .
    <soruce-fields>-IOBELN = IOBELN
    and <source-fields>-IOBELP = IOBELP.
    Checke the techinal name i am not sure about it. It will be something like that.
    Cheers mate

  • ABAP Sample code for HR_MAINTAIN_MASTERDATA

    Hi folks,
    I want to delimit a record in the HR master Table wi the help of Function Module HR_MAINTAIN_MASTERDATA, but its not updating HR master table correctly so please send me some sample code for that function module.
    usefull points will rewarded.
    Reg,
    Hariharan

    hi
    good
    check with this code
    Call update function module:
          CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
            EXPORTING
              PERNR           = SS300_0001T-PERNR
              ACTIO           = OPERATION
              BEGDA           = VALIDITYBEGIN
              ENDDA           = '99991231'
              SUBTY           = SPACE
              NO_ENQUEUE      = SPACE
            IMPORTING
              RETURN1         = RETURN
            TABLES
              PROPOSED_VALUES = VALUES
            MODIFIED_KEYS   =
            EXCEPTIONS
              OTHERS          = 1.
          IF RETURN IS INITIAL.
            CONCATENATE SS300_0002-VORNA SS300_0002-NACHN
              INTO ENAME SEPARATED BY SPACE.
            CONDENSE ENAME.
            MESSAGE S006 WITH ENAME SPACE.
          ELSE.
            MESSAGE ID     RETURN-ID
                    TYPE   'S'
                    NUMBER RETURN-NUMBER
                    WITH   RETURN-MESSAGE_V1 RETURN-MESSAGE_V2
                           RETURN-MESSAGE_V3 RETURN-MESSAGE_V4.
          ENDIF.
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0ce464dc8b11d2803800c04f99fbf0/content.htm
    reward point if helpful.
    thanks
    mrutyun^

  • Write code for this its urgent

    hi its a alv bills of material report plz write code for this
    Develop a report to high light the bom and/or master receipes fall into the constrained planning horizon those are not ready for porduction
    this report will identity the items with a bom with a status other that 03(ready for production) and/or master receips witha a status other than 04(released). the items will be reveiwed in predefined horizon.
    within a few weeks of entering the 18 th week constrained planning horizon.
    for this report take bom tables stko,stpo,mast.
    in sel-scren take mrp controller, plant, divison.
    send immedialtly

    Brother this is not the correct way to ask.
    In your words you are commanding...
    But we have to request the EXPERTS.
    WE are in learning stage dont order or command.
    Just request them in another way...... then only u get the required reply....
    With regards,
    Prasad.

  • Visual Studio Sample Code for Web Services Integration

    I am new to the CRM OnDemand web services and am looking to write an interface for querying and updating data. I have imported the .wsdl and got the log-in and log-out functioning but rather than re-inventing the wheel I was wondering if anybody had some sample code of how to work with the business objects such as Account or Contact.
    I am using Visual Studio .Net (Prefer c#). Any sample would be greatly appreciated.
    Thanks in advance....
    Edited by: user10730659 on 9/01/2009 23:08
    Edited by: user10730659 on 20/01/2009 16:11

    I found some examples in the Web Services Resource Library.
    you can access this through the "Training and Support" link from within CRM OD.
    Then click on "Web Services Library" then download the Getting Started kits
    Edited by: user10730659 on 20/01/2009 16:11

  • Tips on how to write efficient  java code for java mapping

    hi
    I do not have much knowledge in Java
    Can anybody tell me some tips on how to write efficient and optimised java code to be used in java mapping
    Thanks,
    Loveena

    hi D'za,
    JAVA in xi
    A very important place where you will use JAVA in XI is while doing your Mapping. There will be cases when JAVA MAPPING is the best solution to go for. There are 2 types of Parsers available for JAVA Mapping. DOM Parser and SAX parser. Just got through the following links to understand more on Java Mapping and the APIs available.http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
    JAVA mapping -
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    sample code for java mapping
    Re: Example code DOM PARSER API -
    http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html DOM --- /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs tutorial sax and dom
    For a tutorial on the methods of SAX and DOM http://java.sun.com/webservices/docs/1.1/tutorial/doc/
    SAX AND dom PARSER ( BY thorsten) -
    example /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs java mapping example ( testing and debugging) /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
    regards
    biplab
    Use a Good Subject Line, One Question Per Posting - Award Points

  • Hi guys please give me sample code for call transaction that handles error

    hi guys, please give me sample code for call transaction that handles error,
    please send me the sample code in which there should be all decleration part and everything, based on the sample code i will develop my code.
    please do help me as it is urgent.
    thanks and regards.
    prasadnn.

    Hi Prasad,
    Check this code.
    Source Code for BDC using Call Transaction
    *Code used to create BDC
    *& Report  ZBDC_EXAMPLE                                                *
    *& Example BDC program, which updates net price of item 00010 of a     *
    *& particular Purchase order(EBELN).                                   *
    REPORT  ZBDC_EXAMPLE  NO STANDARD PAGE HEADING
                          LINE-SIZE 132.
    Data declaration
    TABLES: ekko, ekpo.
    TYPES: BEGIN OF t_ekko,
        ebeln TYPE ekko-ebeln,
        waers TYPE ekko-waers,
        netpr TYPE ekpo-netpr,
        err_msg(73) TYPE c,
    END OF t_ekko.
    DATA: it_ekko  TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko  TYPE t_ekko,
          it_error TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_error TYPE t_ekko,
          it_success TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_success TYPE t_ekko.
    DATA: w_textout            LIKE t100-text.
    DATA: gd_update TYPE i,
          gd_lines TYPE i.
    *Used to store BDC data
    DATA: BEGIN OF bdc_tab OCCURS 0.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdc_tab.
    *Used to stores error information from CALL TRANSACTION Function Module
    DATA: BEGIN OF messtab OCCURS 0.
            INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END OF messtab.
    *Screen declaration
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
                                        TITLE text-001. "Purchase order Num
    SELECT-OPTIONS: so_ebeln FOR ekko-ebeln OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK block1.
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME
                                        TITLE text-002. "New NETPR value
    PARAMETERS:  p_newpr(14)   TYPE c obligatory.  "LIKE ekpo-netpr.
    SELECTION-SCREEN END OF BLOCK block2.
    *START-OF-SELECTION
    START-OF-SELECTION.
    Retrieve data from Purchase order table(EKKO)
      SELECT ekkoebeln ekkowaers ekpo~netpr
        INTO TABLE it_ekko
        FROM ekko AS ekko INNER JOIN ekpo AS ekpo
          ON ekpoebeln EQ ekkoebeln
       WHERE ekko~ebeln IN so_ebeln AND
             ekpo~ebelp EQ '10'.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Check data has been retrieved ready for processing
      DESCRIBE TABLE it_ekko LINES gd_lines.
      IF gd_lines LE 0.
      Display message if no data has been retrieved
        MESSAGE i003(zp) WITH 'No Records Found'(001).
        LEAVE TO SCREEN 0.
      ELSE.
      Update Customer master data (instalment text)
        LOOP AT it_ekko INTO wa_ekko.
          PERFORM bdc_update.
        ENDLOOP.
      Display message confirming number of records updated
        IF gd_update GT 1.
          MESSAGE i003(zp) WITH gd_update 'Records updated'(002).
        ELSE.
          MESSAGE i003(zp) WITH gd_update 'Record updated'(003).
        ENDIF.
    Display Success Report
      Check Success table
        DESCRIBE TABLE it_success LINES gd_lines.
        IF gd_lines GT 0.
        Display result report column headings
          PERFORM display_column_headings.
        Display result report
          PERFORM display_report.
        ENDIF.
    Display Error Report
      Check errors table
        DESCRIBE TABLE it_error LINES gd_lines.
      If errors exist then display errors report
        IF gd_lines GT 0.
        Display errors report
          PERFORM display_error_headings.
          PERFORM display_error_report.
        ENDIF.
      ENDIF.
    *&      Form  DISPLAY_COLUMN_HEADINGS
          Display column headings
    FORM display_column_headings.
      WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
      SKIP.
      WRITE:2 'The following records updated successfully:'(013).
      WRITE:/ sy-uline(42).
      FORMAT COLOR COL_HEADING.
      WRITE:/      sy-vline,
              (10) 'Purchase Order'(004), sy-vline,
              (11) 'Old Netpr'(005), sy-vline,
              (11) 'New Netpr'(006), sy-vline.
      WRITE:/ sy-uline(42).
    ENDFORM.                    " DISPLAY_COLUMN_HEADINGS
    *&      Form  BDC_UPDATE
          Populate BDC table and call transaction ME22
    FORM bdc_update.
      PERFORM dynpro USING:
          'X'   'SAPMM06E'        '0105',
          ' '   'BDC_CURSOR'      'RM06E-BSTNR',
          ' '   'RM06E-BSTNR'     wa_ekko-ebeln,
          ' '   'BDC_OKCODE'      '/00',                      "OK code
          'X'   'SAPMM06E'        '0120',
          ' '   'BDC_CURSOR'      'EKPO-NETPR(01)',
          ' '   'EKPO-NETPR(01)'  p_newpr,
          ' '   'BDC_OKCODE'      '=BU'.                      "OK code
    Call transaction to update customer instalment text
      CALL TRANSACTION 'ME22' USING bdc_tab MODE 'N' UPDATE 'S'
             MESSAGES INTO messtab.
    Check if update was succesful
      IF sy-subrc EQ 0.
        ADD 1 TO gd_update.
        APPEND wa_ekko TO it_success.
      ELSE.
      Retrieve error messages displayed during BDC update
        LOOP AT messtab WHERE msgtyp = 'E'.
        Builds actual message based on info returned from Call transaction
          CALL FUNCTION 'MESSAGE_TEXT_BUILD'
               EXPORTING
                    msgid               = messtab-msgid
                    msgnr               = messtab-msgnr
                    msgv1               = messtab-msgv1
                    msgv2               = messtab-msgv2
                    msgv3               = messtab-msgv3
                    msgv4               = messtab-msgv4
               IMPORTING
                    message_text_output = w_textout.
        ENDLOOP.
      Build error table ready for output
        wa_error = wa_ekko.
        wa_error-err_msg = w_textout.
        APPEND wa_error TO it_error.
        CLEAR: wa_error.
      ENDIF.
    Clear bdc date table
      CLEAR: bdc_tab.
      REFRESH: bdc_tab.
    ENDFORM.                    " BDC_UPDATE
          FORM DYNPRO                                                   *
          stores values to bdc table                                    *
    -->  DYNBEGIN                                                      *
    -->  NAME                                                          *
    -->  VALUE                                                         *
    FORM dynpro USING    dynbegin name value.
      IF dynbegin = 'X'.
        CLEAR bdc_tab.
        MOVE:  name TO bdc_tab-program,
               value TO bdc_tab-dynpro,
               'X'  TO bdc_tab-dynbegin.
        APPEND bdc_tab.
      ELSE.
        CLEAR bdc_tab.
        MOVE:  name TO bdc_tab-fnam,
               value TO bdc_tab-fval.
        APPEND bdc_tab.
      ENDIF.
    ENDFORM.                               " DYNPRO
    *&      Form  DISPLAY_REPORT
          Display Report
    FORM display_report.
      FORMAT COLOR COL_NORMAL.
    Loop at data table
      LOOP AT it_success INTO wa_success.
        WRITE:/      sy-vline,
                (10) wa_success-ebeln, sy-vline,
                (11) wa_success-netpr CURRENCY wa_success-waers, sy-vline,
                (11) p_newpr, sy-vline.
        CLEAR: wa_success.
      ENDLOOP.
      WRITE:/ sy-uline(42).
      REFRESH: it_success.
      FORMAT COLOR COL_BACKGROUND.
    ENDFORM.                    " DISPLAY_REPORT
    *&      Form  DISPLAY_ERROR_REPORT
          Display error report data
    FORM display_error_report.
      LOOP AT it_error INTO wa_error.
        WRITE:/      sy-vline,
                (10) wa_error-ebeln, sy-vline,
                (11) wa_error-netpr CURRENCY wa_error-waers, sy-vline,
                (73) wa_error-err_msg, sy-vline.
      ENDLOOP.
      WRITE:/ sy-uline(104).
      REFRESH: it_error.
    ENDFORM.                    " DISPLAY_ERROR_REPORT
    *&      Form  DISPLAY_ERROR_HEADINGS
          Display error report headings
    FORM display_error_headings.
      SKIP.
      WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
      SKIP.
      WRITE:2 'The following records failed during update:'(008).
      WRITE:/ sy-uline(104).
      FORMAT COLOR COL_HEADING.
      WRITE:/      sy-vline,
              (10) 'Purchase Order'(009), sy-vline,
              (11) 'Netpr'(010), sy-vline,
              (73) 'Error Message'(012), sy-vline.
      WRITE:/ sy-uline(104).
      FORMAT COLOR COL_NORMAL.
    ENDFORM.                    " DISPLAY_ERROR_HEADINGS
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Need case studies and sample code for all concept of ABAP

    Hello,
           Can anybody provide me the case studies and sample code for learning different concepts in ABAP programming like: module pool, ALV, interactive reports, BDC, Smart Form etc.? As I want to do some practical application by which i can learn more.
    Thanks & Regards,
    Vikram Rawal

    In this link You can find Step by Step Scren Shot document :
    http://www.201interviewquestions.com/docs/User%20exits.ppt
    http://erpgenie.com/abaptips/component/option,com_docman/task,doc_details/gid,27/
    <b>
    Reprots</b>
    http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    <b>Dictionary</b>
    http://sapabap.iespana.es/sapabap/manuales/learnabap/
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb6e446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ea31446011d189700000e8322d00/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf
    <b>ABAP objects</b>
    Please check this online document (starting page 1291).
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    Also check this links as well.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.futureobjects.de/content/intro_oo_e.html
    http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
    /people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
    <b>
    SAPScripts</b>
    http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
    http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
    http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
    http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
    http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
    http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
    SAP SCRIPT FIELDS
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
    scripts easy material
    http://www.allsaplinks.com/sap_script_made_easy.html
    Check these step-by-step links
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    <b>Smartforms material</b>
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    http://www.sap-img.com/smartforms/smartform-tutorial.htm
    http://www.sapgenie.com/abap/smartforms.htm
    How to trace smartform
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF
    http://www.sap-img.com/smartforms/smart-006.htm
    http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm
    Re: Need FAQ's
    check most imp link
    http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    <b>
    BAPI</b>
    http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sapgenie.com/abap/bapi/example.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
    <b>List of all BAPIs</b>
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    http://www.planetsap.com/Bapi_main_page.htm
    http://www.topxml.com/sap/sap_idoc_xml.asp
    http://www.sapdevelopment.co.uk/
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    <b>ALV programs.</b>
    http://www.geocities.com/mpioud/Abap_programs.html
    . How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    <b>ALV</b>
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    <b>Top-of-page in ALV</b>
    selection-screen and top-of-page in ALV
    <b>ALV Group Heading</b>
    http://www.sap-img.com/fu037.htm
    <b>ALV</b>
    http://www.geocities.com/mpioud/Abap_programs.html
    <b>
    RFC Destination</b>
    Re: SM59
    <b>
    ALE/ IDOC</b>http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapgenie.com/sapedi/idoc_abap.htm
    http://www.allsaplinks.com/idoc_sample.html
    http://www.sappoint.com/abap.html
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.allsaplinks.com/idoc_sample.html
    <b>Table Control</b>
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
    <b>
    ABAP transactions</b>
    http://www.easymarketplace.de/transactions-a-e.php?Area=4soi&name=volker&pw=vg&
    Regards,
    Priyanka.

  • What’s the best practice for this scenario?

    Hi,
    My users want the ability to change the WHERE and/or ORDER BY clause at runtime. They may define user preferences on each screen ( which is bind to a view object). They want to see the same records based on WHERE/ORDER BY defined on the last visit. That is why I keep the users preferences and load the screen based on that, using :
    View.setWhereClause(...);
    View.setOrderByClause(...);
    View.executeQuery();
    This works good when only one user working with the application but faced low performance when more than one user working with the application.
    What are the points to increase the performance and what is the best practice for this scenario?
    Thanks for your help in advance.

    Sung,
    I am talking only about 2 users in my testing. I am sure i missed something but could not recognize that.
    This page is my custom query page including a tag to instantiate app module in stateful mode at the top <jbo:ApplicationModule..> and a tag to instantiate data source <jbo:Datasource...> and release tag at the bottom <jbo:ReleasePageResources..> and some java code in the middle(body). The java code constructed the query statement and then fires the query to set the view object based on the query statement using the above methods.
    So, I am facing very slow performance(speed) when two clients load this page at the same time. Looks like the entire application locks for others when one client load this page and fire the query. i realized the battle neck is where executeQuery() is executing.
    what do you think.
    Thanks in advance for your comments.

  • Need help with API and sample code for checking a user's rights on a folder

    Hi All,
    I am working on an UCM integration where user supplies a folderpath (ucm folders), and a file is later uploaded to this location.
    Since a user can provide a folderpath where he has only Read Access or no access at all, we are trying to work out a way to pre-check his permissions on the folder.
    Since we have Entity Security enabled, we have 5 security fields to rely on Account, Security Group, User Access List, Group Access List, Role Access List.
    Writing custom code for this security check is second on our agenda.
    Firstly, we wish to know the API and sample code that typically performs this Security Check in UCM.
    We could find intradoc.shared.SecurityUtils which has methods to check security on SGroup and Account, but we couldn't find anything for:
    1) Overall security check
    2) ACL security check on top of sgroup and account security check

    Any ideas anyone?!
    I am looking forward to some pointers here. :(

  • Sample code for Org Management

    Hi,
             I am new to Org Management coding in HR ABAP.
       Can anybody post some simple sample code for Org. Management so that I can understand the flow of coding..
    Thanks and Regards,
    Ram

    Hi
    see the sample code using Orgn management infotypes like HRP1000 etc
    report zporgr0040
           line-size 108
           line-count 60(1)
           no standard page heading
           message-id zndc.
    Database Tables
    tables: hrp1001,     " HR Master Record (Orgn. Assignment)
            pa0002,      " Personal Data
            t528t,       " Position Texts
            t527x,       " Org Unit Text
            t528b,       " Positions
            csks,        " Cost Center
            cskt.        " Cost Center Texts
    Declaration of Internal Tables
    Internal Table for Orgn Object Data  HRP1000
    data: begin of obj_tab occurs 0,
            otype like hrp1000-otype,      " Object Type
            objid like hrp1000-objid,      " Object ID
            plvar like hrp1000-plvar,      " Plan Version
            istat like hrp1000-istat,      " Planning Status
            begda like hrp1000-begda,      " Begin date
            endda like hrp1000-endda,      " End date
          end of obj_tab.
    Internal Table for Active Employees data PA0000
    data: begin of stat_tab occurs 0,
            pernr like pa0000-pernr,       " Object Type
            begda like pa0000-begda,       " Begin date
            endda like pa0000-endda,       " End date
            stat2 like pa0000-stat2,       " Employment Status
          end of stat_tab.
    Internal Table for Actual Orgn Assignment Data PA0001
    data: begin of act_tab occurs 0,
            pernr like pa0001-pernr,       " Object Type
            begda like pa0001-begda,       " Begin date
            endda like pa0001-endda,       " End date
            kostl like pa0001-kostl,       " Cost Center
            orgeh like pa0001-orgeh,       " Org Unit
            plans like pa0001-plans,       " Position
            natio like pa0002-natio,       " Nationality
          end of act_tab.
    Internal Table for Orgn Data HRP1001
    data: begin of org_tab occurs 0,
            otype like hrp1001-otype,      " Object Type
            objid like hrp1001-objid,      " Object ID
            plvar like hrp1001-plvar,      " Plan Version
            istat like hrp1001-istat,      " Planning Status
            begda like hrp1001-begda,      " Begin date
            endda like hrp1001-endda,      " End date
            subty like hrp1001-subty,      " Sub Type
            sclas like hrp1001-sclas,      " Type of Related Object
            sobid like hrp1001-sobid,      " Id of Related Object
            kostl like pa0001-kostl,       " Cost Center
            plstx like t528t-plstx,        " Position Text
            orgtx like t527x-orgtx,        " Org Unit Text
          end of org_tab.
    Internal Table for Position Calculations
    data: begin of org1_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            objid like hrp1001-objid,      " Object ID
          end of org1_tab.
    Internal Table for Position Calculations
    data: begin of org2_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            count type i,                  " No of Positions
          end of org2_tab.
    Internal Table for Actual Manpower Calculations
    data: begin of act1_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            natio like pa0002-natio,       " Nationality
            plans like pa0001-plans,       " Position
          end of act1_tab.
    Internal Table for Actual Manpower Calculations(UAE)
    data: begin of act2_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            natio like pa0002-natio,       " Nationality
          end of act2_tab.
    Internal Table for Actual Manpower Calculations(Others)
    data: begin of act3_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            natio like pa0002-natio,       " Nationality
          end of act3_tab.
    Internal Table for Actual Manpower Calculations(UAE)
    data: begin of act4_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            count1 type i,                 " No of Positions(UAE)
          end of act4_tab.
    Internal Table for Actual Manpower Calculations(OTHERS)
    data: begin of act5_tab occurs 0,
            kostl like pa0001-kostl,       " Cost Center
            count2 type i,                 " No of Positions(Others)
          end of act5_tab.
    Internal Table for Vaccancies Data
    data: begin of vac_tab occurs 0,
            plvar like hrp1007-plvar,      " Plan Version
            otype like hrp1007-otype,      " Object Type
            objid like hrp1007-objid,      " Object ID
            istat like hrp1007-istat,      " Planning Status
            begda like hrp1007-begda,      " Begin date
            endda like hrp1007-endda,      " End date
            vacan like hrp1007-vacan,      " Vacancy Indicator
            status like hrp1007-status,    " Status of Vacancy
          end of vac_tab.
    Internal Table to store the Report Output data
    data : begin of rep_tab occurs 0 ,
             kostl(10) type n,                  " Cost Cente
             plans   like pa0001-plans,         " Position
             vacan   like hrp1007-vacan,        " Vacancy Indicator
             status  like hrp1007-status,       " Status of Vacancy
             plstx   like t528t-plstx,          " Position Text
             orgtx like t527x-orgtx,            " Org Unit Text
           end of rep_tab.
    Internal Table to store the Report Output data
    data : begin of rep1_tab occurs 0 ,
             kostl(10) type n,                  " Cost Cente
             cnt     type i,                    " No of Vacancies
           end of rep1_tab.
    Internal Table to store the Report Output data
    data : begin of rep2_tab occurs 0 ,
             kostl(10) type n,                  " Cost Cente
             app_no    type i,                  " Approved
             nat_no    type i,                  " National
             exp_no    type i,                  " Expatriate
             tot_no    type i,                  " Total
             vac_no    type i,                  " Vacancies
           end of rep2_tab.
    Declaration of Variables
    data: v_sobid  like hrp1001-sobid,   " Object Id
          v_sobid1 like hrp1001-sobid,   " Object Id
          v_sobid2 like hrp1001-sobid,   " Object Id
          v_sclas  like hrp1001-sclas,   " Related Obj Type
          v_subty  like hrp1001-subty,   " Related Object Id
          v_otype  like hrp1007-otype,   " Object Type
         v_str(9)    type c,            " Text
         v_str1(10)  type c,            " Text
          v_cnt    like sy-tabix.        " Table Index
    Declaration of Constants
    constants : c_x         type c value 'X',            " Flag
                c_stat1  like pa0000-stat2  value '3',   " Emp Status
                c_plan   like hrp1001-plvar value '01',  " Plan Version
                c_name   like hrp1000-uname value 'SAP', " Uname
                c_uae    like pa0002-natio  value 'AE',  " Country
                c_type   like hrp1007-otype  value 'O',  " Object Type
                c_otype  like hrp1007-otype  value 'S',  " Object Type
                c_stat   like hrp1007-status value '0',  " Status
                c_pstat  like hrp1007-istat  value '1',  " Plang Status
                c_sclas  like hrp1001-sclas value 'K',    " Rel. Obj Type
                c_subty  like hrp1001-subty value 'A002', " Related ObjId
                c_subty2 like hrp1001-subty value 'A003', " Related ObjId
                c_sclas1 like hrp1001-sclas value 'O',    " Rel.Obj Type
                c_subty1 like hrp1001-subty value 'A011', " Rel.Object Id
                c_kokrs  like coej-kokrs value '1000'. " Controlling Area
    Selection Screen
    selection-screen begin of block b1 with frame title text-001.
    parameters     :
      p_date  like pa0001-begda obligatory default sy-datum. " Date
    select-options :
      s_kostl for csks-kostl,                     " Cost Center
      s_plans for t528b-plans.                    " Position ID
    selection-screen end of block b1.
    At selection-screen
    at selection-screen.
    Validate the Selection Screen fields
      perform validate_screen.
    Start-of-Selection
    start-of-selection.
    Get the Orgn data from database Table HRP1001
      perform get_org_data.
    Get the Actual Manpower from PA0001
      perform get_act_data.
    Get the Vaccancies data from database Table HRP1007
      perform get_vac_data.
    Append the data into final Internal Table
      perform append_data.
    Top-of-page
    top-of-page.
    Write the Report and Column Headings
      perform top_of_page.
    End-of-Page
    end-of-page.
      write /1(108) sy-uline.
    End-of-Selection
    end-of-selection.
    Display the Output Report.
      perform display_report.
    Form-Routines
    *&      Form  validate_screen
    Validation of selection Screen fields
    form validate_screen.
    Validation of Position ID
      clear t528b.
      if not s_plans[] is initial.
        select single plans
          into t528b-plans
          from t528b
          where plans in s_plans.
        if sy-subrc <> 0.
          message e999 with 'Invalid Position ID'(009).
        endif.
      endif.
    Validation of Cost Center
      clear csks.
      if not s_kostl[] is initial.
        select single kostl
          into csks-kostl
          from csks
          where kostl in s_kostl.
        if sy-subrc <> 0.
          message e999 with 'Invalid Cost Center'(008).
        endif.
      endif.
    endform.                  "validate_screen
    *&      Form  get_org_data
    Get the Orgn Data from Database Table HRP1001
    form get_org_data.
    v_str  = 'Developee'(002).
    v_str1 = 'Deployment'(003).
    Select All the Positions from HRP1000
      select otype       " Object Type
             objid       " Object ID
             plvar       " Plan Version
             istat       " Planning Status
             begda       " Begin date
             endda       " End date
         into table obj_tab
         from hrp1000
         where otype = c_otype  and
               plvar = c_plan   and
               istat = c_pstat  and
               begda le p_date  and
               endda ge p_date  and
               objid in s_plans and
               uname ne c_name.
      sort obj_tab by otype objid.
    Get the Orgn and Cost Center for all the above Positions
      if not obj_tab[] is initial.
        select otype       " Object Type
               objid       " Object ID
               plvar       " Plan Version
               istat       " Planning Status
               begda       " Begin date
               endda       " End date
               subty       " Sub Type
               sclas       " Type of Related Object
               sobid       " Id of Related Object
           into table org_tab
           from hrp1001
           for all entries in obj_tab
           where otype = c_otype  and
                 plvar = c_plan   and
                 istat = c_pstat  and
                 begda le p_date  and
                 endda ge p_date  and
                 sclas eq c_sclas1 and
                 subty eq c_subty2 and
                 objid eq obj_tab-objid.
      endif.
      sort org_tab by otype objid.
    Get the Cost Center
      loop at org_tab.
        v_otype = c_otype.       " S
        v_sclas = c_sclas.       " K
        v_subty = c_subty1.                                     " A011
        v_sobid = org_tab-objid.
        perform get_org using v_otype v_sclas v_subty
                        v_sobid.
        if sy-subrc = 0.
          org_tab-kostl = hrp1001-sobid+0(10).
        else.
          v_otype = c_otype.    " S
          v_sclas = c_sclas1.   " O
          v_subty = c_subty2.                                   " A003
          v_sobid = org_tab-objid.
          perform get_org using v_otype v_sclas v_subty
                         v_sobid.
          if sy-subrc = 0.
            v_otype = c_type.     " O
            v_sclas = c_sclas.    " K
            v_subty = c_subty1.                                 " A011
            v_sobid1 = v_sobid.
            perform get_org using v_otype v_sclas v_subty
                                 v_sobid.
            if sy-subrc <> 0.
              v_otype = c_type.    " O
              v_sclas = c_sclas1.  " O
              v_subty = c_subty.                                " A002
              v_sobid = v_sobid1.
              perform get_org using v_otype v_sclas v_subty
                        v_sobid.
              if sy-subrc = 0.
                v_otype = c_type.   " O
                v_sclas = c_sclas.  " K
                v_subty = c_subty1.                             " A011
                v_sobid2 = v_sobid.
                perform get_org using v_otype v_sclas v_subty
                                 v_sobid.
                if sy-subrc <> 0.
                  v_otype = c_type.   " O
                  v_sclas = c_sclas1. " O
                  v_subty = c_subty.                            " A002
                  v_sobid = v_sobid2.
                  perform get_org using v_otype v_sclas v_subty
                          v_sobid.
                else.
                  org_tab-kostl = hrp1001-sobid+0(10).
                endif.
              endif.
            else.
              org_tab-kostl = hrp1001-sobid+0(10).
            endif.
          else.
            v_otype = c_otype.   " S
            v_sclas = c_otype.   " S
            v_subty = c_subty.                                  " A002
            v_sobid = org_tab-objid.
            perform get_org using v_otype v_sclas v_subty
                           v_sobid.
            if sy-subrc = 0.
              v_otype = c_otype.  " S
              v_sclas = c_sclas.  " K
              v_subty = c_subty1.                               " A011
              v_sobid1 = v_sobid.
              perform get_org using v_otype v_sclas v_subty
                                   v_sobid.
              if sy-subrc <> 0.
                v_otype = c_otype.  " S
                v_sclas = c_sclas1. " O
                v_subty = c_subty2.                             " A003
                v_sobid = v_sobid1.
                perform get_org using v_otype v_sclas v_subty
                          v_sobid.
                if sy-subrc = 0.
                  v_otype = c_type.   " O
                  v_sclas = c_sclas.  " K
                  v_subty = c_subty1.                           " A011
                  v_sobid2 = v_sobid.
                  perform get_org using v_otype v_sclas v_subty
                                   v_sobid.
                  if sy-subrc <> 0.
                    v_otype = c_type.    " O
                    v_sclas = c_sclas1.  " O
                    v_subty = c_subty.                          " A002
                    v_sobid = v_sobid2.
                    perform get_org using v_otype v_sclas v_subty
                            v_sobid.
                  else.
                    org_tab-kostl = hrp1001-sobid+0(10).
                  endif.
                endif.
              else.
                org_tab-kostl = hrp1001-sobid+0(10).
              endif.
            endif.
          endif.
        endif.
    Get the Position Text
        clear t528t.
        select single plstx from t528t into t528t-plstx
          where sprsl = sy-langu and
                otype = c_otype  and
                plans = org_tab-objid.
        org_tab-plstx = t528t-plstx.
    Get the Org Unit Text
        clear t527x.
        select single orgtx from t527x into t527x-orgtx
          where sprsl = sy-langu and
                orgeh = org_tab-sobid+0(8).
        org_tab-orgtx = t527x-orgtx.
        modify org_tab index sy-tabix.
        clear v_sobid.
      endloop.
      sort org_tab by otype objid.
    Calculate the Approved No of Positions
      loop at org_tab.
        if org_tab-kostl in s_kostl.
          move-corresponding org_tab to org1_tab.
          append org1_tab.
          clear org1_tab.
        endif.
      endloop.
      sort org1_tab by kostl objid.
      clear v_cnt.
      loop at org1_tab.
        at end of kostl.
          sy-tabix = sy-tabix - v_cnt.
          org2_tab-kostl = org1_tab-kostl.
          org2_tab-count   = sy-tabix.
          v_cnt = v_cnt + sy-tabix.
          append org2_tab.
          clear:org2_tab.
        endat.
      endloop.
      sort org2_tab by kostl.
    endform.              "get_org_data
    *&      Form  get_act_data
    Get the Actual Manpower Data from Database Table PA0001
    form get_act_data.
      clear  : stat_tab, act_tab.
      refresh: stat_tab, act_tab.
    Get all the Active Employees
      select pernr       " Object Type
             begda       " Begin date
             endda       " End date
             stat2       " Emp Status
           into table stat_tab
           from pa0000
           where stat2 eq c_stat1 and
                 begda le p_date  and
                 endda ge p_date.
      sort act_tab by pernr.
      if not stat_tab[] is initial.
        select pernr       " Object Type
               begda       " Begin date
               endda       " End date
               kostl       " Cost Center
               orgeh       " Org Unit
               plans       " Position
           into table act_tab
           from pa0001
           for all entries in stat_tab
           where pernr eq stat_tab-pernr and
                 kostl in s_kostl and
                 plans in s_plans and
                 persg eq '1'     and
                 begda le p_date  and
                 endda ge p_date.
      endif.
      sort act_tab by pernr.
      loop at act_tab.
        move-corresponding act_tab to act1_tab.
        clear pa0002-natio.
        select single natio into pa0002-natio from pa0002
          where pernr = act_tab-pernr.
        if sy-subrc = 0.
          act1_tab-natio = pa0002-natio.
        endif.
        append act1_tab.
        clear act1_tab.
      endloop.
      sort act1_tab by kostl natio.
    Calculate the Local and Expatriate Manpower
      loop at act1_tab.
        if act1_tab-natio = c_uae.
          act2_tab-kostl = act1_tab-kostl.
          act2_tab-natio = act1_tab-natio.
        else.
          act3_tab-kostl = act1_tab-kostl.
          act3_tab-natio = act1_tab-natio.
        endif.
        append: act2_tab, act3_tab.
        clear : act2_tab,act3_tab.
      endloop.
      sort act2_tab by kostl.
      sort act3_tab by kostl.
    Actual UAE Manpower
      clear v_cnt.
      loop at act2_tab.
        at end of kostl.
          sy-tabix = sy-tabix - v_cnt.
          act4_tab-kostl   = act2_tab-kostl.
          act4_tab-count1  = sy-tabix.
          v_cnt = v_cnt + sy-tabix.
          append act4_tab.
          clear:act4_tab.
        endat.
      endloop.
      sort act4_tab by kostl.
    Other Countries
      clear v_cnt.
      loop at act3_tab.
        at end of kostl.
          sy-tabix = sy-tabix - v_cnt.
          act5_tab-kostl   = act3_tab-kostl.
          act5_tab-count2  = sy-tabix.
          v_cnt = v_cnt + sy-tabix.
          append act5_tab.
          clear:act5_tab.
        endat.
      endloop.
      sort act5_tab by kostl.
    endform.              "get_act_data
    *&      Form  get_org
    Get the Cost Center from Parent Org Id
    form get_org using p_v_otype p_v_sclas p_v_subty p_v_sobid.
      clear hrp1001.
      select single * from hrp1001
            where otype = p_v_otype  and
                  plvar = c_plan   and
                  istat = c_pstat  and
                  begda le p_date  and
                  endda ge p_date  and
                  sclas eq p_v_sclas   and
                  subty eq p_v_subty  and
                  objid eq p_v_sobid.
      v_sobid = hrp1001-sobid+0(8).
    endform.                    " get_org
    *&      Form  get_vac_data
    Get the Vaccancies Data from Database Table HRP1007
    form get_vac_data.
      if not org_tab[] is initial.
        select plvar       " Plan Version
               otype       " Object Type
               objid       " Object ID
               istat       " Planning Status
               begda       " Begin date
               endda       " End date
               vacan       " Vacancy Indicator
               status      " Status of Vacancy
           into table vac_tab
           from hrp1007
           for all entries in org_tab
           where plvar = c_plan   and
                 otype = c_otype  and
                 istat eq c_pstat and
                 objid = org_tab-objid and
                 begda le p_date and
                 endda ge p_date and
                 vacan eq c_x  and
                 status eq c_stat.
      endif.
      sort vac_tab by plvar otype objid.
    Get the HR data into the rep_tab Internal Table
      loop at vac_tab.
        rep_tab-plans  = vac_tab-objid.
        rep_tab-vacan  = vac_tab-vacan.
        rep_tab-status = vac_tab-status.
        read table org_tab with key objid = vac_tab-objid.
        if sy-subrc = 0.
          rep_tab-kostl = org_tab-kostl.
          rep_tab-plstx = org_tab-plstx.
          rep_tab-orgtx = org_tab-orgtx.
        endif.
        append rep_tab.
        clear  rep_tab.
      endloop.
      loop at rep_tab.
        if not rep_tab-kostl in s_kostl.
          delete rep_tab index sy-tabix.
        endif.
      endloop.
      sort rep_tab by kostl plans.
    delete rep_tab where plstx cs v_str.
    delete rep_tab where orgtx cs v_str1.
    Calculate the Count of Vacancies in each Division
      clear v_cnt.
      loop at rep_tab.
        at end of kostl.
          sy-tabix = sy-tabix - v_cnt.
          rep1_tab-kostl = rep_tab-kostl.
          rep1_tab-cnt   = sy-tabix.
          v_cnt = v_cnt + sy-tabix.
          append rep1_tab.
          clear:rep1_tab.
        endat.
      endloop.
      sort rep1_tab by kostl.
    endform.                  "get_vac_data
    *&      Form append_data
    Append the data into final Internal Table
    form append_data.
      loop at org2_tab.
        rep2_tab-kostl = org2_tab-kostl.
        rep2_tab-app_no = org2_tab-count.
        read table act4_tab with key kostl = org2_tab-kostl
                                     binary search.
        if sy-subrc = 0.
          rep2_tab-nat_no = act4_tab-count1.
        endif.
        read table act5_tab with key kostl = org2_tab-kostl
                                     binary search.
        if sy-subrc = 0.
          rep2_tab-exp_no = act5_tab-count2.
        endif.
        read table rep1_tab with key kostl = org2_tab-kostl
                                     binary search.
        if sy-subrc = 0.
          rep2_tab-vac_no = rep1_tab-cnt.
        endif.
        rep2_tab-tot_no = rep2_tab-nat_no + rep2_tab-exp_no.
        append rep2_tab.
        clear rep2_tab.
      endloop.
      sort rep2_tab by kostl.
    endform.             "append_data
    *&      Form  top_of_page
    Write the Report and Column Headings
    form top_of_page.
      skip.
      format color col_heading on.
      write: /1(108) 'NATIONAL DRILLING COMPANY'(010) centered,
             /1(108) 'Summary of Manning Level Report'(011) centered.
      format color off.
      skip.
      write: /2 'Key Date        :'(013), p_date,
             75 'Report Run Date:'(041), sy-datum.
      if not s_kostl[] is initial.
        if s_kostl-high is initial.
          write: /2 'Cost Center     :'(023), s_kostl-low,
                 75 'Time           :'(042), sy-uzeit.
        else.
          write: /2 'Cost Center From:'(024), s_kostl-low+7(3),
                                    'To'(022), s_kostl-high,
                 75 'Time           :'(042), sy-uzeit.
        endif.
      else.
        write: /75  'Time           :'(042), sy-uzeit.
      endif.
      if not s_plans[] is initial.
        if s_plans-high is initial.
          write: /2 'Position Id     :'(019), s_plans-low,
                 75 'User           :'(043), sy-uname.
        else.
          write: /2 'Position Id From:'(021), s_plans-low,
                              'To'(022), s_plans-high,
                 75 'User           :'(043), sy-uname.
        endif.
      else.
        write: /75 'User           :'(043), sy-uname.
      endif.
      write: /75 'Page No        :'(044), sy-pagno.
      skip.
      write /1(108) sy-uline.
      format color col_heading.
      write:/1 sy-vline,
            12 sy-vline, 53 sy-vline,
            64 sy-vline, 65(32)  'Actual'(018) centered,
            97 sy-vline,108 sy-vline.
      write:/1 sy-vline,  2(10) 'CostCenter'(014),
            12 sy-vline, 13(40) 'Description'(026) centered,
            53 sy-vline, 54(10) 'Approved'(025) centered,
            64 sy-vline, 65(32)  sy-uline,
            97 sy-vline, 98(10) 'Vacancies'(017),
           108 sy-vline.
      write:/1 sy-vline,
            12 sy-vline, 53 sy-vline,
            64 sy-vline, 65(10) 'National'(015) centered,
            75 sy-vline, 76(10) 'Expatriate'(020) centered,
            86 sy-vline, 87(10) 'Total'(016) centered,
            97 sy-vline,108 sy-vline.
      format color off.
      write /1(108) sy-uline.
    endform.               "top_of_page
    *&      Form  Display_report
    Write the Report Output
    form display_report.
      if rep2_tab[] is initial.
        message i999 with
        'No Data found for the entered Selection'(035).
      else.
        loop at rep2_tab.
    Authorization Check for the Orgn and Cost Centers
          perform auth_check_org.
          if sy-subrc = 0.
            clear cskt.
            select single ltext into cskt-ltext from cskt
                where spras = sy-langu and
                      kokrs = c_kokrs and
                      kostl = rep2_tab-kostl.
            format color col_normal.
            write: /1 sy-vline, 2(10) rep2_tab-kostl+7(3),
                   12 sy-vline, 13(40) cskt-ltext,
                   53 sy-vline, 54(10) rep2_tab-app_no,
                   64 sy-vline, 65(10) rep2_tab-nat_no,
                   75 sy-vline, 76(10) rep2_tab-exp_no,
                   86 sy-vline, 87(10) rep2_tab-tot_no,
                   97 sy-vline, 98(10) rep2_tab-vac_no,
                  108 sy-vline.
            format color off.
            at last.
              sum.
              format color 3.
              write /1(108) sy-uline.
              write: /1 sy-vline, 2(10) 'Total'(027),
                     12 sy-vline,
                     53 sy-vline, 54(10) rep2_tab-app_no,
                     64 sy-vline, 65(10) rep2_tab-nat_no,
                     75 sy-vline, 76(10) rep2_tab-exp_no,
                     86 sy-vline, 87(10) rep2_tab-tot_no,
                     97 sy-vline, 98(10) rep2_tab-vac_no,
                    108 sy-vline.
              format color off.
            endat.
          endif.
        endloop.
      endif.
      write /1(108) sy-uline.
    endform.                    " Display_report
    *&      Form  auth_check_org
    Authorization Check for the Orgn and Cost Center
    form auth_check_org.
      authority-check object 'ZNDCHROM'
            id 'PLVAR' dummy
            id 'OTYPE' dummy
            id 'KOSTL' field rep2_tab-kostl.
    endform.                  "auth_check_org
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Send some sample program for ALV reports

    Hi all ,
    send some sample program for ALV reports for learing purpose
    tahnks.

    Hi ,
    Resource Master
    Program                     YPPCRR                  *
    Program type                Report Program                     *
    Title                       Resource Master Dara for Updation  *
    Author                      Naga Raju                          *
    Requested By                Balaji                             *
    Date Written                24.05.2007                         *
    Specification Id            F2-DP-FS-2-0002                    *
    Transport Request                                              *
    On-line Documentation
    Description
    This Program updates the Location Mater through the Transaction
    /SAPAPO/LOC3 Based on the User Selection
    Update
    Reset
    No Action
    Output
    ALV List output of the main Program
    ALV List output of the Error Log
    REPORT  YPPCRR NO STANDARD PAGE HEADING
                   LINE-SIZE 120
                   LINE-COUNT 62(4)
                   MESSAGE-ID yap..
    Global data
    Include where all the data declarations are coded.
      INCLUDE YPPCRR_data.
    *Initialization
    INITIALIZATION.
    perform init_variant.
    Constants
    CONSTANTS: c_formname_top_of_page TYPE slis_formname
    VALUE 'F_TOP_OF_PAGE'.
    Selection-Screen
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-040.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:p_prs RADIOBUTTON GROUP ztyp USER-COMMAND ucom DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 3(28) text-003.
    position 40.
    parameters: p_file1 TYPE rlgrap-filename.
    SELECTION-SCREEN END OF LINE.
    skip 5.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: p_aps RADIOBUTTON GROUP ztyp.
    SELECTION-SCREEN COMMENT 3(28) text-004.
    position 40.
    parameters: p_file2 type rlgrap-filename.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
       EXPORTING
         program_name        = syst-repid
      DYNPRO_NUMBER       = SYST-DYNNR
         field_name          = p_file1
      STATIC              = ' '
      MASK                = ' '
        CHANGING
          file_name           = p_file1
    EXCEPTIONS
      MASK_TOO_LONG       = 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.
    START-OF-SELECTION.
    if p_prs = 'X'.
         PERFORM f_read_datum1 TABLES t_res_head
                          USING p_file1
                          CHANGING w_subrc.
      elseif p_aps = 'X'.
         PERFORM f_read_datum2 TABLES t_res_head
                          USING p_file2
                          CHANGING w_subrc.
    endif.
    IF w_subrc = 0.
    Validations
    PERFORM VALIDATION.
    PERFORM display_alv.
    IF SY-UCOMM = '&F03'
    or SY-UCOMM = '&F12'
    or SY-UCOMM = '&F15'.
    LEAVE LIST-PROCESSING.
    ELSE.
    ENDIF.
    ELSE.
    Message s100 with text-002.
    ENDIF.
    END-OF-SELECTION.
    Forms part*
    INCLUDE YPPCRR_forms.
    *&  Include           YPPCRR_DATA
    Type-Pools
      TYPE-POOLS: slis.
    *TYPES
    DATA:  BEGIN OF tl_res_head.
            INCLUDE STRUCTURE ypp_res_head.
    DATA:  END OF tl_res_head.
    DATA:  BEGIN OF tl_res_head_val.
            INCLUDE STRUCTURE ypp_resv.
    DATA:  END OF tl_res_head_val.
    DATA : BEGIN OF ty_errlog ,
             counter type i,
             type(2) ,
             name(10) TYPE c,
             vrsioid(22) TYPE c,
             restype TYPE c,
             message(80) TYPE c,
           END OF ty_errlog.
    Global Variables
    DATA : gc_flag(1) TYPE c,
           w_val_err_flag(1) type c.
    DATA: w_filename TYPE rlgrap-filename,
          w_subrc TYPE sy-subrc,
          w_t_res_head TYPE slis_t_fieldcat_alv,
          wa_t_res_head TYPE slis_fieldcat_alv.
    DATA :  wa_date(10) TYPE c,
            wa_time(10) TYPE c,
           wa_title(40) TYPE c,
           wa_type(4) TYPE c  .
    DATA: BAPI_RUN_YES_NO TYPE C.
    *Structure
    *INTERNAL TABLES USED BY ALV
    DATA:
    it_fieldcat_alv  TYPE slis_t_fieldcat_alv,
    IT_FIELDCAT_ALV_ERR  TYPE SLIS_T_FIELDCAT_ALV,
    it_status TYPE slis_formname VALUE 'F_MAIN',
    it_user_command TYPE slis_formname VALUE 'F_USER_COMMAND',
    it_events        TYPE slis_t_event,
    it_event_exit    TYPE slis_t_event_exit,
    it_list_comments TYPE slis_t_listheader,
    it_excluding     TYPE slis_t_extab,
    it_sort          TYPE slis_t_sortinfo_alv.
    *Internal Table Declarations
    DATA : BEGIN OF t_imex OCCURS 0 ,
                    string(256) TYPE c,
           END OF t_imex.
    DATA : fcode TYPE TABLE OF sy-ucomm.
    DATA : fcode_bdc TYPE TABLE OF sy-ucomm.
    DATA : fcode_error TYPE TABLE OF sy-ucomm.
    DATA : fcode_final TYPE TABLE OF sy-ucomm.
    STRUCTURE and WORKARES
    *Internal Table Declarations
    DATA : t_res_head  like  tl_res_head occurs 0 WITH HEADER LINE.
    DATA : t_res_head_val like tl_res_head_val occurs 0 with header line.
    data :l_res_head LIKE LINE OF t_res_head.
    DATA : w_file TYPE string.
    *DATA : wa_vrsioid(22) type c,
          wa_locno(20) type c,
          wa_calendar(2) type c,
          wa_planner(3) type c.
    DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA: RESOURCE_HEAD LIKE BAPI10004RESHEAD OCCURS 0 WITH HEADER LINE,
          RESOURCE_HEAD_X LIKE BAPI10004RESHEADX OCCURS 0 WITH HEADER LINE,
          RESOURCE_TEXT LIKE BAPI10004RESTEXT OCCURS 0 WITH HEADER LINE,
          RESOURCE_TEXT_X LIKE BAPI10004RESTEXTX OCCURS 0 WITH HEADER LINE.
    data : t_errlog like ty_errlog occurs 0 with header line.
    DATA : wk_lines TYPE i,
           wk_errlines TYPE i,
           wk_count TYPE i.
    DATA:   g_tabname TYPE slis_tabname VALUE 'T_RES_HEAD'.
    Variables to be used by ALV
    DATA:
      wk_variant          LIKE disvariant,
      wx_variant         LIKE disvariant,
      wk_variant_save(1)  TYPE c,
      wk_exit(1)          TYPE c,
      wk_repid            LIKE sy-repid,
      wk_user_specific(1) TYPE c,
      wk_callback_ucomm   TYPE slis_formname,
      wk_callback_status   TYPE slis_formname,
    wk_callback_status1  TYPE slis_formname,
      wk_print            TYPE slis_print_alv,
      wk_layout           TYPE slis_layout_alv,
      wk_html_top_of_page TYPE  slis_formname,
      wk_fieldcat_alv     LIKE LINE OF it_fieldcat_alv,
      wk_excluding        LIKE LINE OF it_excluding,
      wk_events           LIKE LINE OF it_events,
      wk_event_exit       LIKE LINE OF it_event_exit,
      wk_list_comments    LIKE LINE OF it_list_comments,
      wk_list1_comments    LIKE LINE OF it_list_comments,
      wk_list2_comments    LIKE LINE OF it_list_comments,
      wk_sort             LIKE LINE OF it_sort.
    *DATA :gc_delete_flag(1).
    *&  Include           YAPOLOC_FORMS
    FORM display_alv .
      PERFORM f_fieldcat_build.
      PERFORM f_event_build.
      PERFORM f_exclude_build.
      PERFORM f_print_build.
      PERFORM f_layout_build.
      PERFORM f_display_data.
    ENDFORM.                    " display_alv
    *&      Form  f_fieldcat_build
          text
    FORM f_fieldcat_build .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name   = wk_repid
          i_structure_name = 'YPP_RESV'
          i_inclname       = wk_repid
        CHANGING
          ct_fieldcat      = it_fieldcat_alv.
    ENDFORM.                    " F_FIELDCAT_BUILD
    *&      Form  F_EVENT_BUILD
          text
    >  p1        text*  <  p2        text
    FORM f_event_build .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = it_events.
      READ TABLE it_events WITH KEY
      name = slis_ev_top_of_page INTO wk_events.
      IF sy-subrc = 0.
        MOVE c_formname_top_of_page TO wk_events-form.
        MODIFY it_events FROM wk_events INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " F_EVENT_BUILD
    *&      Form  F_EXCLUDE_BUILD
          text
    -->  p1        text
    <--  p2        text
    FORM f_exclude_build .
      wk_excluding = '&GRAPH'. "Graphic
      APPEND wk_excluding TO it_excluding.
    ENDFORM.                    " F_EXCLUDE_BUILD
    *&      Form  F_PRINT_BUILD
          text
    -->  p1        text
    <--  p2        text
    FORM f_print_build .
      wk_print-no_print_listinfos = 'X'.
    ENDFORM.                    " F_PRINT_BUILD
    *&      Form  F_LAYOUT_BUILD
          text
    -->  p1        text
    <--  p2        text
    FORM f_layout_build .
      wk_layout-zebra                = 'X'.
    WK_LAYOUT-COLWIDTH_OPTIMIZE    = 'X'.
      wk_layout-detail_popup         = 'X'.
      wk_layout-detail_initial_lines = 'X'.
      wk_layout-detail_titlebar      = 'Details '.
    ENDFORM.                    " F_LAYOUT_BUILD
    *&      Form  F_DISPLAY_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM f_display_data .
      wk_callback_ucomm = 'CALLBACK_UCOMM'.
      IF sy-ucomm = 'UPD' OR sy-ucomm = space .
        wk_callback_status   = 'CALLBACK_STATUS'.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_background_id             = 'SIWB_WALLPAPER'
          i_callback_program          = wk_repid
         i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
          i_callback_pf_status_set    = wk_callback_status
          i_callback_user_command     = wk_callback_ucomm
          it_sort                     = it_sort
          i_default                   = 'X'
          i_save                      = 'A'
          is_variant                  = wk_variant
          is_layout                   = wk_layout
          it_fieldcat                 = it_fieldcat_alv
          it_events                   = it_events
          it_event_exit               = it_event_exit
          it_excluding                = it_excluding
          is_print                    = wk_print
        TABLES
          t_outtab                    = t_res_head_val.
    ENDFORM.                    " F_DISPLAY_DATA
    ALV for Error Log
    *&      Form  display_alv_ERR
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv_err .
      PERFORM f_fieldcat_build_err.
      PERFORM f_event_build_err.
      PERFORM f_exclude_build_err.
      PERFORM f_print_build_err.
      PERFORM f_layout_build_err.
      PERFORM f_display_data_err.
    ENDFORM.                    " display_alv_ERR
    *&      Form  F_FIELDCAT_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_fieldcat_build_err .
    BREAK-POINT.
      REFRESH it_fieldcat_alv.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name     = wk_repid
          i_internal_tabname = 'TY_ERRLOG'
      i_structure_name = 'YPP_ERR_LOG'
          i_inclname         = wk_repid
        CHANGING
          ct_fieldcat        = it_fieldcat_alv_err.
      LOOP AT it_fieldcat_alv INTO wk_fieldcat_alv.
        CASE wk_fieldcat_alv-fieldname.
          WHEN 'COUNTER'.
            wk_fieldcat_alv-seltext_s = text-023.
            wk_fieldcat_alv-seltext_m = text-023.
            wk_fieldcat_alv-seltext_l = text-023.
            wk_fieldcat_alv-reptext_ddic = text-023.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'TYPE'.
            wk_fieldcat_alv-seltext_s = text-009.
            wk_fieldcat_alv-seltext_m = text-009.
            wk_fieldcat_alv-seltext_l = text-009.
            wk_fieldcat_alv-reptext_ddic = text-009.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'NAME'.
            wk_fieldcat_alv-seltext_s = text-010.
            wk_fieldcat_alv-seltext_m = text-010.
            wk_fieldcat_alv-seltext_l = text-010.
            wk_fieldcat_alv-reptext_ddic = text-010.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'VRSIOID'.
            wk_fieldcat_alv-seltext_s = text-011.
            wk_fieldcat_alv-seltext_m = text-011.
            wk_fieldcat_alv-seltext_l = text-011.
            wk_fieldcat_alv-reptext_ddic = text-011.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'RESTYPE'.
            wk_fieldcat_alv-seltext_s = text-012.
            wk_fieldcat_alv-seltext_m = text-012.
            wk_fieldcat_alv-seltext_l = text-012.
            wk_fieldcat_alv-reptext_ddic = text-012.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN 'MESSAGE'.
            wk_fieldcat_alv-seltext_s = text-013.
            wk_fieldcat_alv-seltext_m = text-013.
            wk_fieldcat_alv-seltext_l = text-013.
            wk_fieldcat_alv-reptext_ddic = text-013.
            wk_fieldcat_alv-edit         = 'X'.
          WHEN OTHERS.
        ENDCASE.
        MODIFY it_fieldcat_alv FROM wk_fieldcat_alv.
      ENDLOOP.
    ENDFORM.                    " F_FIELDCAT_BUILD_err
    *&      Form  F_EVENT_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_event_build_err .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = it_events.
      READ TABLE it_events WITH KEY name = slis_ev_top_of_page
                                   INTO wk_events.
      IF sy-subrc = 0.
        MOVE c_formname_top_of_page TO wk_events-form.
        MODIFY it_events FROM wk_events INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " F_EVENT_BUILD_err
    *&      Form  F_EXCLUDE_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_exclude_build_err .
      wk_excluding = '&GRAPH'. "Graphic
      APPEND wk_excluding TO it_excluding.
    ENDFORM.                    " F_EXCLUDE_BUILD_err
    *&      Form  F_PRINT_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_print_build_err .
      wk_print-no_print_listinfos = 'X'.
    ENDFORM.                    " F_PRINT_BUILD_err
    *&      Form  F_LAYOUT_BUILD_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_layout_build_err .
      wk_layout-zebra                = 'X'.
    WK_LAYOUT-COLWIDTH_OPTIMIZE    = 'X'.
      wk_layout-detail_popup         = 'X'.
      wk_layout-detail_initial_lines = 'X'.
      wk_layout-detail_titlebar      = 'Details '.
    ENDFORM.                    " F_LAYOUT_BUILD_err
    *&      Form  F_DISPLAY_DATA_err
          text
    -->  p1        text
    <--  p2        text
    FORM f_display_data_err .
      wk_callback_ucomm = 'CALLBACK_UCOMM'.
    IF SY-UCOMM ne '&F03'.
      wk_callback_status = 'CALLBACK_STATUS'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_background_id          = 'SIWB_WALLPAPER'
          i_callback_program       = wk_repid
          i_callback_pf_status_set = wk_callback_status
          i_callback_user_command  = wk_callback_ucomm
          it_sort                  = it_sort
          i_default                = 'X'
          i_save                   = 'A'
          is_variant               = wk_variant
          is_layout                = wk_layout
          it_fieldcat              = it_fieldcat_alv_err
          it_events                = it_events
          it_event_exit            = it_event_exit
          it_excluding             = it_excluding
          is_print                 = wk_print
        TABLES
          t_outtab                 = t_errlog.
        KEEP EERRLOG BUTTON
      SET PF-STATUS 'ZSTANDARD' EXCLUDING 'UPD' IMMEDIATELY.
    ENDFORM.                    "f_display_data_err
    **&      Form  F_TOP_OF_PAGE
          text
    FORM f_top_of_page.
      CLEAR: it_list_comments[],
             wk_list_comments,
             wk_list1_comments,
             wk_list2_comments.
      wk_list_comments-typ  = 'H'. "H=Header,S=Selection, A=Action
      wk_list_comments-key  = ''.
      CASE sy-ucomm.
        WHEN ''.
          wk_list_comments-info = text-030.
        WHEN 'UPD'.
          IF t_errlog[] IS INITIAL.
            wk_list_comments-info = text-031.
          ELSE.
            wk_list_comments-info = text-032.
          ENDIF.
        WHEN 'ERRLOG'.
          wk_list_comments-info = text-032.
        WHEN '&F03'.
          wk_list_comments-info = text-031.
        WHEN '&F15'.
          wk_list_comments-info = text-031.
        WHEN '&F12'.
          wk_list_comments-info = text-031.
      ENDCASE.
      APPEND wk_list_comments TO it_list_comments.
      WRITE sy-datum TO wa_date.
      WRITE sy-uzeit TO wa_time.
      wk_list_comments-typ  = 'S'. "H=Header, S=Selection, A=Action
      wk_list_comments-key  = ''.
      wk_list_comments-info = 'User:'.
      wk_list1_comments-info = sy-uname.
      CONCATENATE wk_list_comments wk_list1_comments
      INTO wk_list2_comments.
      APPEND wk_list2_comments TO it_list_comments.
      wk_list_comments-typ  = 'S'. "H=Header, S=Selection, A=Action
      wk_list_comments-key  = ''.
      wk_list_comments-info = '                   Run Date : '.
      wk_list1_comments-info = wa_date.
      CONCATENATE wk_list_comments wk_list1_comments
      INTO wk_list2_comments .
      APPEND wk_list2_comments TO it_list_comments.
      wk_list_comments-typ  = 'S'. "H=Header, S=Selection, A=Action
      wk_list_comments-key  = ''.
      wk_list_comments-info = 'Run Time : '.
      wk_list1_comments-info = wa_time.
      CONCATENATE wk_list_comments wk_list1_comments
      INTO wk_list2_comments .
      APPEND wk_list2_comments TO it_list_comments.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
         I_LOGO             = 'ENJOYSAP_LOGO'
          it_list_commentary =  it_list_comments.
    ENDFORM.                    "F_TOP_OF_PAGE
          FORM USER_COMMAND_SAMPLE                                  *
    -->  UCOMM                                                     *
    -->  SELFIELD                                                  *
    FORM callback_ucomm USING ucomm LIKE sy-ucomm
                         selfield TYPE slis_selfield.
      DATA: v_langu(2) ,
             v_loctype TYPE  /sapapo/c_loctype.
      data err_flg(1).
      IF  bapi_run_yes_no IS INITIAL.
        CASE sy-ucomm.
          WHEN 'UPD'.
            bapi_run_yes_no = 'X'.
            LOOP AT t_res_head_val  WHERE val_err_msg  EQ space.
              v_langu = 'EN'.
               refresh tables
              REFRESH : resource_head ,
                        resource_head_x ,
                        resource_text ,
                        resource_text_x,
                        t_return.
              CLEAR   : resource_head ,
                        resource_head_x ,
                        resource_text ,
                        resource_text_x,
                        t_return .
              resource_head-resource   = t_res_head-name .
              resource_head-restype    = t_res_head-restype.
              resource_head-location   = t_res_head-locno.
              CLEAR : v_loctype .
              SELECT SINGLE loctype  FROM  /sapapo/loc CLIENT SPECIFIED
                     INTO v_loctype
                     WHERE  mandt    = sy-mandt
                     AND    locno    = t_res_head-locno.
              resource_head-loctype  = v_loctype.
              resource_head-calendar   = t_res_head-calendar.
              resource_head-type       = t_res_head-type.
              IF t_res_head-type = '03'.
                resource_head-dimension_bucket = t_res_head-dimension_bucket.
              ELSE.
                resource_head-dimension_bucket = space.
              ENDIF.
              APPEND resource_head.
              CLEAR  resource_head.
              resource_head_x-resource = t_res_head-name.
              resource_head_x-restype  = 'X'.
              resource_head_x-location = 'X'.
              resource_head_x-loctype  = 'X'.
              resource_head_x-calendar = 'X'.
              resource_head_x-type     = 'X'.
              IF t_res_head-type = '03'.
                resource_head_x-dimension_bucket = 'X'.
              ELSE.
                resource_head_x-dimension_bucket = space.
              ENDIF.
              APPEND resource_head_x.
              CLEAR  resource_head_x.
              resource_text-resource = t_res_head-name.
              resource_text-langu    = v_langu.
              resource_text-res_short_text = t_res_head-text.
              APPEND resource_text.
              CLEAR  resource_text.
              resource_text_x-resource = t_res_head-name.
              resource_text_x-langu    = v_langu.
              resource_text_x-res_short_text = 'X'.
              APPEND resource_text_x.
              CLEAR  resource_text_x.
               call bapi
              CALL FUNCTION 'BAPI_RSSRVAPS_SAVEMULTI_30A'
                EXPORTING
                  logical_system                      = 'AD2CLNT200'
                 business_system_group               =  'BSG001'
                 commit_control                      = 'E'
               NO_CREATE                           = ' '
               TABLES
                 resource_head                       =  resource_head
                 resource_head_x                     =  resource_head_x
                 resource_text                       =  resource_text
                 resource_text_x                     =  resource_text_x
                 return                              =  t_return.
              IF sy-subrc = 0.
                LOOP AT t_return WHERE type = 'E'
                              OR type = 'A'.
                  MOVE t_res_head_val-counter TO t_errlog-counter.
                  MOVE t_res_head_val-type TO t_errlog-type.
                  MOVE t_res_head_val-name TO t_errlog-name.
                  MOVE t_res_head_val-vrsioid TO t_errlog-vrsioid.
                  MOVE t_res_head_val-restype TO t_errlog-restype.
                  MOVE t_return-message TO t_errlog-message.
                  APPEND t_errlog.
                  CLEAR t_errlog..
                ENDLOOP.
    IF not t_errlog[] is initial..
               IF sy-subrc = 0.
                ERROR POP UP
                  MESSAGE  text-007 type 'I'.
                ELSE.
                   err_flg = 'X'.
               SUCC POP UP
                 MESSAGE text-008 type 'I'.
                ENDIF.
              ELSE.                                             "NE 0
                LOOP AT t_return WHERE type = 'E'
                              OR type = 'A'.
                  MOVE t_res_head_val-counter TO t_errlog-counter.
                  MOVE t_res_head_val-type TO t_errlog-type.
                  MOVE t_res_head_val-name TO t_errlog-name.
                  MOVE t_res_head_val-vrsioid TO t_errlog-vrsioid.
                  MOVE t_res_head_val-restype TO t_errlog-restype.
                  MOVE t_return-message TO t_errlog-message.
                  APPEND t_errlog.
                  CLEAR t_errlog..
             ENDLOOP.
                IF sy-subrc = 0.
                ELSE.
                  MOVE t_res_head_val-counter TO t_errlog-counter.
                  MOVE t_res_head_val-type TO t_errlog-type.
                  MOVE t_res_head_val-name TO t_errlog-name.
                  MOVE t_res_head_val-vrsioid TO t_errlog-vrsioid.
                  MOVE t_res_head_val-restype TO t_errlog-restype.
                  MOVE 'Error in Creation' TO t_errlog-message.
                  APPEND t_errlog.
                  CLEAR t_errlog..
                ENDIF.
              ENDIF.
          ENDLOOP.
            gc_flag = 'X'.
            REFRESH fcode.
       if err_flg = 'X'.
                  MESSAGE text-008 type 'I'.
       endif.
        ENDCASE.
      ENDIF.
      IF NOT t_errlog[] IS INITIAL.
        wk_list_comments-info = text-032.
        APPEND wk_list_comments TO it_list_comments.
        APPEND 'UPD' TO fcode_error.
        APPEND 'ERRLOG' TO fcode_error.
        SET PF-STATUS 'ZSTANDARD' EXCLUDING fcode_error.
        PERFORM display_alv_err.
      ELSE.
      ENDIF.
    ENDFORM.                    "CALLBACK_UCOMM=
    *&      Form  CALLBACK_STATUS
          text
         -->RT_EXTAB   text
    FORM callback_status USING rt_extab TYPE slis_t_extab.
    IF  bapi_run_yes_no IS NOT INITIAL .
        IF t_errlog[] IS INITIAL.
          REFRESH fcode.
          APPEND 'UPD' TO fcode.
          APPEND 'ERRLOG' TO fcode.
            SET PF-STATUS 'ZSTANDARD' EXCLUDING 'ERRLOG'.
          SET PF-STATUS 'ZSTANDARD' EXCLUDING fcode IMMEDIATELY .
        ENDIF.
      ELSE.
        SET PF-STATUS 'ZSTANDARD' EXCLUDING 'ERRLOG' IMMEDIATELY .
      ENDIF.
    ENDFORM.                    "CALLBACK_STATUS
    *&      Form  CALLBACK_STATUS1
          text
         -->RT_EXTAB   text
    FORM callback_status1 USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD' EXCLUDING 'UPD'.
    ENDFORM. " CALLBACK_STATUS
    *&      Form  CALLBACK_STATUS2
          text
         -->RT_EXTAB   text
    FORM callback_status2 USING rt_extab TYPE slis_t_extab.
      REFRESH fcode_final.
      IF sy-ucomm NE '&F03'.
        APPEND 'UPD'  TO fcode_final.
        APPEND 'ERRLOG' TO fcode_final.
        SET PF-STATUS 'ZSTANDARD' EXCLUDING fcode_final.
      ELSE.
        SET PF-STATUS 'ZSTANDARD' EXCLUDING 'UPD'.
      ENDIF.
    ENDFORM.                    "CALLBACK_STATUS2
    *&      Form  callback_ucomm_E
          text
         -->UCOMM      text
         -->SELFIELD   text
    FORM callback_ucomm_e USING ucomm LIKE sy-ucomm
                         selfield TYPE slis_selfield.
      CASE sy-ucomm.
        WHEN 'ERRLOG' .
          PERFORM display_alv_err.
        WHEN '&F03'.
          SET PF-STATUS 'ZSTANDARD' EXCLUDING 'UPD' IMMEDIATELY .
          PERFORM display_alv .
      ENDCASE.
    ENDFORM.                    "CALLBACK_UCOMM=
    *&      Form  init_variant
          text
    -->  p1        text
    <--  p2        text
    FORM init_variant .
      CLEAR: wk_variant.
      wk_repid              = sy-repid.
      wk_variant-report     = wk_repid.
      wk_variant-username   = sy-uname.
      wk_variant_save       = 'A'. "All types
    ENDFORM.                    " init_variant
    *&      Form  f_read_datum1
          text
         -->P_T_RES_HEAD  text
         -->P_P_FILE1  text
         <--P_W_SUBRC  text
    FORM f_read_datum1  TABLES   p_t_res_head STRUCTURE ypp_res_head
                        USING    p_p_file1
                        CHANGING p_w_subrc.
      DATA : iexcel LIKE zexcel_read OCCURS 0 WITH HEADER LINE.
      CLEAR  p_w_subrc.
      CALL FUNCTION 'ZALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_p_file1
          i_begin_col             = 1
          i_begin_row             = 1
          i_end_col               = 62
          i_end_row               = 50000
        TABLES
          intern                  = iexcel
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        p_w_subrc = 0 .
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT iexcel WHERE row > 2.
        IF iexcel-col = '0001'.
          p_t_res_head-type = iexcel-value.
        ENDIF.
        IF iexcel-col = '0002'.
          p_t_res_head-name = iexcel-value.
        ENDIF.
        IF iexcel-col = '0003'.
          p_t_res_head-vrsioid = iexcel-value.
        ENDIF.
        IF iexcel-col = '0004'.
          p_t_res_head-restype = iexcel-value.
        ENDIF.
        IF iexcel-col = '0005'.
          p_t_res_head-locno = iexcel-value.
        ENDIF.
        IF iexcel-col = '0006'.
          p_t_res_head-tzone = iexcel-value.
        ENDIF.
        IF iexcel-col = '0007'.
          p_t_res_head-calendar = iexcel-value.
        ENDIF.
        IF iexcel-col = '0008'.
          p_t_res_head-planner = iexcel-value.
        ENDIF.
        IF iexcel-col = '0009'.
          p_t_res_h

  • Do we have a user exit to write some custom code at the R3 Logoff event

    Hi Colleagues,
    is it possible to have some custom code at the Log Off event. I mean when the user logs off from the R/3 system, do we have a user exit to write some custom code at that time?
    Thanks,
    Gaurav

    Hi Venkat,
    I suppose you are aware of the fact that for custom infotype, you need to create custom segment and custom message type. This process can be found at- **************** - Step-by-step guide to ALE and IDOCs
    You need to also know about the change pointer and job scheduling concept for the same. You can refer to this link- Resource Configuration Notes (Sun Identity Manager 8.1 Resources Reference)
    I hope studying these links will make you achieve your goal. All the best
    Tip- Try out each step that has been mentioned these links
    Regards,
    Ajinkya

Maybe you are looking for