Calling a function in a report

The following query brings in the calender month in a year but i want to get the fiscal year from the table.
And to get the fiscal year from the table i created a function check_trans_date and tried calling the same in the query but while compling it is assuming that the function is a column from the table and gives a message ORA-00904 invalid column name. In order to eliminate this error i created the function in the database and then tried to compile the query then it gives me a different message -- not a group by function.
Can anyone shed a light on this.
QUERY :::
select
msi.segment1
,hla.location_code
,'Month'
, decode(check_trans_date(trunc(mmt.transaction_date), 1), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month1"
, decode(check_trans_date(trunc(mmt.transaction_date), 2), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month2"
, decode(check_trans_date(trunc(mmt.transaction_date), 3), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month3"
, decode(check_trans_date(trunc(mmt.transaction_date), 4), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month4"
, decode(check_trans_date(trunc(mmt.transaction_date), 5), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month5"
, decode(check_trans_date(trunc(mmt.transaction_date), 6), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month6"
, decode(check_trans_date(trunc(mmt.transaction_date), 7), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month7"
, decode(check_trans_date(trunc(mmt.transaction_date), 8), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month8"
, decode(check_trans_date(trunc(mmt.transaction_date), 9), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month9"
, decode(check_trans_date(trunc(mmt.transaction_date), 10), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month10"
, decode(check_trans_date(trunc(mmt.transaction_date), 11), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month11"
, decode(check_trans_date(trunc(mmt.transaction_date), 12), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1, sum(mmt.transaction_quantity)), 'N', 0, 0) "Month12"
from inv.mtl_material_transactions mmt
,inv.mtl_txn_request_headers mtrh
,inv.mtl_system_items_b msi
,apps.hr_locations_v hla
where
mtrh.ship_to_location_id = hla.ship_to_location_id(+)
and mtrh.ship_to_location_id is not null
and mtrh.header_id = mmt.transaction_source_id
and mmt.transaction_date BETWEEN :CP_month1_start and :CP_month12_end
and mmt.transaction_type_id = 63
and mmt.transaction_source_type_id = 4
and mmt.organization_id = msi.organization_id
and msi.segment1 between nvl(:P_Inventory_item_id_low, msi.segment1) and nvl(:P_Inventory_item_id_high,msi.segment1)
and mmt.inventory_item_id = msi.inventory_item_id
and msi.organization_id = :p_org_id
group by
msi.segment1
,hla.location_code
,to_date(to_char(mmt.transaction_date,'MON/YY'),'MON/YY')

Check your code,
decode(check_trans_date(trunc(mmt.transaction_date), 1), 'Y', decode(sign(sum(mmt.transaction_quantity)), -1, sum(mmt.transaction_quantity) * -1,
sum(mmt.transaction_quantity)), 'N', 0, 0) "Month1"
You are using the SUM() function twice in each line. This query is not valid without Group By Clause.
Explain more about what you are trying to achieve.

Similar Messages

  • Calling IP function in ABAP report

    Hi guys,
    I would like to execute a planning function of BIIP from an ABAP report. Which function module has to be used or is there a different approach? For the old BPS planning function there was the API_SEM_BPS....
    Regards
    Stefan

    Hi Stefan,
    I think there is no way to call a planning function of IP in a report. But we can call planning sequences using the program
    RSPLS_PLSEQ_EXECUTE.
    In your case, you can create a planning sequence which contains the planning function and filter, and in your ABAP report, call the program RSPLS_PLSEQ_EXECUTE using the statement SUBMIT.
    Also, you can use the statement SUBMIT VIA SELECTION-SCREEN which will prompt you to give the Planning Sequence name at run-time of the execution of the ABAP report.
    Hope this helps.
    Please revert if unresolved.
    Regards,
    Srinivas Kamireddy.

  • How to call C++ function in Crystal report

    Hi,
    i am working on serious issue now, i need some help, Could you please tell me how can i call my C++ method in crystal report designer (may be formula editor), i can see only this support VB and Crystal basic.
    Regards,
    Prabhakar J.

    Hi Prabhakar,
    The name of the UFL dll must begin with U2L. Rename your and if it's compile properly CR should find it when loading all of it's dependencies.
    Check the developers help file and search for Custom User Function Library.
    I should also mention that UFL's only support MBCS string formats so if you define them they must be defined this way or CR will have problems passing them from/to your UFL. CR uses UNICODE format internally but the UFL bridge will thunk them to MBCS format on the way out and expect that format on the way in. There is a possibility of data loss in the conversion routines.
    Thank you
    Don
    Edited by: Don Williams on Jun 12, 2009 11:24 AM

  • ORA-06502 when trying to call a function inside my report

    Hi guys,
    I have the following code in a function to get my open bal for a field in my report but I am getting ORA-06502 every time I try to run it.
    Does any one have any idea as why?
    ================================
    function CF_OPNE_BALFormula return Number is
    v_bal number;
    v_period char;
    v_prv_period char;
    BEGIN
    v_period := to_char(last_day(:p_date_From),'RRRRMM');
    if substr(v_period,5,2) = '01' then
    v_prv_period := to_char(to_number(substr(v_period,1,4))-1) ||'13';
    else
    v_prv_period := to_char(to_number(to_char(:p_date_From,'YYYYMM')-1));
    end if;
    v_bal := csh_acc_pkg.csh_get_acc_bal(:p_own_id,:P_GLA_acc_num,v_prv_period,'F','ACC');
    return(v_bal);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
    END;
    ====================================================
    Thanks
    Hali

    Try using varchar2 with length specified instead of char in the variable declarations.

  • IP - Is it possible to call exit planning function from ABAP Report..

    Hi All,
    Greetings.
    Is it possible to call exit planning function from ABAP Report (t-code SE38) ? Or I mean is not limited only to be called from ABAP Report, perhaps from BSP / Web-Dynpro / Function Module.
    If somebody here has been doing it before, I'm keen to ask to kindly share it. Particularly how to call and transfer data to that exit function.
    Or if somebody has done in BPS, appreciate if it can be shared too .
    Thanks a lot and have a good day,
    Best regards,
    Daniel N.

    Hi.
    You can achive this as suggested by Mattias in your previous post.
    Lets say you have next data structure:
    CostCenter | Amount | PercentForDistibution |
    Create input ready query in this format. Restrict cost center by variable type range.
    Create WAD with analysis item.
    When you run web page you enter range of cost centers (lets say you will enter 101004 to 101010).
    I assume you have data only for 101004 in your cube (lets say 1000).
    You will see only one record in your webpage.
    CostCenter | Amount | PercentForDistibution |
    101004       | 1000     | NOTHING
    When you create WAD in analysis item properties set "NUMBER_OF_NEW_LINES" to lets say 1 (so in WAD you will see always one blank line for entering new data).
    Just add 6 new records:
    CostCenter | Amount   | PercentForDistibution |
    101005       | NOTHING| 10
    101006       | NOTHING| 30
    101007       | NOTHING| 20
    101008       | NOTHING| 25
    101009       | NOTHING| 5
    101010       | NOTHING| 10
    Then run planning FOX function like this:
    FOREACH Z_COST_CENTER.
    IF {Amount, Z_COST_CENTER} <> 0
    Z_AMNT_TO_DISTRIBUTE = {Amount, Z_COST_CENTER}.
    ENDIF.
    ENDFOR.
    FOREACH Z_COST_CENTER.
    IF {PercentForDistibution Z_COST_CENTER} <> 0.
    {Amount, Z_COST_CENTER} = Z_AMNT_TO_DISTRIBUTE * {PercentForDistibution Z_COST_CENTER}.
    ENDIF.
    ENDFOR.
    It is not perfect FOX, but as an idead, it should work.
    Regards.

  • Link that calls DB function in report

    I have a standard report. I would like to add 2 links to the end of each row with the action by the user.
    For example:
    Order No Name Action
    123 John Doe Approve | Decline
    456 Jane Dow Approve | Decline
    Where Approve and Decline are links that call DB functions.
    How do I begin?
    TIA
    Scott

    Hi Scott,
    You can try this
    Create an application level item F101_ID
    Create 2 appication level processes to call you're stored procedures / functions.
    One for Accept and one Decline. F101_ID would probably be the PK of the record you are dealing with or
    in the example below "column_name_1"
    If you want to use a icon
    select .....
    '<img src="#WORKSPACE_IMAGES#accept.ico" width="30" height="30" alt="Accept"'
    || 'onclick="javascript:accept(this,'||column_name_1||','||column_name_2||');">',
    '<img src="#WORKSPACE_IMAGES#decline.ico" width="30" height="30" alt="Accept"'
    || 'onclick="javascript:decline(this,'||column_name_1||','||column_name_2||');">'
    from table_name
    if you want to use a URL then use this
    select ....
    'a href="javascript:accept(this,'||column_name_1||','||column_name_2||');">Accept',
    'a href="javascript:decline(this,'||column_name_1||','||column_name_2||');">Decline'
    from table_name
    On your page definition under HTML header add the following javascript
    <script language="JavaScript" type="text/javascript">
    function accept(pThis,pSelect,formItem1){
    alert("Accepted.");
    var l_Return = null;
    var url;
    var l_Select = html_GetElement(pSelect);
    var get = new htmldb_Get(null,$x('pFlowId').value,
    'APPLICATION_PROCESS=ACCEPT',0);
    get.add('F101_ID',pSelect);
    gReturn = get.get('XML');
    url = 'f?p=&APP_ID.:108:&APP_SESSION.::::P108_ID:' + formItem1;
    w = window.location(url);
    return false;
    </script>
    <script language="JavaScript" type="text/javascript">
    function decline(pThis,pSelect,formItem1){
    alert("Declined.");
    var l_Return = null;
    var url;
    var l_Select = html_GetElement(pSelect);
    var get = new htmldb_Get(null,$x('pFlowId').value,
    'APPLICATION_PROCESS=DECLINE',0);
    get.add('F101_ID',pSelect);
    gReturn = get.get('XML');
    url = 'f?p=&APP_ID.:108:&APP_SESSION.::::P108_ID:' + formItem1;
    w = window.location(url);
    return false;
    </script>
    Hope this helps
    Connor
    Edited by: user4505115 on 2010/05/03 1:40 PM
    Edited by: user4505115 on 2010/05/03 1:41 PM

  • Call Javascript function to pass a id  from APEX report column link

    Hi,
    Can anyone help me, in a report column link i'm calling a function to pass an id and i want to onclick change a icon on that column based on the value on the column status of this table.
    Is this possible?

    Hi Ron,
    I am doing exaclty what you have suggested me but no luck. I started changing the DEMO_CUSTOMERS application to my requirements.The report is working fine and on the report I have created a page attribute to the Hyper linked column and linked that to the page 2 and assign that attribute with #JOBNUM#.
    I am able to pass that value on to form when I click on the JOBNUM. But the problem is I am not able to pass that value into the SQL query so that my query pulls 20+ columns on to the Form ( which is second page ).
    Small clarification... On the form region it is said FORM NAME and type is HTML is that is the way the APEX was designed or does it need to say region type as FORM.
    Thanks for your help in advance.
    Cheers,
    Krishna.

  • Calling DB function for each row in a report

    I'd like to call a function inside a database package from my Oracle Report. My report is a very simple tabular listing and I'd like to pass one the row's column value as a parameter to my function call.
    Where would i have to write this block of code? How do I get the value of a particular column in the report? I need to pass the value to the function call.
    Thanks

    Depends what you want to do in this function. There are several possibilites:
    - Add a formula column to your data model.
    - Directly call the function in your query:
    select col1, col2, my_package.my_function(col1) return_value
    from my_table
    where ...The 2nd option would be my preferred one.

  • Calling ORACLE Functions from within CF Builder report

    Hi, I have an ORACLE function that I would like to call from within my CF REPORT.
    I know there is a section in the report builder where you can write coldfusion code to perform tasks, but I would rather simply call the ORACLE function for each detail row in the report
    I do not want to call this function from within my main ORACLE query that I use for the report, so please don't suggest that.
    Thanks so much.
    -Jim

    6.0.5 is not certified against 10g database, so I suggest to upgrade to 6.0.8.26 (6i patch 17) first to see if the problem is gone.

  • Can call a function a few times in reports

    Hi
    Please help me to solve this problem:
    I have a function taking parameters and return a number, I tried
    2 ways to call this function but get same error saying the
    function may not be used in SQL:
    1. the function is in a package, and I use the pl/sql query
    (build from data model) to call it a few times by passing
    different parameters, I get error when compile the query
    2. the function is outside the package, and is called from
    another function in the package a few times, get error when
    compile the package body.
    3. by the way is weekly typed ref cursor allowed in reports?
    Below is part of my code:
    case 1:
    create or replace package perDiem AS
    PRAGMA SERIALLY_REUSABLE;
    TYPE curType IS REF CURSOR;
    function diemSum (
    party_id IN NUMBER,
    partytype IN NUMBER,
    fid IN NUMBER,
    freeday_type IN VARCHAR2,
    startdays IN NUMBER,
    enddays IN NUMBER)
    RETURN NUMBER;
    END;
    CREATE OR REPLACE PACKAGE BODY perDiem AS
    PRAGMA SERIALLY_REUSABLE;
    function diemSum (
    party_id IN NUMBER,
    partytype IN NUMBER,
    fid IN NUMBER,
    freeday_type IN VARCHAR2,
    startdays IN NUMBER,
    enddays IN NUMBER)
    RETURN NUMBER IS
    pdSum NUMBER(10);
    BEGIN
    IF partytype = 1 THEN
    IF freeday_type = 'gateout' THEN
    SELECT COUNT(*) INTO pdsum
    FROM equipment e,
    equipmenttrip et,
    facilitysegment s
    WHERE s.facilityid =fid
    AND et.lastfreeday between startdays AND enddays
    AND et.carrierpartyid =party_id;
    ELSIF freeday_type = 'strip' THEN
    SELECT COUNT(*) INTO pdsum
    FROM equipment e,
    END IF;
    ELSIF partytype = 3 THEN
    IF freeday_type = 'gateout' THEN
    SELECT COUNT(*) INTO pdsum
    FROM ...
    ELSIF freeday_type = 'strip' THEN
    SELECT COUNT(*) INTO pdsum
    FROM facility f,
    END IF;
    END IF;
    RETURN pdsum;
    END diemSum;
    END;
    /////////// pl/sql query//////////////
    function diemDet return perDiem.curType is
    sum_cv perDiem.curType;
         party_code VARCHAR2(20);     
              freeday_type VARCHAR2(20);
    begin
    party_code := :partycode;
              freeday_type := :freeday;
              OPEN sum_cv FOR SELECT      f.facilitycode,
                   perDiem.diemSum(p.partyid,
    p.partytypeid, f.facilityid, freeday_type, 1, 4 ) as days1,
              perDiem.diemSum(p.partyid, p.partytypeid,
    f.facilityid, freeday_type, 5, 10 ) as days2,
              perDiem.diemSum(p.partyid, p.partytypeid,
    f.facilityid, freeday_type, 11, 10000 ) as days3
              FROM equipmenttrip et,
                   facility f,
                   facilitysegment s,
                   party p
         WHERE f.facilityid = s.facilityid
              AND p.partycode = party_code ;
         RETURN sum_cv ;
    end;
    case 2 *** diemSum is a seperate function from package
    create or replace package perDiem AS
    PRAGMA SERIALLY_REUSABLE;
    TYPE curType IS REF CURSOR;
    function diemDet (
    party_code IN VARCHAR2,
    freeday_type IN VARCHAR2)
    RETURN curType;
    END;
    CREATE OR REPLACE PACKAGE BODY perDiem AS
    PRAGMA SERIALLY_REUSABLE;
    function diemDet (
    party_code IN VARCHAR2,
    freeday_type IN VARCHAR2)
    RETURN curType IS
    sum_cv curType;
    BEGIN
    OPEN sum_cv FOR SELECT f.facilitycode,
    diemSum(p.partyid, p.partytypeid, f.facilityid, freeday_type, 1,
    4 ) as days1,
    diemSum(p.partyid, p.partytypeid, f.facilityid, freeday_type, 5,
    10 ) as days2,
    diemSum(p.partyid, p.partytypeid, f.facilityid, freeday_type,
    11, 10000 ) as days3
    FROM equipmenttrip et,
    facility f,
    facilitysegment s,
    party p
    WHERE ...
    RETURN sum_cv ;
    END diemDet;
    END;

    My bet would be that the function doesn't promise not to update
    the database. Therefor it can't be called from a select statment.
    To overcome this you need to define a pragma. I don't remember
    its exact name but I think it is restricted_reference.

  • Calling databse function from report end. Using Evaluate function.

    Hi All,
    We have a req where we need to call the backend functions from the report end. I have seen that Evaluate function can be used to do the same. I tried replicating the same same but it didnt work.
    Can any one please elaborate more on this. Syntax & other details. We need to also pass on parameters to the function, probably some column value.
    Also please do let me know where all changes need to be done... RPD etc if applicable.
    This is the functiion we need to replicate in OBIEE.
    Nvl(dwh.dwh_pa_get_si_value_f(Pa_Projects_All_V.Project_Id,Pa_Periods_All_V.Period_Name,-1,Dwh_Pa_Project_Si_Info.Currency_Type,Dwh_Pa_Task_Si_V.Task_Number,'R'),0)
    Thanks,
    Pankaj

    Hey Pankaj,
    I got solution for your issue...
    Under any logical table.. you create a logical column and
    Select Existing logical columns as source checkbox
    Click on Eclipse button..
    Now here you write..
    EVALUATE('dwh.dwh_pa_get_si_value_f(%1,%2,%3,%4,%5)' ,Pa_Projects_All_V.Project_Id,Pa_Periods_All_V.Period_Name,-1,Dwh_Pa_Project_Si_Info.Currency_Type,Dwh_Pa_Task_Si_V.Task_Number,'R')
    And click ok..
    Hope it works..
    it worked for me..
    Thanks & Regards
    Kishore Guggilla

  • Calling javascript function from report customization form

    I have been unable to call any user-defined javascript function from Portal Report Customization forms.
    Even a simple Message Box function doesn't work. I've been placing my code in the ..after header PL/SQL section for the report customization form.
    htp.p('<script type="javascript">');
    htp.p('function MsgBox(message){');
    htp.p('alert(message);}');
    htp.p('</script>');
    htp.p('See if it works');
    I have verified in plain html that my syntax is fine. Even the syntax rendered by portal is correct:
    <script type="javascript">
    function MsgBox(message){
    alert(message);}
    </script>
    See if it works
    Despite this, you will get a javascript error that an Object is expected, MsgBox not defined. Clearly from the script above MsgBox is defined.
    I have tried any number of calls to user defined functions and can't get anything to work. However, calling native functions like 'alert' works fine ( ie
    See if it works
    Anyone know how I can call a user defined javascript function in a Portal Report Customization form?

    Try changing the code
    htp.p('<script type="javascript">');
    to
    htp.p('<script language="javascript">');
    Thanks
    -Krishnamurthy

  • LabVIEW PDA reports COREDLL.DLL error when using Call Library Function Node

    I'm trying to build a LV PDA app that calls an external DLL file built using embedded visual C. When configuring the Call Library Function node I select the stub DLL, configure the I/O parameters and select OK. When the configuration dialog closes I get the following error:
    LabVIEW: LabVIEW.exe - Unable to Locate Component
    This application has failed to start because COREDLL.DLL was not found. Re-installing the application may fix this problem.
    I do not get this error when using the configuration dialog in the example VIs.
    Any suggestions as to the cause and/or the solution?
    Thanks,
    Ryan

    Hello -
    When you create a PDA VI that calls a DLL, you must include the .c or .lib file that corresponds to the DLL. Take a look at these documents:
    LabVIEW PDA Module Build Errors with VIs that Call DLLs
    Why Do I Receive Errors When Calling a C++ DLL from a Call Library Node Using the LabVIEW PDA Module...
    How To Call External Code in LabVIEW PDA for Palm OS
    H
    ow To Call External Code in LabVIEW PDA for Pocket PC
    Hope this helps!
    S Vences
    Applications Engineer
    National Instruments

  • Upload data from excel with vba by calling a function module

    Hello all,
    i have a problem with the function module "ALSM_EXCEL_TO_INTERNAL_TABLE". I will call this function module with vba to load data from excel to sap with a Buttonclick. I have copied this function module and set it remotable. But i can´t call it from excel.
    Can you give me some tips how can i
    upload data from excel with vba by click a button.
    The problem seems the function: call method cl_gui_frontend_services=>clipboard_import in the function module, because when i comment this function call the vba-call is true but no results. 
    How can I call the function module correct with vba?
    Thanks a lot for your tips!!!!
    Chris
    Message was edited by:
            Christoph Kirschner

    HI
    Uploading data directly from Excel file format
    * Upload data direct from excel.xls file to SAP
    REPORT ZEXCELUPLOAD.
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    <b>Excel Upload Alternative - KCD_EXCEL_OLE_TO_INT_CONVERT</b>
    *Title : Excel Uploading
    TYPES:   BEGIN OF t_datatab,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             col6(30)  TYPE c,
             col7(30) TYPE c,
             col8(30)  TYPE c,
             col9(30)  TYPE c,
             col10(30)  TYPE c,
             col11(30)    TYPE c,
           END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    Data : p_table type t_datatab occurs 0 with header line.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '1',
           gd_ecol   TYPE i VALUE '256',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    field-symbols : <fs>.
    *Selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:  p_file LIKE rlgrap-filename
                   DEFAULT 'c:test.xls' OBLIGATORY.   " File Name
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
    *    so_fpath-sign = 'I'.
    *    so_fpath-option = 'EQ'.
    *    append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    * END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5,
                wa_datatab-col6,
                wa_datatab-col7,
                wa_datatab-col8,
                wa_datatab-col9,
                wa_datatab-col10,
                wa_datatab-col11.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
    *       upload excel spreadsheet into internal table
    *      -->P_TABLE    Table to return excel data into
    *      -->P_FILE     file name and path
    *      -->P_SCOL     start column
    *      -->P_SROW     start row
    *      -->P_ECOL     end column
    *      -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    * Has the following format:
    *             Row number   | Colum Number   |   Value
    *      i.e.     1                 1             Name1
    *               2                 1             Joe
      DATA : ld_index TYPE i.
    * Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = LT_INTERN
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
         MOVE lt_intern-col TO ld_index.
         assign component ld_index of structure
         p_table to <fs>.
    move : lt_intern-value to <fs>.
    *     MOVE lt_intern-value TO p_table.
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "UPLOAD_EXCEL_FILE
    Regards
    Pavan

  • Calling a function from a DLL, exectution in background mode.

    Dear Experts,
    We have created an ABAP report the calls a function from a DLL file. If the report is executed in on-line mode the program calls and executes the function from the DLL, but if the ABAP programa is executed in background mode it doesnt calls the DLL function.
    Do you know a way to solve the problem when executing in background mode?
    Best regards.
    Antonio

    Hi Gabriel,
    Let me explain in details about my DLL function.
    We are importing the business partners from legacy system into the SAP CRM system, so at the moment we created the BP master data via BAPI, I get the name of the BP and this moment I call the function in the DLL file. I export the parameter name and I receive back a simplified string with the name reduced to a code. This code I get back from the dll it is insert in a Z table, so there is no interaction in the screen, all must be executed in background mode, because there are a lot of business partners to be converted in SAP system.
    I am sending my code for your considerations.
    Instancia a DLL
      CREATE OBJECT dll 'MTCODE.CPFONET'.
      IF sy-subrc NE 0.
        RAISE without_dll.
      ENDIF.
    Move para a tabela interna IT_NAME os valores recebidos na TI_NAME
      it_name[] = ti_name[].
    Para cada registro importado
      LOOP AT it_name.
        CLEAR v_string_ret.
        wa_matchcode-zregid     = it_name-zregid.
        wa_matchcode-name1_text = it_name-name1_text.
        v_string = it_name-name1_text.
        CONDENSE  v_string.
        TRANSLATE v_string TO UPPER CASE.
        CALL METHOD  OF dll 'SetNome' EXPORTING #1 = v_string.
        CALL METHOD  OF dll 'ExecMatch'.
        CALL METHOD  OF DLL 'GetMCData' = v_string_ret.
        FREE OBJECT dll.
      Preenche os campos do match-code de acordo com o retorno da DLL
        SPLIT v_string_ret
        AT '|'
        INTO wa_matchcode-zparmcln
             wa_matchcode-zparmcfn
             v_empty
             wa_matchcode-name_first
             wa_matchcode-name_last
             wa_matchcode-namemiddle.
      Adiciona o registro com o match-code correspondente na TE_MATCHCODE
        APPEND wa_matchcode TO te_matchcode.
      ENDLOOP.

Maybe you are looking for

  • Error in Leave Approval Workflow

    Hello Experts, I'm Using Standard Workflow WS0040077 for Leave Approval . I Activated the Event Linkage in SWEL .Did General Task in Agent Assignment . But when i run transaction PA30 . i get this error in SAP Inbox. Following error occurred: 00 341

  • Bug with sidebars duplicating links

    Has anyone else encountered this bug: If you create a static sidebar that contains multiple URLs that reference the same relative path, the sidebar will duplicate the links listed. The code appended to the bottom of this post will produce the followi

  • An unknown error has occured while saving to .ai file

    After reading through tons of topics about "An unknown error has occured" I still can't find any suitable sollution for the problem. So, my observations are: I have both 32- and 64-bit versions of Adobe Illustrator CS6 The error occurs only with the

  • New yahoo mail not opening when I right click and choose "Send Link".

    When I right click on any web page and choose "Send Link", Yahoo mail asks for password over and over and never opens a new email page.

  • Screen Sharing in iMessage

    I have been trying to share my screen via AIM in iMessage, and whenver I do, I connect for less than a second and then get an error message (1005) saying that there was no response from the network.  Is this a network setting?  Or is there something