Displaying Russian commented text in ABAP program

Hi Experts,
I have one program in which comments are in Russian and in one system those commented text is being displayed in Russian after after choosing Cyrillic from Character set of Customizing of local layout option while in an other system same commented texts are displayed as junk characters even after choosing Cyrillic from Character set of Customizing of local layout option.
Example :
In 1st system, russian commented text is displayed correctly as follow
DATA: YEAR_AFABG(4) TYPE N. " Год даты начала амортизации
while in 2nd system in which code comes from the 1st sytem, russian commented text is not displayed in russian and displayed as junk characters as follows -
DATA: YEAR_AFABG(4) TYPE N. " Ãîä äàòû íà÷àëà àìîðòèçàöèè
Can anybody help me on these ? Any help would be highly appreciated.
Thanks in advance,
Akash

try this.
data: report_pg type SY-REPID ,
      rpt_source type standard table of D022S .
REFRESH rpt_source .
move: <rpt name> to report_pg .
READ REPORT report_pg INTO rpt_source .
now do a search/find in rpt_source.
Regards
Raja

Similar Messages

  • How to display a HTML page using ABAP program.

    Hi all,
    I know that this is easy and possible too but I haven't worked on this kind yet. I need to display a screen/ABAP program like TCODE PPMDT, where an HTML page is to be displayed and on the click of the HTML links provided, I need to navigate to someother transaction codes.
    Cheers,
    Sam

    Hi,
    See this sample code
    REPORT ZTESTHTML .
    DATA: ok_code LIKE sy-ucomm,
          myurl(132).
    data: custom_container type ref to cl_gui_custom_container,
          myhtml type ref to CL_GUI_HTML_VIEWER,
          repid like sy-repid.
    DATA events TYPE cntl_simple_events.
    DATA wa_events TYPE  cntl_simple_event.
          CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS NC_Handler
                FOR EVENT NAVIGATE_COMPLETE OF CL_GUI_HTML_VIEWER
                IMPORTING URL.
    ENDCLASS.
          CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD NC_Handler.
        myurl = URL.
      ENDMETHOD.
    ENDCLASS.
    start-of-selection.
      set screen 100.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE OK_CODE.
        WHEN 'BACK'.
          CALL METHOD myhtml->go_back
               EXCEPTIONS cntl_error = 1.
          if sy-subrc ne 0.
          endif.
        WHEN 'FORW'.
          CALL METHOD myhtml->go_forward
               EXCEPTIONS cntl_error = 1.
          if sy-subrc ne 0.
          endif.
        WHEN 'STOP'.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'REFR'.
          CALL METHOD myhtml->SHOW_URL
               EXPORTING
                  URL = myurl
                  IN_PLACE = 'X'
                  FRAME = ''
               EXCEPTIONS
                  CNTL_ERROR = 1
                  CNHT_ERROR_NOT_ALLOWED = 2
                  CNHT_ERROR_PARAMETER = 3
                  DP_ERROR_GENERAL = 4.
        WHEN 'OTHERS'.
          CALL METHOD CL_GUI_CFW=>DISPATCH.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MENU'.
      if myhtml is initial.
        CREATE OBJECT custom_container
           EXPORTING
              CONTAINER_NAME = 'CONTAINER1'
           EXCEPTIONS
              CNTL_ERROR = 1
              CNTL_SYSTEM_ERROR = 2
              CREATE_ERROR = 3
              LIFETIME_ERROR = 4
              LIFETIME_DYNPRO_DYNPRO_LINK = 5.
        CREATE OBJECT myhtml
           EXPORTING
              PARENT = custom_container
           EXCEPTIONS
              CNTL_ERROR = 1
              CNTL_INSTALL_ERROR = 2
              DP_INSTALL_ERROR = 3
              DP_ERROR = 4.
        wa_events-eventid = CL_GUI_HTML_VIEWER=>M_ID_NAVIGATE_COMPLETE .
        wa_events-appl_event = 'X'.
        APPEND wa_events TO events.
        CALL METHOD myhtml->set_registered_events( events = events ).
        SET HANDLER lcl_event_receiver=>NC_Handler FOR myhtml.
        CALL METHOD cl_gui_cfw=>flush
             EXCEPTIONS cntl_system_error = 1
                        cntl_error        = 2.
      endif.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    Svetlin

  • Finding Hard coded Text in ABAP program

    Gurus,
    Is there any method to find out Hard coded TEXT in an abap Program? For Example
    write:/ TEXT-T01,
    'Hello World',TEXT-T02.
    In which i need to find out Hello world which is inside ''. I am not able to find with Search command.
    Can you Please guide me,
    Regards,
    Lijo Joseph
    Message was edited by: Lijo Joseph vazhappilly

    try this.
    data: report_pg type SY-REPID ,
          rpt_source type standard table of D022S .
    REFRESH rpt_source .
    move: <rpt name> to report_pg .
    READ REPORT report_pg INTO rpt_source .
    now do a search/find in rpt_source.
    Regards
    Raja

  • Download/Upload ABAP Programs, screens, texts, etc

    Hi Experts,
    Is there any standard program or any tool by which we can download/ upload ABAP programs, sapscripts, Screens, text-elements, Webdynpro for ABAP applications to a local file????
    The Download to local server option in SE38 just gives a text copy of program without any screens, text eleemnts, etc which is not as per my requirement.
    Points will be rewarded.
    Regards,
    Mansi.

    use This
    REPORT  ZDOWNLOAD.
    *& Report  ZDOWNLAOD
                     I N F O R M A T I O N                            *
    Module             :
    FUNCTIONAL         :
    Developer          :
    Functional Spec#   :
    Date Of Creation   :
    Transport Request# :
    Program NAME       :
    Transaction Code   :
    DEVELOPMENT CLASS  :
    DESCRIPTION        :
                     Change History
    FUNCTIONAL         :
    Developer          :
    Functional Spec#   :
    Date Of Change     :
    Transport Request# :
    Change DESCRIPTION :
    *======================================================================================================================
    Direct Download Enterprise version 1.3.1.
    THIS SOFTWARE IS FOR PERSONAL USE ONLY.
    THIS PROGRAM IS FREEWARE AND IS PROVIDED ON AN AS-IS BASIS WITHOUT WARRANTY OF ANY KIND.
    THE PROVIDER SPECIFICALLY DISCLAIMS ANY OTHER WARRANTY, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY
    OR FITNESS FOR A PARTICULAR PURPOSE.
    IN NO EVENT SHALL THE PROVIDER BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL OR INCIDENTAL DAMAGES, EVEN IF PROVIDER
    HAS BEEN ADVISED BY CLIENT OF THE POSSIBILITY OF SUCH POTENTIAL LOSS OR DAMAGE.
    CLIENT AGREES TO HOLD PROVIDER HARMLESS FROM AND AGAINST ANY AND ALL CLAIMS, LOSSES, LIABILITIES AND EXPENSES.  BY
    INSTALLING OR RUNNING THIS PROGRAM YOU ARE AGREEING TO THE TERMS AND CONDITONS STATED ABOVE.
    PROGRAM DESCRIPTION & USE
    Allows a user to download programs, Functions, DD definitions, etc to the presentation server.  This version searches
    recursively for nested includes and function modules, and allows you to download the resulting code as standard text
    or HTML web pages within a suitable directory structure.
    You can either search by object name, using wildcards if you wish, or a combination of Author and object name.  If
    you want all objects returned for a particular author then select the author name and choose the most suitable
    radiobutton.  All objects will be returned if the fields to the right hand side of the radiobutton are left completely
    blank.
    Compatible with R/3 Enterprise only, for older versions of SAP you will need Direct Download version 5.xx.
    This version removes the programming limitations imposed by developing across SAP releases 3 to 4.6.
    In order to be able to download files to the SAP server you must first set up a logical filepath within transaction
    'FILE', or use an existing one.  You must also create a external operating system command in SM69 called ZMKDIR. This
    will then be used to create any directories needed on the SAP server
    This program is intended to allow a person to keep a visual representation of a program for backup purposes only as
    has not been designed to allow programs to be uploaded to SAP systems.
    author          : E.G.Mellodew
    program cont
    SAP Tables
    TABLES: TRDIR, SEOCLASS, TFDIR, ENLFDIR, DD02L.
    Types
    text element structure
    TYPES: TTEXTTABLE LIKE TEXTPOOL.
    GUI titles
    TYPES: TGUITITLE LIKE D347T.
    Message classes
    TYPES: BEGIN OF TMESSAGE,
             ARBGB LIKE T100-ARBGB,
             STEXT LIKE T100A-STEXT,
             MSGNR LIKE T100-MSGNR,
             TEXT  LIKE T100-TEXT,
           END OF TMESSAGE.
    Screen flow.
    TYPES: BEGIN OF TSCREENFLOW,
             SCREEN LIKE D020S-DNUM,
             CODE LIKE D022S-LINE,
           END OF TSCREENFLOW.
    Holds a table\structure definition
    TYPES: BEGIN OF TDICTTABLESTRUCTURE,
             FIELDNAME LIKE DD03L-FIELDNAME,
             POSITION  LIKE DD03L-POSITION,
             KEYFLAG   LIKE DD03L-KEYFLAG,
             ROLLNAME  LIKE DD03L-ROLLNAME,
             DOMNAME   LIKE DD03L-DOMNAME,
             DATATYPE  LIKE DD03L-DATATYPE,
             LENG      LIKE DD03L-LENG,
             DDTEXT    LIKE DD04T-DDTEXT,
           END OF TDICTTABLESTRUCTURE.
    Holds a tables attributes + its definition
    TYPES: BEGIN OF TDICTTABLE,
             TABLENAME    LIKE DD03L-TABNAME,
             TABLETITLE   LIKE DD02T-DDTEXT,
             ISTRUCTURE TYPE TDICTTABLESTRUCTURE OCCURS 0,
           END OF TDICTTABLE.
    Include program names
    TYPES: BEGIN OF TINCLUDE,
             INCLUDENAME LIKE TRDIR-NAME,
             INCLUDETITLE LIKE TFTIT-STEXT,
           END OF TINCLUDE.
    Exception class texts
    TYPES: BEGIN OF TCONCEPT,
             CONSTNAME TYPE STRING,
             CONCEPT TYPE SOTR_CONC,
           END OF TCONCEPT.
    Method
    TYPES: BEGIN OF TMETHOD,
             CMPNAME LIKE VSEOMETHOD-CMPNAME,
             DESCRIPT LIKE VSEOMETHOD-DESCRIPT,
             EXPOSURE LIKE VSEOMETHOD-EXPOSURE,
             METHODKEY TYPE STRING,
           END OF TMETHOD.
    Class
    TYPES: BEGIN OF TCLASS,
             SCANNED(1),
             CLSNAME LIKE VSEOCLASS-CLSNAME,
             DESCRIPT LIKE VSEOCLASS-DESCRIPT,
             MSG_ID LIKE VSEOCLASS-MSG_ID,
             EXPOSURE LIKE VSEOCLASS-EXPOSURE,
             STATE LIKE VSEOCLASS-STATE,
             CLSFINAL LIKE VSEOCLASS-CLSFINAL,
             R3RELEASE LIKE VSEOCLASS-R3RELEASE,
             IMETHODS TYPE TMETHOD OCCURS 0,
             IDICTSTRUCT TYPE TDICTTABLE OCCURS 0,
             ITEXTELEMENTS TYPE TTEXTTABLE OCCURS 0,
             IMESSAGES TYPE TMESSAGE OCCURS 0,
             ICONCEPTS TYPE TCONCEPT OCCURS 0,
             TEXTELEMENTKEY TYPE STRING,
             PUBLICCLASSKEY TYPE STRING,
             PRIVATECLASSKEY TYPE STRING,
             PROTECTEDCLASSKEY TYPE STRING,
             TYPESCLASSKEY TYPE STRING,
             EXCEPTIONCLASS TYPE I,
           END OF TCLASS.
    function modules
    TYPES: BEGIN OF TFUNCTION,
             FUNCTIONNAME LIKE TFDIR-FUNCNAME,
             FUNCTIONGROUP LIKE ENLFDIR-AREA,
             INCLUDENUMBER LIKE TFDIR-INCLUDE,
             FUNCTIONMAININCLUDE LIKE TFDIR-FUNCNAME,
             FUNCTIONTITLE LIKE TFTIT-STEXT,
             TOPINCLUDENAME LIKE TFDIR-FUNCNAME,
             PROGNAME LIKE TFDIR-PNAME,
             PROGRAMLINKNAME LIKE TFDIR-PNAME,
             MESSAGECLASS LIKE T100-ARBGB,
             ITEXTELEMENTS TYPE TTEXTTABLE OCCURS 0,
             ISELECTIONTEXTS TYPE TTEXTTABLE OCCURS 0,
             IMESSAGES TYPE TMESSAGE OCCURS 0,
             IINCLUDES TYPE TINCLUDE OCCURS 0,
             IDICTSTRUCT TYPE TDICTTABLE OCCURS 0,
             IGUITITLE TYPE TGUITITLE OCCURS 0,
             ISCREENFLOW TYPE TSCREENFLOW OCCURS 0,
           END OF TFUNCTION.
    TYPES: BEGIN OF TPROGRAM,
             PROGNAME LIKE TRDIR-NAME,
             PROGRAMTITLE LIKE TFTIT-STEXT,
             SUBC LIKE TRDIR-SUBC,
             MESSAGECLASS LIKE T100-ARBGB,
             IMESSAGES TYPE TMESSAGE OCCURS 0,
             ITEXTELEMENTS TYPE TTEXTTABLE OCCURS 0,
             ISELECTIONTEXTS TYPE TTEXTTABLE OCCURS 0,
             IGUITITLE TYPE TGUITITLE OCCURS 0,
             ISCREENFLOW TYPE TSCREENFLOW OCCURS 0,
             IINCLUDES TYPE TINCLUDE OCCURS 0,
             IDICTSTRUCT TYPE TDICTTABLE OCCURS 0,
           END OF TPROGRAM.
    Internal tables
    Dictionary object
    DATA: IDICTIONARY TYPE STANDARD TABLE OF TDICTTABLE WITH HEADER LINE.
    Function modules.
    DATA: IFUNCTIONS TYPE STANDARD TABLE OF TFUNCTION WITH HEADER LINE.
    Tree display structure.
    DATA: ITREEDISPLAY TYPE STANDARD TABLE OF SNODETEXT WITH HEADER LINE.
    Message class data
    DATA: IMESSAGES TYPE STANDARD TABLE OF TMESSAGE WITH HEADER LINE.
    Holds a single message class an all of its messages
    DATA: ISINGLEMESSAGECLASS TYPE STANDARD TABLE OF TMESSAGE WITH HEADER LINE.
    Holds program related data
    DATA: IPROGRAMS TYPE STANDARD TABLE OF TPROGRAM WITH HEADER LINE.
    Classes
    DATA: ICLASSES TYPE STANDARD TABLE OF TCLASS WITH HEADER LINE.
    Table of paths created on the SAP server
    DATA: ISERVERPATHS TYPE STANDARD TABLE OF STRING WITH HEADER LINE.
    Table prototypes
    DATA: DUMIDICTSTRUCTURE TYPE STANDARD TABLE OF TDICTTABLESTRUCTURE.
    DATA: DUMITEXTTAB TYPE STANDARD TABLE OF TTEXTTABLE.
    DATA: DUMIINCLUDES TYPE STANDARD TABLE OF TINCLUDE.
    DATA: DUMIHTML TYPE STANDARD TABLE OF STRING.
    DATA: DUMIHEADER TYPE STANDARD TABLE OF STRING .
    DATA: DUMISCREEN TYPE STANDARD TABLE OF TSCREENFLOW .
    DATA: DUMIGUITITLE TYPE STANDARD TABLE OF TGUITITLE.
    DATA: DUMIMETHODS TYPE STANDARD TABLE OF TMETHOD.
    DATA: DUMICONCEPTS TYPE STANDARD TABLE OF TCONCEPT.
      Global objects
    DATA: OBJFILE TYPE REF TO CL_GUI_FRONTEND_SERVICES.
    DATA: OBJRUNTIMEERROR TYPE REF TO CX_ROOT.
    Constants
    CONSTANTS: VERSIONNO TYPE STRING VALUE '1.3.1'.
    CONSTANTS: TABLES TYPE STRING VALUE 'TABLES'.
    CONSTANTS: TABLE TYPE STRING VALUE 'TABLE'.
    CONSTANTS: LIKE TYPE STRING VALUE 'LIKE'.
    CONSTANTS: TYPE TYPE STRING VALUE 'TYPE'.
    CONSTANTS: TYPEREFTO TYPE STRING VALUE 'TYPE REF TO'.
    CONSTANTS: STRUCTURE TYPE STRING VALUE 'STRUCTURE'.
    CONSTANTS: LOWSTRUCTURE TYPE STRING VALUE 'structure'.
    CONSTANTS: OCCURS TYPE STRING VALUE 'OCCURS'.
    CONSTANTS: FUNCTION TYPE STRING VALUE 'FUNCTION'.
    CONSTANTS: CALLFUNCTION TYPE STRING VALUE ' CALL FUNCTION'.
    CONSTANTS: MESSAGE TYPE STRING  VALUE 'MESSAGE'.
    CONSTANTS: INCLUDE TYPE STRING VALUE 'INCLUDE'.
    CONSTANTS: LOWINCLUDE TYPE STRING VALUE 'include'.
    CONSTANTS: DESTINATION TYPE STRING VALUE 'DESTINATION'.
    CONSTANTS: IS_TABLE TYPE STRING VALUE 'T'.
    CONSTANTS: IS_PROGRAM TYPE STRING VALUE 'P'.
    CONSTANTS: IS_SCREEN TYPE STRING VALUE 'S'.
    CONSTANTS: IS_GUITITLE TYPE STRING VALUE 'G'.
    CONSTANTS: IS_DOCUMENTATION TYPE STRING VALUE 'D'.
    CONSTANTS: IS_MESSAGECLASS TYPE STRING VALUE 'MC'.
    CONSTANTS: IS_FUNCTION TYPE STRING VALUE 'F'.
    CONSTANTS: IS_CLASS TYPE STRING VALUE 'C'.
    CONSTANTS: IS_METHOD TYPE STRING VALUE 'M'.
    CONSTANTS: ASTERIX TYPE STRING VALUE '*'.
    CONSTANTS: COMMA TYPE STRING VALUE ','.
    CONSTANTS: PERIOD TYPE STRING VALUE '.'.
    CONSTANTS: DASH TYPE STRING VALUE '-'.
    CONSTANTS: TRUE TYPE I VALUE 1.
    CONSTANTS: FALSE TYPE I VALUE 0.
    CONSTANTS: LT TYPE STRING VALUE '&lt;'.
    CONSTANTS: GT TYPE STRING VALUE '&gt;'.
    CONSTANTS: UNIX TYPE STRING VALUE 'UNIX'.
    CONSTANTS: NON_UNIX TYPE STRING VALUE 'not UNIX'.
    CONSTANTS: BACKGROUND_COLOUR TYPE STRING VALUE '#FFFFE0'.
    CONSTANTS: COLOUR_WHITE TYPE STRING VALUE '#FFFFFF'.
    CONSTANTS: COLOUR_BLACK TYPE STRING VALUE '#000000'.
    CONSTANTS: COLOUR_YELLOW TYPE STRING VALUE '#FFFF00'.
    CONSTANTS: COMMENT_COLOUR TYPE STRING VALUE '#0000FF'.
    CONSTANTS: HTMLEXTENSION TYPE STRING VALUE 'html'.
    CONSTANTS: TEXTEXTENSION TYPE STRING VALUE 'txt'.
    Global variables
    DATA: STATUSBARMESSAGE(100).
    DATA: FORCEDEXIT TYPE I VALUE 0.
    DATA: STARTTIME LIKE SY-UZEIT.
    DATA: RUNTIME LIKE SY-UZEIT.
    DATA: DOWNLOADFILEEXTENSION TYPE STRING.
    DATA: DOWNLOADFOLDER TYPE STRING.
    DATA: SERVERSLASHSEPARATOR TYPE STRING.
    DATA: FRONTENDSLASHSEPARATOR TYPE STRING.
    DATA: SLASHSEPARATORTOUSE TYPE STRING.
    DATA: SERVERFILESYSTEM TYPE FILESYS_D.
    DATA: SERVERFOLDER TYPE STRING.
    DATA: FRONTENDOPSYSTEM TYPE STRING.
    DATA: SERVEROPSYSTEM TYPE STRING.
    DATA: CUSTOMERNAMESPACE TYPE STRING.
    RANGES: SOPROGRAMNAME FOR TRDIR-NAME.
    RANGES: SOAUTHOR FOR USR02-BNAME.
    RANGES: SOTABLENAMES FOR DD02L-TABNAME.
    RANGES: SOFUNCTIONNAME  FOR TFDIR-FUNCNAME.
    RANGES: SOCLASSNAME FOR VSEOCLASS-CLSNAME.
    RANGES: SOFUNCTIONGROUP FOR ENLFDIR-AREA.
    FIELD-SYMBOLS: <WADICTSTRUCT> TYPE TDICTTABLE.
    Selection screen declaration
    Author
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TBLOCK1.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(23) TAUTH.
    PARAMETERS: PAUTH LIKE USR02-BNAME MEMORY ID MAUTH.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(36) TPMOD.
    PARAMETERS: PMOD AS CHECKBOX.
    SELECTION-SCREEN END OF LINE.
    Local objects
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(36) T$TMP.
    PARAMETERS: P$TMP AS CHECKBOX DEFAULT ''.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TBLOCK2.
    Tables
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RTABLE RADIOBUTTON GROUP R1.
    SELECTION-SCREEN COMMENT 5(15) TRTABLE.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TPTABLE.
    SELECT-OPTIONS: SOTABLE FOR DD02L-TABNAME.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(79) TTNOTE.
    SELECTION-SCREEN END OF LINE.
    Message classes
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RMESS RADIOBUTTON GROUP R1.
    SELECTION-SCREEN COMMENT 5(18) TPMES.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(18) TMNAME.
    PARAMETERS: PMNAME LIKE T100-ARBGB MEMORY ID MMNAME.
    SELECTION-SCREEN END OF LINE.
    Function modules
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RFUNC RADIOBUTTON GROUP R1.
    SELECTION-SCREEN COMMENT 5(30) TRFUNC.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TPFNAME.
    SELECT-OPTIONS: SOFNAME FOR TFDIR-FUNCNAME.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TFGROUP.
    SELECT-OPTIONS: SOFGROUP FOR ENLFDIR-AREA.
    SELECTION-SCREEN END OF LINE.
    Classes
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RCLASS RADIOBUTTON GROUP R1.
    SELECTION-SCREEN COMMENT 5(30) TRCLASS.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TPCNAME.
    SELECT-OPTIONS: SOCLASS FOR SEOCLASS-CLSNAME.
    SELECTION-SCREEN END OF LINE.
    Programs / includes
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RPROG RADIOBUTTON GROUP R1 DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 5(18) TPROG.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TRPNAME.
    SELECT-OPTIONS: SOPROG FOR TRDIR-NAME.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    Language
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(18) TMLANG.
    PARAMETERS: PMLANG LIKE T100-SPRSL DEFAULT 'EN'.
    SELECTION-SCREEN END OF LINE.
    Package
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(18) TPACK.
    PARAMETERS: PPACK LIKE TADIV-DEVCLASS MEMORY ID MPACK.
    SELECTION-SCREEN END OF LINE.
    Customer objects
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(27) TCUST.
    PARAMETERS: PCUST AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 32(25) TNRANGE.
    PARAMETERS: PCNAME TYPE NAMESPACE MEMORY ID MNAMESPACE.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B2.
    Additional things to download.
    SELECTION-SCREEN: BEGIN OF BLOCK B3 WITH FRAME TITLE TBLOCK3.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPTEXT.
    PARAMETERS: PTEXT AS CHECKBOX DEFAULT 'X' MEMORY ID MTEXT.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TMESS.
    PARAMETERS: PMESS AS CHECKBOX DEFAULT 'X' MEMORY ID MMESS.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPINC.
    PARAMETERS: PINC AS CHECKBOX DEFAULT 'X' MEMORY ID MINC.
    SELECTION-SCREEN COMMENT 40(20) TRECC.
    PARAMETERS: PRECI AS CHECKBOX DEFAULT 'X' MEMORY ID MRECI.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPFUNC.
    PARAMETERS: PFUNC AS CHECKBOX DEFAULT 'X' MEMORY ID MFUNC.
    SELECTION-SCREEN COMMENT 40(20) TRECF.
    PARAMETERS: PRECF AS CHECKBOX DEFAULT 'X' MEMORY ID MRECF.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TDOC.
    PARAMETERS: PDOC AS CHECKBOX DEFAULT 'X' MEMORY ID MDOC.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPSCR.
    PARAMETERS: PSCR AS CHECKBOX DEFAULT 'X' MEMORY ID MSCR.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPDICT.
    PARAMETERS: PDICT AS CHECKBOX DEFAULT 'X' MEMORY ID MDICT.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TSORTT.
    PARAMETERS: PSORTT AS CHECKBOX DEFAULT ' ' MEMORY ID MSORTT.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B3.
    File details
    SELECTION-SCREEN: BEGIN OF BLOCK B4 WITH FRAME TITLE TBLOCK4.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TPHTML.
    PARAMETERS: PHTML RADIOBUTTON GROUP G1 DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) TCOMM.
    PARAMETERS: PCOMM AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) TBACK.
    PARAMETERS: PBACK AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TPTXT.
    PARAMETERS: PTXT RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    Download to SAP server
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(25) TSERV.
    PARAMETERS: PSERV RADIOBUTTON GROUP G2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 8(20) TSPATH.
    PARAMETERS: PLOGICAL LIKE FILENAME-FILEINTERN MEMORY ID MLOGICAL.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN COMMENT /28(60) TSDPATH.
    Download to PC
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(25) TPC.
    PARAMETERS: PPC RADIOBUTTON GROUP G2 DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 8(20) TPPATH.
    PARAMETERS: PFOLDER LIKE RLGRAP-FILENAME MEMORY ID MFOLDER.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B4.
    Display options
    SELECTION-SCREEN: BEGIN OF BLOCK B5 WITH FRAME TITLE TBLOCK5.
    Display final report
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TREP.
    PARAMETERS: PREP AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    Display progress messages
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(33) TPROMESS.
    PARAMETERS: PPROMESS AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B5.
    Display a directory picker window
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR PFOLDER.
      DATA: OBJFILE TYPE REF TO CL_GUI_FRONTEND_SERVICES.
      DATA: PICKEDFOLDER TYPE STRING.
      DATA: INITIALFOLDER TYPE STRING.
      IF SY-BATCH IS INITIAL.
        CREATE OBJECT OBJFILE.
        IF NOT PFOLDER IS INITIAL.
          INITIALFOLDER = PFOLDER.
        ELSE.
          OBJFILE->GET_TEMP_DIRECTORY( CHANGING TEMP_DIR = INITIALFOLDER
                                       EXCEPTIONS CNTL_ERROR = 1
                                                 ERROR_NO_GUI = 2
                                                 NOT_SUPPORTED_BY_GUI = 3 ).
        ENDIF.
        OBJFILE->DIRECTORY_BROWSE( EXPORTING INITIAL_FOLDER = INITIALFOLDER
                                   CHANGING SELECTED_FOLDER = PICKEDFOLDER
                                   EXCEPTIONS CNTL_ERROR = 1
                                              ERROR_NO_GUI = 2
                                              NOT_SUPPORTED_BY_GUI = 3 ).
        IF SY-SUBRC = 0.
          PFOLDER = PICKEDFOLDER.
        ELSE.
          WRITE: / 'An error has occured picking a folder'.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN.
      CASE 'X'.
        WHEN PPC.
          IF PFOLDER IS INITIAL.
          User must enter a path to save to
            MESSAGE E000(OO) WITH 'You must enter a file path'.
          ENDIF.
        WHEN PSERV.
          IF PLOGICAL IS INITIAL.
          User must enter a logical path to save to
            MESSAGE E000(OO) WITH 'You must enter a logical file name'.
          ENDIF.
      ENDCASE.
    AT SELECTION-SCREEN ON PLOGICAL.
      IF NOT PSERV IS INITIAL.
        CALL FUNCTION 'FILE_GET_NAME'
          EXPORTING
            LOGICAL_FILENAME = PLOGICAL
          IMPORTING
            FILE_NAME        = SERVERFOLDER
          EXCEPTIONS
            FILE_NOT_FOUND   = 1
            OTHERS           = 2.
        IF SY-SUBRC = 0.
          IF SERVERFOLDER IS INITIAL.
            MESSAGE E000(OO) WITH 'No file path returned from logical filename'.
          ELSE.
          Path to display on the selection screen
            TSDPATH = SERVERFOLDER.
          Remove the trailing slash off the path as the subroutine buildFilename will add an extra one
            SHIFT SERVERFOLDER RIGHT DELETING TRAILING SERVERSLASHSEPARATOR.
            SHIFT SERVERFOLDER LEFT DELETING LEADING SPACE.
          ENDIF.
        ELSE.
          MESSAGE E000(OO) WITH 'Logical filename does not exist'.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOPROG-LOW.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'PROG'
          OBJECT_NAME           = SOPROG-LOW
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOPROG-LOW
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOPROG-HIGH.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'PROG'
          OBJECT_NAME           = SOPROG-HIGH
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOPROG-HIGH
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOCLASS-LOW.
      CALL FUNCTION 'F4_DD_ALLTYPES'
        EXPORTING
          OBJECT               = SOCLASS-LOW
          SUPPRESS_SELECTION   = 'X'
          DISPLAY_ONLY         = ''
          ONLY_TYPES_FOR_CLIFS = 'X'
        IMPORTING
          RESULT               = SOCLASS-LOW.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOCLASS-HIGH.
      CALL FUNCTION 'F4_DD_ALLTYPES'
        EXPORTING
          OBJECT               = SOCLASS-HIGH
          SUPPRESS_SELECTION   = 'X'
          DISPLAY_ONLY         = ''
          ONLY_TYPES_FOR_CLIFS = 'X'
        IMPORTING
          RESULT               = SOCLASS-HIGH.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOFNAME-LOW.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'FUNC'
          OBJECT_NAME           = SOFNAME-LOW
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOFNAME-LOW
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOFNAME-HIGH.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'FUNC'
          OBJECT_NAME           = SOFNAME-HIGH
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOFNAME-HIGH
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOFGROUP-LOW.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'FUGR'
          OBJECT_NAME           = SOFGROUP-LOW
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOFGROUP-LOW
        EXCEPTIONS
          CANCEL                = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SOFGROUP-HIGH.
      CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
        EXPORTING
          OBJECT_TYPE           = 'FUGR'
          OBJECT_NAME           = SOFGROUP-HIGH
          SUPPRESS_SELECTION    = 'X'
          USE_ALV_GRID          = ''
          WITHOUT_PERSONAL_LIST = ''
        IMPORTING
          OBJECT_NAME_SELECTED  = SOFGROUP-HIGH
        EXCEPTIONS
          CANCEL                = 1.
    initialisation
    INITIALIZATION.
    Parameter screen texts.
      TBLOCK1 = 'Author (Optional)'.
      T$TMP   = 'Programs only: include local objects'.
      TBLOCK2 = 'Objects to download'.
      TBLOCK3 = 'Additional downloads for programs, function modules and classes'.
      TBLOCK4 = 'Download parameters'.
      TBLOCK5 = 'Display options'.
      TAUTH   = 'Author name'.
      TPMOD   = 'Include programs modified by author'.
      TCUST   = 'Only customer objects'.
      TNRANGE = 'Alt customer name range'.
      TRTABLE = 'Tables / Structures'.
      TPTABLE = 'Table name'.
      TTNOTE  = 'Note: tables are stored under the username of the last person who modified them'.
      TRFUNC  = 'Function modules'.
      TPFNAME = 'Function name'.
      TFGROUP = 'Function group'.
      TRCLASS  = 'Classes'.
      TPCNAME = 'Class name'.
      TMESS   = 'Message class'.
      TMNAME  = 'Class name'.
      TMLANG  = 'Language'.
      TPROG   = 'Programs'.
      TRPNAME = 'Program name'.
      TPACK   = 'Package'.
      TPTXT   = 'Text document'.
      TPHTML  = 'HTML document'.
      TCOMM   = 'Highlight comments'.
      TBACK   = 'Include background colour'.
      TPTEXT  = 'Text elements'.
      TPINC   = 'Include programs'.
      TRECC   = 'Recursive search'.
      TPPATH  = 'File path'.
      TSPATH  = 'Logical file name'.
      TPMES   = 'Message classes'.
      TPFUNC  = 'Function modules'.
      TDOC    = 'Function module documentation'.
      TRECF   = 'Recursive search'.
      TPSCR   = 'Screens'.
      TPDICT  = 'Dictionary structures'.
      TSORTT  = 'Sort table fields alphabetically'.
      TSERV   = 'Download to server'.
      TPC     = 'Download to PC'.
      TREP    = 'Display download report'.
      TPROMESS  = 'Display progress messages'.
    Determine the frontend operating system type.
      IF SY-BATCH IS INITIAL.
        PERFORM DETERMINEFRONTENDOPSYSTEM USING FRONTENDSLASHSEPARATOR FRONTENDOPSYSTEM.
      ENDIF.
      PERFORM DETERMINESERVEROPSYSTEM USING SERVERSLASHSEPARATOR SERVERFILESYSTEM SERVEROPSYSTEM.
    Determine if the external command exists.  If it doesn't then disable the server input field
      PERFORM FINDEXTERNALCOMMAND.
    start-of-selection.
    START-OF-SELECTION.
      PERFORM CHECKCOMBOBOXES.
      PERFORM FILLSELECTIONRANGES.
      STARTTIME = SY-UZEIT.
    Don't display status messages if we are running in the background
      IF NOT SY-BATCH IS INITIAL.
        PPROMESS = ''.
      ENDIF.
    Fool the HTML routines to stop them hyperlinking anything with a space in them
      IF PCNAME IS INITIAL.
        CUSTOMERNAMESPACE  = '^'.
      ELSE.
        CUSTOMERNAMESPACE = PCNAME.
      ENDIF.
    Determine which operating slash and download directory to use
      CASE 'X'.
        WHEN PPC.
          SLASHSEPARATORTOUSE = FRONTENDSLASHSEPARATOR.
          DOWNLOADFOLDER = PFOLDER.
        WHEN PSERV.
          SLASHSEPARATORTOUSE = SERVERSLASHSEPARATOR.
          DOWNLOADFOLDER = SERVERFOLDER.
      ENDCASE.
    Main program flow.
      CASE 'X'.
      Select tables
        WHEN RTABLE.
          PERFORM RETRIEVETABLES USING IDICTIONARY[]
                                       SOTABLENAMES[]
                                       SOAUTHOR[].
      Select message classes tables
        WHEN RMESS.
          PERFORM RETRIEVEMESSAGECLASS USING IMESSAGES[]
                                             SOAUTHOR[]      "Author
                                             PMNAME          "Message class name
                                             PMLANG          "Message class language
                                             PMOD.           "Modified by author
      Select function modules
        WHEN RFUNC.
          PERFORM RETRIEVEFUNCTIONS USING SOFUNCTIONNAME[]   "Function name
                                          SOFUNCTIONGROUP[]  "Function group
                                          IFUNCTIONS[]       "Found functions
                                          SOAUTHOR[]         "Author
                                          PTEXT              "Get text elements
                                          PSCR               "Get screens
                                          PCUST              "Customer data only
                                          CUSTOMERNAMESPACE. "Customer name range
          LOOP AT IFUNCTIONS.
          Find Dict structures, messages, functions, includes etc.
            PERFORM SCANFORADDITIONALFUNCSTUFF USING IFUNCTIONS[]
                                                     PRECI                   "Search for includes recursively
                                                     PRECF                   "Search for functions recursively
                                                     PINC                    "Search for includes
                                                     PFUNC                   "Search for functions
                                                     PDICT                   "search for dictionary objects
                                                     PMESS                   "Search for messages
                                                     PCUST                   "Customer data only
                                                     CUSTOMERNAMESPACE.      "Customer name range
          ENDLOOP.
      Select Classes
        WHEN RCLASS.
          PERFORM RETRIEVECLASSES USING ICLASSES[]
                                        IFUNCTIONS[]
                                        SOCLASSNAME[]       "Class name
                                        SOAUTHOR[]          "Author
                                        CUSTOMERNAMESPACE   "Customer name range
                                        PMOD                "Also modified by author
                                        PCUST               "Customer object only
                                        PMESS               "Find messages
                                        PTEXT               "Text Elements
                                        PDICT               "Dictionary structures
                                        PFUNC               "Get functions
                                        PINC                "Get includes
                                        PRECF               "Search recursively for functions
                                        PRECI               "Search recursively for includes
                                        'X'                 "Search recursively for classes
                                        PMLANG.             "Language
          LOOP AT IFUNCTIONS.
          Find Dict structures, messages, functions, includes etc.
            PERFORM SCANFORADDITIONALFUNCSTUFF USING IFUNCTIONS[]
                                                     PRECI                   "Search for includes recursively
                                                     PRECF                   "Search for functions recursively
                                                     PINC                    "Search for includes
                                                     PFUNC                   "Search for functions
                                                     PDICT                   "search for dictionary objects
                                                     PMESS                   "Search for messages
                                                     PCUST                   "Customer data only
                                                     CUSTOMERNAMESPACE.      "Customer name range
          ENDLOOP.
      Select programs
        WHEN RPROG.
          PERFORM RETRIEVEPROGRAMS USING IPROGRAMS[]
                                         IFUNCTIONS[]
                                         SOPROGRAMNAME[]    "Program name
                                         SOAUTHOR[]         "Author
                                         CUSTOMERNAMESPACE  "Customer name range
                                         PMOD               "Also modified by author
                                         PCUST              "Customer object only
                                         PMESS              "Find messages
                                         PTEXT              "Text Elements
                                         PDICT              "Dictionay structures
                                         PFUNC              "Get functions
                                         PINC               "Get includes
                                         PSCR               "Get screens
                                         PRECF              "Search recursively for functions
                                         PRECI              "Search recursively for includes
                                         P$TMP              "local objects
                                         PPACK.             "Package
      ENDCASE.
    end-of-selection
    END-OF-SELECTION.
      IF FORCEDEXIT = 0.
      Set the file extension and output type of the file
        IF PTXT IS INITIAL.
          DOWNLOADFILEEXTENSION = HTMLEXTENSION.
        ELSE.
          DOWNLOADFILEEXTENSION = TEXTEXTENSION.
        ENDIF.
      Decide what to download
        CASE 'X'.
        Download tables
          WHEN RTABLE.
            IF NOT ( IDICTIONARY[] IS INITIAL ).
              PERFORM DOWNLOADDDSTRUCTURES USING IDICTIONARY[]
                                                 DOWNLOADFOLDER
                                                 HTMLEXTENSION
                                                 SPACE
                                                 PSORTT
                                                 SLASHSEPARATORTOUSE
                                                 PSERV
                                                 PPROMESS.
            Free up any memory used for caching HTML versions of tables
              LOOP AT IDICTIONARY.
                FREE MEMORY ID IDICTIONARY-TABLENAME.
              ENDLOOP.
            Display donwload report
              IF NOT PREP IS INITIAL.
                GET TIME.
                RUNTIME = SY-UZEIT - STARTTIME.
                PERFORM FILLTREENODETABLES USING IDICTIONARY[]
                                                 ITREEDISPLAY[]
                                                 RUNTIME.
              ENDIF.
              CLEAR IDICTIONARY[].
            ENDIF.
        Download message class
          WHEN RMESS.
            IF NOT ( IMESSAGES[] IS INITIAL ).
              SORT IMESSAGES ASCENDING BY ARBGB MSGNR.
              LOOP AT IMESSAGES.
                APPEND IMESSAGES TO ISINGLEMESSAGECLASS.
                AT END OF ARBGB.
                  PERFORM DOWNLOADMESSAGECLASS USING ISINGLEMESSAGECLASS[]
                                                     IMESSAGES-ARBGB
                                                     DOWNLOADFOLDER
                                                     DOWNLOADFILEEXTENSION
                                                     PHTML
                                                     SPACE
                                                     PCOMM
                                                     CUSTOMERNAMESPACE
                                                     PINC
                                                     PDICT
                                                     PMESS
                                                     SLASHSEPARATORTOUSE
                                                     PSERV
                                                     PPROMESS.
                  CLEAR ISINGLEMESSAGECLASS[].
                ENDAT.
              ENDLOOP.
            Display download report
              IF NOT PREP IS INITIAL.
                GET TIME.
                RUNTIME = SY-UZEIT - STARTTIME.
                PERFORM FILLTREENODEMESSAGES USING IMESSAGES[]
                                                   ITREEDISPLAY[]
                                                   RUNTIME.
              ENDIF.
              CLEAR IMESSAGES[].
            ENDIF.
        Download functions
          WHEN RFUNC.
            IF NOT ( IFUNCTIONS[] IS INITIAL ).
              PERFORM DOWNLOADFUNCTIONS USING IFUNCTIONS[]
                                              DOWNLOADFOLDER
                                              DOWNLOADFILEEXTENSION
                                              SPACE
                                              PDOC
                                              PHTML
                                              PCOMM
          

  • How to Display  'purchase order text' in MM03 using report program

    Hi Friends,
    Can anybody suggest me how to display 'purchase order text' in MM03 using report program.
    'Purchase order text' tab displays purchase long text of particular material .
    I coded as:
          SET PARAMETER ID 'MXX' FIELD 'E'.
          SET PARAMETER ID 'MAT' FIELD k_final-matnr.
          SET PARAMETER ID 'WRK' FIELD k_final-werks.
          CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    It displays Purchasing tab other than Purchase Order Text tab of MM03.
    Please suggest me how can i solve this.
    Is there any parameter id to set values for Purchase Order text tab

    >
    Madhu Mano Chitra wrote:
    > I want how to navigate to MM03 'Purchase Order text'  tab/ view using ABAP code.
    > could any suggest me
    You can call a transaction and pass it a BDC table that tells it where you want it to go.  You have to work out for yourself what to put into the BDC table.  The code below works for tcode CATSSHOW.
    DATA: bdcdata_wa  TYPE bdcdata,
          bdcdata_tab TYPE TABLE OF bdcdata.
    DATA opt TYPE ctu_params.
       CLEAR bdcdata_wa.
        bdcdata_wa-program  = 'CATSSHOW'.
        bdcdata_wa-dynpro   = '1000'.
        bdcdata_wa-dynbegin = 'X'.
        APPEND bdcdata_wa TO bdcdata_tab.
        CLEAR bdcdata_wa.
        bdcdata_wa-fnam = 'SO_STATU-LOW'.
        bdcdata_wa-fval = '20'.
        APPEND bdcdata_wa TO bdcdata_tab.
        CLEAR bdcdata_wa.
        bdcdata_wa-fnam = 'ANDZEIT'.
        bdcdata_wa-fval = SPACE.
        APPEND bdcdata_wa TO bdcdata_tab.
        CLEAR bdcdata_wa.
        bdcdata_wa-fnam = 'PAST'.
        bdcdata_wa-fval = 'X'.
        APPEND bdcdata_wa TO bdcdata_tab.
        IF p_selscr = SPACE.
           CLEAR bdcdata_wa.
           bdcdata_wa-fnam = 'BDC_OKCODE'.
           bdcdata_wa-fval = '=ONLI'.
           APPEND bdcdata_wa TO bdcdata_tab.
        ENDIF.
        opt-dismode = 'E'.
        opt-defsize = 'X'.
    CALL TRANSACTION 'CAPP' USING bdcdata_tab OPTIONS FROM opt.

  • I want recover in ABAP program a "Long Text"

    Hi, 
    In FB01 transaction when you go to "Enter Fixed Asset posting: Correct G/L account item", there are a button with a label: "Long Text". When you push this button appear a little window with name "Long Text for Document Line Item" and you can write a long note for a document. I want to recover this long note in a ABAP program. I want know where SAP keeps this texts and how I can recover it. 
    A lot of thanks in advance. 
    Regards.

    Now, my code is:
    report zutil060.
    data: l_thead like thead.
    data: it_text like  tline occurs 0 with header line.
    call function 'ZREAD_TEXT'
         exporting
              id       = '0001'
              language = sy-langu
              name     = 'EV1000000811282006001'
              object   = 'DOC_ITEM'
         tables
              lines    = it_text.
      l_thead-tdobject = 'DOC_ITEM'.
      l_thead-tdspras = 'ES'.
      l_thead-tdid = '0001'.
      l_thead-tdname = 'EV1000000811282006001'.
      refresh it_text.
      clear it_text.
      it_text-tdline = 'Hola caracola'.
      it_text-TDFORMAT = '*'.
      append it_text.
      call function 'SAVE_TEXT'
        exporting
          client          = sy-mandt
          header          = l_thead
         insert          = 'X'
          savemode_direct = 'X'
        tables
          lines           = it_text
        exceptions
          id              = 1
          language        = 2
          name            = 3
          object          = 4
          others          = 5.
      if sy-subrc <> 0.
      write:/ sy-subrc.
      endif.
    If i comment "insert          = 'X'" sy-subrc is 0 but text note dont change.
    My finally mission is to makes an interface (ABAP program) and this program should pick up the long notes from another system and to create new ABAP notes.
    Now i only need to know how i can insert or change a new long note.
    a lot of thanks for your time.
    regards.

  • Key/Text table - usage in an ABAP program

    Hi Abapers!
    I need help about usage of key and text tables.
    I have created key and text table and now i want to use them in the abap program. My problem is, that i don't know how to properly read data into internal table from these two tables, so i can show these data in the table control. I also want to know how to save data from text boxes into key and text table (text boxes: txtid, txtlang, txttext).
    Key Table:
    name: ztbl1
    fields: mandt, id
    key fields: mandt, id
    Text table:
    name: ztbl2
    fields: mandt, lang, id, text
    key fields: mandt, lang, id
    Tables are connected together as they should be.
    And i don't want to use sm30 for editing table data.
    Regards,
    Egi

    My Dear,
    u are loosing the concept of Text table...
    Text table are generally used for multi lingual F4 (i.e you enter vaious F4 list to be displayed for a perticular field when a user from differenct lang log on)
    for eg...
    in urr text table u have .. 2 key itemm
    item_code     ||      lang     ||     text
    10111         ||      E        ||     Eng_Chicken
    10111         ||      D        ||     Chickeno (translation from eng to germen)
    10111         ||        F      ||     Ghoose..
    so when a user with logon lang as 'E' will log on and when he press F4 on item_code he ill see Eng_chicken
    but when a user with logon lang as 'D' will log on and when he press F4 on item_code he ill see Chickeno not Eng_chicken..
    i hope u understood the whole concept...
    No rewards Plz...

  • How to copy/download  all ABAP programs in a text with a single report  ?

    How to copy/download  all ABAP programs in a text format with a single report/TC  ?
    How to copy/download  ABAP source code with all include programs ?....
    we need to search & copy all include programs everytime....

    Hi,
    check this link
    downloading programs
    Regards

  • Regarding text attachment in Email in ABAP program

    Hello...
    Need your expertise in one of the issues. Requirement is seems to be simple
    but i am stuck up at this moment. i have refereed SDN with Several code but
    some point its not giving the proper solution. So its a request to you please
    do not provide any SDN link for reference as i am very much tried all of them.
    please share piece of code.
    Requirement : Need to develope one ABAP program, Email text attachment with Header line.thought its
    very simple but still facing difficulties.
    i have tried many code either its showing Data in single line without new line , in one of the Codes
    data is coming in successive line but there is lot of spacing within Words means all alphabates are tab
    separated. coud you please provide ,me the proper solution for this.
    in  one of the codes is working fine for excel but when Txt extension done data is not coming in successive line all
    data is coming in single line.
    Ex. Text file should contain 1 head and 4 colunns and Data size 50..
    Thanks
    Nishi

    Hi,
    Another option....
    Some sample code using cl_bcs .
    Note the use of cl_abap_char_utilities=>cr_lf .
    FORM mail_1_prep_10
    USING
        it_data         TYPE table
      CHANGING
        ob_document_bcs TYPE REF TO cl_document_bcs .
      DATA: txt_line TYPE string .
      DATA: txt_data TYPE string .
    * Create some text data .
      DO 20 TIMES .
        txt_line = '' .
        DO 10 TIMES .
          CONCATENATE txt_line '|' 'some data 01' '|'   INTO txt_line .
        ENDDO .
        CONCATENATE txt_line cl_abap_char_utilities=>cr_lf INTO txt_line .
        CONCATENATE txt_data txt_line INTO txt_data .
      ENDDO .
    * Mail stuf....
      DATA: it_solix TYPE solix_tab .
      CALL METHOD cl_bcs_convert=>string_to_solix
        EXPORTING
          iv_string = txt_data
        IMPORTING
          et_solix  = it_solix.
      DATA: attachment_subject TYPE so_obj_des .
      DATA: attachment_type TYPE so_obj_tp .
      attachment_subject = 'Some text data' .
      attachment_type = 'txt' .
      TRY.
          CALL METHOD ob_document_bcs->add_attachment
            EXPORTING
              i_attachment_type    = attachment_type
              i_attachment_subject = attachment_subject
              i_att_content_hex    = it_solix.
        CATCH cx_document_bcs .
      ENDTRY.
    ENDFORM .                    "mail_1_prep_10
    regards.
    This is how I see it in my mail :

  • How to read Production Order Long Text data in ABAP program

    Hi friends,
      I have the issue in reading the ' Long Text '  tab view data of production order
    in CO03 transaction.Please can some body help me out to get this in ABAP program.
    Regards,
    Rajesh Akarte

    ok goto the long text, double click it, or use the small pencil, so that you proceed to the text editor.
    Once you are there, use the menu: goto->head
    a small popup will come up, stating the information you need.
    what you need is OBJECT, ID, Language and NAME.
    with those information you can feed the FM READ_TEXT.
    and woooohooo there you go

  • How to write a program to read any texts in any ABAP program?

    Hi Experts,
    How can I write a program to read specific coding section or any texts in any ABAP program?
    For example, I want to wirte a program to count how many 'LOOP' and 'ENDLOOP' are in any other program.
    Thanks!
    Best regards,
    Hao

    Hi,
    Follow the given below URL for the program to read another Program into an internal Table.
    http://abap4.tripod.com/Upload_and_Download_ABAP_Source_Code.html
    Once the Code is there in the Internal Table , you can do the necessary string search.

  • It is possible to write abap programming lines in text element

    Hi experts,
                       Can we write abap programming lines(loop command etc....) in text element in smart forms.
    Thanks in adavnce,
    Nag.
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on May 17, 2011 11:44 AM

    The lines on the DIO port respond to trhe MOMO (Must On, Must Off) protocol which is a tri state protocol. This allows each line on the DIO ports to be used individually. The lines, however, are by default static DIO which means that if you want to create a pulse train in them you must do it through a software routine where you change the states every time the set dio port momo call is executed. Another option is to use the PWM ouptut lines available on this port. You can use the lines specified as PWM outputs (check the 7344 hardware manual for this) so that in MAX you can generate a continous pulse train and then you can use NI-Motion's PWM fucntions to control the frequency and duty cycle of the train.

  • Need to display grand total text in OOPS ABAP ALV report

    Hi
    I am using OOPS for alv display and need to display grand "total text" in any column in th eoutput display.
    I know the procedure to display in ALV display. but dont have idea in OOPS. Please help.
    Thanks
    Amminesh.

    hi,
    follow this link for alv's with oop's oncept.
    http://abapreports.blogspot.com/2008/06/alv-grid-display-with-oops.html
    for calculating total  to the specific field.....
    while creating the fieldcatalog pass the value 'X' to field do_sum of lvc_t_fcat( field catalog).
    data: fcat type lvc_t_fcat.
    fcat-fieldname = <field-name>.
    fcat-ref_table = <ref-tablename>.
    fcat-ref_field = <ref-fieldname>.
    fcat-do_sum = 'X'.
    regards,
    Ashok

  • Abap program standards

    hi all,
         i need to design flow chart for checking for a program whether it satifies the abap coding standards or not. who to do it. if possible send me graphical representations [flow charts]  or links to find programming standards.
    some of my requirements in that folw chart are
      1. how to recognize a blank space in a given program,
      2. how to recognize a comment,
      3. how to check wheteher a keyword is used or not,
      4. how to identify the ' :' symbol
    thanks & regards,
    suresh babu aluri.

    plz go through this documementaion,
    i think its helpful.
    ABAP Programming StandardsContents
    1.     Objective     5
    2.     Naming Conventions     5
    2.1     Codes for naming conventions     5
    2.1.1     Module Codes     5
    2.1.2     Free text     6
    2.2     Naming Convention of Development Objects     6
    2.2.1     Package     6
    2.2.2     Executable Program     6
    2.2.3     BSP Application     7
    2.2.4     Logical Database     8
    2.2.5     SAP Scripts /Smartforms     9
    2.2.6     Idocs     9
    2.2.7     Transaction Code     10
    2.2.8     Function Groups     10
    2.2.9     Dictionary Objects     11
    2.2.10     Message Class     11
    2.2.11     Enhancement Projects (User Exits)     11
    2.2.12     LSMW Objects     12
    2.2.13     Classes     12
    2.2.14     BOR Object Types     13
    2.2.15     Screen / Transaction Variants     13
    2.2.16     Area Menu     13
    2.3     Naming of Sub-Objects     13
    2.3.1     Program Sub-Objects     13
    2.3.2     SAP Script /Smartform sub-objects     14
    3.     General Programming Guidelines     14
    3.1     Modification Logs     14
    3.2     Program Organization     15
    3.2.1     Executable Programs     15
    3.2.2     Dialog Programs     15
    3.3     Package     15
    3.3.1     Adding Components to existing objects     15
    3.3.2     Creation of New Objects     15
    3.4     Program Messages     15
    3.4.1     Adding Messages to existing landscapes     15
    3.4.2     Creation of New Objects     16
    3.5     Dictionary Objects     16
    4.     Structure of ABAP Programs     16
    4.1     Type     16
    4.2     Status     18
    4.3     Authority Check     18
    4.4     Program Structure     19
    4.4.1     Declaration data for global data, classes and selection screens     19
    4.4.2     Container for Processing Blocks     19
    4.4.3     Calling Processing Blocks     20
    4.5     Screen Flow Logic (Dialog Programs)     20
    4.5.1     Place the AT EXIT COMMAND at the beginning of the flow logic.     20
    4.5.2     Use FIELD and CHAIN statements to keep fields in error open for correction.     20
    4.6     Main Program     20
    4.6.1     Events     20
    5.     General Coding Standards     21
    5.1     One command per line     21
    5.2     Indented Source Code     21
    5.3     Extended Syntax Check     21
    5.4     Reusability and Modularity     21
    5.5     Text Handling     21
    5.6     Usage of System Variables     22
    5.7     Chaining Statements     22
    5.8     Common Routines     22
    5.9     Dialog Messages     22
    5.10     Function Keys     23
    5.11     Enqueuing and Dequeuing Data Objects     23
    5.12     Error Handling (SY-SUBRC)     23
    5.13     General Conventions and Hints     24
    5.14     Parameters in Sub-Routines     24
    6.     Performance Standards     25
    6.1     General Tips on Performance Tuning     25
    6.1.1     Avoid Redundant code     25
    6.1.2     Subroutine Usage     25
    6.1.3     Case vs. Nested IF     25
    6.1.4     Using the MOVE Statement     25
    6.1.5     SELECT Queries     25
    6.1.6     Using the READ statement     27
    6.1.7     Hashed table     27
    6.1.8     Transporting     28
    6.1.9     Using LDB     28
    6.1.10     Append Lines of     28
    6.1.11     Use WHILE     28
    6.1.12     DELETE <itab> WHERE     28
    6.1.13     Using WHERE clause in LOOP…….ENDLOOP     28
    1.     Objective
    The objective of this document is to describe general programming guidelines, methodologies, Naming conventions and performance guidelines for all the programs developed for SAP Project.
    2.     Naming Conventions
    This chapter describes the naming conventions to be followed for naming the programming objects for SAP project.
    2.1      Codes for naming conventions
    The variable portion of naming convention is given with Code ID given in angle brackets(<>). Use the following tables for replacing code IDs with codes in the object naming.
    2.1.1     Module Codes
    Code ID:  mm
    Code     Description
    FI     Finance
    CO     Controlling Module
    MM     Materials Management
    PP      Production Planning
    SD     Sales & Distribution
    QM      Quality Management
    PM     Plant Maintenance
    IM     Inventory Management
    WM     Warehouse Management
    BC     Basis Module
    BW     Business Warehouse
    WF     Workflows (Master Data Management)
    HR     Human Resources
    EBP     EBP
    PS     Project Systems
    PCP     Synpro: Product Costing
    PAP     Synpro: COPA
    DP     APO :  Demand Planning
    SP     APO :  Supply Network Planning
    DS      APO : Production Planning & Detailed Scheduling
    AT     APO : Global ATP
    TP     APO : Transportation Planning/Vehicle Scheduling
    CI     Core Interface
    LC     Live Cache
    2.1.2     Free text
    Code ID: ffff
    Developer should replace ‘ffff’ with meaningful text. The text can be multiple words separated by underscore.
    2.2     Naming Convention of Development Objects
    2.2.1     Package
    Naming Convention: Z<mm>_<ffff>.
    Notes:
    1.     Replace <mm> with Module codes given in section 2.1.1 above.
    2.     Replace <ffff> with the sub-landscape of the Module that this Message Class caters to as illustrated in examples below.
    3.     The maximum permissible length for development class is 30 characters
    Examples:
    Dev. Class     Description
    ZFI_AR     FI: Account Receivables
    ZCO_CCA     CO: Cost Center Accounting
    2.2.2     Executable Program
    Naming Convention: Z<mm>_<ffff>.
    Notes:
    1.     Replace <mm> with module codes given in section 2.1.1 above.
    2.     Replace <ffff> with meaningful text as illustrated in examples below.
    3.     The maximum permissible length for program name is 30 characters. However, the name should be restricted to 25 characters to accommodate appropriate Include naming as described in 2.2.2.
    Examples:
    Program Name     Description
    ZFI_VAT_RET     FI:  Report for VAT Return
    ZMM_AUTO_GR     MM: Automated Goods Receipt
    ZSD_XX_STCK_SHORTAGE     SD: Stock shortage report for stock allocation
    2.2.2.1     Includes for executable programs
    Naming Convention: Z<mm>_<ffff>_<Inn>.
    Notes:
    1.     All includes of executable program will be prefixed by Z, followed by the same program name as described in 2.2.2 above.
    2.     Replace <Inn> with include type and sequence number. Use the following table for includes.
    Include Type ID     Description
    TOP     Top Include.
    Fnn     Subroutine pool (Forms)
    Inn     PAI Modules
    Onn     PBO Modules
    Xnn     Other Includes
    The maximum permissible length for Include name is 30 characters.
    Examples:
    Include Name     Main Program Name     Description
    ZFI_VAT_RET_TOP     ZFI_VAT_RET     FI:  Report for VAT Return – Top Include
    ZFI_VAT_RET_F01     ZFI_VAT_RET     FI:  Report for VAT Return – Forms
    ZMM_AUTO_GR_TOP     ZMM_FR_AUTO_GR     MM: – Automated Goods Receipt – Top include
    ZMM_AUTO_GR_F01     ZMM_FR_AUTO_GR     MM:– Automated Goods Receipt – Forms
    2.2.3     BSP Application
    2.2.3.1     Main Application
    Naming Convention: BSP Applications shall follow the same Naming Convention as Executable Programs i.e. Z<mm>_<ffff>.
    Notes:
    1.     Replace <mm> with module codes given in section 2.1.1 above.
    2.     Replace <ffff> with meaningful text as illustrated in examples below.
    2.2.3.2     Pages & Controllers
    Naming Convention: <ffff>
    Notes:
    1.     Replace <ffff> with meaningful text, that adequately describes the function of the page/controller
    2.2.3.3     Theme
    Naming Convention: Z_<ffff>.
    Notes:
    1.     Replace <ffff> with meaningful text
    2.2.3.4     Mime Objects:
    Naming Convention: <ffff>
    1.     A MIME Object can be logo for the company.
    2.     Replace <ffff> with meaningful text, that adequately describes the function of the MIME objects
    2.2.3.5     Controller and Handler Classes:
    See section Classes (Section 2.2.133)
    2.2.3.6     BSP Extension
    Naming Convention: Z_<ffff>
    Notes:
    1.     Replace <ffff> with meaningful text
    2.2.3.7     BSP Layout elements id
    Label:     lb_fffff
    Input field:     if_fffff
    Button:     b_fffff
    Text Edit:     te_fffff
    Text View:     tv_fffff
    Radio button Group:     rbg_fffff
    Radio button:     rb_fffff
    Check Box Group:     cbg_fffff
    Check Box     cb_fffff
    Tray     tr_fffff
    Tabstrip     ts_fffff
    Tableview      tab_fffff
    1.  Replace <fffff> with meaningful text
    2.2.4     Logical Database
    Naming Convention: Z<mm>_<ffff>.
    Notes:
    1.     Replace <mm> with module codes given in section 2.1.1 above.
    2.     Replace <ffff> with meaningful text
    3.     The maximum permissible length for LDB name is 20 characters. However, the name should be restricted to 15 characters to accommodate appropriate Include naming
    4.     LDB Program and LDB Program Includes shall follow the naming convention Auto-Generated by SAP
    2.2.5     SAP Scripts /Smartforms
    Naming Convention: ZF<mm>_<ffff>.
    Notes:
    1.     Replace <mm> with module codes given in section 2.1.1 above.
    2.     Replace <ffff> with meaningful text as illustrated in examples below.
    Examples:
    Form Name     Description
    ZFFI_EMP_CONF     Employee Confirmation Letter
    ZFFI_ANN_TO     Annual Turnover Letter To Customers and Vendors
    2.2.6     Idocs
    2.2.6.1     Idoc Types
    Basic Type :
    Naming Convention : ZB<FFFF>NN
    Notes:
    1.Replace <NN> with sequence number.
    3.     Replace <ffff> with meaningful text.
    Extension Type : ZX<Basic type name>_NN
    Notes:
    1.     Replace <NN> with sequence number .
    2.2.6.2     Message Types
    Naming Convention :  ZM<mm><ffff>.
    Notes :
    1.   Replace <mm> with module codes given in section 2.1.1 above.
    2.  Replace <ffff> with meaningful text .
    2.2.6.3      Process Code
    Naming Convention :  Z<ffff>.
    Notes :
    1.     Replace <ffff> with meaningful text ..
    2.2.6.4     IDOC Segments
    Naming Convention :  Z1<ffff>.
    Notes :
    1.Replace <ffff> with meaningful text as illustrated in examples below.
    2.2.7     Transaction Code
    Notes:
    1.     The tcode name is provided by SAP TIN The Developer must write a mail to SAP Tin asking for the T-Code name with a filled form.
    The form can be found at :
    2.2.8     Function Groups
    Naming Convention: Z<mm><ffff>
    Notes:
    1.     Replace <mm> with relevant module code as given above
    2.     Replace <ffff> with meaningful text.
    2.2.8.1     Function Group Include Programs
    Naming Convention: LZ<Function Group><Inn>.
    Notes:
    1.     All includes of Function Group program will be prefixed by LZ, followed by the Function Group name
    2.     Replace <Inn> with include type and sequence number. Use the values from the table given in 2.2.2.1
    Examples:
    Include Name     Function Group Name     Description
    SAPLZMMPURCHASING     ZMMPURCHASING     F.Group-Purchasing: Main Program
    LZMMPURCHASINGO01     ZMMPURCHASING     F.Group-Purchasing: PBO
    LZMMPURCHASINGI01     ZMMPURCHASING     F.Group-Purchasing: PAI
    LZMMPURCHASINGF01     ZMMPURCHASING     F.Group-Purchasing: Forms
    LZMMPURCHASINGTOP     ZMMPURCHASING     F.Group-Purchasing: Data Declarations
    2.2.8.2     Function Modules
    2.2.8.2.1     Normal Function Modules
    Convention: Z_<mm>_<ffff>.
    Notes:
    1.     Replace <mm> with relevant module code as given above.
    2.     Replace <ffff> with meaningful text.
    2.2.8.2.2     IDOC Function Modules
    Convention: Z_IDOC_<mode>_<msg type>.
    Notes:
    1.     Replace <mode> with INPUT or OUTPUT depending on whether the function processes incoming or outgoing IDOC.
    2.     Replace <msg type> with the IDOC message type.
    2.2.9     Dictionary Objects
    Tables:      Z<mm><ffff>
    Structures:      ZS<mm><ffff>
    Views:      ZV<mm><ffff>
    Data Element:      ZDE<mm><ffff>
    Domain:      ZDO<mm><ffff>
    Table Type:      ZTT<mm><ffff>
    Type Group:      Z<ffff>
    Search Help:      ZSH<mm><ffff>
    Lock Object:      EZ<mm><ffff>
    Notes:
    1.     Replace <mm> with module code given above.
    2.     Replace <ffff> with meaningful text.
    2.2.10     Message Class
    Naming Convention: Z<mm>_<ffff>.
    Notes:
    1.     Replace <mm> with Module codes given in section 2.1.1 above.
    2.     Replace <ffff> with the sub-landscape of the Module that this Message Class caters to as illustrated in examples below.
    3.     The maximum permissible length for development class is 30 characters
    Examples:
    Msg. Class     Description
    ZFI_AR     FI: Account Receivables
    ZCO_CCA     CO: Cost Center Accounting
    2.2.11     Enhancement Projects (User Exits)
    Convention: Z<XX><nn>.
    Notes:
    1.     XX is the application area code e.g. for sales it is SD etc.
    2.     'nn'  is one up number for one application area. It starts with 001.
    3.     Maximum length of the Project name is 8.
    Example:  The name of the SD enhancement project can be ZSD001.
    2.2.12     LSMW Objects
    2.2.12.1     Project
    Naming Convention: ZM_<ffff>.
    Notes:
    1.     1.     Replace <ffff> with meaningful text
    2.     The maximum permissible length for Project name is 16 characters. But please limit it to 12.
    Example : ZM_VENDOR
    2.2.12.2     SubProject
    Naming Convention: ZM_<ffff>_<n>.
    Notes:
         Suffix Project name with a running sequence no.
    Example : ZM_VENDOR_1
    2.2.12.3     Object
    Naming Convention: ZM_<ffff>_<n><n>.
    Notes:
         Suffix Subproject name with a running sequence no.
    Example : ZM_VENDOR_11
    2.2.13     Classes
    Naming Convention: ZCL_[IM/DF/BSPCO/BSPHN/BADI]_<ffff>.
    1.     IM: Implementation Class;
    DF: Definition Class
    BSPCO: BSP Controller class
    BSPHN: BSP Handler class
    BADI : BADI implementation
    2.     Replace <ffff> with meaningful text: In case of Implementation classes, it should preferably be the same as that of the Definition Class
    3.     Example:
    IMPLEMENTATION Class: ZCL_IM_REBATE_SETTL
    DEFINITION: ZCL_DF_REBATE_SETTL
    2.2.14     BOR Object Types
    Object     Convention     Example
    Supertype     Z<ffff>     ZLVAPPL
    SubType     Z<SuperType><nn>     ZZLVAPPL01
    Program     <Subtype>     ZZLVAPPL01
    1.     Replace <nn> with a running 2 digit serial Number
    2.     Replace <ffff> with meaningful text
    2.2.15     Screen / Transaction Variants
    Naming Convention: <tcode>_<ffff>
    Where:
    1.     Replace <tcode> with the t-code that will be assigned to this Variant
    2.     Replace ffff with a meaningful text
    E.g.:
    For an SE16 variant for table KONA that will be used by T-Code Z_CH_SD_001:
    Z_CH_SD_001_KONA
    2.2.16     Area Menu
    Naming Convention: Z<mm>_<Main Menu>_<Sub Menu>…<ffff>
    Where:
    1.     Replace <mm> with the Module code
    2.     Followed by the hierarchical position of the immediate parent of this Area Menu
    3.     Followed by a Meaningful text for this Menu
    E.g.:
    ZSD
    ZSD_TAB
    ZSD_TAB_VIEW
    ZSD_TAB_UPDT
    Notes:
    1.     Clusters of Transactions should be introduced as Sub-Menus rather than as Folders
    2.     As a gradual process, the current Clusters that exist as Folders should also be replaced with Sub-Menus
    2.3     Naming of Sub-Objects
    2.3.1     Program Sub-Objects
    Naming of all the internal components of a program will be consistent across the project.
    Naming Convention: <Prefix>ffff.
    Notes:
    1.     Replace <Prefix> with the component prefix values given in the table below.
    Program Component     Prefixed by
    Program Constants     C_
    Global Variables     W_
    Types Definition     T_
    Global Structures     WA_
    Global Internal Tables     I_
    Select-Options     SO_
    Parameters     PO_
    Table Type     TT_
    Field Symbols     FS_
    Ranges     R_
    Local Constants     LC_
    Local Variables     L_
    Local Static Variables     LS_
    Local Internal Tables     LI_
    Local Work Area     LWA_
    Local Range     LR_
    Field Groups     FG_
    Container      CO_
    Macro     MA_
    Important: The Same sequence as above must be followed in the Data declaration part of all the ABAP/4 programs.
    2.3.2     SAP Script /Smartform sub-objects
    Naming of all the internal components of a SAPScript/SmartForm shall follow the same convention as for Programs (2.2.2), with the addition of the Field Label on the FRS. E.g. if the FRS has labeled a field for Sales Order Number as Field 27 on the Layout, the variable name should be W_27_VBELN.
    3.     General Programming Guidelines
    3.1     Modification Logs
    At the top of every ABAP Object Modified by a Developer, there should be a Modification Log Every Line Created/Changed by the developer should be Identifiable by the TR Number.
    ABAP Patterns: Following Patterns should be used for Uniform ModLogs:
    Nature of Change     Pattern to Use
    New Development     ZZNEWPROG
    In-Line Logs     ZZLINE
    Modification Logs at the Top of Object     ZZMODLOG
    3.2     Program Organization
    All the programs will be organized as described below.
    3.2.1     Executable Programs
    TOP Include: For global data declarations
    Form Include: For definition of all the FORMs.
    3.2.2     Dialog Programs
    TOP Include: For global data declarations
    Form Include: For definition of all the FORMs.
    PBO Include: Include for PBO Modules
    PAI Include: Include for PAI Modules
    3.3     Package
    All the related objects within a sub-module of SAP will be developed under a single Package.
    3.3.1     Adding Components to existing objects
    When adding new workbench components to existing Objects, the same Package will be used as has been used for the existing Components
    3.3.2     Creation of New Objects
    When creating new Objects or new Sub-lanscapes, Packages used should have the Naming convention as in Section 2 Above
    3.4     Program Messages
    All the messages within a sub-module of SAP will be grouped under a single Message Class.
    3.4.1     Adding Messages to existing landscapes
    When adding new messages for existing Objects, the same Message Class will be used as has been used for the existing Objects
    3.4.2     Creation of New Objects
    When creating new Objects or new Sub-landscapes, Message classes used should have the Naming convention as in Section 2 Above
    3.5     Dictionary Objects
    Whenever you create a Z table in  system always include MANDT field as the first field, except when the table contains client independent data. Also create the table with attribute Data Class as USER.
    4.     Structure of ABAP Programs
    4.1     Type
    •     When an ABAP program is run, its processing blocks are called. ABAP programs are controlled from outside the program itself by the processors in the current work process. For the purposes of program flow, we can summarize the screen processor and ABAP processor into the ABAP runtime environment. The runtime environment controls screens and ABAP processing blocks. It contains a range of special control patterns that call screens and processing blocks in certain orders. These sections are also called processors. When a ABAP program is run, the control passes between various processors.
    •     In the R/3 System, there are various types of ABAP program. The program type determines the basic technical attributes of the program, and must be set when created. The main difference between the different program types is the way in which the runtime environment calls its processing blocks.
    •     When an application program is run, it must at least call the first processing block from outside the program, that is, from the runtime environment. This processing block can then either call further processing blocks or return control to the runtime environment. When an ABAP program is started, the runtime environment starts a processor (dependent on the program type), which calls the first ABAP processing block.
    •     The following program types are relevant to application programming:
    Type 1
    •     Type 1 programs have the important characteristic that they do not have to be controlled using user-defined screens. Instead, they are controlled by the runtime environment, which calls a series of processing blocks (and selection screens and lists where necessary) in a fixed sequence. User actions on screens can then trigger further processing blocks.
    Type M
    •     The most important technical attribute of a type M program is that it can only be controlled using screen flow logic and run via a transaction code which is linked to the program and one of its screens (initial screen).
    •     ABAP programs with type M contain the dialog modules belonging to the various screens. They are therefore known as module pools.
    Type F
    •     Type F programs are containers for function modules, and cannot be started using a transaction code or by entering their name directly.
    •     Type F programs are known as function groups. Function modules may only be programmed in function groups. The Function Builder is a tool in the ABAP Workbench that is used to create function groups and function modules. Apart from function modules, function groups can contain global data declarations and subroutines. These are visible to all function modules in the group. They can also contain event blocks for screens in function modules.
    Type K
    •     Type K programs are containers for global classes in ABAP Objects. Type K programs are known as class definitions. The Class Builder is a tool in the ABAP Workbench that can be used to create class definitions.     
    Type J
    •     Type J programs are containers for global interface in ABAP Objects. Type J programs are known as interface definitions and are created in the Class Builder.
    Type I
    •     Type I programs - called includes - are a means of dividing up program code into smaller, more manageable units. The coding of an include program can be inserted at any point in another ABAP program using the INCLUDE statement. There is no technical relationship between include programs and processing blocks. Includes are more suitable for logical programming units, such as data declarations, or sets of similar processing blocks. The ABAP Workbench has a mechanism for automatically dividing up module pools and function groups into include programs.
    4.2     Status
    P = SAP standard production program
    K = Customer production program
    S = System program
    T = Test program
    Application
    •     Categorize the program according to the purpose it fulfills.
    4.3     Authority Check
    Authority checks will be carried out as given in the respective FRS’s.
    4.4     Program Structure
    ABAP programs are responsible for data processing within the individual dialog steps (ie. events) of an application program. This means that the program cannot be constructed as a single sequential unit, but must be divided into sections that can be assigned to the individual dialog steps. To meet this requirement, ABAP programs should have a modular structure. Each module is called a processing block. A processing block consists of a set of ABAP statements. When a program is run, effectively a series of processing blocks is called. Therefore, they should not be nested but modularized.
    •     Each ABAP program consists of the following two parts:
    4.4.1     Declaration data for global data, classes and selection screens
    •     The first part of an ABAP program is the declaration part for global data, classes, and selection screens. This consists of:
    •     All declaration statements for global data. Global data is visible in all internal  processing   blocks and should be defined using declarative statements that appear before the first processing block, in dialog modules, or in event blocks. Local data should not be declared in dialog modules or event blocks.
    •     All selection screen definitions.
    •     All local class definitions (CLASS DEFINITION statement). Local classes are part of ABAP Objects, the object-oriented extension of ABAP.
    •     Declaration statements which occur in procedures (methods, subroutines, function modules) form the declaration part for local data in those processing blocks. This data is only visible within the procedure in which it is declared.
    4.4.2     Container for Processing Blocks
    •     The second part of an ABAP program contains all of the processing blocks for the program. The following types of processing blocks are allowed:
    1.     Dialog modules (no local data area)
    2.     Event blocks (no local data area)
    3.     Procedures (methods, subroutines and function modules with their own local data area).
    •     Whereas dialog modules and procedures are enclosed in the ABAP keywords which define them, event blocks are introduced with event keywords and concluded implicitly by the beginning of the next processing block.
    •     All ABAP statements (except declarative statements in the declaration part of the program) are part of a processing block. Non-declarative ABAP statements, which occur between the declaration of global data and a processing block are automatically assigned to the START-OF-SELECTION processing block.
    4.4.3     Calling Processing Blocks
    •     Processing blocks can be called from either the ABAP program or using ABAP commands which are themselves part of a processing block. Dialog modules and event blocks are called from outside the ABAP program. Procedures are called using ABAP statements in ABAP programs.
    •     Calling event blocks is different from calling other processing blocks for the following reasons:
    •     An event block call is triggered by an event. User actions on selection screens and lists, and the runtime environment trigger events that can be processed in ABAP programs. Define event blocks for the events that the program needs to react to (whereas a subroutine call, for example, must have a corresponding subroutine). This ensures that while an ABAP program may react to a particular event, it is not forced to do so.
    4.5     Screen Flow Logic (Dialog Programs)
    4.5.1     Place the AT EXIT COMMAND at the beginning of the flow logic.
    Example:
    PROCESS AFTER INPUT
       MODULE EXIT_1170 AT EXIT-COMMAND.
       MODULE PAINT_1170.
    4.5.2     Use FIELD and CHAIN statements to keep fields in error open for correction.
    Example:
       PROCESS AFTER INPUT.
       MODULE EXIT_1170 AT EXIT-COMMAND.
       CHAIN.
          FIELD BTCH1170-JOBNAME.
          FIELD BTCH1170-USERNAME.
          FIELD BTCH1170-FROM_DATE.
          FIELD BTCH1170-FROM_TIME.
          MODULE PAINT_1170.
       ENDCHAIN.
    4.6     Main Program
    4.6.1     Events
    The Program MUST NOT be coded without the use of Proper Coding blocks
    •     Initializations
    •     Top-of-page during line-selection
    •     At Selection-Screen
    •     At Line-Selection
    •     At User-Command
    •     At Pfn
    •     Start-Of-Selection
    •     Top-Of-Page
    •     Get
    •     End-Of-Page
    •     End-Of-Selection
    NOTE: The coding for each event should be logically split into forms (subroutines). That is to say, each event will comprise mostly of ‘PERFORM’ statements.
    5.     General Coding Standards
    5.1     One command per line
    Each ABAP/4 command consists of a sentence ending with a period. Multiple commands can be on one line; however, as a standard start each new command on a new line. This will allow for easier deleting, commenting, and debugging.
    5.2     Indented Source Code
    The ABAP/4 editor has a "Pretty Printer" command to indent by 2 positions specific lines of code and add subroutine comments. Event keywords are typically not indented.
    5.3     Extended Syntax Check
    Extended Program Check (EPC) to be done on each object to make sure the code is Syntactically correct. There should be no Error/warning messages in the code.
    5.4     Reusability and Modularity
    If a block of code is executed more than once, it should be placed in a subroutine at the bottom of the code. This makes the code more readable, requires less indentation, and is easier to debug since the debugger can jump through an entire subroutine via a PF key. Also, when possible parameters should be passed to and from subroutines to make the purpose easier to understand and reduce the need for global variables. Always document the purpose of each parameter.
    5.5     Text Handling
    Text elements must be used to display any text messages.
    5.6     Usage of System Variables
    The system variables should be used wherever possible. The SY-SUBRC is to be checked after any function call, selection operation, etc.
    5.7     Chaining Statements
    •     Consecutive sentences with an identical beginning shall be combined into a chained statement.
    Example:
    Instead of the statements
    MOVE SY-MANDT TO D00001-MANDT.
    MOVE SY-LANGU TO D00001-SPRAS.
    A chained statement shall be used
    MOVE:
                 SY-MANDT TO D00001-MANDT,
                 SY-LANGU TO D00001-SPRAS,
                 SY-UNAME TO D00001-BNAME.
    5.8     Common Routines
    •     Standard sub-routines should be implemented as FUNCTION's rather than a FORM (ie. SUBROUTINE). A FUNCTION is easier to maintain and can be easily tested without a calling program. Standard SAP function modules are also available and the function library should be used to check if function modules already exist for a function that needs to be performed i.e.POPUP_TO_CONFIRM_LOSS_OF_DATA etc.
    •     Includes can also be created for re-usable or common code e.g. common data declaration statements.
    5.9     Dialog Messages
    Dialogue messages are stored in table T100. Programmers shall check to see if an appropriate message exists before adding a new message. Programs shall use the message-id which corresponds to the SAP module that the program most relates to.
    5.10     Function Keys
    PF-keys should be programmed to execute functions where required. SAP Standard function keys should be used where appropriate. The most commonly used buttons should be displayed as pushbuttons in the application toolbar.
    5.11     Enqueuing and Dequeuing Data Objects
    •     All database objects being processed by a program, for purposes other than for display, shall be enqueued before such processing is executed. If the enqueue is unsuccessful, then a message shall be returned stating why the enqueue was unsuccessful.
    •     Enqueue and Dequeue objects should be created via the data dictionary.
    5.12     Error Handling (SY-SUBRC)
    •     Return codes shall always be checked immediately after an event which returns a code.  
    Eg. Function calls, Select statements, Updates etc.
    •     The value of SY-SUBRC is 0 when successful and generally produces a value of 4 when unsuccessful (there are a few exceptions).
    Therefore, rather check SY-SUBRC with:
               IF SY-SUBRC <> 0
    than with
             IF SY-SUBRC = 4  (which is redundant and makes the system do a double check)
    •     Error messages displayed to the user must be clear and descriptive.
    •     Remember to group related / dependant steps together and to Rollback all changes for steps in that group should any one of them fail, thus maintaining the integrity of the system.
    •     Check whether an Error Log, (file), must be produced by your program and if so check on the format of the file.
    •     If any Error Logging is done to a custom table in the database then make sure this table is maintained and monitored correctly. (Dev. Note)
    •     Transaction SE91 provides the facility to create and utilize messages in their appropriate message class. Elaborate on the message if necessary, using the long text documentation for that message number.
    5.13     General Conventions and Hints
    •     There should be NO hard coding of values in programs – easy maintainability
    •     For amounts, use the CURRENCY command in write statements to automatically convert fields into their correct decimal format. The currency specified in the write statement is treated as a key for the table TCURX. If no entry exists for the currency specified, the system assumes two decimal places.
    •     For quantities, use the UNIT command in write statements to automatically convert fields into their correct decimal format. The contents of the unit specified are used on table T006. If no entry exists for the unit specified, the formatting has no effect.
    •     Use the ‘LIKE’ statement as often as possible to declare ‘DATA’ variables instead of an explicit ‘TYPE’ declarations.
    •     Try to use the ‘INCLUDE’ statement with standard SAP structures and tables for your structures and internal tables where possible.  If you use the include statement to include other program components in your code then document what those components are, what they do and how to use them.
    •     Try to make use of standard SAP Function Modules wherever possible rather than building your own. Use the pull down functionality in transaction SE37 to find suitable standard function modules.
    •     Make use of the SAP PATTERN tool to automatically insert the standard code for:
    •     CALL FUNCTION
    •     MESSAGE ID
    •     SELECT*FROM
    •     PERFORM
    •     AUTHORITY-CHECK
    •     WRITE
    •     CASE
    •     CALL DIALOG
    •     The standard date format to use is ‘DD/MM/YYYY’. (Dev. Note)
    The standard time format to use is ‘HH:MM:SS’.
    5.14     Parameters in Sub-Routines
    Naming convention for Parameters in subroutine is P_
    6.     Performance Standards
    6.1     General Tips on Performance Tuning
    6.1.1     Avoid Redundant code
    Avoid leaving "dead" code in the program. Comment out variables that are not referenced and code that is not executed. To analyze the program, use the Program Analysis function in SE38 -> Utilities -> Program Analysis.
    6.1.2     Subroutine Usage
    For good modularization, the decision of whether or not to execute a subroutine should be made before the subroutine is called.
    Example:
    IF f1 NE 0.
      PERFORM sub1.
    ENDIF.
    FORM sub1.
    ENDFORM.
    6.1.3     Case vs. Nested IF
    When testing fields "equal to" something, one can use either the nested IF or the CASE statement. The CASE is better for two reasons. It is easier to read and after about five nested IFs the performance of the CASE is more efficient.
    6.1.4     Using the MOVE Statement
    When records a and b have the exact same structure, it is more efficient to MOVE a TO b than to MOVE-CORRESPONDING a TO b.
    6.1.5     SELECT Queries
    The performance of  any ABAP program mainly depends on the ABAP Queries used in it. More optimum the queries , better the performance. Take care of the points mentioned nin the following sections while writing any ABAP queries.
    6.1.5.1     Using all the keys in SELECT statement
    When using the SELECT statement, study the key and always provide as much of the left-most part of the key as possible. The SELECT * command is to be avoided everywhere.
    6.1.5.2     Fetching Single Record
    If the entire key can be qualified, code a SELECT SINGLE not just a SELECT. If all the keys are not available, we should use SELECT UPTO 1 ROWS if we are interested only in the first record.
    6.1.5.3     Avoid SELECT-ENDSELECT
    Selecting data into an internal table using an array fetch versus a SELECT-ENDELECT loop will give at least a 2x performance improvement.  After the data has been put into the internal data, then row-level processing can be done.  
    Example:
    select ... from table <..>
               into <itab>
               where ...
    loop at <itab>
      <do the row-level processing here>
    endloop.
    6.1.5.4     Using Indexs
    Use indexes wherever possible. Tune the Query so that optimum Indexing will happen.
    6.1.5.5     Provide all the keys
    Give as many keys as possible in the WHERE clause to optimize the database fetching. Use the Index fields in the first position to optimize performance.
    6.1.5.6     Avoid “INTO CORRESPONDING”
    Avoid using INTO CORESPONDING FIELDS of Table. Instead, explicitly mention the fields. Else, The Table Fields should be in the same sequence as the selection
    6.1.5.7     SELECT statement inside LOOP
    Do not write SELECT statements inside the loop. Instead, use the FOR ALL ENTRIES Command
    Before using FOR ALL ENTRIES command, check that the
    1.     Corresponding Internal table is not empty. If the Internal table is empty, the statement will select ALL the entries in the Database
    2.     The Internal table is sorted by the Filed used in the Where Clause: This makes selection faster
    6.1.5.8     Nested SELECT statement
    Avoid Using nested SELECT statements. Instead, make use of different internal tables to fetch the data, and Use Nested LOOPS to read them.
    6.1.5.9     Select Distinct
    Whenever its possible avoid SELECT DISTINCT, instead select data into internal table, sort and use DELETE ADJACENT DUPLICATES
    6.1.5.10     Use of OR in Where Clause
    Do not use OR when selecting data from DB table using an index because The optimizer generally stops if the WHERE condition contains an OR expression.
    e.g.
    Instead of
         SELECT * FROM spfli WHERE carrid = ‘LH’
                                   AND (cityfrom = ‘FRANKFURT’ OR
                 city from = ‘NEWYORK’)
    Use
         SELECT * FROM spfli WHERE (carrid = ‘LH’ AND cityfrom = ‘FRANKFURT’)
                                      OR (carrid = ‘LH’ AND cityfrom = ‘NEWYORK’).
    6.1.5.11     Order By
    ORDER BY will Bypass buffer. So, performance will decrease. If you want to sort data, it is efficient to SORT them in INTERNAL TABLE rather than using ORDER BY. Only use an ORDER BY in your SELECT if the order matches the index, which should be used.
    6.1.6     Using the READ statement
    When reading a single record in an internal table, the READ TABLE WITH KEY is not a direct READ. The table needs to be sorted by the Key fields and the command READ TABLE WITH KEY BINARY SEARCH is to be used.
    6.1.7     Hashed table
    If the number of entries in the Internal Table is high then use Hashed Table with Keys to access the table.
    6.1.8     Transporting
    With READ or MODIFY Statements use TRANSPORTING
    6.1.9     Using LDB
    In order to improve performance in case of an LDB, individual tables can be excluded from selection. Under the section ‘Table Selection’ in the Documentation of LDB the fields with proper description has been given those fields can be set in the application report at the time of INITIALIZATION or at the START OF SELECTION. This can enhance the performance.
    6.1.10     Append Lines of
    Whenever it is possible use APPEND LINES OF to append the internal Tables instead of using loop and then APPEND Statement.
    6.1.11     Use WHILE
    Use WHILE instead of a DO+EXIT-construction, as WHILE is easier to understand and faster to execute
    6.1.12     DELETE <itab> WHERE
    Use DELETE <itab> WHERE…for deleting records from an internal table.
    e.g.
    Instead of
    LOOP AT <itab> WHERE <field> = ‘0001’
         DELETE <itab>.
    ENDLOOP.
    Use
    DELETE <itab>  WHERE <field> = ‘0001’.
    6.1.13     Using WHERE clause in LOOP…….ENDLOOP
    Use:
    Sort ITAB by NAME.
    Loop at itab where name EQ SY-UNAME
    Endloop.
    Instead Of:
    Read itab with key name = SY-UNAME.
    L_tabix = sy-tabix.
    Loop at itab from l_tabix.
    If name eq ‘bijoy’
    Endif.
    Endloop.

  • I need hr abap programs and syntax?

    i need hr abap programs and syntax?

    Check with below one example :
    REPORT ZPETROL_EXCLUDE .
    TABLES SSCRFIELDS.
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    SELECTION-SCREEN SKIP 9.
    PARAMETERS NUMBER(200) TYPE C.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN:
    BEGIN OF LINE,
    PUSHBUTTON 2(10) TEXT-001 USER-COMMAND PROC,
    END OF LINE.
    SELECTION-SCREEN END OF SCREEN 100.
    CALL SCREEN 100.
    AT SELECTION-SCREEN.
    CASE SSCRFIELDS.
    WHEN 'PROC'.
    SET PARAMETER ID: 'NUM' FIELD NUMBER.
    CALL TRANSACTION 'ZP_PALLOWANCE'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    SECOND PRG
    REPORT ZPR_PETROL_ALLOWANCE NO STANDARD PAGE
    HEADING .
    *-- Infotypes
    INFOTYPES : 0000, "Actions
    0002, "Personal Data
    0008. "Basic pay details
    *-- Tables
    TABLES : PERNR, "Standard Selections for HR Master Data Reporting
    PC207, "Payroll Results: Results Table
    PCL1, "HR Cluster 1
    PCL2, "HR Cluster 2
    T510, "Pay scales
    T549A, "Payroll areas
    T549Q, "Payroll Periods
    PA0002. "Personal details
    *-- Internal Tables
    *-- Internal Table Declaration For Holding The Data
    DATA: BEGIN OF INT_PETROL OCCURS 0,
    PERNR LIKE PA0008-PERNR, "Personnel Number
    TRFST LIKE PA0008-TRFST, "Pay Scale Level
    NAME(40), "Name of Employee
    PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
    END OF INT_PETROL.
    DATA: BEGIN OF PA0015_DATA OCCURS 0,
    PERNR LIKE PA0015-PERNR,
    BETRG LIKE PA0015-BETRG,
    END OF PA0015_DATA.
    DATA:BEGIN OF INT_PETROL2 OCCURS 0,
    PERNR LIKE PA0008-PERNR, "Personnel Number
    VORNA LIKE PA0002-VORNA, "First Name
    NACHN LIKE PA0002-NACHN, "Last Name
    TRFST LIKE PA0008-TRFST, "Pay Scale Level
    NAME(40), "Name of Employee
    PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
    END OF INT_PETROL2.
    DATA : TITLE TYPE LVC_TITLE.
    DATA: BEGIN OF PER_NO OCCURS 0,
    PERNR LIKE PA0008-PERNR,
    TRFST LIKE PA0008-TRFST,
    END OF PER_NO.
    DATA: BEGIN OF MSG OCCURS 0,
    MSG1(100) TYPE C,
    END OF MSG.
    DATA: FLAG TYPE I VALUE '0',
    DIS_FLAG TYPE I VALUE '0'.
    DATA: INT_PETROL3 LIKE STANDARD TABLE OF INT_PETROL2 INITIAL SIZE 0
    WITH HEADER LINE.
    DATA: INT_PETROL1 LIKE STANDARD TABLE OF INT_PETROL INITIAL SIZE 0 WITH
    HEADER LINE.
    DATA: WA_PET_ALLOWANCE TYPE ZBPETROL_ALL. "WORKAREA FOR INSERTING
    VALUES.
    *DATA: P_LGART1 LIKE T512T-LGART VALUE '0010'. "CHANGE WAGE TYPE HERE
    DATA: P_LGART1 LIKE T512T-LGART VALUE '0077'. "CHANGE WAGE TYPE HERE
    DATA: BEGIN OF INT_0015 OCCURS 0,
    PERNR(038),
    BEGDA(010),
    BETRG(018),
    END OF INT_0015.
    *-- Internal Table To Store Error Records.
    DATA: E_INT_0015 LIKE INT_0015 OCCURS 0 WITH HEADER LINE.
    *-- Batch Input Data of Single Transaction
    DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    *-- Internal Table For Export and Import Payroll Results
    DATA: INT_RGDIR LIKE PC261 OCCURS 0 WITH HEADER LINE,
    LGTXT LIKE T512T-LGTXT.
    DATA: BEGIN OF EMP_NO OCCURS 0,
    PERNR(4) TYPE C,
    END OF EMP_NO.
    DATA: BEGIN OF EMP_NO1 OCCURS 0,
    PERNR TYPE I,
    END OF EMP_NO1.
    DATA EMPNO LIKE STANDARD TABLE OF EMP_NO INITIAL SIZE 0.
    DATA EMPNO1 LIKE STANDARD TABLE OF EMP_NO1 INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA LEN1 TYPE I.
    DATA: ERR LIKE MESSAGE.
    DATA TEMP_NUM(200) TYPE C.
    *-- Includes
    *-- International Include
    INCLUDE RPC2CD09. "Cluster CD data definition
    INCLUDE RPC2CA00. "Cluster CA Data-Definition
    INCLUDE RPPPXD00. "Data Definition buffer PCL1/PCL2 Buffer INCLUDE RPPPXD10.
    "Common part buffer PCL1/PCL2 INCLUDE RPPPXM00. "Buffer Handling routine
    *-- Country Specific Include
    INCLUDE PC2RXIN0. "Cluster IN data definition
    INCLUDE RPC2RX09.
    *-- ALV Declaration
    TYPE-POOLS : SLIS.
    DATA: INT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
    INT_EVENTS TYPE SLIS_T_EVENT,
    INT_LAYOUT TYPE SLIS_LAYOUT_ALV,
    WS_EVENTS TYPE SLIS_ALV_EVENT,
    WS_REPID LIKE SY-REPID.
    *-- Initialization
    INITIALIZATION.
    WS_REPID = SY-REPID.
    *-- At Selection-Screen
    START-OF-SELECTION.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(30) TEXT-002.
    SELECTION-SCREEN POSITION 33.
    PARAMETERS: P_RATE TYPE P DECIMALS 2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN BEGIN OF BLOCK B3.
    PARAMETERS: P_UPLOAD AS CHECKBOX,
    P_FG RADIOBUTTON GROUP G1,
    P_BG RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN BEGIN OF BLOCK B4.
    PARAMETERS: P_DI AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK B4.
    SELECTION-SCREEN END OF BLOCK B2.
    AT SELECTION-SCREEN.
    *-- Wate Type Text
    SELECT SINGLE LGTXT INTO LGTXT FROM T512T WHERE SPRSL = 'E' AND
    MOLGA = '40' AND LGART = P_LGART1 .
    *-- Data Retrieval From Logical Database PNP
    GET PERNR.
    PROVIDE PERNR FROM P0000 VORNA NACHN FROM P0002 BETWEEN PN-BEGDA AND
    PN-ENDDA.
    INT_PETROL1-PERNR = P0000-PERNR.
    CONCATENATE P0002-VORNA P0002-NACHN INTO INT_PETROL1-NAME SEPARATED
    BY SPACE.
    ENDPROVIDE.
    *-- Clear Data
    CLEAR: RGDIR, INT_RGDIR.
    REFRESH: RGDIR, INT_RGDIR.
    *-- Read All The Payroll Runs For An Employee
    CD-KEY-PERNR = PERNR-PERNR.
    RP-IMP-C2-CU.
    CHECK RP-IMP-CD-SUBRC EQ 0.
    *-- Clear Data
    REFRESH: RT.
    Read IN Cluster.
    LOOP AT RGDIR WHERE FPBEG >= PN-BEGDA AND FPEND <= PN-ENDDA.
    MOVE-CORRESPONDING RGDIR TO INT_RGDIR.
    APPEND INT_RGDIR.
    CLEAR INT_RGDIR.
    ENDLOOP.
    Read the last record.
    SORT INT_RGDIR BY SEQNR DESCENDING.
    READ TABLE INT_RGDIR INDEX 1.
    RX-KEY-SEQNO = INT_RGDIR-SEQNR.
    RX-KEY-PERNR = PERNR-PERNR.
    RP-IMP-C2-IN.
    CHECK RP-IMP-IN-SUBRC EQ 0.
    READ TABLE RT WITH KEY LGART = P_LGART1.
    IF SY-SUBRC = 0.
    INT_PETROL1-PALLOWANCE = RT-BETRG.
    ENDIF.
    APPEND INT_PETROL1.
    CLEAR INT_PETROL1.
    SELECT TRFST PERNR
    INTO CORRESPONDING FIELDS OF TABLE PER_NO
    FROM PA0008
    WHERE TRFST LIKE 'L%'
    AND BET01 > 0.
    SORT PER_NO.
    DELETE ADJACENT DUPLICATES FROM PER_NO.
    *-- END-OF-SELECTION.
    END-OF-SELECTION.
    LOOP AT INT_PETROL1.
    READ TABLE PER_NO WITH KEY PERNR = INT_PETROL1-PERNR.
    IF SY-SUBRC = 0.
    INT_PETROL-TRFST = PER_NO-TRFST.
    MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING TRFST.
    ENDIF.
    ENDLOOP.
    SORT INT_PETROL1.
    DELETE ADJACENT DUPLICATES FROM INT_PETROL1.
    CONCATENATE 'From' ' : ' PN-BEGDA6(2) '.' PN-BEGDA4(2) '.' PN-
    BEGDA+0(4)
    ' To' ' : ' PN-ENDDA6(2) '.' PN-ENDDA4(2) '.' PN-ENDDA+0(4)
    INTO TITLE.
    IF P_DI = 'X'. "TO DISPLAY PETROL ALLOWANCE ONLY
    IF PNPTIMRA = 'X'. "CHECK OTHER PERIOD CHECKED
    DIS_FLAG = 1.
    ENDIF.
    IF PNPTIMR9 = 'X'. "CHECK TO SEE CURRENT PERIOD SELECTED
    CASES - NO RATE GIVEN, RATE GIVEN
    CURRENT PERIOD UPLOADED BUT PAYROLL NOT WRITTEN SO NO RESULT FROM LDB
    SELECT RATE INTO P_RATE FROM ZBPETROL_ALL WHERE BEGDA = PN- BEGDA AND ENDDA = PN-ENDDA.
    ENDSELECT.
    IF SY-DBCNT = 0.
    MESSAGE I455(0) WITH 'NO PETROL RATE EXSISTS'.
    ELSE.
    FLAG = 1.
    ENDIF. "OF SY-DBCNT
    IF P_RATE > 0 AND FLAG = 1. " PETROL RATE EXSISTS.
    SELECT PERNR SUM( BETRG ) INTO TABLE PA0015_DATA
    FROM PA0015
    WHERE BEGDA BETWEEN PN-BEGDA AND PN-ENDDA
    GROUP BY PERNR.
    SELECT APERNR ATRFST BVORNA BNACHN
    INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
    FROM PA0008 AS A
    INNER JOIN PA0002 AS B ON BPERNR = APERNR
    WHERE A~TRFST LIKE 'L%'
    AND A~BET01 > 0.
    SORT INT_PETROL3.
    DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
    REFRESH INT_PETROL1.
    LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
    employee name
    CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
    INT_PETROL2-NAME SEPARATED BY SPACE.
    MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
    ENDLOOP.
    LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
    one
    table to another table
    READ TABLE PA0015_DATA WITH KEY PERNR = INT_PETROL2-PERNR.
    IF SY-SUBRC = 0.
    INT_PETROL-PERNR = INT_PETROL2-PERNR.
    INT_PETROL-TRFST = INT_PETROL2-TRFST.
    INT_PETROL-NAME = INT_PETROL2-NAME.
    INT_PETROL-PALLOWANCE = PA0015_DATA-BETRG.
    APPEND INT_PETROL TO INT_PETROL1.
    ENDIF.
    ENDLOOP.
    DIS_FLAG = 1.
    ENDIF. "P_RATE > 0 AND FLAG = 1.
    IF P_RATE > 0 AND FLAG = 0. "CURRENT PERIOD AND DATA NOT UPLOADED
    SELECT APERNR ATRFST BVORNA BNACHN
    INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
    FROM PA0008 AS A
    INNER JOIN PA0002 AS B ON BPERNR = APERNR
    WHERE A~TRFST LIKE 'L%'
    AND A~BET01 > 0.
    SORT INT_PETROL3.
    DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
    REFRESH INT_PETROL1.
    LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
    employee name
    CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
    INT_PETROL2-NAME SEPARATED BY SPACE.
    MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
    ENDLOOP.
    PERFORM GET_VALUE. "TO CONVERT THE FIRST SCREEN PERNR INTO
    NUMBER FORMATE
    LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
    one
    table to another table
    READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
    IF SY-SUBRC <> 0.
    INT_PETROL-PERNR = INT_PETROL2-PERNR.
    INT_PETROL-TRFST = INT_PETROL2-TRFST.
    INT_PETROL-NAME = INT_PETROL2-NAME.
    APPEND INT_PETROL TO INT_PETROL1.
    ENDIF.
    ENDLOOP.
    PERFORM CAL_ALLOWANCE.
    ENDIF. " OF P_RATE > 0
    DIS_FLAG = 1.
    ENDIF. " OF CURRENT PERIOD CHECK.
    ENDIF. " OF CHECK DISPLAY.
    *----BDC
    IF P_UPLOAD = 'X'.
    IF PNPTIMRA = 'X'. "CHECK OTHER PERIOD CHECKED
    MESSAGE I455(0) WITH 'Petrol Allowance cannot be uploaded'.
    LEAVE SCREEN.
    ENDIF.
    IF P_RATE > 0.
    IF P_RATE > 0 OR P_RATE = 0.
    IF PNPTIMR9 = 'X'. "CHECK TO SEE CURRENT PERIOD SELECTED
    WA_PET_ALLOWANCE-BEGDA = PN-BEGDA.
    WA_PET_ALLOWANCE-ENDDA = PN-ENDDA.
    WA_PET_ALLOWANCE-RATE = P_RATE.
    WA_PET_ALLOWANCE-CURR = 'INR'.
    INSERT INTO ZBPETROL_ALL VALUES WA_PET_ALLOWANCE.
    SELECT A~PERNR A~TRFST B~VORNA B~NACHN
    INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
    FROM PA0008 AS A
    INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR
    WHERE A~TRFST IN ('L1' , 'L2' , 'L3')
    AND A~BET01 > 0.
    SORT INT_PETROL3.
    DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
    REFRESH INT_PETROL1.
    LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
    employee name
    CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
    INT_PETROL2-NAME SEPARATED BY SPACE.
    MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
    ENDLOOP.
    PERFORM GET_VALUE. "TO CONVERT THE FIRST SCREEN PERNR INTO
    NUMBER FORMATE
    LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
    one
    table to another table
    READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
    IF SY-SUBRC <> 0.
    INT_PETROL-PERNR = INT_PETROL2-PERNR.
    INT_PETROL-TRFST = INT_PETROL2-TRFST.
    INT_PETROL-NAME = INT_PETROL2-NAME.
    APPEND INT_PETROL TO INT_PETROL1.
    ENDIF.
    ENDLOOP.
    PERFORM CAL_ALLOWANCE.
    DIS_FLAG = 1.
    SORT INT_PETROL1.
    LOOP AT INT_PETROL1.
    MOVE: INT_PETROL1-PERNR TO INT_0015-PERNR,
    INT_PETROL1-PALLOWANCE TO INT_0015-BETRG.
    CONCATENATE PN-ENDDA6(2) PN-ENDDA4(2) PN-ENDDA+0(4) INTO
    INT_0015-BEGDA SEPARATED BY '.'.
    APPEND INT_0015.
    CLEAR INT_0015.
    ENDLOOP.
    LOOP AT INT_0015.
    PERFORM F_BDCDATA.
    IF P_FG = 'X'.
    CALL TRANSACTION 'PA30' USING BDCDATA MODE 'A' UPDATE 'S'.
    ELSE.
    CALL TRANSACTION 'PA30' USING BDCDATA MODE 'N' UPDATE 'S'.
    ENDIF.
    *-- Handling Error records.
    IF SY-SUBRC <> 0.
    *-- Handling Error Messages
    PERFORM ERROR_MSG.
    MOVE-CORRESPONDING INT_0015 TO E_INT_0015.
    APPEND E_INT_0015.
    CLEAR E_INT_0015.
    ENDIF.
    REFRESH BDCDATA.
    ENDLOOP.
    *-- Downloading Error Records.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    FILENAME = 'C:\Errors.Txt'
    FILETYPE = 'ASC'
    TABLES
    DATA_TAB = E_INT_0015.
    *-- Downloading Error Messages.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    FILENAME = 'C:\Err_Msg.Txt'
    FILETYPE = 'ASC'
    TABLES
    DATA_TAB = MSG.
    ENDIF. " FOR CURRENT PERIOD
    ENDIF.
    ELSE.
    MESSAGE I455(0) WITH 'Enter Petrol Rate'.
    LEAVE TO SCREEN 0.
    ENDIF. " FOR PETROL RATE
    ENDIF. " FOR UPLOAD
    IF DIS_FLAG = 1.
    INT_LAYOUT-SUBTOTALS_TEXT = TEXT-004.
    INT_LAYOUT-TOTALS_TEXT = TEXT-004.
    INT_LAYOUT-ZEBRA = 'X'.
    PERFORM FILL_FIELDCAT.
    PERFORM GET_EVENTS_ALV.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = WS_REPID
    IS_LAYOUT = INT_LAYOUT
    IT_FIELDCAT = INT_FIELDCAT[]
    I_DEFAULT = 'X'
    I_SAVE = 'X'
    IT_EVENTS = INT_EVENTS
    TABLES
    T_OUTTAB = INT_PETROL1
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    *& Form GET_VALUE
    text
    FORM GET_VALUE.
    GET PARAMETER ID: 'NUM' FIELD TEMP_NUM.
    IF TEMP_NUM <> ''.
    LEN1 = STRLEN( TEMP_NUM ).
    PERFORM GET_PERNR.
    APPEND TEMP_NUM TO EMPNO.
    LOOP AT EMPNO INTO EMP_NO.
    CALL FUNCTION 'CHECK_AND_CONVERT_NUMERICS'
    EXPORTING
    DFELD = ' '
    DMZEI = ','
    DTYPE = 'STRING'
    DYPNO = ' '
    EFELD = EMP_NO-PERNR
    FNAME = ' '
    PROGR = ' '
    IMP_DECIMALS = '0'
    IMPORTING
    ERROR =
    IFELD = EMP_NO1-PERNR
    MESSG = ERR
    MSGLN =
    IF ( ERR-MSGID = '' ).
    APPEND EMP_NO1 TO EMPNO1.
    CLEAR EMP_NO1-PERNR.
    ELSE.
    MESSAGE I455(0) WITH 'Could not convert employee number'.
    LEAVE TO SCREEN 0.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDFORM. "GET_VALUE
    *& Form GET_PERNR
    text
    FORM GET_PERNR.
    SPLIT TEMP_NUM AT ',' INTO EMP_NO TEMP_NUM.
    APPEND EMP_NO TO EMPNO.
    CLEAR EMP_NO.
    SEARCH TEMP_NUM FOR ','.
    IF SY-SUBRC = 0.
    PERFORM GET_PERNR.
    ENDIF.
    ENDFORM. "GET_PERNR
    *& Form ERROR_MSG
    text
    --> p1 text
    <-- p2 text
    FORM ERROR_MSG.
    IF SY-SUBRC <> 0.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    LANG = SY-LANGU
    IMPORTING
    MSG = MSG-MSG1.
    APPEND MSG.
    CLEAR MSG.
    ENDIF.
    ENDFORM. "ERROR_MSG
    *& Form F_BDCDATA
    text
    FORM F_BDCDATA.
    PERFORM BDC_DYNPRO USING 'SAPMP50A' '1000'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '=INS'.
    PERFORM BDC_FIELD USING 'RP50G-PERNR'
    INT_0015-PERNR.
    PERFORM BDC_FIELD USING 'RP50G-TIMR6'
    'X'.
    PERFORM BDC_FIELD USING 'BDC_CURSOR'
    'RP50G-CHOIC'.
    PERFORM BDC_FIELD USING 'RP50G-CHOIC'
    '0015'.
    PERFORM BDC_DYNPRO USING 'MP001500' '2000'.
    PERFORM BDC_FIELD USING 'BDC_CURSOR'
    'Q0015-BETRG'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '/00'.
    PERFORM BDC_FIELD USING 'P0015-LGART'
    '0077'. "CHANGE WAGE TYPE HERE
    ALSO
    PERFORM BDC_FIELD USING 'Q0015-BETRG'
    INT_0015-BETRG.
    PERFORM BDC_FIELD USING 'P0015-WAERS'
    'INR'.
    PERFORM BDC_FIELD USING 'P0015-BEGDA'
    INT_0015-BEGDA.
    PERFORM BDC_DYNPRO USING 'MP001500' '2000'.
    PERFORM BDC_FIELD USING 'BDC_CURSOR'
    'P0015-LGART'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '=UPD'.
    PERFORM BDC_FIELD USING 'P0015-LGART'
    '0077'. "CHANGE WAGE TYPE HERE
    ALSO
    PERFORM BDC_FIELD USING 'Q0015-BETRG'
    INT_0015-BETRG.
    PERFORM BDC_FIELD USING 'P0015-WAERS'
    'INR'.
    PERFORM BDC_FIELD USING 'P0015-BEGDA'
    INT_0015-BEGDA.
    ENDFORM. "F_BDCDATA
    *& Form BDC_DYNPRO
    text
    -->P_0732 text
    -->P_0733 text
    FORM BDC_DYNPRO USING VALUE(P_0732) TYPE C
    VALUE(P_0733) TYPE C.
    CLEAR BDCDATA.
    BDCDATA-PROGRAM = P_0732.
    BDCDATA-DYNPRO = P_0733.
    BDCDATA-DYNBEGIN = 'X'.
    APPEND BDCDATA.
    ENDFORM. " BDC_DYNPRO
    *& Form BDC_FIELD
    text
    -->P_0755 text
    -->P_0756 text
    FORM BDC_FIELD USING VALUE(P_0755) TYPE C
    VALUE(P_0756) TYPE C.
    CLEAR BDCDATA.
    BDCDATA-FNAM = P_0755.
    BDCDATA-FVAL = P_0756.
    APPEND BDCDATA.
    ENDFORM. " BDC_FIELD
    *& Form CAL_ALLOWANCE
    text
    FORM CAL_ALLOWANCE.
    LOOP AT INT_PETROL1 INTO INT_PETROL.
    IF INT_PETROL-TRFST = 'L1'.
    INT_PETROL-PALLOWANCE = P_RATE * 100. "CHANGE TO SELECT WHEN
    DISPLAY
    ELSEIF INT_PETROL-TRFST = 'L2'.
    INT_PETROL-PALLOWANCE = P_RATE * 150.
    ELSEIF INT_PETROL-TRFST = 'L3'.
    INT_PETROL-PALLOWANCE = P_RATE * 150.
    ELSEIF INT_PETROL-TRFST = 'L4'.
    INT_PETROL-PALLOWANCE = P_RATE * 200.
    ELSEIF INT_PETROL-TRFST = 'L5'.
    INT_PETROL-PALLOWANCE = P_RATE * 250.
    ENDIF.
    MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING PALLOWANCE.
    ENDLOOP.
    ENDFORM. "CAL_ALLOWANCE
    *& Form FILL_FIELDCAT
    text
    --> p1 text
    <-- p2 text
    FORM FILL_FIELDCAT.
    INT_FIELDCAT-COL_POS = 1.
    INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
    INT_FIELDCAT-FIELDNAME = 'PERNR'.
    INT_FIELDCAT-SELTEXT_L = TEXT-005.
    INT_FIELDCAT-OUTPUTLEN = 10.
    INT_FIELDCAT-KEY = 'X'.
    APPEND INT_FIELDCAT.
    CLEAR INT_FIELDCAT.
    INT_FIELDCAT-COL_POS = 2.
    INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
    INT_FIELDCAT-FIELDNAME = 'NAME'.
    INT_FIELDCAT-SELTEXT_L = TEXT-006.
    INT_FIELDCAT-OUTPUTLEN = 25.
    INT_FIELDCAT-KEY = 'X'.
    APPEND INT_FIELDCAT.
    CLEAR INT_FIELDCAT.
    INT_FIELDCAT-COL_POS = 3.
    INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
    INT_FIELDCAT-FIELDNAME = 'TRFST'.
    INT_FIELDCAT-SELTEXT_L = TEXT-007.
    INT_FIELDCAT-OUTPUTLEN = 5.
    INT_FIELDCAT-KEY = 'X'.
    APPEND INT_FIELDCAT.
    CLEAR INT_FIELDCAT.
    INT_FIELDCAT-COL_POS = 4.
    INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
    INT_FIELDCAT-FIELDNAME = 'PALLOWANCE'.
    INT_FIELDCAT-SELTEXT_L = TEXT-008.
    INT_FIELDCAT-OUTPUTLEN = 16.
    INT_FIELDCAT-KEY = 'X'.
    APPEND INT_FIELDCAT.
    CLEAR INT_FIELDCAT.
    ENDFORM. " FILL_FIELDCAT
    *& Form GET_EVENTS_ALV
    text
    --> p1 text
    <-- p2 text
    FORM GET_EVENTS_ALV.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 1
    IMPORTING
    ET_EVENTS = INT_EVENTS[]
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE INT_EVENTS INTO WS_EVENTS WITH KEY NAME =
    SLIS_EV_TOP_OF_PAGE.
    IF SY-SUBRC = 0.
    WS_EVENTS-FORM = 'TOP'.
    MODIFY INT_EVENTS FROM WS_EVENTS INDEX SY-TABIX.
    ENDIF.
    ENDFORM. " GET_EVENTS_ALV
    *& Form TOP-OF-PAGE
    text
    FORM TOP.
    *-- ALV Declarations
    DATA: WS_HEADER TYPE SLIS_T_LISTHEADER,
    WA_HEADER TYPE SLIS_LISTHEADER.
    *-- Title
    WA_HEADER-TYP = 'H'.
    WA_HEADER-INFO = TEXT-009.
    APPEND WA_HEADER TO WS_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'H'.
    WA_HEADER-INFO = TITLE.
    APPEND WA_HEADER TO WS_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'H'.
    WA_HEADER-INFO = ' '.
    APPEND WA_HEADER TO WS_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'H'.
    WA_HEADER-INFO = ' '.
    APPEND WA_HEADER TO WS_HEADER.
    CLEAR WA_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = WS_HEADER
    I_LOGO = 'LOGO'.
    ENDFORM. "TOP-OF-PAGE
    HR deals with the INFOTYPES which are similar to Tables in General ABAP.
    There are different ways of fetching data from these infotypes.
    There are different areas in HR LIKE Personal Admn, Orgn Management, Benefits, Time amangement, Event Management, Payroll etc
    Infotypes for these areas are different from one another area.
    storing of records data in each type of area is different
    LDBS like PNP are used in HR programing.
    Instead of Select.. we use some ROUTINES and PROVIDE..ENDPROVIDE.. etc
    and in the case of Pay roll we use Clusters and we Import and Export them for data fetching.
    On the whole Normal ABAP is different from HR abap.
    For Personal Admn the Infotypes start with PA0000 to PA1999
    Time Related Infotypes start with PA2000 to PA2999.
    Orgn related Infotypes start with HRP1000 to HRP1999.
    All custom developed infotypes stsrat with PA9000 onwards.
    In payroll processing we use Clusters like PCL1,2,3 and 4.
    Instead of Select query we use PROVIDE and ENDPROVIDE..
    You have to assign a Logical Database in the attributes PNP.
    Go through the SAp doc for HR programming and start doing.
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    See:
    http://help.sap.com/saphelp_46c/helpdata/en/4f/d5268a575e11d189270000e8322f96/content.htm
    sites regarding hr-abap:
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPD/PAPD.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYINT/PYINT_BASICS.pdf
    http://www.atomhr.com/training/Technical_Topics_in_HR.htm
    http://www.planetsap.com/hr_abap_main_page.htm
    You can see some Standard Program examples in this one ...
    http://www.sapdevelopment.co.uk/programs/programshr.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?Offer=SAlgwn12604#Certification
    http://www.erpgenie.com/faq/hr.htm.
    http://www.planetsap.com/hr_abap_main_page.htm
    http://www.sapbrain.com/TUTORIALS/FUNCTIONAL/HR_tutorial.html
    These are the FAQ's that might helps you as well.
    http://www.sap-img.com/human/hr-faq.htm
    http://www.sapgenie.com/faq/hr.htm
    http://www.planetsap.com/hr_abap_main_page.htm
    http://www.atomhr.com/library_full.htm
    HR Long texts Upload
    Look at the below link
    BDC - hr maintain text
    Please refer to the following sample program for accessing PCH LDB.
    For concept to start with refer url:
    http://www.sap-press.de/download/dateien/860/sappress_mysap_hr_technical_principles2.pdf
    It contains info regarding PCH Reporting.
    REPORT zhsol010.
    TABLES: objec, gdstr.
    INFOTYPES: 0002, 0006, 1003.
    DATA: stabs LIKE p1003-stabs,
    name LIKE p0001-ename.
    INITIALIZATION.
    pchotype = 'O'.
    pchwegid = 'O-S-P'.
    GET objec.
    IF objec-otype = 'S'.
    CLEAR stabs.
    LOOP AT p1003 WHERE begda LE pc-endda
    AND endda GE pc-begda.
    IF p1003-stabs = 'X'.
    stabs = 'X'.
    WRITE : / objec-objid, objec-short, objec-stext.
    ENDIF.
    ENDLOOP.
    ENDIF.
    IF objec-otype = 'P' AND stabs = 'X'.
    PROVIDE vorna nachn FROM p0002
    subty telnr FROM p0006
    BETWEEN pc-begda and pc-endda
    WHERE p0006-subty = '1'.
    IF p0006_valid = 'X'.
    CONCATENATE p0002-vorna p0002-nachn INTO name
    SEPARATED BY space.
    WRITE: / name, p0006-telnr.
    SKIP.
    ENDIF.
    ENDPROVIDE.
    ENDIF.
    sample code:
    REPORT zpwtest .
    TABLES : t001 .
    TYPE-POOLS slis .
    DATA : t_t001 TYPE TABLE OF t001 ,
    t_abaplist TYPE TABLE OF abaplist .
    DATA : w_abaplist TYPE abaplist .
    SELECT-OPTIONS : s_bukrs FOR t001-bukrs OBLIGATORY .
    PARAMETERS : p_list TYPE c NO-DISPLAY .
    START-OF-SELECTION .
    IF sy-batch = 'X' AND p_list IS INITIAL .
    Submit report and get list in memory
    SUBMIT zpwtest EXPORTING LIST TO MEMORY
    WITH s_bukrs IN s_bukrs
    WITH p_list = 'X'
    AND RETURN.
    Get the list from memory.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = t_abaplist
    EXCEPTIONS
    not_found = 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.
    Send report to mail receipent
    PERFORM send_mail .
    ELSE.
    PERFORM select_data .
    PERFORM display_data .
    ENDIF.
    *SO_NEW_DOCUMENT_SEND_API1
    *& Form select_data
    FORM select_data.
    SELECT *
    INTO TABLE t_t001
    FROM t001
    WHERE bukrs IN s_bukrs .
    ENDFORM. " select_data
    *& Form display_data
    FORM display_data.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_structure_name = 'T001'
    TABLES
    t_outtab = t_t001
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " display_data
    *& Form send_mail
    FORM send_mail.
    DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
    receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
    packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
    listobject LIKE abaplist OCCURS 10,
    compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
    w_object_hd_change LIKE sood1,
    compressed_size LIKE sy-index.
    Fot external email id
    receiver_list-recextnam = '[email protected]'.
    receiver_list-recesc = 'E'.
    receiver_list-sndart = 'INT'.
    receiver_list-sndpri = '1'.
    FOr internal email id
    receiver_list-recnam = sy-uname .
    receiver_list-esc_des = 'B'.
    APPEND receiver_list.
    General data
    w_object_hd_change-objla = sy-langu.
    w_object_hd_change-objnam = 'Object name'.
    w_object_hd_change-objsns = 'P'.
    Mail subject
    w_object_hd_change-objdes = 'Message subject'.
    Mail body
    APPEND 'Message content' TO message_content.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    compressed_size = compressed_size
    TABLES
    in = t_abaplist
    out = compressed_attachment.
    DESCRIBE TABLE compressed_attachment.
    CLEAR packing_list.
    packing_list-transf_bin = 'X'.
    packing_list-head_start = 0.
    packing_list-head_num = 0.
    packing_list-body_start = 1.
    packing_list-body_num = sy-tfill.
    packing_list-objtp = 'ALI'.
    packing_list-objnam = 'Object name'.
    packing_list-objdes = 'Attachment description'.
    packing_list-objlen = compressed_size.
    APPEND packing_list.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    object_hd_change = w_object_hd_change
    object_type = 'RAW'
    owner = sy-uname
    TABLES
    objcont = message_content
    receivers = receiver_list
    packing_list = packing_list
    att_cont = compressed_attachment.
    ENDFORM. " send_mail
    Check this links,
    https://forums.sdn.sap.com/click.jspa?searchID=4564732&messageID=3009173
    https://forums.sdn.sap.com/click.jspa?searchID=4564732&messageID=2198920
    https://forums.sdn.sap.com/click.jspa?searchID=4564732&messageID=1714842
    https://forums.sdn.sap.com/click.jspa?searchID=4564732&messageID=2232979
    Regards
    vasu

