ABAP Classical Report in background

Hi,
I have written a ABAP classical report, when i run in foreground the format of the report works fine. When i run the same report in background the format of the report is changing.
I.e end of page triggers in between the page.
I am dynamically handling the line-count of a page. it is working for foreground.
Please help me out from this issue.
Regards
Krishna

Most likely you try to change data which is locked by another user to the same time in some cases - depending on what you were doing the locks are created by the same job in a previous step. In both cases there is only one scenario that works - check, resp. wait until the locks are released.
Christian

Similar Messages

  • ABAP CLASSICAL REPORT

    Hi to all,
                 Can u please send me your analyzation about the report given below why because i cant understand it.  Please send me your analyzation and how to develop this report.
    Service Request Title:     Custom SAP Report for MS Get Well Project
    ITSM ticket #431199
    Originator Name:
    Originator Phone:
    Originator Department:     John Simoens
    204 958 1791
    Supply Services
    SAP Module(s) Affected:     MM
    Requested Due Date:     June 25th, 2007
    Existing Situation
    ESD Toronto warehouse current keeps an Excel spreadsheet of ‘IBIS’ (a stand alone customer driven system, used for a specific product line i.e. Routers) numbers in relation to inventory reservations that have been issued from the warehouse. This is critical information to the Network/Customer Operations group in determining service levels and successful customer installs. These routers are staged for specialized configuration for a short term after they are issued from stock and assigned an IBIS number.
    MS Get Well is addressing this manual process along many other processes and understands that there is an improvement opportunity, reliant on a SAP customized solution.
    The IBIS number could be manually entered to material document and requisition screens, recording this number on SAP instead of on a manual Excel spreadsheet. A custom report would then capture all IBIS numbers related to these SAP material documents related to a specific material group, and requisitions created with an IBIS number that was entered to a dedicated requisition field. The report would batch nightly and upload this report information to an internal server where the data can be extracted as required on a daily basis. This would avoid manual reports being run throughout the working day, as this information is needed with great frequency.
    Impact Statement (impact to business if request is not completed)
    Reduction of manual enteries and report extracts from SAP, and elimination of Excel database related processes.
    Efficient use of employee time.
    Increased untilization of SAP to store vital customer information.
    Requirements
    1.     MB51 report:  Extract reservation and material document information from the ‘header text’ field where an 11 character alphanumeric number (IBIS Number) will be manually entered. 
    o     The customer report will draw information from specific material numbers and movement types saved in a variant in report transaction MB51.
    o     Report will be batched on a daily basis, extracting segmented 24 hour posting periods.
    o     Report will collect layout values as noted in the table below.
    2.     Purchase Order info systems: Research suitable text field for IBIS number entry and subsequent reporting.
    o     Investigate suitable SAP Requisitions field where the same 11 character alphanumeric value will be entered and be reportable; require dedicated field to capture the IBIS number.
    o     Require a custom report to extract this information. Requisition SE16 report table EBAN may be suitable. 
    o     Report will be batched on a daily basis, extracting segmented 24 hour posting periods.
    Note: See table below for specific field information that is required on the reports.
    SAP Data Requirements     SAP Field Location
    Material Document     
    Reserv_No     
    Material     
    Material Description     
    Document Header Text (IBIS Order Number)     
    Network     
    OpAc     
    WBS Element     
    Loc. Amt.curr     
    Quantity     
    SLOC     
    Material Doc.     
    PSTG Date / Time     
    Reservation requirements date      Added to report if possible- not currently available in MB51
    User     
    PO/Requisition     
    IBIS Order Number     
    Requisition Number     
    Requisition_Created_DTS     System Date/Time Requisition was created. (If possible)
    PO Number     
    PO_Created_DTS     Data/Time the PO was created
    ETA Date     
    ETA_Date_Entered_DTS     System Date/Time the ETA Date was entered. (If possible)
    Goods Receipt     X indicates associated PO receipt was done.
    Require Server to Server communication where the two sets of data (material document & PO/Req.) will be transferred on a daily basis to Operational Reporting’s TORSQ008 Server located in our ‘TJ’ office in Markham, Ontario. The actual data transfer process (timing, data format and data transfer methodology) will be determined when we can have a teleconference with HP.
    The range of data to be transferred would be as follows.
    a)     Material document/Reservation Module – PSGT Date Time starting June 30, 2007 (earlier if possible) with a (suggested) range of 90 Calendar Days.
    The data would be overwritten daily. This would allow Ops Reporting to accumulate the data and as well, due to the daily updates
    pick up any data corrections along the way. Ops Reporting would organize a History version of the table to allow the data to be
    stored after 90 days.
    b)     PO Module  - Requisition Create DTS starting June 30, 2007 (earlier if possible) with a (suggested) range of 90 Calendar Days,
    The data would be overwritten daily. This would allow Ops Reporting to accumulate the data and as well, due the daily updates
                       pick up any data corrections along the way. Ops reporting would organize a History version of          this table to allow the data to be stored after 90 days. 
    Benefits
    Accomplish MS Get well project milestone task. 
    Increase productivity and simplify processes for tracking IBIS customer related information. 
    Proper utilization of SAP.
    Thanks in Advance,
    Jalaluddin.Basha

    hi SV,
       I guess Report Painter as Report Painter has 90% of the functionality that Report Writer and  Report Writer functions can be accessed from within the Report Painter
    Regards,
    Santosh

  • Report Writer/Report Painer/ABAP classical reports

    Which one is good if there are lot of reports to be written.Thanks.

    hi SV,
       I guess Report Painter as Report Painter has 90% of the functionality that Report Writer and  Report Writer functions can be accessed from within the Report Painter
    Regards,
    Santosh

  • Increasing Font in Classical Report

    Hi friends,
    I need a small help.
    Can we increase the font size of ABAP Classical Report ?
    I have tried the PRINT-CONTROL FUNCTION 'SF000'.
    But,of no use.
    Can we really increase the font size of ABAP Classical Report ?
    Regards,
    Imran.

    Be aware that the PRINT-CONTROL is not supported in SAP Enterprise 4.7
    For your information, SAP cannot provide any support to error caused by print control command (see SAP OSS notes 66478). * Parameters for function below should be taken from your printer
    configuration in SAP - check SPAD transaction -
    standard print control
    print-control position 1 function: 'CI006', 'SF015'.
    Submitted by : SAP Basis, ABAP Programming and Other IMG Stuff
    http://www.sap-img.com
    REPORT ZFONT NO STANDARD PAGE HEADING LINE-SIZE 80 LINE-COUNT 65.
    Start of print-control
    NEW-PAGE PRINT ON.
    PRINT-CONTROL FUNCTION 'SF000'.
    WRITE: / 'This is CPI 20'.
    SKIP.
    PRINT-CONTROL FUNCTION 'SF020'.
    WRITE: / 'This is CPI 6'.
    SKIP.
    PRINT-CONTROL FUNCTION 'SF008'.
    WRITE: / 'This is CPI 12'.
    Depending on your SAP printer device, this may also work
    PRINT-CONTROL FONT 1 LPI 6.
    you can try to change font and LPI numbers
    WRITE: / 'font 1 lpi 6'.
    PRINT-CONTROL FONT 2 LPI 6.
    WRITE: / 'font 2 lpi 6'.
    PRINT-CONTROL FONT 3 LPI 6.
    WRITE: / 'font 3 lpi 6'.
    End of print-control
    NEW-PAGE PRINT OFF.*--- End of Program
    Reward points if helpful
    Message was edited by:
            taranam dhindsa

  • ABAP Custom Report (ALV Format) in Background Processing

    Hi
    I am not the hardcore ABAP Person. But want to know about the detail fact of the ABAP Custome Reports. The question is can we do the background processing for the ABAP Custome Report in ALV Format.
    If Yes ..do we require to have any additional Function/code to get the spool in ALV Format. I saw the comments that the output will look like the mess.
    Please share your comment or any useful documenation on this. We are in ECC 6.0
    Thanks in advance..and yes it will be rewared by points.
    Navin

    You can use alv's in background using docking containers, but the display wont be interactive. If you search the forum you will see tons of threads which talk about running ALV's in background.
    For the output to be interactive, you can run the report in foreground and do the data processing in background.
    Refer this link:
    Displaying ALV Grid in Background Job

  • Background Color In Classical Report

    Hi Experts,
    I need to Highlight the entire row in classical report based on condition.
    For Example:
    I need to show the employee's detail in RED whose salary in less then 10000
    and green to those who get more then 10000.
    I tried using case and adding column and then editing report attribute's HTML Expression
    <xmp>
    <span style="color:#THE_COLOR#;font-weight:bold;">#SALARY#</span>
    </xmp>
    But this highlighting only text not the entire row.
    please help me with this.
    Animesh
    Edited by: Animesh Tripathi on Jan 31, 2013 3:18 AM
    Edited by: Animesh Tripathi on Jan 31, 2013 3:19 AM
    Edited by: Animesh Tripathi on Jan 31, 2013 3:20 AM

    The best way to do this is by creating a Named Column (row template) template report.
    Here is a post of someone with a similar problem:
    Template Condition based on PL/SQL Expression

  • CNTL_ERROR while running a report in background mode

    Hi,
    I am running a report in background on daily basis. I am using cl_gui_custom_container class here and calling the constructor of this class. I am getting a CNTL_ERROR exception at this point. But if i run the same report directly, it is not throwing any exception. The problem is if i schedule it to background. I am not able to sort it out. So please if any body knows, answer this.
    Thanks,
    Kumar

    Hi Nithin,
    I was facing the similar issue in a custom report program. I did apply the logic that you'd mentioned.
    I've implemented the code as below.
    IF  gr_container IS INITIAL.
    *** Check whether the program is run in batch or foreground
        IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
    * Run in foreground
          CREATE OBJECT gr_container
            EXPORTING
              container_name = 'WORK_AREA_CONTAINER'.
          CREATE OBJECT lv_grid
            EXPORTING I_PARENT = gr_container.
        ELSE.
    * Run in background
          CREATE OBJECT lv_grid
            EXPORTING
              I_PARENT = gr_dockcontainer.
          ENDIF.
          ENDIF.
    i_parent_control = gr_dockcontainer.
            CREATE OBJECT m_base_splitter
            EXPORTING
              parent            = i_parent_control
              ROWS              = 1
              columns           = 2
            EXCEPTIONS
              cntl_error        = 1
              cntl_system_error = 2
              OTHERS            = 3.
            CALL METHOD m_base_splitter->get_container
            EXPORTING
              row       = 1
              column    = 2
              RECEIVING
              container = m_splitter_right_part
            EXCEPTIONS
              OTHERS    = 1.
    After I've implemented the above code I'm getting the following error in the batch job:
    Category               ABAP Programming Error
    Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED
    Except.                CX_SY_REF_IS_INITIAL
    You attempted to use a 'NULL' object reference (points to 'nothing')
    access a component (variable: "M_BASE_SPLITTER").
    An object reference must point to an object (an instance of a class)
    before it can be used to access components.
    Either the reference was never set or it was set to 'NULL' using the
    CLEAR statement.
    Would you be able to help me in the above issue?

  • Display image in classical report

    Experts,
    Please share how to display image stored in SO10 in to a  classical report??

    Hi
    check this
    In the transaction OAOR, you should be able to insert your company Logo.
    GOTO - OAOR (Business Document Navigator)
    Give Class Name - PICTURES Class Type - OT..... then Execute
    It will show you the list, then select ENJOYSAP_LOGO.
    On that list, you will find one control with a "create" tab.
    Click std. doc types.
    Select SCREEN and double-click.
    It will push FILE selection screen.
    Select your company logo (.gif) and press OK.
    It will ask for a description- for instance: "company logo".
    It will let you know your doc has been stored successfully.
    You can find your logo under ENJOYSAP_LOGO->Screen->company logo.
    Just run your ALV program, you should find your company logo in place of the EnjoySAP logo.
    FORM TOP-OF-PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = HEADING[]
    I_LOGO = 'ENJOYSAP_LOGO'
    I_END_OF_LIST_GRID ='GT_LIST_TOP_OF_PAGE'.
    ENDFORM. "TOP-OF-PAGE
    Here 'ENJOYSAP_LOGO' will replace by ur created logo.
    Refer this link
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm
    http://www.sap-img.com/abap/alv-logo.htm
    http://www.sap-img.com/fu002.htm
    Re: Logo on Login screen
    Re: To change image into main menu of sap
    Regards
    Anji

  • RE: Report for Background jobs

    Hi SAP Guru's,
    I need to create a report on Background Job status , please tell me is there any standard reports ? or How to create a report on Background Jobs Status?
    Thanks in Advance,
    Krishna.

    Dear Raja,
    In std report this is not possible, talk to ur ABAPer to fetch the feild PLNUM from AFPO table with respect to the AUFNR field. This can be added to the std report itself. use this logic it will work
    sree

  • OnMouseOver displays Tooltip from hidden column of classic report

    What: The Goal:
    Make easily available more information than fits on one line of the screen without using multiple fixed lines.
    Background:
    Classic report with 18 data items (columns) visible. Has Search box and user can choose number of rows displayed.
    A couple data items can be long (20-30 characters) compared to the screen width. The right-most data item might run 100 characters.
    Proposed Strategy:
    1) Display the first n characters of the long item(s) on the report.
    2) On onMouseOver display the entire item.
    Proposed Approach:
    1) For each column with long data, hold the entire value in a hidden item.
    2) Display long (hidden) value in tooltip (bubble?/balloon?) upon onMouseOver of that value.
    Note: This is not ToolTip/Help for a column but display of the long value for a specifc item in the row of a column.
    Sought After Feature:
    1) To reduce maintenance, would like to implement for multiple columns using a single common block of code.
    Question:
    Given other approaches you know, is this a good approach to achieve the goal? Alternative approaches?
    Howard

    Well it took a while and you really made me work for this. :)
    For the end result hover on the Job Ln Nm column.
    http://apex.oracle.com/pls/apex/f?p=991202:1
    I added some old code I had laying around. It adds a bubble that will stay up for 5 sec or until you click away or hover on another record.
    What I would do at this point is just truncate (with a substr) the length of the Long Nm to something short. Use whatever indicator you want for the hover. Like for example these glasses <img src="#IMAGE_PREFIX#Fndview1.gif"> It's really up to you.
    You'll see there's an AJAX Callback PLSQL where you can retreive and format the content of the popup to whatever you want. You could make it real pretty.
    Here's what I did:
    1. New ShowJob javascript procedure.
    function ShowJob(pThis,pId){
         this.dTimeout;
         clearTimeout(this.dTimeout);
         this.dGet = dGet;
         this.dShow = dShow;
         this.dCancel = dCancel;
         var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=FULL_LONG_NAME',$v('pFlowStepId'));
         this.dGet();
         return;
         function dGet(){
               this.dTimeout = setTimeout("this.dCancel()",6500);
              get.addParam('x01',pId);
               get.GetAsync(dShow);
         function dShow(){
               $x_Hide('rollover');
               if(p.readyState == 1){
               }else if(p.readyState == 2){
               }else if(p.readyState == 3){
               }else if(p.readyState == 4){
                     $x('rollover_content').innerHTML = p.responseText;
                     $x_Show('rollover');
                var l = findPosX(pThis)+pThis.offsetWidth+5;
                     var t = findPosY(pThis);
                $x_Style('rollover','left',l + 'px');
                     $x_Style('rollover','top',t + 'px');
    // This math would center on the vertical           
    //                 $x_Style('rollover','left',findPosX(pThis)+pThis.offsetWidth+5);
    //                 $x_Style('rollover','top',findPosY(pThis)-($x('rollover').offsetHeight/2)+($x(pThis).offsetHeight/2));
                   document.onclick = function(e){
                   dCheckClick(e);
               }else{return false;}
         function dCheckClick(e){
              var elem = html_GetTarget(e);
              try{
                        var lTable = $x_UpTill(elem,"DIV");
                        if(lTable.id!='rollover_content'){dCancel();}
                        else{}
              }catch(err){dCancel();}
         function dCancel(){
               $x_Hide('rollover');
              document.onclick = null;
               get = null;
    }2. Rollover div on the page footer (div id="rollover"...). Of course this could be a region also.
    &lt;div id="rollover" style="display:none;color:black;background:#FFF;border:2px solid #369;width:290px;position:absolute;padding:4px;">
    &lt;div id="rollover_content">&lt;/div>
    &lt;/div>
    3. PLSQL AJAX Callback. : FULL_LONG_NAME
    -- select your value with apex_application.g_x01
    htp.p('You hover over ' || apex_application.g_x01 || '<br>');
    htp.p('Here is the Full Long Name: XXXXXXX XXXXXXX XXXXXXX 1234565');4. Changed Long Nm column to be a link with the onmouseover call that calls the new procedure ShowJob. I made the assumption that with the NUM parameter you could fetch the full record of what you need.
    onmouseover="ShowJob(this,#NUM#)"
    That should be it.
    Let me know what you think.
    -Jorge
    Edited by: jrimblas on Apr 22, 2013 1:05 PM: Added code to post for completion

  • Triggering END_OF_PAGE IN CLASSIC REPORT

    Hi Experts,
                          I have one classical reporting in that END_OF_PAGE is not Triggered At last Page due to Less No of Records in last Page,can anyone
    tell me how to trigger END_OF_PAGE  . i want to display the page total for every page but for last page i cant display Page total Due To Less
    No Of Records can any one suggest how  to solve this problem.
                                                                                                                                                                      Thanks in advance.

    Hello,
    If you read F1 help, it is mention as below.
    Effect
    This statement defines an event block that is raised by the ABAP-runtime during creation of a basic list, if there is a line reservation in the addition LINE-COUNT of the initiating statement for a page footer, which was reached while writing to this page. A list output that takes place in the event block, is placed in this area. Output statements that exceed the reserved area will be ignored.

  • Highlight  a row in classic report based on condition

    HI all Gurus
    Using Apex 4.1.1 oracle 11g linux oc4j
    I want to highlight a row where #column_value#='Y' to grey  keep others as normal report settings.
    I have a simple sql query
    SELECT PK_ID,
      FIRST_NAME,
      LAST_NAME,
      INITIAL_REG_DATE,
      MAIL_DATE,
      BEGIN_DATE,
      END_DATE,
      END_DATE-BEGIN_DATE as "#days",
      BEGIN_STATUS,
      END_STATUS, 
      COMMENTS,
      DELETE_FLAG,
    case when  DELETE_FLAG='Y' then 'GREY' else '#f0f0f0' end  DELETE_FLAG ,
    INITIAL_REG_DATE+(END_DATE-BEGIN_DATE) "New Reg end date"
    FROM SOR_TRACKING_DEL
    where pk2_id =:P216_Detail
    order by mail_Date desc
    I created a Dynamic action
    which will fir on on load , BIND on this classic report
    $("input[name=f29]").each(function(){ 
    var lThis=$(this); 
    if(lThis.is("Y")){ 
      lThis.parents("tr:eq(0)").children("td").css({"background-color":"GREY"}); 
    } else { 
      lThis.parents("tr:eq(0)").children("td").css({"background-color":"#f0f0f0"}); 
    But this is not changing color as expected..
    Kindly help me !
    Thanks

    Scott and Tom
    Thanks you guys for looking into this.
    Pls ignore my improper explanation and my inexperience with jquery.
    I read some blog and was trying to do same on classic report but all blogs I found so far referred either interactive report or tabular report none of them mentioned classic report.
    I guess using array for classic report wont be a good idea to start with. :/
    I am not sure if this is right syntax and logic to highlight the row
    $(function(){
    var DELETE_FLAG = $(this);
        if DELETE_FLAG.is("Y"))
      DELETE_FLAG.parents("tr").children("td").css({"background-color":"GREY"});
    I also created app here
    http://apex.oracle.com/pls/apex/f?p=35155
    workspace sors
    user tester/testing
    application 35155
    Thanks again.

  • Classic report - Highlight row

    APEX 4.2.1
    With all the latest and greatest dynamic action and jQuery goodness in 4.2.1, what is the easiest, declarative way to highlight rows in a classic report region (Generic Column Template) based on data condition using values on the row, using #COL# notation? e.g. If SAL > 1000 and DEPT = Marketing, highlight row in red or some such.
    In prior versions, this involved copying the Generic Column Template to one used just by this report and use the (up to 4) Column Templates with a PL/SQL expression.
    Thanks

    Custom report templates are okay if your needs are straightforward. But you said it already, there are only four different flavors to chose from.
    Here is a solution that'll work on all pages if once installed and can be extended to a multitude of visual attributes. Only an example that you may want to adapt to your liking.
    Edit Page, "CSS, Inline", or via Shared Components &gt; CSS files
    td.color1 {background-color:#9F9} /* Table cell gets colored in light green  */
    td.color2 {background-color:#FF9} /* Table cell gets colored in light yellow */
    td.color3 {background-color:#F99} /* Table cell gets colored in light red    */
    /** and so forth, followed by as many declarations as you need... */Page Template, "Function and Global Variable Declaration":
    /** Change the visual appearance of your classic report as you like after it's rendered */
    function customClassicReportDisplay(){
      /** Transfer the color class from the text to the table cell */
      $('td span.color1').closest('td').addClass('color1');
      $('td span.color2').closest('td').addClass('color2');
      $('td span.color3').closest('td').addClass('color3');
      // and so forth, followed by as many declarations as you need...
    }This jQuery code can be simplified, especially the handling of many lines for many colors can still be compacted, which makes it more difficult to understand though.
    Page Template, "Execute when Page Loads":
    /** Perform the function on Page Load */
    customClassicReportDisplay();
    /** Perform the function after Partial Page Rendering */
    $('form').bind('apexafterrefresh', function(){
      customClassicReportDisplay();
    });Here comes the trick. In the SQL statement, you wrap a &lt;span&gt; HTML tag with a different class declaration around each value that you want to color.
    SELECT '<span class="color' || case when some_value > 100 then '2' else null end || '">' || some_value       || '</span>' AS some_value
         , '<span class="color' || decode(some_other_value, 'too much', '3', NULL)   || '">' || some_other_value || '</span>' AS some_other_value
         , '<span class="color' || case when last_value between  0 and  10 then '1'
                                        when last_value between 11 and  50 then '2'
                                        when last_value between 51 and 100 then '3'
                                        else null end                                || '">' || last_value       || '</span>' AS last_value
      FROM ...This obviously makes the SQL a bit more complicated but in my opinion, I think this is a data driven topic and therefore just fine. Hence you say "depending on value ranges I want to change something" - and that belongs to SQL. WHAT you want to do (here: change color) is then up to your JS and CSS declaration. If you shift the SQL code into a view it's better to maintain and won't get spoiled by non-savvy third party developers...
    I know that's not what you originally asked for, because there is no #COL# notation, but for me it's the most flexible solution I can think of under APEX.

  • Submit  ALV report in Background & exporting list to memory and return

    Dear all,
    I created one Z program (ZPROGRAM2). 
    Here i use SUBMIT ZPRORAM1_ALV exporting list to memory and return.
    call function 'LIST_FROM_MEMORY'.
    call function 'TABLE_COMPRESS' .
    ZPRORAM1_ALV output i send mail.
    This all are working in foreground.
    If i schedule ZPROGRAM2 in background. that SUBMIT ZPRORAM1_ALV statement not working.
    Please give me the Solution.
    Thanks,
    Durai.V

    It is because of the ALV output that you are using. Check the condition sy-batch = 'X' (background processing) and then display a classical report. It will work then.
    Thanks,
    Jayant

  • Not able to Submit CJI5 report in background using Variant

    Hi Experts,
    Is it possible to fill the multiple screens through FM rs_create_variant.
    Reagrds,
    Nava

    Hi Ramesh,
    I am trying to submit the CJI5 report in back ground through variant. The varaint was created using FM RS_CREATE_VARIANT. it's throughing an error .
    IF I create variant directly via selectin screen then it's working fine.
    FYI.
    REPORT z_co99_cji5
           NO STANDARD PAGE HEADING
           MESSAGE-ID 00
           LINE-SIZE 290.
    PROGRAM      : Z_CO99_CJI5                                           *
    TITLE        : CJI5 In Background                                    *
    AUTHOR.      : Raja Nesanoor                                         *
    DATE WRITTEN : 27-Feb_2007                                           *
    REVTRAC      : xxxxxx                                                *
    PROGRAM FUNCTION:                                                    *
    To DISPLAY CJI5 Report in background                                 *
    PROGRAM TYPE : Executable  program                                   *
    DEV. CLASS   : XXXXXX                                                *
    LOGICAL DB   : NA                                                    *
    AUHTORIZATION CHECKS                                                 *
    Object           Authorization Fields             ABAP Fields        *
    S_TCODE                                                              *
                        BUKRS                          v_BUKRS           *
    CHANGE HISTORY                                                       *
    Date         Id        Name      Indicator   Description             *
    DATA : v_repid LIKE sy-repid VALUE 'ZRKPEP005' ,
    v_variant LIKE varid-variant VALUE 'V_CJI5' .
    DATA: BEGIN OF w_varid.
            INCLUDE STRUCTURE varid.
    DATA: END OF w_varid.
    DATA: BEGIN OF i_rsparams OCCURS 10.
            INCLUDE STRUCTURE rsparams.
    DATA: END OF i_rsparams.
    DATA: BEGIN OF i_rsparams1 OCCURS 10.
            INCLUDE STRUCTURE rsparams.
    DATA: END OF i_rsparams1.
    DATA: BEGIN OF i_varit OCCURS 2.
            INCLUDE STRUCTURE varit.
    DATA: END OF i_varit.
    DATA: BEGIN OF i_vscreens OCCURS 2.
            INCLUDE STRUCTURE rsdynnr.
    DATA: END OF i_vscreens.
    start-of-Selection
    START-OF-SELECTION.
      SET PARAMETER ID 'CAC' FIELD 'GC10'.
      SET PARAMETER ID 'PDB' FIELD '000000000001'.
      PERFORM populate_var_table.
      PERFORM create_variant.
      PERFORM submit_cji5.
    *& Form POPULATE_VAR_TABLE
    text
    --> p1 text
    <-- p2 text
    FORM populate_var_table .
      CLEAR w_varid .
      REFRESH i_varit .
      REFRESH i_rsparams .
      i_rsparams-selname = 'CN_NETNR'.
      i_rsparams-kind = 'S'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'EQ'.
      i_rsparams-low = '90273536'.
      i_rsparams-high = space.
      APPEND i_rsparams.
      CLEAR : i_rsparams .
      i_rsparams-selname = 'CN_NETNR'.
      i_rsparams-kind = 'S'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'EQ'.
      i_rsparams-low = '90274010'.
      i_rsparams-high = space.
      APPEND i_rsparams.
      CLEAR : i_rsparams .
      i_rsparams-selname = 'R_OBDAT'.
      i_rsparams-kind = 'S'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'BT'.
      i_rsparams-low = space .
      i_rsparams-high = space.
      APPEND i_rsparams.
      CLEAR : i_rsparams .
      i_rsparams-selname = 'P_DISVAR'.
      i_rsparams-kind = 'P'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'EQ'.
      i_rsparams-low = '1SAP' .
      APPEND i_rsparams.
      CLEAR : i_rsparams .
      i_rsparams-selname = 'P_USEDB'.
      i_rsparams-kind = 'P'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'EQ'.
      i_rsparams-low = SPACE.
      APPEND i_rsparams.
      w_varid-mandt = sy-mandt.
      w_varid-report = v_repid.
      w_varid-variant = v_variant.
      w_varid-flag1 = space.
      w_varid-flag2 = space.
      w_varid-transport = space.
      w_varid-environmnt = 'A'. "Variant for batch and online
      w_varid-protected = space.
      w_varid-secu = space.
      w_varid-version = '0'.
      w_varid-ename = sy-uname.
      w_varid-edat = sy-datum.
      w_varid-etime = sy-uzeit.
      w_varid-aename = space.
      w_varid-aedat = space.
      w_varid-aetime = space.
      w_varid-mlangu = sy-langu.
      i_varit-mandt = sy-mandt.
      i_varit-langu = sy-langu.
      i_varit-report = w_varid-report.
      i_varit-variant = w_varid-variant.
      i_varit-vtext = 'CO99-OUTPUT'.
      APPEND i_varit.
    ENDFORM. " POPULATE_VAR_TABLE
    *& Form CREATE_VARIANT
    text
    --> p1 text
    <-- p2 text
    FORM create_variant .
    data: h_rc like sy-subrc.
    *Check variant exists.
      CALL FUNCTION 'RS_VARIANT_EXISTS'
           EXPORTING
                report              = v_repid
                variant             = v_variant
           IMPORTING
                R_C                 = h_rc
             EXCEPTIONS
                not_authorized      = 01
                no_report           = 02
                report_not_existent = 03
                report_not_supplied = 04.
      IF h_rc = 0.
        CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
             EXPORTING
                  curr_report               = v_repid
                  curr_variant              = v_variant
                  vari_desc                 = w_varid
             TABLES
                  vari_contents             = i_rsparams
                  vari_text                 = i_varit
             EXCEPTIONS
                  illegal_report_or_variant = 01
                  illegal_variantname       = 02
                  not_authorized            = 03
                  not_executed              = 04
                  report_not_existent       = 05
                  report_not_supplied       = 06
                  variant_doesnt_exist      = 07
                  variant_locked            = 08
                  selections_no_match       = 09.
        COMMIT WORK.
      ELSE.
        CALL FUNCTION 'RS_CREATE_VARIANT'
             EXPORTING
                  curr_report               = v_repid
                  curr_variant              = v_variant
                  vari_desc                 = w_varid
             TABLES
                  vari_contents             = i_rsparams
                  vari_text                 = i_varit
             EXCEPTIONS
                  illegal_report_or_variant = 1
                  illegal_variantname       = 2
                  not_authorized            = 3
                  not_executed              = 4
                  report_not_existent       = 5
                  report_not_supplied       = 6
                  variant_exists            = 7
                  variant_locked            = 8
                  OTHERS                    = 9.
        COMMIT WORK.
        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.
    ENDFORM. " CREATE_VARIANT
    *& Form submit_cji5
    text
    --> p1 text
    <-- p2 text
    FORM submit_cji5 .
      CALL FUNCTION 'SUBST_START_REPORT_IN_BATCH'
           EXPORTING
                iv_jobname                    = 'TEST_JOB'
                iv_repname                    = v_repid
                iv_varname                    = v_variant
                iv_authcknam                  = sy-uname
                iv_language                   = sy-langu
                iv_varianttext                = 'CO99-OUTPUT'
           TABLES
                tt_reportparam                = i_rsparams
           EXCEPTIONS
                variant_exist_check_failed    = 1
                variant_update_failed         = 2
                variant_update_not_authorized = 3
                variant_update_no_report      = 4
                variant_update_no_variant     = 5
                variant_update_variant_locked = 6
                variant_insert_failed         = 7
                variant_insert_not_authorized = 8
                variant_insert_no_report      = 9
                variant_insert_variant_exists = 10
                variant_insert_variant_locked = 11
                variant_write_failed          = 12
                no_batch_service              = 13
                no_server_list                = 14
                batch_scheduling_failed       = 15
                OTHERS                        = 16.
      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.
    Thanks
    Nava

Maybe you are looking for