Hard coded member names vs. member set function

Hello,I'm having a difficult time troubleshooting the following dynamic calc. This formula works perfectly - it gives me the total units sold in the prior 13 weeks:@SUMRANGE("POS Units", @CURRMBRRANGE(Time, LEV, 0, -13, -1))However I'd like to make the member more generic, so instead of "POS Units" I thought I could simply substitute @CURRMBR(Measures), as in:@SUMRANGE(@CURRMBR(Measures), @CURRMBRRANGE(Time, LEV, 0, -13, -1))But when I check the syntax in the outline formula editor, it tells me "Invalid Parameter Type".I have the same problem with the 0 as a parameter of @CURRMBRRANGE. I tried substituting the function @CURLEV(Time) and got the same error.-dan

Well, there are a couple of things. First, if the total member (to store the 13 time periods total) is in the Accounts dimension, then you cannot have it store sums for all possible measures.The SUMRANGE function wants a member to sum - aside from the syntax problem - when SUMRANGE is calculating the Total Units Sold, what do you think THe CURRMBR is from Measures? Its the Total Units Sold! You would be calculating the sum of Total Units Sold over time and putting the result into Total Units Sold. The reason for this is that two members from the same dimension do not intersect each other.Now, if you put a member in a different dimension, and you want to sum any possible measure, use the @SUM command rather than @SUMRANGE. It will implicitly choose the current member from the other dimensions as it calculates.Finally, despite what the documentation says, some functions don't work when used in combination. Also, some function give syntax validation errors, but do work when the calc is run. THere is a "Server Formula Validate" option in the outline editor that sometimes properly evaluates formulas.Hope that helps.Regards,Jade-------------------------------Jade ColeSenior Business Intelligence ConsultantClarity [email protected]