Maybe you are looking for

  • Someone else with same problems?

    I have a kt4-ultra and i wato to know if someone else have or had my problem...i have i xp 2100+ and i am not able to run it at fsb 133 mhz i must set it to 125 mhz... I haven't found solution at this problem....(temperature ok...400 w ali ok...ram o

  • What happened to searching the body of emails in iOS 5?

    Although Apple advertised it as a feature of the mail app in iOS 5, I am unable to search the body of emails.

  • Firefox will not load either Google, or my AOL mail

    When I type in http://www.google.com, the site will not load. Also, when I am signed in on http://www.aol.com , if I click the mail icon, my mail page will not load.

  • Javac -- javax.servlet does not exist

    I have j2sdk1.4, j2re1.4 installed on rhat7.1 and CLASSPATH=/j2sdk1.4/lib/tools.jar PATH=/j2sdk1.4/bin when I run javac (or /j2sdk1.4/bin/./javac) test.java it issue: test.java: package javax.servlet does not exist import javax.servlet.*; any suggest

  • SAP Netweaver 7.00 - JSPM hangs during deployment

    Hello community, we have an environment with SAP Netweaver 7.00 Java stack only We are trying to apply Support package stack SP20, starting from SP14, but JSPM remains hang after the start of the deploy. JSPM window becomes blank and we are not able