ABAP Code Generator

Hi, I wish to write a program that generates and create the code for me.
One example could be I see a standard SAP Module which I like, but want to change it slightly. I enter the function module in to a program click execute it it generate an identical function module in the repository but with Z infront of all the parameters.
I know in CRM the Replication extract modules are generated based on criteria so am sure it is possible.
I know this may seem a little excessive, but I wish to introduce an extra degree of flexibility into our custom programs and wish to POC this method.
Does anybody know if any documentation or books that exists on the relevent technique to achieve such a thing. e.g. are their standard Modules to call.
Thanks
Andrew

Hi Andrew!
A simple copy might bring you faster to your goal. At least, have a look at the copy function of SE37 (entry screen).
But be careful: there are global parameters! There are several function modules, which use variables in common (..._init, ...change, ...post)!
Not without reason FM copying is based on whole function groups. Same applies for includes / whole programs.
Once you have a complete copy, you can decide to include standard parts (for functions, you don't want to change) again: your own copy will have some z-includes, some standard parts.
Now you can use some search&replace. This you can do manually - or via an own program, if you like.
Copying I would do by standard (maybe you make a call transaction to SE37 / SE38), for automatic code changes have a look at statements 'read report...' 'insert report...'. They handle source code (of includes) in internal tables.
Regards,
Christian

Similar Messages

  • How to generate new perner number using Abap Code in pa0002. what is the fu

    how to generate new perner number using Abap Code in pa0002. what is the function Module used.

    hi
    define internal number ranges for ur implementation then when u run PA 40  do not input any employee number , system will generate the employee number automatically.
    Regards
    sameer

  • LKM SAP BW to Oracle (SQLLDR) generates sintax error in ABAP code.

    Hi Experts,
    We are installing a SAP BW KM's in ODI 11g.
    Actually, we are able to make reverse ingeneering succesfully.
    Now we want to use the LKM in order to extract SAP data.
    The KM fails, in step Generate ABAP Code. The code is uploaded to SAP system but with sintaxis errors.
    That's the beginning of the SAPAbapExecuteOpenTool_8001_7001.log.
    +##################################################+
    +############ Open Tool Logger ####################+
    +##################################################+
    +############ Upload value: 1+
    +############ Execute value: 1+
    +############ BASE RKM FLAG: 0+
    +############ ZRFC_RUN_INSTALL: 1+
    +############ Abap Function Name: ZODI_8001_7001+
    +############ Sap Host Name: XXXXXXXX+
    +############ Sap User Name: XXXX+
    +############ Sap password: ********+
    +############ Sap Client: 100+
    +############ Sap language: ES+
    +############ Sap system no: 00+
    +############ Sap Connection Pool Name: SAP_ODI_LKM_POOL_GLOBAL+
    +############ Sap Connection Pool Size: 10+
    +############ Sap Function group name: ZODIBW_LKM_FGRP+
    +############ File Delimiter:+
    +############ File Name: ZODI_8001_7001.txt+
    +############ FTP Host: XXXXXXXXX+
    +############ FTP User: ftpbi+
    +############ FTP Password: ********+
    +############ FTP Passive Mode: 1+
    +############ FTP Transfer Time out: 100000+
    +############ User abap parameter names: IV_DELIMITER,CHAR1;IV_FILENAME,CHAR255;IV_USER,CHAR35;IV_PWD,CHAR35;IV_HOST,CHAR35;IV_HASHVALUE,CHAR35;IV_PATH,CHAR35;IV_REQUID_L,RSSID;IV_REQUID_H,RSSID+
    +############ Abap rfc table parameters: RETURN,BAPIRETURN;ET_FILE_RETURN,BAPIRET2+
    +############ Log File Name: /tmp/SAPAbapExecuteOpenTool_8001_7001.log+
    +############ OpenHub Path: /tmp/+
    +############ Delta Extraction First Request ID : 0+
    +############ Delta Extraction Last Request ID : 0+
    +############ SAP Development Class : ZODIBW_PCKG+
    +############ Max Row Count :+
    +############ Fetch Batch Size :+
    +############ Hash Value Marker: HVM+
    +############ Generated Program:+
    *** ODS DSO extraction
    TYPES: BEGIN OF ty_final,
    +/BIC/AZOFI_UTE00_/BIC/ZFI_SOCOR+
    TYPE
    +/BIC/AZOFI_UTE00-/BIC/ZFI_SOCOR,+
    +/BIC/AZOFI_UTE00_SOURSYSTEM+
    TYPE
    +/BIC/AZOFI_UTE00-SOURSYSTEM,+
    END OF ty_final.
    In the SAP GUI shows a sintaxis error.
    Functions Module ZODI_8001_7001. line 25
    The name "/BIC/AZOFI_UTE00_/BIC/ZFI_SOCOR" is longer that allowed.
    +30 characters.+
    Really the TYPE "/BIC/AZOFI_UTE00_/BIC/ZFI_SOCOR" has 31 characters.
    The sufix "/BIC/" is the "NAMESPACE", a SAP grouping concept.
    AZOFI_UTE00 is a table name.
    ZFI_SOCOR is a column name.
    Are this sufix correct in the APAP code?
    Has anyone had that problem?
    Any comment will be wellcome.
    Thank's in advance.

    Hi Somchai,
    r U able to resolve ur issue ..........i'm also struck there at the same point.
    I am using shared folder for file transfer and my error message is
    java.lang.RuntimeException: Error occured in open tool execute method...Error in executing ABAP program...Error in executing ABAP program...Error occurred when creating dataset\\<hostname>\bi-interface$\ZODI_11001_12001_GLOBAL.txt
    Thanks.
    Edited by: Drona on Mar 26, 2012 7:25 AM

  • How to insert abap code in LSMW generated program?

    hi,
    i m working on LSMW for loading data in SAP
    i would like to insert abap code into the generated program....
    it's because i have 1 BKPF segment (header data), 2 BSEG segments, but i cannot define rules by customizing for the second BSEG segment(LSMW doesn't permitt).
    i already tried to insert code directly into the program, but obviously it disapears at each time i generate the program.
    i saw that apparently a code insertion has already be made into this program and the subject of this insertion is to define rules for the second BSEG (exactly what i want to do....) and this modification doesn't disapear at new prog generation.....
    Any idea ?

    Hi
    Why dont you use the FORM provided by LSMW
    To use this please do the following
    1.Goto option <b>Maintain Field Mapping and Conversion Rules</b>
    2.Goto menu <b>EXTRAS->LAYOUT->Form Routines</b>
      Here you will now get many options like
       Global Data
       Begin of Transaction
    Begin of Processing
    Begin of Record
      like wise the End of these also.
    Please put a breakpoint and check where you want to insert your code.
    Note:
    This is only for the Conversion Program and does not affect the main program used to update the Standard Tables
    Hi , I was reading your earlier post .. It seems that you have worked on EMIGALL. Consider a similar situation, it is like writing the code in the events till CALL01...
    Thanks
    DOminic
    Message was edited by: Dominic  Pappaly

  • ABAP code to automatic generate an BW Report

    HI Sap BW gurus,
    Can anyone tell me if exists an abap code to automatic generate an report from a query and save it on an directory in HTML format?
    Thanks in advanced,
    Pedro Martins

    You can use this tool...
    /people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-i
    but then you would have to store it into an application server directory as HTML - there is also a how to paper by the same author which you can use... which talks about email query results in HTML
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b7658119-0a01-0010-39a9-b600c816f370;jsessionid=%28J2EE3414800%29ID1001478750DB10940138154678751341End

  • ABAP Code example using "GENERATE DYNPRO"

    I am looking for ABAP code example who use the "Generate dynpro" dynamic generation of dynpro at runtime under SAP 4.6C version.
    Best regards,

    We have some programs that do:
    form %view.
    data: anz type i,
          prog like sy-repid.
      prog = sy-repid.
      perform init_download(rsaqexce).
      case %tab.
      when 'G00'.
        perform generate_view_dynpro(rsaqexce)
                using prog text-grl.
        describe table %g00 lines anz.
        tview100-lines = anz.
        perform init_view(rsaqexce) tables %g00 using tview100.
        call screen 100.
        perform reset_view_dynpro(rsaqexce).
      when others.
        message s860(aq).
      endcase.
    endform.
    I think they were copied from existing SAP programs. In any event, look at the relevant forms in program rsaqexce.
    And as Rich noted, SAP doesn't recommend this.
    Rob

  • Sample ABAP code for userexits, and calling bapi's

    Hi,
    Can someone please send me sample ABAP code
    1) to do extractor enhancement using user exit.
    2) ABAP program to call BAPI to read live cache order series data in SNP and write to Idocs through some ports.
    3) ABAP routine to generate file name (based on date/country)in the infopackage to upload flatfiles.
    Thank you very much in advance and appreciate any help.
    Regards
    Prasad

    hai ,
    check this code...
    *& Tables
    tables : tstc,     "SAP Transaction Codes
             tadir,    "Directory of Repository Objects
             modsapt,  "SAP Enhancements - Short Texts
             modact,   "Modifications
             trdir,    "System table TRDIR
             tfdir,    "Function Module
             enlfdir,  "Additional Attributes for Function Modules
             tstct.    "Transaction Code Texts
    *& Variables
    data : jtab like tadir occurs 0 with header line.
    data : field1(30).
    data : v_devclass like tadir-devclass.
    *& Selection Screen Parameters
    selection-screen begin of block a01 with frame title text-001.
    selection-screen skip.
    parameters : p_tcode like tstc-tcode obligatory.
    selection-screen skip.
    selection-screen end of block a01.
    *& Start of main program
    start-of-selection.
    Validate Transaction Code
      select single * from tstc
        where tcode eq p_tcode.
    Find Repository Objects for transaction code
      if sy-subrc eq 0.
        select single * from tadir
           where pgmid    = 'R3TR'
             and object   = 'PROG'
             and obj_name = tstc-pgmna.
        move : tadir-devclass to v_devclass.
        if sy-subrc ne 0.
          select single * from trdir
             where name = tstc-pgmna.
          if trdir-subc eq 'F'.
            select single * from tfdir
              where pname = tstc-pgmna.
            select single * from enlfdir
              where funcname = tfdir-funcname.
            select single * from tadir
              where pgmid    = 'R3TR'
                and object   = 'FUGR'
                and obj_name = enlfdir-area.
            move : tadir-devclass to v_devclass.
          endif.
        endif.
    Find SAP Modifactions
        select * from tadir
          into table jtab
          where pgmid    = 'R3TR'
            and object   = 'SMOD'
            and devclass = v_devclass.
        select single * from tstct
          where sprsl eq sy-langu
            and tcode eq p_tcode.
        format color col_positive intensified off.
        write:/(19) 'Transaction Code - ',
        20(20) p_tcode,
        45(50) tstct-ttext.
        skip.
        if not jtab[] is initial.
          write:/(95) sy-uline.
          format color col_heading intensified on.
          write:/1 sy-vline,
          2 'Exit Name',
          21 sy-vline ,
          22 'Description',
          95 sy-vline.
          write:/(95) sy-uline.
          loop at jtab.
            select single * from modsapt
            where sprsl = sy-langu and
            name = jtab-obj_name.
            format color col_normal intensified off.
            write:/1 sy-vline,
            2 jtab-obj_name hotspot on,
            21 sy-vline ,
            22 modsapt-modtext,
            95 sy-vline.
          endloop.
          write:/(95) sy-uline.
          describe table jtab.
          skip.
          format color col_total intensified on.
          write:/ 'No of Exits:' , sy-tfill.
        else.
          format color col_negative intensified on.
          write:/(95) 'No User Exit exists'.
        endif.
      else.
        format color col_negative intensified on.
        write:/(95) 'Transaction Code Does Not Exist'.
      endif.
    Take the user to SMOD for the Exit that was selected.
    at line-selection.
      get cursor field field1.
      check field1(4) eq 'JTAB'.
      set parameter id 'MON' field sy-lisel+1(10).
      call transaction 'SMOD' and skip first screen.

  • Warning codes generated in UCCHECK   - Technical Upgrade - 4.0b to ECC 6.0

    Hi SDN'ers ,
    I am currently working on Technical Upgrade project from 4.0 b system to ECC 6.0 system . I am facing a
    problem relating to the analysis of the warnings displayed whehn we run the UCCHECK for the client inventory by
    checking the "Display lines that cannot be analyzed statically" option under the Selection-screen block
    "Statements that cannot be analyzed statically" .Based on the warning codes generated during UCCHECK, they can
    be classified into 12 different categories given below in the list ( Viz. ABB,MESSAGEG!C,MESSAGEG!D......MESSAGEG!P).The same are given below in the end
    I want to know
    - Which are the warning codes which need resolution so that the program does not encounter any runtime
    errors or during Integration testing ?
    - Do all the offset related errors (For example ;variable A = B+offset(length)
    or  variable A+offset(length) = B ) need resolution so that the program gives no runtime error.
    - Also, do all statements where length is calculated using STRLEN also need changes ? I have seen offset length related warnings come under MESSAGEG!M warning code.
    The objective of this is to make sure that the upgraded system ECC 6.0 in Australia ,when rolled out to
    non-English speaking geographies in APAc such as Malaysia,Japan or China would only need translations and no ABAP Coding effort even when using languages such as Japanese which have double byte characters.
    S.No.     Error Code     Message
    1     ABB     Syntax Check Aborted
         ABB Total     
    2     MESSAGEG!C      check at runtime. at runtime.
               statement because of untyped or generic operands. It can only carry out this
              The system could not perform a static convertibility check on the current
         MESSAGEG!C Total     
    3     MESSAGEG!D      out this check at runtime. It can only carry out this check at runtime.
               to a table line because of untyped or generic operands. It can only carry out
              The system could not perform a static check on convertibility from a work area
         MESSAGEG!D Total     
    4     MESSAGEG!E      check at runtime. at runtime.
               defined by a "DATA" statement. .
               statement because of untyped or generic operands. It can only carry out this
              Field "ELEMENTN" is unknown. It is neither in one of the specified tables nor
              The system could not perform a static comparability check on the current
         MESSAGEG!E Total     
    5     MESSAGEG!F      operand "<FELD1>" for the current statement. .
         MESSAGEG!F Total     
    6     MESSAGEG!G      current statement on incompletely typed operand "<DATA>". .
         MESSAGEG!G Total     
    7     MESSAGEG!H      for the incompletely typed operand "<S>". . - - - - - - - - -
              The system cannot perform a static check on a character-type field data type
         MESSAGEG!H Total     
    8     MESSAGEG!I      incompletely-typed operand "<A>" in the current statement. .
              The system cannot perform a static check on a character-type data type for the
         MESSAGEG!I Total     
    9     MESSAGEG!J      "<%_1_SYSINI>" in the current statement to check whether the operand can be
              The system cannot perform a static check on incompletely-typed operand "VALUE"
         MESSAGEG!J Total     
    Early response wil be highly appreciated.

    Hi Karthik
    >
    > 1) SPDD adjustments are done in which phase? PREPARE or UPGRADE?
    >
    SPDD is done in Upgrade ->Phase ACT_700
    > 2) Are here special cases where the adjustments need to be done before running the UPGRADE phase?
    >
    At ACT_700 phase stop the upgrade and take a backup of the DB and the PUT<DIR> before starting the SPDD activity.
    Make sure there are no pending tp request.  Either release them or delete them.
    All phase need to be completed successfully in PREPARE, before starting UPGRADE
    Cheers
    Shaji
    Edited by: Shaji Jacob on May 5, 2008 9:23 PM

  • Warning codes generated in UCCHECK

    Hi SDN'ers ,
    I am currently working on Technical Upgrade project from 4.0 b system to ECC 6.0 system . I am facing a
    problem relating to the analysis of the warnings displayed whehn we run the UCCHECK for the client inventory by
    checking the "Display lines that cannot be analyzed statically" option under the Selection-screen block
    "Statements that cannot be analyzed statically" .Based on the warning codes generated during UCCHECK, they can
    be classified into 12 different categories given below in the list ( Viz. ABB,MESSAGEG!C,MESSAGEG!D......MESSAGEG!P).The same are given below in the end
    I want to know
    - Which are the warning codes which need resolution so that the program does not encounter any runtime
    errors or during Integration testing ?
    - Do all the offset related errors (For example ;variable A = B+offset(length)
    or  variable A+offset(length) = B ) need resolution so that the program gives no runtime error.
    - Also, do all statements where length is calculated using STRLEN also need changes ? I have seen offset length related warnings come under MESSAGEG!M warning code.
    The objective of this is to make sure that the upgraded system ECC 6.0 in Australia ,when rolled out to
    non-English speaking geographies in APAc such as Malaysia,Japan or China would only need translations and no ABAP Coding effort even when using languages such as Japanese which have double byte characters.
    S.No.     Error Code     Message
    1     ABB     Syntax Check Aborted
         ABB Total     
    2     MESSAGEG!C      check at runtime. at runtime.
               statement because of untyped or generic operands. It can only carry out this
              The system could not perform a static convertibility check on the current
         MESSAGEG!C Total     
    3     MESSAGEG!D      out this check at runtime. It can only carry out this check at runtime.
               to a table line because of untyped or generic operands. It can only carry out
              The system could not perform a static check on convertibility from a work area
         MESSAGEG!D Total     
    4     MESSAGEG!E      check at runtime. at runtime.
               defined by a "DATA" statement. .
               statement because of untyped or generic operands. It can only carry out this
              Field "ELEMENTN" is unknown. It is neither in one of the specified tables nor
              The system could not perform a static comparability check on the current
         MESSAGEG!E Total     
    5     MESSAGEG!F      operand "<FELD1>" for the current statement. .
         MESSAGEG!F Total     
    6     MESSAGEG!G      current statement on incompletely typed operand "<DATA>". .
         MESSAGEG!G Total     
    7     MESSAGEG!H      for the incompletely typed operand "<S>". . - - - - - - - - -
              The system cannot perform a static check on a character-type field data type
         MESSAGEG!H Total     
    8     MESSAGEG!I      incompletely-typed operand "<A>" in the current statement. .
              The system cannot perform a static check on a character-type data type for the
         MESSAGEG!I Total     
    9     MESSAGEG!J      "<%_1_SYSINI>" in the current statement to check whether the operand can be
              The system cannot perform a static check on incompletely-typed operand "VALUE"
         MESSAGEG!J Total     
    Early response wil be highly appreciated.
    10     MESSAGEG!K      "<F_YEAR>" in the current statement to check whether the operand can be
              The system cannot perform a static check for incompletely-typed operand "WINY2"
         MESSAGEG!K Total     
    11     MESSAGEG!M      .
               at runtime. .
               check will take place at runtime. .
               entries for operand "<F_SOURCE>(2)". This check will take place at runtime. .
               entries for operand "<F_SOURCE>+2(2)". This check will take place at runtime.
              The system cannot perform a static check on the validity of the offset/length
         MESSAGEG!M Total     
    12     MESSAGEG!P      out this check at runtime. at runtime.
               statement because of untyped or generic operands. The system can only carry
              The system could not perform a static compatibility check on the current
         MESSAGEG!P Total     
         Grand Total

    Hi Monica,
                 as bhaskar said no need to worry about warnings.
    warnings will not lead to dump. only runtime errors will lead to dump.
    if the system is unicode, remediate the objects without errors.
    we can observe mainly,
    open dataset, structure incompatibilty, offset, in byte or char mode etc
    thanks
    vinod

  • Schedule a background job for a program using ABAP code.

    Hi,
    I have to write a program to schedule a background job for another program.
    Need your help to understand how we can achieve this functionality.Any example of an abap code would be of great help.
    Need it urgently.
    Thanks in advance.
    Sandeep.

    Hi Sandeep,
    Here is the demo program regarding the BDC For the background job.
    report zprprbdc1
           no standard page heading line-size 255.
    include bdcrecx1.
    parameters: dataset(132) lower case.
    ***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
    *   If it is nessesary to change the data section use the rules:
    *   1.) Each definition of a field exists of two lines
    *   2.) The first line shows exactly the comment
    *       '* data element: ' followed with the data element
    *       which describes the field.
    *       If you don't have a data element use the
    *       comment without a data element name
    *   3.) The second line shows the fieldname of the
    *       structure, the fieldname must consist of
    *       a fieldname and optional the character '_' and
    *       three numbers and the field length in brackets
    *   4.) Each field must be type C.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    ***data: begin of itab occurs 0 ,
    ***       matnr(20) type c,
    ***       mbrsh(30) type c,
    ***       mtart(30) type c,
    ***       kzsel(20) type c,
    ***       maktx(40) type c,
    ***       meins(5) type c,
    ***       end of itab.
    data: begin of record occurs 0,
    * data element: MATNR
            matnr_001(018),
    * data element: MBRSH
            mbrsh_002(001),
    * data element: MTART
            mtart_003(004),
    * data element: XFELD
            kzsel_01_004(001),
    * data element: MAKTX
            maktx_005(040),
    * data element: MEINS
            meins_006(003),
    * data element: MTPOS_MARA
            mtpos_mara_007(004),
          end of record.
    *** End generated data section ***
    start-of-selection.
    *perform open_dataset using dataset.
    perform open_group.
    **do.
    **read dataset dataset into record.
    **if sy-subrc <> 0. exit. endif.
    call function 'GUI_UPLOAD'
      exporting
        filename                      = 'c:\jitu\bdc\10002.txt'
       filetype                      = 'ASC'
       has_field_separator           = 'x'
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      tables
        data_tab                      = record
    * EXCEPTIONS
    *   FILE_OPEN_ERROR               = 1
    *   FILE_READ_ERROR               = 2
    *   NO_BATCH                      = 3
    *   GUI_REFUSE_FILETRANSFER       = 4
    *   INVALID_TYPE                  = 5
    *   NO_AUTHORITY                  = 6
    *   UNKNOWN_ERROR                 = 7
    *   BAD_DATA_FORMAT               = 8
    *   HEADER_NOT_ALLOWED            = 9
    *   SEPARATOR_NOT_ALLOWED         = 10
    *   HEADER_TOO_LONG               = 11
    *   UNKNOWN_DP_ERROR              = 12
    *   ACCESS_DENIED                 = 13
    *   DP_OUT_OF_MEMORY              = 14
    *   DISK_FULL                     = 15
    *   DP_TIMEOUT                    = 16
    *   OTHERS                        = 17
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    loop at record .
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  record-matnr_001.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-mbrsh_002.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-mtart_003.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-kzsel_01_004.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-maktx_005.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-meins_006.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-mtpos_mara_007.
    perform bdc_transaction using 'MM01'.
    **enddo.
    endloop.
    perform close_group.
    *perform close_dataset using dataset.
    &*****************Reward point if helpful************&

  • Error in ABAP code generation?

    Hi,
    I am using OWB 10.1 to generate ABAP code for SAP-Data-Extraction. For extracting date values there are two APAB lines which (want to) produce one line in the result SQLLDR-Script. ABAP will accept only around 73 characters per line and this is the reason for the two lines.
    But ABAP does not accept a line break inside a string and thus this code runs into an ABAP-error.
    This all seems to be standard - has anyone a solution?
    generated ABAP-lines:
    Line1: TRANSFER ',ERDAT_DATUM_AN_DEM_DER_SATZ_HI DATE ''yyyymmdd'' NULLIF
    Line2: ERDAT_DATUM_AN_DEM_DER_SATZ_HI=''00000000''' TO DATAFILENAME.
    many thanks

    Hello Jean-Pierre,
    many thanks for your answer. Not the expected solution but it works. Another solution we found is to put an ampersand behind the first line, which tells ABAP that this is a line break. But also here manually work is necessary and also changing generated code.
    Cheers
    Stefan

  • ABAP code which will use function module during field mapping in LSMW

    Hi,
    During field mapping in LSMW, for one of the field called field, I want to use a function module 'QF05_RANDOM_INTEGER', which will generate random numbers and map that random number to that field.
    How do I write ABAP code which uses function module, during filed mapping for a particluar field in LSMW ?
    Please help...
    Regards,
    Tushar.

    Hi Tushar,
    You can write in FORM ROUTINE and LSMW.
    I hope you know how to write ABAP code at field level.
    If not ...
    Come to change mode->select the field->Rule->ABAP Code
    write a perform statement in ABAP code at field level.
    <b>PERFORM test</b> using val
                 changing valu.
    Go to Utilities(at menu)->switch layout-> extras ->select Layout->check Form routine-> it will display a FORM Routine... at bottom
    this is the place where you can write some code for
    <b> FORM test</b> using value
              changing value1
      FM call....
    .ENDFORM  
    Get the value1 returned and use for the Field population.
    Reward points if this Helps.
    Manish
    Message was edited by:
            Manish Kumar

  • Execute ABAP Code Inspector from Outside of SAP

    Hi all...
    For reporting purpose, I would like to use ABAP Code Inspector (transaction SCI) for generating output as a file, it should call from outside of SAP through RFC function module and generate the list (output) as flat file (or XML), does anyone have been done with similar work like this? I wonder if you could share your experience with me...
    thanks in advance,
    yayan irianto.

    I managed to set up the variant, however found a problem.
    I used "Search ABAP Statement Patterns" under "Search Functs" and set the pattern like followings.
    SELECT + INTO *
    SELECT SINGLE + INTO *
    However following statements were detected.
    SELECT * INTO TABLE IT_DRAW FROM DRAW.
    SELECT MANDT INTO TABLE IT_DRAW FROM DRAW.
    SELECT SINGLE * INTO TABLE IT_DRAW FROM DRAW.
    SELECT SINGLE MANDT INTO TABLE IT_DRAW FROM DRAW.
    It's because + means one ABAP token in the code inspector.
    Is there anyway to find only "SELECT SINGLE *" and "SELECT *" ?

  • ECATT/ABAP code to close a session while executing a chain script

    How to close the extra created session during the execution of chain script??
    Details of the problem:
    I'm using eCATT for automating different business flows in SAP,
    For a particular scenario I have to create a chain script,
    One chain script may contain up to 40 individual scripts,
    This chain script will contain around 7 report programs using SE38 transation,
    While executing SE38 script(report program), one extra session is opening (log display session),
    but, my script can close the original SE38 screen only, not the extra created session,
    So, after executing 5 scripts (SE38 scripts), then "sessions reached to its max" message is appearing, and the script is failing,
    As it is a automation test script, no manual interaction will be there,
    i.e - we should not close the extra session manually.
    Now, my question is:
    How to close the extra created session..??
    How the recording should be done to handle this problem..??
    or any extra code should be added to close the extra session..??
    Is there any ABAP code.. or eCATT command available to handle this problem..??
    If you have any idea to close the extra created session, please share it with me,
    my effort:
    I tried with "RESCON" command... this will close all the SAP sessions,
    This will not work for my scenario,
    and, I tried with "Close session after every RFC",
    this will work, but, after executing 5 SE38 scripts, I'm facing the above problem.
    Please suggest me a solution, Thanks in advance..
    Regards,
    Chandra shekhar.A
    Message was edited by:
            chandra shekhar
    Message was edited by:
            chandra shekhar

    user13490676 wrote:
    could it be a problem with jmf itself that the endofstream doesnt get generated for the datasource being read from a fileIn this instance, that would be the problem... more than likely, there's something weird about the file, perhaps it doesn't have a duration set in the header and JMF treats it like a live stream.
    You could always write a custom DataSource that just passes through the input of a normal data source, and then generate the EndOfStream event yourself... maybe based on a timeout or failure counter? I haven't received any data in x seconds or after x attempts, so I'm assuming the file is done... Or when you've read enough data that the file can't possibly have any more (read >= file header + file data)...

  • To add a process name in ABAP code

    hi experts,
    I have a requirement where my code is sending only  "unsuccessfull" message on a process failure.
    Now i need to add a name also in the mail. I m using a ABAP code to send the mail.
    Can u suGgest a way to do so?
    thanks.

    Hi,
    You can use the ABAP program an dgive multiple name..see the article.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/4096bf2d-bcea-2b10-4ab4-e0683830d9b2&overridelayout=true
    REPORT  ztest_fm_mail.
    DATA : is_doc_chng        TYPE sodocchgi1,
           it_objtxt          TYPE STANDARD TABLE OF solisti1,
           is_objtxt          TYPE solisti1,
           it_objpack         TYPE STANDARD TABLE OF sopcklsti1,
           is_objpack         TYPE sopcklsti1,
           it_objbin          TYPE STANDARD TABLE OF solisti1,
           is_objbin          TYPE solisti1,
           it_reclist         TYPE STANDARD TABLE OF somlreci1,
           is_reclist         TYPE somlreci1,
           w_lines_tx         TYPE i.
    ** Create Message Body
    **   Title and Description
    *is_doc_chng-obj_name  = 'MAIL'.
    is_doc_chng-obj_descr = 'Auto genareted Mail from BW'.
    ** main text
    is_objtxt-line = 'This is an automatically generated mail. Please do not reply  to it.'(028).
    APPEND is_objtxt TO it_objtxt.
    is_objtxt-line = space.
    APPEND is_objtxt TO it_objtxt.
    *   write packing list (main)
    DESCRIBE TABLE it_objtxt LINES w_lines_tx.
    READ     TABLE it_objtxt INTO is_objtxt INDEX w_lines_tx.
    is_doc_chng-doc_size = ( w_lines_tx - 1 ) * 255 + STRLEN( is_objtxt ).
    CLEAR is_objpack-transf_bin.
    is_objpack-head_start = 1.
    is_objpack-head_num   = 0.
    is_objpack-body_start = 1.
    is_objpack-body_num   = w_lines_tx.
    is_objpack-doc_type   = 'RAW'.
    APPEND is_objpack TO it_objpack.
    is_reclist-receiver = 'SURENDRA.REDDY at ABC.IN'.  " here you need to add mail ids.
    is_reclist-rec_type = 'U'.
    APPEND is_reclist TO it_reclist.
    CLEAR is_reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = is_doc_chng
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = it_objpack
        contents_txt               = it_objtxt
        receivers                  = it_reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        document_type_not_exist    = 3
        operation_no_authorization = 4
        parameter_error            = 5
        x_error                    = 6
        enqueue_error              = 7
        OTHERS                     = 8.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Thanks
    Reddy

Maybe you are looking for