Similar Messages

  • Parse schema name - Avoiding hard-coded schema names

    Hi all,
    I have been trying to find a similar thread but had no luck. I want to avoid hard-coding schema names in my reports. I have tried to use a Substitution string but I don't seem to be able to reference it by just doing :default_schema. I already reference the parsing schema like this: #OWNER# which is saving me a lot of time. Is there any way to create additional variables like that one instead of those substitution strings that can't be parsed in a query?
    Thanks a lot for your help.
    Regards,
    werot.

    Werot wrote:
    I have been trying to find a similar thread but had no luck. I want to avoid hard-coding schema names in my reports. I have tried to use a Substitution string but I don't seem to be able to reference it by just doing :default_schema. I already reference the parsing schema like this: #OWNER# which is saving me a lot of time. Is there any way to create additional variables like that one instead of those substitution strings that can't be parsed in a query?
    Will you actually get any benefit from using substitution strings? They are also hard-coded at design time. You could use application items if you need something dynamic.
    Bind variable syntax (:default_schema) will not work for lexical substitution of substitution string and application item values in report queries. You have to use static text (&DEFAULT_SCHEMA.) references (and be aware of the potential for SQL injection that this exposes).
    I wouldn't recommend using schema qualifiers directly in APEX applications. I would use grants, synonyms and views at the database level.

  • When Hard-coded server name and data base name are replaced with variables , execute process task does not produce the result

    Hi All,
    I am trying to load shape file into a sql spatial table. A execution process task is used to run the ogr2ogr.exe program.
    This is how the process tab looks like .
    Executable : C:\gdal_ogr2ogr\bin\gdal\apps\ogr2ogr.exe
    Argument :  -f MSSQLSpatial   MSSQL:server=SQL-ABC-DEV;database=MYSIMPLE_Dev;Trusted_Connection=True;\\mypath\files\shares\Data\www.mypage.htm\my_sample_file.shp
    Success value : 1
    For above settings, package runs fine. The spatial table is created in SQL server db. However when hard-coded SQL server name and database name are replaced with global variables , the spatial table is not created in the database. Yet the package runs fine.
    It does not throw any errors. (I am using another variable for full file path. It is not causing any errors though)
    " -f MSSQLSpatial   MSSQL:server="+@[$Project::SQLServerName]+";database="+ @[$Project::DatabaseName] +";Trusted_Connection=True;"+ @[User::Filepath] + "\\my_sample_file.shp"
    Both variables are string type. Can anyone tell me what I am doing wrong here please?
    I am running this in VS 2012.
    Thanks for your help in advance..
    shamen

    There should be a single space just after True:
    before
    " -f MSSQLSpatial   MSSQL:server="+@[$Project::SQLServerName]+";database="+ @[$Project::DatabaseName] +";Trusted_Connection=True;"+ @[User::Filepath] + "\\my_sample_file.shp"
    after keeping the space
    " -f MSSQLSpatial   MSSQL:server="+@[$Project::SQLServerName]+";database="+ @[$Project::DatabaseName] +";Trusted_Connection=True; "+ @[User::Filepath] + "\\my_sample_file.shp"
    Thanks
    shamen

  • Hard-coded application name in Customized App.

    Dear all,
    The name of standard application has been hard coded in one of the methods where URL for a page is generated. The customized application starts calling standard pages at this point.
    I copied this method-code and called it from my object. But this is giving runtime context error.
    I would have replaced the application name from this URL after method call, but its called at many points in application.
    Kindly suggest what should i do now.
    Thanks

    The @computername@ variable takes a computer name defined by the user who deploys the template.
    To make this template fit for scaling you have to define the computer name not as a variable but as a name followed by a number of ### symbols. The ### symbols will become numerical values. VMM makes sure that the numbers are incremented each time you scale
    your computer tier.
    Serv## will resolve in Serv01, Serv02, etc.
    I’ve tried to combine the variable with the ### symbols in the past. I recall this didn’t work back then (2012SP1).
    HTH

  • Can we change the display order of member set functions like @Idescendant?

    Generally, for example, if we have dimension with member hierarchy as below:
    Parent
    Child1
    Child11
    Child2
    Child21
    then, when we use function @Idescendant(Parent) to define the row during form design, the form will display the members in the following order:
    Child11
    Child1
    Child21
    Child2
    Parent
    This is not what I want, I need the order to be the same as I defined them.
    I know I can set the members one by one to display any order as I wish, but this is not doable when I have hundreds of members.
    is there any good way to solve this problem? Any answer is appreciated.
    thanks
    tony

    Hi,
    The answer is unfortunately no, there isn't any easy way of doing it. There are ways of doing it and automating it but I can't say it is easy. The solution I found once required me to update form definition tables through a stored procedure in Planning and recycle services after every update.
    Cheers,
    Alp

  • How to retrieve a member set by a certain value?

    Hi everyone,
    I'm having a problem trying to retrieve a set of entity members that have a certian value in an account.
    For a UDA or an attribute there are functions that solve this very problem but I can't figure out how to check on a value.
    For example if I'm trying to allocate a value to entities that contain a '1' in account 'Flag' I cannot find a member set function that would work.
    "Plan"=@allocate("Revenue"->"Plan",@ismbr("Flag"==1)),&PriorYear->"ACT",,share)
    This code doesn't work because the @ismbr function expects a member and not a boolean.
    Alternatively would it be possible to save a member selection so that I can loop through all entites and add them to a selection one by one?
    Thanks for your help :)

    Planning, eh? :)
    I think if you took your calc and stood it on it's head, you might get the calc range you want.
    Here's my (theoretical) idea.
    You're already (I assume) creating a calc block in a calc script/HBR to do the Plan calculation in the first place.
    I wonder if this would work:
    FIX(level 0 dimension members of whatever dimension)
    "Plan"
    IF("Flag" == 1)
    "Plan" = @ALLOCATE("Revenue"->"Plan", @HIERARCHICALFUNCTION("whatever"), "Revenue"->"ACT"->&PriorYear, , share) ;
    ENDIF
    ENDFIX
    The goal is to have the IF statement trump the range in the @ALLOCATE. I'm not sure it would work but it might be worth a try.
    Your @ALLOCATE is really just child member / parent member * basis. You could just roll your own:
    FIX(level 0 dimension members of whatever dimension)
    "Plan"
    IF(@ISMBR("Flag" == 1))
    "Plan" = ("Revenue"->"ACT"->&PriorYear / @PARENTVAL(whatever dimension, "Revenue"->"ACT"->&PriorYear)) * "Revenue"->"Plan" ;
    ENDIF
    ENDFIX
    Regards,
    Cameron Lackpour

  • How to get the table name in the trigger definition without hard coding.

    CREATE  TRIGGER db.mytablename
    AFTER UPDATE,INSERT
    AS
        INSERT INTO table1(col1)
        SELECT InsRec.col1   
        FROM
        INSERTED Ins
       --Below i am calling one sp for which i have to pass the table name
       EXEC myspname 'tablename'
      In the above trigger,presently i am hard coding the tablename
      but is it possible to get the table name dynamically on which the trigger is defined in order to avoid hard coding the table name

    I really liked your audit table concept.  You inspired me to modify it so that, the entire recordset gets captured and added a couple of other fields.  Wanted to share my end result.
    USE [YourDB]
    GO
    /****** Object: Trigger [dbo].[iudt_AutoAuditChanges] Script Date: 10/18/2013 12:49:55 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER TRIGGER [dbo].[iudt_AutoAuditChanges]
    ON [dbo].[YourTable]
    AFTER INSERT,DELETE,UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;
    Declare @v_AuditID bigint
    IF OBJECT_ID('dbo.AutoAudit','U') IS NULL BEGIN
    CREATE TABLE [dbo].[AutoAudit]
    ( [AuditID] bigint identity,
    [AuditDate] DateTime,
    [AuditUserName] varchar(128),
    [TableName] varchar(128) NULL,
    [OldContent] XML NULL,
    [NewContent] XML NULL
    ALTER TABLE dbo.AutoAudit ADD CONSTRAINT
    PK_AutoAudit PRIMARY KEY CLUSTERED
    [AuditID]
    ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    CREATE NONCLUSTERED INDEX [idx_AutoAudit_TableName_AuditDate] ON [dbo].[AutoAudit]
    ( [TableName] ASC,
    [AuditDate] ASC
    )WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    END
    Select * Into #AuditDeleted from deleted
    Select * Into #AuditInserted from inserted
    While (Select COUNT(*) from #AuditDeleted) > 0 OR (Select COUNT(*) from #AuditInserted) > 0
    Begin
    INSERT INTO [dbo].[AutoAudit]
    ( [AuditDate], [AuditUserName], [TableName], [OldContent], [NewContent])
    SELECT
    GETDATE(),
    SUSER_NAME(),
    [TableName]=object_name([parent_obj]),
    [OldContent]=CAST((SELECT TOP 1 * FROM #AuditDeleted D FOR XML RAW) AS XML),
    [NewContent]=CAST((SELECT TOP 1 * FROM #AuditInserted I FOR XML RAW) AS XML)
    FROM sysobjects
    WHERE
    [xtype] = 'tr'
    and [name] = OBJECT_NAME(@@PROCID)
    Set @v_AuditID = SCOPE_IDENTITY()
    Delete from AutoAudit
    Where AuditID = @v_AuditID
    AND Convert(varchar(max),oldContent) = Convert(varchar(max),NewContent)
    Delete top(1) from #AuditDeleted
    Delete top(1) from #AuditInserted
    End
    END

  • Attempt to cross a null member in function @X

    Hi,
    I am getting this error "Attempt to cross a null member in function @X" in the below code. How do i resolve this?
    IF(Grade_All->@MEMBER(@CONCATENATE(Assumptions_,@NAME(@PARENT(@CURRMBR(Location)))))->"Seat Requirement Flag"==1)
    "Production Seat"=((@sumrange("Manpower Required",@List("Agents_L1_Freshers","Agents_L1_Tenured","Agents_L2_L2.5_Billable","SME_Agents_L2_NonBillable"))) / (Grade_All->@MEMBER(@CONCATENATE(Assumptions_,@NAME(@PARENT(@CURRMBR(Location)))))->"Seat Utilization Ratio (Production)"));
    ENDIF;)

    I used a run time prompt in my FIX statement. Now i am not getting this error.
    FIX([Location])
    "Production Seat"(
    IF(Grade_All->@MEMBER(@CONCATENATE(Assumptions_,@NAME(@PARENT(@CURRMBR(Location)))))->"Seat Requirement Flag"==1)
    "Production Seat"=((@sumrange("Manpower Required",@List("Agents_L1_Freshers","Agents_L1_Tenured","Agents_L2_L2.5_Billable","SME_Agents_L2_NonBillable"))) / (Grade_All->@MEMBER(@CONCATENATE(Assumptions_,@NAME(@PARENT(@CURRMBR(Location)))))->"Seat Utilization Ratio (Production)"));
    ENDIF;)
    ENDFIX
    Thanks for ur help.

  • A family member set up my time capsule, promises that it is set up correctly but the light on the capsule isn't green, it is yellow, what does this mean?

    A family member set up my time capsule and sayy it's workign correcly but the light on it isn't green, it is yellow...what does this mean?

    If the Time Capsule is operating normally, the light will be green.
    If the amber light is blinking, something is not adjusted correctly, or there may be an update available for the Time Capsule.
    Do you have the device that was used to set up and configure the Time Capsule there?  Is this a Mac?  If yes, we need to know what operating sysem it is using.
    If you are not sure, click the Apple icon in the upper left corner of the screen and then click About This Mac. Post back with the OS X Version number that you see there.

  • Error in setting final variable using properties vs hard coding

    I am getting the following error when trying to use this line of code
    public static final String MESSAGES_BUNDLE_NAME = System.getProperty("messages");
    java.lang.ExceptionInInitializerError: java.lang.NullPointerException
    When I change the above line to
    public static final String MESSAGES_BUNDLE_NAME = "messages_usa";
    the program works fine.
    Any ideas as to why this is happening would be greatly appreciated.
    Thanks,
    Boris

    I am sorry, but I realized now that I did notdiscribe
    the problem fully.
    The error is happening on the following line
    return APPLICATION_RESOURCE_BUNDLE.getString(key);
    So it looks like APPLICATION_RESOURCE_BUNDLE is
    becoming null.
    No that is not what is happening.
    This is the error that you posted.....
    java.lang.ExceptionInInitializerError:
    java.lang.NullPointerException
    The first part is the exception, not the second part
    (although the second causes the first.)
    The java docs specifically point out that a
    NullPointerException is returned if the base name is
    null - the parameter to getBundle().
    The initialization exception occurs because when it
    tries to excecute the initialization expression for
    the final, then the getBundle() is throwing the null
    pointer exception.
    It is is not clear what you code is actually supposed
    to be doing but I think you suggested that your are
    using a system property. If so then it means that
    that system property is not defined. And it works
    when you use a hard coded value because the hard coded
    value is defined.From this explanation I don't understand why initializing the bundle name from System.getProperty() works in the same class with the bundle obejct initialization, but does not work when it is in another class from bundle object initialization.

  • Passing hard-coded string parameters into a FUNCTION

    I created a Function that accepts two INT and two VARCHAR2 parameters. I want to access it in a SELECT statement and manually pass in parameters to it.
    For example,
    SELECT FN_MYFUNC(10, 20, 'string1', 'string2') FROM DUAL;
    However, when I do this the hard-coded strings don't seem to be recognized by the Function. But, if I were to pass in a Fieldname from a TABLE then the above function works. Is there something extra I need to do to pass in hard-coded strings into a function?

    I have pasted the function where this problem is occuring below. If I use it in a SELECT, for example....
    SELECT fn_GetRegValueFromRegData(3, 3, 'REG', '119') FROM DUAL;
    .....it returns blank everytime when it should return a numeric value. However, this only occurs if I hard-code the parameter values (like above). However, if I pass in fieldnames from a TABLE, for example.....
    SELECT fn_GetRegValueFromRegData(RegLink, EeLink, ChqType, RegCode) FROM RegData;
    ......then I get data back! Any idea why data is returned when I pass in fieldnames but not when I pass in hard-coded parameter values?
    =================================================
    CREATE OR REPLACE FUNCTION fn_GetRegValueFromRegData
    (p_RegLink INT,
    p_EELink INT,
    p_ChequeType VARCHAR2,
    p_RegCode1 VARCHAR2,
    p_RegCode2 VARCHAR2 := '-1')
    RETURN NUMBER
    AS
    v_regvalue NUMBER(14,5);
    BEGIN
    BEGIN
    --retrieve data using the REGCODE1 value
    SELECT a.regvalue INTO v_regvalue
    FROM regdata a
    WHERE a.RegCode = p_RegCode1
    AND a.RegLink = p_RegLink
    AND a.eeLink = p_EELink
    AND a.ChqType = p_ChequeType
    AND a.EndDate IS NULL;
    EXCEPTION
    WHEN OTHERS
    THEN
    --retrieve data using the REGCODE2 value
    SELECT a.regvalue INTO v_regvalue
    FROM regdata a
    WHERE a.RegCode = p_RegCode2
    AND a.RegLink = p_RegLink
    AND a.eeLink = p_EELink
    AND a.ChqType = p_ChequeType
    AND a.EndDate IS NULL;
    END;
    RETURN v_regvalue;
    END;
    /

  • In TOTALYTD function is it possible to avoid hard-coding year_end_date?

    Suppose you have a fiscal year of 9/30. The TOTALYTD function looks like:
      YTD Actual $:=TOTALYTD( [Actual $], 'Date'[Date], ALL('Date'), "9/30")
    But I want to avoid hard coding "9/30", and assuming I have a settings table from where I can get a date with the yearend, I tried this: 
      YTD Actual $:=TOTALYTD ([Actual $], 'Date'[Date], ALL('Date'), DISTINCT( 'Settings'[YearEndDate]))
    I get no errors but it calculates like "12/31". I tried to use Format but with no luck.
    Is there a way to make this work?

    I didn't try it, but I guess a max should work (assuming that there is only one date in the settings table).
    YTD Actual $:=TOTALYTD ([Actual $], 'Date'[Date], ALL('Date'), MAX( 'Settings'[YearEndDate])
    Can you try it out?
    Cheers,
    Jason | www.SqlJason.com
    P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)

  • Is is possible to avoid hard-coding the Item in a shared Select List Query?

    I created a "Select List" in the Shared Components area as follows:
    My goal is to create a shared select list that can be used on any form for a particular Field.
    IF :P10_FK_RSTA_CODE is NULL THEN
    RETURN
              'select col_description, col_code_pk
              from CODE_TABLE
              where col_active_ind = ''Y''';
    ELSE
    RETURN
              'select col_description, col_code_pk
              from CODE_TABLE
              where col_code_pk = :P10_FK_RSTA_CODE';
    END IF
    Which works great, but how can I make the select list work for the same column on a different form?
    Because :P10_FK_RSTA_CODE is hard-coded in the function, I can't reuse this Function from a different form.
    (I could rename the Field on every form to the same name, but I'm hoping there is a better way.)
    Is there a way I can pass in a variable from the Field Item to make this dynamic where I can use it on any form?
    Also, I am very new at this, so if there is a better way to do this, I would greatly appreciate any input.
    Thanks in advance.
    MF

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "956902".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    I created a "Select List" in the Shared Components area as follows:
    My goal is to create a shared select list that can be used on any form for a particular Field.
    IF :P10_FK_RSTA_CODE is NULL THEN
    RETURN
              'select col_description, col_code_pk
              from CODE_TABLE
              where col_active_ind = ''Y''';
    ELSE
    RETURN
              'select col_description, col_code_pk
              from CODE_TABLE
              where col_code_pk = :P10_FK_RSTA_CODE';
    END IF
    Which works great, but how can I make the select list work for the same column on a different form?
    Because :P10_FK_RSTA_CODE is hard-coded in the function, I can't reuse this Function from a different form.
    (I could rename the Field on every form to the same name, but I'm hoping there is a better way.)
    Is there a way I can pass in a variable from the Field Item to make this dynamic where I can use it on any form?Reference the value of an application item rather than a page item in the LOV query, setting the value using a process or computation on each form page.

  • Output type for the managed codes cut letter is hard coded

    Hello,
    Very Good afternoon!
    I have a requirement to create new Output Types for a Smart Form.
    The already existing Output types are hard coded as shown Below :
    CONSTANTS : c_kschl_order LIKE nast-kschl
                             VALUE 'ZUS0',
                c_kschl_order1 LIKE nast-kschl
                             VALUE 'ZUS1',
    Now they do not want to use ZUS1. Insted they wnat to use New Output Types.
    u2022 Remove ZUS1 as we no longer use this one.
    u2022     Add ZAU0
    u2022     Add ZNZ0
    u2022     Add ZJP0
    u2022     Add ZCN0
    u2022     Add ZKR0
    How to add these Output types without Hardcoding as shown ABove.
    Any Suggestions will be appreciated.....
    For reference..I will paste the code of the Program here.
    Here is the code  :
                     PROGRAM DECLARATION
    PROGRAM ID           Z_RVADOR01_SALES_CUT_LETTER
    TABLES: vbak,    "Sales Document: Header Data
           vbap,    "Sales Document: Item Data
           vbpa,    "Sales Document: Partner
           vbep,    "Sales Document: Schedule Line Data
           kna1,    "General Data in Customer Master
           MARA,    "Material Master
            KOMK,                          "Communicationarea for conditions
            KOMP,                          "Communicationarea for conditions
            KOMVD,                         "Communicationarea for conditions
            VBCO3,                         "Communicationarea for view
            VBDKA,                         "Headerview
            VBDPA,                         "Itemview
            VBDPAU,                        "Subitemnumbers
            CONF_OUT,                      "Configuration data
            SADR,                          "Addresses
            TVAG,                          "Reason for rejection
            VEDKA,                         "Servicecontract head data
            VEDPA,                         "Servicecontract position data
            VEDKN,                         "Servicecontract head notice data
            VEDPN,                         "Servicecontract pos. notice data
            RISERLS,                       "Serialnumbers
            KOMSER,                        "Serialnumbers for print
            TVBUR,                         "Sales office
            TVKO,                          "Sales organisation
            ADRS,                          "Communicationarea for Address
            FPLTDR,                        "billing schedules
            WTAD_ADDIS_IN_SO_PRINT,        "additional
            WTAD_BUYING_PRINT_EXTRA_TEXT,  "texts belonging to additional
            adrc,
            adr6,
            t247.
    INCLUDE RVADTABL.
    INCLUDE RVDIREKT.
    INCLUDE VEDADATA.
    data for access to central address maintenance
    INCLUDE SDZAVDAT.
    TYPE-POOLS: ADDI.
    DATA PRICE_PRINT_MODE(1) TYPE C.       "Print-mode
    DATA: RETCODE   LIKE SY-SUBRC.         "Returncode
    DATA: REPEAT(1) TYPE C.
    DATA: XSCREEN(1) TYPE C.               "Output on printer or screen
    DATA: BEGIN OF STEU,                   "Controldata for output
            VDKEX(1) TYPE C,
            VDPEX(1) TYPE C,
            KBKEX(1) TYPE C,
            KBPEX(1) TYPE C,
          END OF STEU.
    DATA: BEGIN OF TVBDPA OCCURS 0.        "Internal table for items
            INCLUDE STRUCTURE VBDPA.
    DATA: END OF TVBDPA.
    DATA: BEGIN OF TKOMV OCCURS 50.
            INCLUDE STRUCTURE KOMV.
    DATA: END OF TKOMV.
    DATA: BEGIN OF TKOMVD OCCURS 50.
            INCLUDE STRUCTURE KOMVD.
    DATA: END OF TKOMVD.
    DATA: BEGIN OF TVBDPAU OCCURS 5.
            INCLUDE STRUCTURE VBDPAU.
    DATA: END   OF TVBDPAU.
    DATA: BEGIN OF TKOMCON OCCURS 50.
            INCLUDE STRUCTURE CONF_OUT.
    DATA: END   OF TKOMCON.
    DATA: BEGIN OF TKOMSERVH OCCURS 1.
            INCLUDE STRUCTURE VEDKA.
    DATA: END   OF TKOMSERVH.
    DATA: BEGIN OF TKOMSERVP OCCURS 5.
            INCLUDE STRUCTURE VEDPA.
    DATA: END   OF TKOMSERVP.
    DATA: BEGIN OF TKOMSERVHN OCCURS 5.
            INCLUDE STRUCTURE VEDKN.
    DATA: END   OF TKOMSERVHN.
    DATA: BEGIN OF TKOMSERVPN OCCURS 5.
            INCLUDE STRUCTURE VEDPN.
    DATA: END   OF TKOMSERVPN.
    DATA: BEGIN OF TKOMSER OCCURS 5.
            INCLUDE STRUCTURE RISERLS.
    DATA: END   OF TKOMSER.
    DATA: BEGIN OF TKOMSER_PRINT OCCURS 5.
            INCLUDE STRUCTURE KOMSER.
    DATA: END   OF TKOMSER_PRINT.
    DATA: BEGIN OF TFPLTDR OCCURS 5.
            INCLUDE STRUCTURE FPLTDR.
    DATA: END   OF TFPLTDR.
    DATA: TADDI_PRINT TYPE ADDI_SO_PRINT_ITAB WITH HEADER LINE.
    TYPES:BEGIN OF ty_orders ,
         xblnr    LIKE  mkpf-xblnr,       "delivery number
         erfmg    LIKE  mseg-erfmg,       "goods issue quantity
         custname LIKE  kna1-name1,       "customer name
         bstnk    LIKE  vbak-bstnk,       "purchase order number
         ean11    LIKE  vbap-ean11,       "upc
         kdmat    LIKE  vbap-kdmat,       "customer material code
         arktx    LIKE  vbap-arktx,       "description
         csrno    LIKE  kna1-kunnr,       "customer service rep number
         spras    LIKE  kna1-spras,       "customer language key
         csrname  LIKE  kna1-name1,       "customer service rep name
         csremail LIKE  adr6-smtp_addr,   "csr email
         csrphone LIKE  kna1-telf1,       "csr telephone
         csrext   LIKE  adrc-tel_extens,  "csr extension
         csrfax   LIKE  kna1-telfx,       "csr fax
         total    LIKE  lips-lfimg,       "cut quantity
         ldate(18)    TYPE c,
       END OF ty_orders.
    CONSTANTS: c_kschl_order LIKE nast-kschl
                             VALUE 'ZUS0',
                c_kschl_order1 LIKE nast-kschl
                             VALUE 'ZUS1',            c_parvw_shipto LIKE vbpa-parvw
                             VALUE 'WE',
                c_parvw_csr    LIKE vbpa-parvw
                             VALUE 'ZS',
                 c_eng(1)       TYPE c VALUE 'E',
                 c_sep(1)       TYPE c VALUE '/',
                 c_sale(25) type c VALUE 'Sales Order'.
    DATA: WA_VBAK TYPE VBAK,
          tbl_ord TYPE ty_orders OCCURS 0 WITH HEADER LINE,
          w_csrname(30)  TYPE c,
         w_csrno(30)    TYPE c,
         w_email    LIKE adr6-smtp_addr,
         f_shipto_found     TYPE c,
         w_custname(30) TYPE c,
         w_month(2),
         w_ldate(18),
         w_total LIKE lips-lfimg,
         w_lines        TYPE i VALUE 0,
         f_mail(1)  TYPE c,
         cnt_1          TYPE i VALUE 0,
         cnt_2          TYPE i VALUE 0,
         tbl_otf     LIKE itcoo OCCURS 0 WITH HEADER LINE,
         w_type(25)     TYPE c,
         st_doc_data   LIKE sodocchgi1,
         tbl_objtxt    LIKE solisti1 OCCURS 10 WITH HEADER LINE,
         tbl_line      LIKE tline OCCURS 0 WITH HEADER LINE,
         tbl_attach    LIKE solisti1 OCCURS 10 WITH HEADER LINE,
         tbl_objhead   LIKE solisti1 OCCURS 10 WITH HEADER LINE,
         tbl_proc_para LIKE soparai1 OCCURS 10 WITH HEADER LINE,
         tbl_maillist  LIKE somlreci1 OCCURS 10 WITH HEADER LINE,
         tbl_pack_list LIKE sopcklsti1 OCCURS 10 WITH HEADER LINE,
         tbl_cpo      LIKE itcpo OCCURS 0 WITH HEADER LINE,"SAPscript output
                                                                " interface
         tbl_cpp LIKE itcpp OCCURS 0 WITH HEADER LINE,"SAPscript output
                                                       " parameters
         tbl_smtp  TYPE szadr_adsmtp_line OCCURS 0 WITH HEADER LINE,
         tbl_cdhdpos LIKE cdshw OCCURS 0 WITH HEADER LINE,
         tbl_cdpos LIKE cdshw OCCURS 0 WITH HEADER LINE,
         wrk_lines LIKE sy-tabix,
         hltlines   TYPE i,
         off1       TYPE p,
         fle1(2)    TYPE p,
         fle2(2)    TYPE p,
         htabix     LIKE sy-tabix,
         hfeld(500) TYPE c.
    FORM ENTRY USING RETURN_CODE US_SCREEN.
    if sy-tcode = 'VA01'.
      IF nast-kschl = c_kschl_order.
      SELECT SINGLE * FROM VBAK INTO WA_VBAK WHERE vbeln = nast-objky.
      IF SY-SUBRC = 0.
      CLEAR RETCODE.
      XSCREEN = US_SCREEN.
      PERFORM PROCESSING USING us_screen.
      IF RETCODE NE 0.
        RETURN_CODE = 1.
      ELSE.
        RETURN_CODE = 0.
      ENDIF.
       ELSE.
          retcode = sy-subrc.
          syst-msgid = 'ZVERROR'.
          syst-msgno = '000'.
          syst-msgty = 'E'.
          syst-msgv1 = NAST-KSCHL.
         syst-msgv1 = 'Sales Order cut letter
                       for this order already issued'.
         syst-msgv2 = ' '.
          PERFORM protocol_update.
        ENDIF.
    ELSE.
        CLEAR retcode.
        xscreen = us_screen.
        PERFORM processing USING us_screen.
        IF retcode NE 0.
          return_code = 1.
        ELSE.
          return_code = 0.
        ENDIF.
      ENDIF.
    endif.
    ENDFORM.
          FORM PROCESSING                                               *
    FORM PROCESSING USING proc_screen.
    CASE nast-kschl.
        WHEN c_kschl_order.
          PERFORM get_orders.
          CHECK retcode = 0.
          PERFORM openform USING proc_screen vbak-landtx.
          CHECK retcode = 0.
          PERFORM layout.
          CHECK retcode = 0.
          CHECK proc_screen NE 'X'.
          w_type = c_sale.
          PERFORM send_email USING proc_screen.
      WHEN c_kschl_order1.
         PERFORM get_orders.
         CHECK retcode = 0.
         CHECK proc_screen NE 'X'.
         w_type = c_sale.
         PERFORM send_email USING proc_screen.
       WHEN OTHERS.
          retcode = 1.
          syst-msgid = 'E0'.
          syst-msgno = '430'.
          syst-msgty = 'E'.
          PERFORM protocol_update.
      ENDCASE.
      IF retcode EQ 0.
        syst-msgid = '69'.
        syst-msgno = '254'.
        syst-msgty = 'S'.
        syst-msgv1 = nast-kschl.
        PERFORM protocol_update.
      ELSE.
        syst-msgid = 'CKCC'.
        syst-msgno = '036'.
        syst-msgty = 'E'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.
          FORM PROTOCOL_UPDATE                                          *
          The messages are collected for the processing protocol.       *
    FORM PROTOCOL_UPDATE.
      IF xscreen EQ space.
        CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
           EXPORTING
                MSG_ARBGB = SYST-MSGID
                MSG_NR    = SYST-MSGNO
                MSG_TY    = SYST-MSGTY
                MSG_V1    = SYST-MSGV1
                MSG_V2    = SYST-MSGV2
                MSG_V3    = SYST-MSGV3
                MSG_V4    = SYST-MSGV4
           EXCEPTIONS
                OTHERS    = 1.
       ELSE.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    ENDFORM.
    *&      Form  get_orders
          text
    -->  p1        text
    <--  p2        text
    FORM get_orders.
    DATA : f_csr_found        TYPE c.
    SELECT SINGLE vbeln vkorg vdatu bstnk kunnr
        FROM   vbak
        INTO  (vbak-vbeln,vbak-vkorg,vbak-vdatu,vbak-bstnk,vbak-kunnr)
        WHERE vbeln EQ nast-objky.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'VN'.
        syst-msgno = '203'.
        syst-msgty = 'E'.
        syst-msgv1 = 'VBAK'.
        syst-msgv2 = sy-subrc.
        PERFORM protocol_update.
      ENDIF.
      SELECT vbeln posnr matnr pmatn arktx abgru kdmat werks
      FROM vbap
      INTO (vbap-vbeln,vbap-posnr,vbap-matnr,vbap-pmatn,
    vbap-arktx,vbap-abgru,vbap-kdmat,vbap-werks)
      WHERE vbeln = vbak-vbeln
      AND abgru NE space "select items havng Rejection Reason
      and PSTYV NE 'ZHDR'.
    to check whether the reason for rejection was picked from the
    managed codes tables
    data: war_abgru type abgru,
          w_exist type c.
    clear : war_abgru, w_exist.
      select single abgru  from ZMAT_REJ002
                    into war_abgru
                    where vkorg = vbak-vkorg
                    and kunnr <> vbak-kunnr
                    and MATNR = vbap-matnr
                    and datef <= vbak-vdatu
                    and datet >= vbak-vdatu.
       if sy-subrc <> 0.
             select single abgru from ZMAT_REJ003
                              into war_abgru
                              where vkorg = vbak-vkorg
                              and kunnr <> vbak-kunnr
                              and MATNR = vbap-matnr
                              and datef <= vbak-vdatu
                              and datet >= vbak-vdatu.
             if sy-subrc <> 0.
                    select single abgru from ZMAT_REJ001
                              into war_abgru
                              where vkorg = vbak-vkorg
                              and werks <> vbap-werks
                              and matnr = vbap-matnr
                              and datef <= vbak-vdatu
                              and datet >= vbak-vdatu.
                    if sy-subrc <> 0.
                         select single abgru from ZMAT_REJ004
                                             into war_abgru
                                             where vkorg = vbak-vkorg
                                             and matnr = vbap-matnr
                                             and datef >= vbak-vdatu
                                             and datet <= vbak-vdatu.
                         if sy-subrc <> 0.
                         else.
                         w_exist = 'X'.
                         endif.
                   else.
                   w_exist = 'X'.
                   endif.
             else.
             w_exist = 'X'.
             endif.
       else.
       w_exist = 'X'.
       endif.
    if w_exist = 'X'.
    end for check from managed codes table
    *to find the quantity fields
        SELECT SINGLE wmeng bmeng
        FROM vbep
        INTO (vbep-wmeng,vbep-bmeng)
        WHERE vbeln EQ vbap-vbeln
        AND   posnr EQ vbap-posnr.
    *to get info about the customer
        SELECT SINGLE kunnr
        FROM vbpa
        INTO vbpa-kunnr
        WHERE  vbeln EQ vbak-vbeln
        AND    parvw EQ c_parvw_shipto.
         IF sy-subrc EQ 0.
          f_shipto_found = 'X'.
          SELECT SINGLE name1 spras
            FROM kna1
            INTO (kna1-name1,kna1-spras)
            WHERE kunnr EQ vbpa-kunnr.
          IF sy-subrc EQ 0.
            w_custname = kna1-name1.
            CLEAR kna1-name1.
          ENDIF.
         ENDIF.
         SELECT SINGLE kunnr
        FROM vbpa
        INTO vbpa-kunnr
        WHERE vbeln EQ vbak-vbeln
        AND   parvw EQ c_parvw_csr.
        IF SY-SUBRC EQ 0.
         f_csr_found = 'X'.
          SELECT SINGLE kunnr name1 name2 adrnr
           FROM kna1
           INTO (kna1-kunnr,kna1-name1,kna1-name2,
                 kna1-adrnr)
           WHERE  kunnr EQ vbpa-kunnr.
          IF sy-subrc EQ 0.
            w_csrno = kna1-kunnr.
            w_csrname = kna1-name1.
            CLEAR kna1-name1.
               SELECT SINGLE tel_number tel_extens fax_number
                 FROM adrc
                 INTO (adrc-tel_number,adrc-tel_extens,
       adrc-fax_number)
                 WHERE addrnumber EQ kna1-adrnr.
            CLEAR: adr6, w_email.
            SELECT SINGLE * FROM adr6 WHERE addrnumber = kna1-adrnr.
            IF sy-subrc = 0.
              w_email = adr6-smtp_addr.
            ENDIF.
          ENDIF.
        ENDIF.
    *to get the date format in french
        IF kna1-spras NE c_eng.
          w_month = sy-datum+4(2).
          SELECT SINGLE ltx
            FROM t247
            INTO t247-ltx
            WHERE spras EQ kna1-spras
            AND mnr EQ w_month.
          CONCATENATE sy-datum+6(2)
                      t247-ltx
                      sy-datum+0(4)
                      INTO w_ldate
                      SEPARATED BY space.
          ELSE.
          CONCATENATE sy-datum+4(2)
                      sy-datum+6(2)
                      sy-datum+0(4)
                      INTO w_ldate
                      SEPARATED BY c_sep.
        ENDIF.
        w_total = vbep-wmeng - vbep-bmeng.
         IF w_total GT 0.
         PERFORM fill_orders.
        ELSE.
          IF vbap-abgru NE space.
            w_total = vbep-wmeng.
            PERFORM fill_orders.
          ENDIF.
        ENDIF.
        CLEAR vbap.
        endif.           " check for w_exist for Managed Codes entry
    ENDSELECT.
    IF tbl_ord[] IS INITIAL.
        retcode = 1.
        syst-msgid = 'FZ'.
        syst-msgno = '027'.
        syst-msgty = 'E'.
        PERFORM protocol_update.
      ENDIF.
      IF f_csr_found IS INITIAL.
        syst-msgid = '8B'.
        syst-msgno = '127'.
        syst-msgty = 'W'.
        syst-msgv1 = c_parvw_csr.
        PERFORM protocol_update.
      ENDIF.
      IF f_shipto_found IS INITIAL.
        syst-msgid = '8B'.
        syst-msgno = '127'.
        syst-msgty = 'W'.
        syst-msgv1 = c_parvw_shipto.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " get_orders
    *&      Form  layout
          text
    -->  p1        text
    <--  p2        text
    FORM layout.
    SORT tbl_ord BY bstnk kdmat.
      LOOP AT tbl_ord.
        AT FIRST.
          PERFORM writeform_text.
        ENDAT.
        PERFORM writeform.
        AT LAST.
          PERFORM writeform_footer.
        ENDAT.
      ENDLOOP.
      CLEAR : cnt_1,cnt_2.
      PERFORM closeform.
    ENDFORM.                    " layout
    *&      Form  openform
          text
    FORM openform USING us_screen us_country.
    DESCRIBE TABLE tbl_ord LINES w_lines.
      IF w_lines EQ 0.
        retcode    = '1'.
        syst-msgid = 'FE'.
        syst-msgno = '078'.
        syst-msgty = 'E'.
        PERFORM protocol_update.
      ENDIF.
      CHECK retcode EQ 0.
    INCLUDE zrvadopfo.
    ENDFORM.                    " openform
    *&      Form  send_email
          text
         -->P_PROC_SCREEN  text
    FORM send_email USING    PROC_SCREEN.
    f_mail = 'X'.
      PERFORM openform USING proc_screen vbak-landtx.
      LOOP AT tbl_ord.
        AT FIRST.
          PERFORM writeform_text.
        ENDAT.
        PERFORM writeform.
        AT LAST.
          PERFORM writeform_footer.
        ENDAT.
      ENDLOOP.
      CLEAR cnt_2.
      PERFORM closeform.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'  "'ASCII'
           IMPORTING
                bin_filesize          = st_doc_data-doc_size
           TABLES
                otf                   = tbl_otf
                lines                 = tbl_line
           EXCEPTIONS                                           "DEVK912166
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                OTHERS                = 4.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'OA'.                                      "DEVK912166
        syst-msgno = '186'.                                     "DEVK912166
        syst-msgty = 'E'.                                       "DEVK912166
        PERFORM protocol_update.
      ENDIF.
      REFRESH tbl_objtxt.
      CLEAR tbl_objtxt.
      CLEAR tbl_proc_para.
      REFRESH tbl_proc_para.
      CLEAR tbl_maillist.
      REFRESH tbl_maillist.
      CLEAR tbl_pack_list.
      REFRESH tbl_pack_list.
      st_doc_data-obj_name   = 'Sales Order Cut Letter'.
      st_doc_data-obj_langu   = 'E'.                            "DEVK905849
      st_doc_data-sensitivty  = 'F'.                            "DEVK905849
      st_doc_data-obj_prio    =  1.                             "DEVK905849
      CONCATENATE w_type 'Cut Letter' INTO          "#EC NOTEXT
                                  st_doc_data-obj_descr  SEPARATED BY space.
      DATA w_line(3) TYPE c.
      PERFORM format_pdf.                                       "DEVK905849
      concatenate VBAK-VBELN '.PDF' into tbl_objhead.
    tbl_objhead = 'Sales Order Cut Letter.PDF'.
      APPEND tbl_objhead.
           "DEVK905849
      CLEAR wrk_lines.
      DESCRIBE TABLE tbl_attach LINES wrk_lines.
    fields needed for email
      tbl_maillist-com_type = 'INT'.
      tbl_maillist-receiver =  w_email.
      tbl_maillist-rec_type = 'U'.
      APPEND tbl_maillist.
    send email
      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
                                      STARTING NEW TASK 'MAIL'
           EXPORTING
                document_data              = st_doc_data
                document_type              = 'PDF'
                COMMIT_WORK                = 'X'    " added after ECC6.0 upgrade
           TABLES
                object_header              = tbl_objhead
                object_content             = tbl_objtxt
                receivers                  = tbl_maillist
           EXCEPTIONS                                           "DEVK912166
                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 NE 0.
        retcode = sy-subrc.
        syst-msgid = 'ZA_G'.                                    "DEVK912166
        syst-msgno = '922'.                                     "DEVK912166
        syst-msgty = 'E'.                                       "DEVK912166
        syst-msgv1 = sy-subrc.                                  "DEVK912166
        syst-msgv2 = tbl_smtp-adsmtp-smtp_addr.                 "DEVK912166
        PERFORM protocol_update.
        syst-msgid = 'VW'.
        syst-msgno = '001'.
        syst-msgty = 'E'.
        syst-msgv1 = 'Print successful:email Recepient Invalid'."#EC NOTEXT
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " send_email
    *&      Form  fill_orders
          text
    -->  p1        text
    <--  p2        text
    FORM fill_orders.
    tbl_ord-bstnk    = vbak-bstnk.
      tbl_ord-kdmat    = vbap-kdmat.
      tbl_ord-xblnr    = vbak-vbeln.
      tbl_ord-ean11    = vbap-pmatn.
      tbl_ord-arktx    = vbap-arktx.
      tbl_ord-csrno    = w_csrno .
      tbl_ord-csremail = w_email.
      tbl_ord-spras    = kna1-spras .
      tbl_ord-csrphone = adrc-tel_number.
      tbl_ord-csrfax   = adrc-fax_number.
      tbl_ord-csrext   = adrc-tel_extens.
      tbl_ord-total    = w_total.
      tbl_ord-custname = w_custname.
      tbl_ord-csrname  = w_csrname .
      tbl_ord-ldate    = w_ldate.
      APPEND tbl_ord.
      CLEAR tbl_ord.
      CLEAR w_total.
      CLEAR w_ldate.
    ENDFORM.                    " fill_orders
    *&      Form  writeform_text
          text
    -->  p1        text
    <--  p2        text
    FORM writeform_text.
    CALL FUNCTION 'WRITE_FORM'
           EXPORTING
                element = 'WTEXT'
                window  = 'WINDOW2'
           EXCEPTIONS
                element = 1
                window  = 2.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'EBR'.
        syst-msgno = '056'.
        syst-msgty = 'E'.
        syst-msgv1 = 'WTEXT'.
        syst-msgv2 = 'WINDOW2'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " writeform_text
    *&      Form  writeform
          text
    -->  p1        text
    <--  p2        text
    FORM writeform.
    CALL FUNCTION 'WRITE_FORM'
           EXPORTING
                element = 'EMAIN'
                window  = 'MAIN'
           EXCEPTIONS
                element = 1
                window  = 2.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'EBR'.
        syst-msgno = '056'.
        syst-msgty = 'E'.
        syst-msgv1 = 'WTEXT'.
        syst-msgv2 = 'WINDOW2'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " writeform
    *&      Form  writeform_footer
          text
    -->  p1        text
    <--  p2        text
    FORM writeform_footer.
    IF nast-spras = 'N'.
        CALL FUNCTION 'WRITE_FORM'
             EXPORTING
                  element = 'FOOTER'
                  window  = 'MAIN'
             EXCEPTIONS
                  element = 1
                  window  = 2.
      ENDIF.
      CALL FUNCTION 'WRITE_FORM'
           EXPORTING
                element = 'WFOOTER'
                window  = 'WINDOW12'
           EXCEPTIONS
                element = 1
                window  = 2.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'EBR'.
        syst-msgno = '056'.
        syst-msgty = 'E'.
        syst-msgv1 = 'WFOOTER'.
        syst-msgv2 = 'WINDOW12'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " writeform_footer
    *&      Form  closeform
          text
    -->  p1        text
    <--  p2        text
    FORM closeform.
    CALL FUNCTION 'CLOSE_FORM'
           TABLES
                otfdata                  = tbl_otf
           EXCEPTIONS
                unopened                 = 1
                bad_pageformat_for_print = 2
                OTHERS                   = 3.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'PS'.
        syst-msgno = '005'.
        syst-msgty = 'E'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " closeform
    *&      Form  format_pdf
          text
    -->  p1        text
    <--  p2        text
    FORM format_pdf.
    FIELD-SYMBOLS <fs>.
      DESCRIBE TABLE tbl_line    LINES  hltlines.
    DESCRIBE FIELD tbl_line    LENGTH fle1 IN BYTE MODE . Defect#1579-
    DESCRIBE FIELD tbl_objtxt  LENGTH fle2 IN BYTE MODE . Defect#1579-
    Start of Defect#1579+
      DESCRIBE FIELD tbl_line    LENGTH fle1 IN CHARACTER MODE.
      DESCRIBE FIELD tbl_objtxt  LENGTH fle2 IN CHARACTER MODE.
    End of Defect#1579+
      CLEAR   tbl_objtxt.
      REFRESH tbl_objtxt.
      LOOP AT tbl_line.
        htabix = sy-tabix.
        MOVE tbl_line TO hfeld+off1.
        IF htabix = hltlines.
          fle1 = strlen( tbl_line ).
        ENDIF.
        off1 = off1 + fle1.
        IF off1 GE fle2.
          CLEAR tbl_objtxt.
          tbl_objtxt = hfeld(fle2).
          APPEND tbl_objtxt.
          SHIFT hfeld BY fle2 PLACES.
          off1 = off1 - fle2.
        ENDIF.
        IF htabix = hltlines.
          IF off1 GT 0.
            CLEAR tbl_objtxt.
            tbl_objtxt = hfeld(off1).
            APPEND tbl_objtxt.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " format_pdf
    ANy Suggestion or help will be appreciated!
    Regards,
    Kittu
    Edited by: Kittu on Jun 30, 2008 12:32 PM

    Hello Julie Waller,
    Very Good evening!
    Thank you very much for your response!
    Sometimes...I miss the basic things and start concentarcting on typical ways to fix the issue. ....which will only make my issue critical. 
    Hello Sathya,
    Thank you for your response!
    POints are rewarded..
    Have a great day ahead!
    Regards,
    Kittu

  • How to use the set functions effectively in webi ,please let me know with detail

    how to use the set functions effectively in webi ,please let me know with detail

    Hi,
    we use use set functions on heirarchies with aggregate functions mostly .
    If you include member_set, Min returns the minimum value of the aggregated data for all members in the member set.
    Member_set can include multiple sets separated by semicolons (;).
    The list of member sets must be enclosed in {}.
    If the member set expression does not specify a precise member or node, the hierarchy referenced must be present in the table, then the member set expression references the current member in the hierarchy in the table. If the hierarchy is not in the table, the function returns the message #MULTIVALUE.
    Eg .
    1)     Ancestor
    =Sum([YTD] ; {Ancestor([Test Hierarchy];2)})
    2)     IsLeaf
    =[Test Hierarchy].IsLeaf
    You can use this function when you want to show your Measure only at lower level .
    3)     .Depth
    =[Test Hierarchy].Depth
    This is also function used with hierarchy to find Level of Members .
    Follow this link for PDF reference .
    Page 147
    https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&ved=0CDIQFjAB&url=https%3A%2F%2Fhelp.sap.com%2Fbusinessobject%2Fproduct_guides%2Fboexir4%2Fen%2Fxi4sp5_ffc_en.pdf&ei=nBAUU-iUM4WWrAeMuoCoDg&usg=AFQjCNHakXsEjd_yUk2y3lVdibf3PXpEOA&bvm=bv.61965928,d.bmk
    search on SCN this question was discussed before also one those links .
    http://scn.sap.com/thread/3183380
    Hope this will help you .

Maybe you are looking for

  • .pdf file changed into .tmp when trying to send pdf file as attachment

    Dears, A few days now, .pdf files are exported as .tmp files if we try to send them as attachment directly from the adobe reader plug-in in internet explorer 8. Unfortunatly Outlook interprets .tmp files as harmfull, so we are no longer able to send

  • Photoshop CS5 will not open in one of four accounts why

    I have an issue with Photoshop not opening in one of my four accounts on my MacPro.  I had t change my bootup drive to a larger one.  Now, whenever I try to open Photoshop CS5 in my primary standard account it says that it cannot find the scratch dis

  • Blank DVD and CD not showing up in Finder or anywhere

    My blank dvd and cd are not showing up in Finder. I checked my preference and deleted from my library com.apple.finder.plist. All to no avail. I have the new upgraded Lion.

  • My HD installation, thanks for tips

    I wanted to go with WD black scorpio but after hearing from and here and other reviews that it had problems I went with the Hitachi travelstar 7200.. Kudos for Newegg. $98 free shipping with a $30 rebate and I got it the next day, wow. I did it mysel

  • SAP HR LSO: Removed fields on course (Object E)

    Dear all, When booking a Course in LSO there the section (with fields) called the "price and cost assignment". We would like to remove this from the Course. Would anyone know if it is possible to remove this, and how? We would also like to remove the