Pb with a function(need example)

i'm trying to use SCXI_Set_Config in vb and i have some problem... (hardware: pci 6024 + SCXI 1000+ SCXI 1520)
is ther any example on how to use this function in vb..i'm using it just to put my 1520 in parallel mode is there another way to do that??
thanx
Olivier

Hello
You will have to use the Measurement and Automatioon Explorer to configure the 1520 in parallel mode, you wont be able to do it programatically. Check out this KB for details on how to do this.
I hope this helps
Bilal Durrani
NI
Bilal Durrani
NI

Similar Messages

  • Difficulties replacing some BC functionality with XI (refer to example)

    <b>Difficulties replacing some BC functionality with XI (refer to example)</b>
    I am transferring all interface processing from BC to XI and am having difficulties replacing some of the current BC functionality.  Please refer to my example below
    <b>Current process</b>
    <b>SAP R/3</b>
    SAP R/3 executes an abap that extracts certain data.  This data is passed via a remote function which is configured to point to Business Connector
    <b>Business Connector</b>
    Business Connector takes control and the relevant package does some internal processing then calls the remote enabled function BAPI_ACC_BILLING_POST
    <b>SAP R/3</b>
    Control is returned to SAP R/3 to post the data and on completion control is returned to Business Connector
    <b>Business Connector</b>
    Business Connector again takes control where some more processing is done to generate an xml version of the data prior to returning control back to SAP R/3
    <b>SAP R/3</b>
    Control is returned to the abap immediately following the call to the remote function and processing completes
    The initial synchronous call from SAP R/3 to Business Connector remains open whilst Business Connector executes a subsequent synchronous call to SAP R/3.
    Finally the initial synchronous call in SAP R/3 completes
    <b>Proposed Process</b>
    I am transferring all interface processing from BC to XI and am having difficulties replacing some of the current BC functionality.  In this instance I can set up the initial synchronous call via an XI Integration Process (sync/async bridge).  This allows me to perform subsequent asynchronous calls prior to closing the synchronous bridge
    I have successfully performed synchronous calls to SAP R/3 from XI for different scenarios and have set up the XI design and config in the same manner
    When I try to perform the synchronous posting back to SAP R/3 from within the SA bridge I get the message ‘Message is incomplete. No Sender found’
    Unlike BC, it appears that XI does not allow me to perform the synchronous posting back to SAP R/3 from within the SA bridge.
    <b>Refer to</b> http://help.sap.com/saphelp_nw04/helpdata/en/83/d2a84028c9e469e10000000a1550b0/frameset.htm <b>for the SAP description</b> To enable the communication between a synchronously calling business system (synchronous outbound interface) and an asynchronously called business system (asynchronous inbound and outbound interface), you can define a sync/async bridge in an integration process. You can only define one sync/async bridge for each integration process.
    How can I replace the current BC functionality using XI?
    Regards,
    Mike

    Hi all,
    I cannot replicate the current BC functionality in XI
    So I will take this opportunity to simplify and improve the design for XI --> R/3
    Regards,
    Mike

  • Need valuable guidance to make a peformance oriented query, trying to replace unions with analytical function

    Hi,
       Please find below table structure and insert scritps. Requesting for vluable help.
    create table temp2 (col1 number,col2 varchar2(10),col3 number,col4 varchar2(20));
    insert into temp2 values (1,'a',100,'vvv');
    insert into temp2 values (2,'b',200,'www'); 
    insert into temp2 values (3,'c',300,'xxx');
    insert into temp2 values (4,'d',400,'yyy');   
    insert into temp2 values (5,'e',500,'zzz');
    insert into temp2 values (6,'f',600,'aaa');
    insert into temp2 values (7,'g',700,'bbb'); 
    insert into temp2 values (8,'h',800,'ccc');
    I am trying to get same output, what we get from below UNION query with ANALYTICAL Function.
    select * from temp2 where col1 in (1,2,3,4,5)
    union
    select * from temp2 where col1 in (1,2,5,6)
    union
    select * from temp2 where col1 in (1,2,7,8);
    I am seeking help by this dummy example to understand the concept, how can we use analytical functional over UNION or OUTER JOINS.
    In my exact query, I am using same table three times adding UNION clause. here also we scan temp2 three times, so for bulky tables using 'union'  would be hampering query's performance
    It means i go with three time scans of same table that is not performance oriented. With the help of above required concept, i will try to remove UNIONs from my exact query.
    Thanks!!

    Thanks for your time BluShadow and sorry as i think i couldn't make my query clear.
    I try it again. Below there are three queries, you may see all three queries are using same tables. Difference in all three queries are just few conditions, which makes all three queries diff with each other.
    I know, u cant run below query in your database, but i think it will convey my doubt to you. I have mentioned no. of rows with each clause and total i am getting 67 rows as my output. (Reason may be first n third query's result set are the subset of Second Query dataset)
    So i want to take all common rows as well as additional rows, if present in any of the query. This is getting easliy done with UNION clause but want to have it in other way as here my same is getting scanned again n again.
    SELECT
             START_TX.FX_TRAN_ID START_FX_TRAN_ID
            ,END_TX.FX_TRAN_ID END_FX_TRAN_ID
            ,START_TX.ENTERED_DT_TS
            ,USER
            ,START_TX.TRADE_DT
            ,START_TX.DEAL_NUMBER
            ,START_TX.FX_DEAL_TYPE
            ,START_TX.ORIENTATION_BUYSELL
            ,START_TX.BASE_CCY
            ,START_TX.BASE_CCY_AMT
            ,START_TX.SECONDARY_CCY
            ,START_TX.SECONDARY_CCY_AMT
            ,START_TX.MATURITY_DT
            ,START_TX.TRADE_RT
            ,START_TX.FORWARD_PTS              
            ,START_TX.CORPORATE_PIPS           
            ,START_TX.DEAL_OWNER_INITIALS      
            ,START_TX.CORPORATE_DEALER         
            ,START_TX.PROFIT_CENTER_CD
            ,START_TX.COUNTERPARTY_NM
            ,START_TX.COUNTERPARTY_NUMBER
      FROM
          (SELECT * FROM FX_TRANSACTIONS WHERE GMT_CONV_ENTERED_DT_TS >=  TO_DATE('20-Nov-2013 4:00:01 AM','DD-Mon-YYYY HH:MI:SS AM')) START_TX
           INNER JOIN
          (SELECT * FROM FX_TRANSACTIONS WHERE GMT_CONV_ENTERED_DT_TS <=  TO_DATE('20-Nov-2013 4:59:59 PM','DD-Mon-YYYY HH:MI:SS AM'))  END_TX
       ON START_TX.COUNTERPARTY_NM        = END_TX.COUNTERPARTY_NM         AND
          START_TX.COUNTERPARTY_NUMBER    = END_TX.COUNTERPARTY_NUMBER     AND
          START_TX.FX_DEAL_TYPE           = END_TX.FX_DEAL_TYPE            AND
          START_TX.BASE_CCY               = END_TX.BASE_CCY                AND
          START_TX.SECONDARY_CCY          = END_TX.SECONDARY_CCY           AND
          NVL(START_TX.CORPORATE_DEALER,'nullX')=NVL(END_TX.CORPORATE_DEALER,'nullX')       AND
          START_TX.ORIENTATION_BUYSELL='B'                                 AND 
          END_TX.ORIENTATION_BUYSELL='S'                                  AND
          START_TX.FX_TRAN_ID = 1850718                                  AND
         (START_TX.BASE_CCY_AMT           = END_TX.BASE_CCY_AMT          
          OR
          START_TX.SECONDARY_CCY_AMT      = END_TX.SECONDARY_CCY_AMT)        -- 10 Rows
    UNION
    SELECT
             START_TX.FX_TRAN_ID START_FX_TRAN_ID
            ,END_TX.FX_TRAN_ID END_FX_TRAN_ID
            ,START_TX.ENTERED_DT_TS
            ,USER
            ,START_TX.TRADE_DT
            ,START_TX.DEAL_NUMBER
            ,START_TX.FX_DEAL_TYPE
            ,START_TX.ORIENTATION_BUYSELL
            ,START_TX.BASE_CCY
            ,START_TX.BASE_CCY_AMT
            ,START_TX.SECONDARY_CCY
            ,START_TX.SECONDARY_CCY_AMT
            ,START_TX.MATURITY_DT
            ,START_TX.TRADE_RT
            ,START_TX.FORWARD_PTS              
            ,START_TX.CORPORATE_PIPS           
            ,START_TX.DEAL_OWNER_INITIALS      
            ,START_TX.CORPORATE_DEALER         
            ,START_TX.PROFIT_CENTER_CD
            ,START_TX.COUNTERPARTY_NM
            ,START_TX.COUNTERPARTY_NUMBER
      FROM
          (SELECT * FROM FX_TRANSACTIONS WHERE GMT_CONV_ENTERED_DT_TS >=  TO_DATE('20-Nov-2013 4:00:01 AM','DD-Mon-YYYY HH:MI:SS AM')) START_TX
           INNER JOIN
          (SELECT * FROM FX_TRANSACTIONS WHERE GMT_CONV_ENTERED_DT_TS <=  TO_DATE('20-Nov-2013 4:59:59 PM','DD-Mon-YYYY HH:MI:SS AM'))  END_TX
       ON START_TX.COUNTERPARTY_NM        = END_TX.COUNTERPARTY_NM         AND
          START_TX.COUNTERPARTY_NUMBER    = END_TX.COUNTERPARTY_NUMBER     AND
          START_TX.FX_DEAL_TYPE           = END_TX.FX_DEAL_TYPE            AND
          START_TX.BASE_CCY               = END_TX.BASE_CCY                AND
          START_TX.SECONDARY_CCY          = END_TX.SECONDARY_CCY           AND
          NVL(START_TX.CORPORATE_DEALER,'nullX')=NVL(END_TX.CORPORATE_DEALER,'nullX')  AND
          START_TX.FX_TRAN_ID = 1850718                                  AND
          START_TX.ORIENTATION_BUYSELL='B'                                 AND 
          END_TX.ORIENTATION_BUYSELL='S'                        --                                   67 Rows
    UNION 
    SELECT
             START_TX.FX_TRAN_ID START_FX_TRAN_ID
            ,END_TX.FX_TRAN_ID END_FX_TRAN_ID
            ,START_TX.ENTERED_DT_TS
            ,USER
            ,START_TX.TRADE_DT
            ,START_TX.DEAL_NUMBER
            ,START_TX.FX_DEAL_TYPE
            ,START_TX.ORIENTATION_BUYSELL
            ,START_TX.BASE_CCY
            ,START_TX.BASE_CCY_AMT
            ,START_TX.SECONDARY_CCY
            ,START_TX.SECONDARY_CCY_AMT
            ,START_TX.MATURITY_DT
            ,START_TX.TRADE_RT
            ,START_TX.FORWARD_PTS              
            ,START_TX.CORPORATE_PIPS           
            ,START_TX.DEAL_OWNER_INITIALS      
            ,START_TX.CORPORATE_DEALER         
            ,START_TX.PROFIT_CENTER_CD
            ,START_TX.COUNTERPARTY_NM
            ,START_TX.COUNTERPARTY_NUMBER
      FROM
          (SELECT * FROM FX_TRANSACTIONS WHERE GMT_CONV_ENTERED_DT_TS >=  TO_DATE('20-Nov-2013 4:00:01 AM','DD-Mon-YYYY HH:MI:SS AM')) START_TX
           INNER JOIN
          (SELECT * FROM FX_TRANSACTIONS WHERE GMT_CONV_ENTERED_DT_TS <=  TO_DATE('20-Nov-2013 4:59:59 PM','DD-Mon-YYYY HH:MI:SS AM'))  END_TX
       ON START_TX.COUNTERPARTY_NM        = END_TX.COUNTERPARTY_NM         AND
          START_TX.COUNTERPARTY_NUMBER    = END_TX.COUNTERPARTY_NUMBER     AND
          START_TX.FX_DEAL_TYPE           = END_TX.FX_DEAL_TYPE            AND
          START_TX.BASE_CCY               = END_TX.BASE_CCY                AND
          START_TX.SECONDARY_CCY          = END_TX.SECONDARY_CCY           AND
          NVL(START_TX.CORPORATE_DEALER,'nullX')=NVL(END_TX.CORPORATE_DEALER,'nullX') AND
          START_TX.ORIENTATION_BUYSELL='B'                                 AND 
          END_TX.ORIENTATION_BUYSELL='S'                                   AND
          START_TX.FX_TRAN_ID = 1850718                                  AND
            END_TX.BASE_CCY_AMT BETWEEN (START_TX.BASE_CCY_AMT - (START_TX.BASE_CCY_AMT * :PERC_DEV/100)) AND (START_TX.BASE_CCY_AMT + (START_TX.BASE_CCY_AMT * :PERC_DEV/100))        
            OR
            END_TX.SECONDARY_CCY_AMT BETWEEN (START_TX.SECONDARY_CCY_AMT - (START_TX.SECONDARY_CCY_AMT*:PERC_DEV/100) ) AND (START_TX.SECONDARY_CCY_AMT + (START_TX.SECONDARY_CCY_AMT*:PERC_DEV/100))
        );                                                       ---                              10 Rows

  • Need a File Parameter with Browse Functionality in ABAP

    Hi
    I Need a File Parameter with Browse Functionality in ABAP.
    Can anyone help me with logic.
    Regards,
    Sree

    Check below code:
    PARAMETERS: p_file TYPE localfile.
    DATA: l_path TYPE string,
          l_fpath TYPE string,
          l_fname TYPE string.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = 'Save to...'
          default_extension    = '.txt'
          initial_directory    = 'C:\'
        CHANGING
          filename             = l_fname
          path                 = l_path
          fullpath             = l_fpath
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
      IF sy-subrc EQ 0.
        MOVE l_fpath TO p_file.
      ENDIF.

  • Hello i have a problem with onfocus function on ipad. i am trying to bring my cursor on a text box on a button click. It works fine with safari web browser but not on ipad. Need a solution.

    Hello i have a problem with onfocus function on ipad. I am trying to bring my cursor on a text box on a button click. It works fine with safari web browser but not on ipad. Need a solution.

    I don't think that a software update from Apple will solve the issues that you are having. You have a rogue installation. After you posted I have just done the following:
    Disk Utility can verify  my partitioned Volume (including my boot disk) AND REPAIR the non-boot disks on the same Volume without a glitch. It repairs the non-boot disks containing data smoothly.
    I have used Mail to send some mails from some Yahoo and Hotmail accounts to my Thunderbird client containing GMail accounts - absolutely normal.
    I have iLife '09 but my iMovie '09 and iPhoto '09 open in a jiffy and I see no issues here. I have 6GB RAM (Maximum) on an early 2008 Macbook Pro with a 750GB hard drive partitioned with 120GB reserved for the Boot Drive.
    I am sorry that I cannot help further but I am sure there must be a way to reinstall the software without having to revert to restoring your ML backup. I have two clones and if you have such I would attempt to do that through that rather than through Time Machine - that is of course if you have a cloned drive.
    Good luck!

  • Need some help with a function

    create or replace function do_it(p_val varchar2) return varchar2 is
    x varchar2(100);
    begin
    select 1 into x from dual
    where 'hi' in(p_val);
    return x;
    exception
    when no_data_found then
    return p_val;
    end;
    Above function works fine, except when I pass a string like:
    select do_it('''hi'',''hello''') from dual;
    At runtime, I am expecting the SQL inside the function to appear like:
    select 1 into x from dual
    where 'hi' in('hi','hello');
    I would appreciate any help. the function can take only one parameter.

    The function needs only 1 argument to execute and you are passing 2.
    If I am not wrong, the error should be of kind
    "Invalid number of arguments to function do_it...."

  • TestStand with perl and Tcl examples need newer dlls

    I'm trying to run the TestStand with perl and tcl examples but they both point to older dlls. When I try to update by making changes and recompiling the main.cpp in VC++ 6.0, I get errors referencing cl.exe and oleauto.h, I'm not sure if I missed a step or what. See attached screenshot. TIA. Judy Jiru
    Attachments:
    scrnShotErrors.doc ‏110 KB

    Hey Judy,
    From my understanding oleauto.h and cl.exe are not National Instruments files. My suggestion would be to google the files - I found a bunch of hits for both the files. It may also be helpful to post on a discussion forum dedicated to VC++ 6.0. You may want to try the Microsoft newsgroups or I'm sure there are tons of other online.
    I hope this helps! Once you compile the dll if you have problems calling it from TestStand please post back.
    Regards,
    Sarah Miracle
    National Instruments

  • I need example for VARIABLES with Customer Exit.

    hi every body i need example for Variable for Customer Exit.

    Hi,
    You can define 'Formula' variables in your customer exit..for example..
    you need to calculate no of machine running hours per month, in order to
    caculate the machine total utilization time..in this context.. you need to know
    how may hours are there in an month by month..
    you can define a variable and write the code in the customer exit for deriving the total no. of hours available for that month and get that value into a variable for further calution like deducting the down time and set up time so on..in your
    calculated KF..
    Hope this helps..
    Assign points if useful..
    Cheers,
    Pattan.

  • A problem with a function

    Oracle Version: 10g
    Operating System: Microsoft windows 2003
    Hello, I need some help, I would appriciate if anyone could help me out.
    on one hand, I have a table that contains a list of table names that are sensitive in my org.
    In addition, not all the columns in the table are sensitive, some tables have only one or tow sensitive columns
    on the other hand, I have another table that contains all the SQL Statements that passed through all my DB's in the org + some other details like username, machine name etc.
    the sql statement is one columns - varchar2(4000). ALL the SQL TEXT is printed there.
    I need to create a report of the SQL Statements and their details that have any reference to the sensitive entities.
    I'm kind of new to PL/SQL or programming in DB in general.
    Can you please assist me in designing the write function and script.
    Additional details:
    Sensitive_tables table:
    table_name varchar2 (65) -- the names of the sensitive tables
    All_fields number (1) -- 0=not all the fields are sensitive, 1=all the fields are sensitive
    the conditions where the function should return true:
    1. It's not a select/SELECT statement.
    2. There is a relation to a sensitive table that all its columns are sensitive
    3. There is a relation to a sensitive table and to a specific sensitive column.
    below is the function.
    There are 2 cursors - the first loop will check if the SQL Statement touches a sensitive column + a sensitive table.
    The second one checks if the the SQL Statement a table that all its columns are sensitive.
    CREATE OR REPLACE function sens_entity_match (p_statement varchar2)
    return VARCHAR2
    IS
    v_match VARCHAR2(5);
    sql_stmt VARCHAR2(4000);
    TYPE tbls_wth_all_flds IS REF CURSOR;
    tbls_all_fields tbls_wth_all_flds;
    table_name_y varchar2(65);
    TYPE tbls_wthout_all_flds IS REF CURSOR;
    tbls_some_fields tbls_wthout_all_flds;
    table_name_n varchar2(65);
    BEGIN
    sql_stmt:=upper(p_statement);
    OPEN tbls_all_fields FOR select table_name from sens_tables where ALL_FIELDS='1';
    OPEN tbls_some_fields FOR select table_name from sens_tables where ALL_FIELDS='0';
    FETCH tbls_all_fields INTO table_name_y;
    FETCH tbls_some_fields INTO table_name_n;
    WHILE tbls_some_fields%FOUND LOOP
    BEGIN
    IF upper (sql_stmt) like 'SELECT%' THEN
    BEGIN
    RETURN ('FALSE');
    v_match:='FALSE';
    END;
    ELSIF
    ( ((sql_stmt LIKE '%ID_NUMBER%' ) OR (sql_stmt LIKE '%id_number%' )) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%ADDRESS%') OR (sql_stmt LIKE '%address%')) AND (sql_stmt LIKE table_name_n) )
    OR
    ( (((sql_stmt LIKE '%EMAIL%') OR (sql_stmt LIKE '%E_MAIL%')) OR (sql_stmt LIKE '%email%') OR (sql_stmt LIKE '%e_mail%') ) AND (sql_stmt LIKE table_name_n) )
    OR
    (( (sql_stmt LIKE '%BANK%') or (sql_stmt LIKE '%bank%')) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%PYM%') OR (sql_stmt LIKE '%PYM%')) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%CREDIT_CARD%') OR (sql_stmt LIKE '%credit_card%')) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ( (sql_stmt LIKE '%USER%') OR (sql_stmt LIKE '%user%') )AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%CHURN%') OR (sql_stmt LIKE '%churn%') ) AND (sql_stmt LIKE table_name_n) )
    OR
    ( ((sql_stmt LIKE '%LEGAL%') OR (sql_stmt LIKE '%legal%') ) AND (sql_stmt LIKE table_name_n) )
    THEN
    BEGIN
    v_match:='TRUE';
    RETURN ('TRUE');
    END;
    ELSE
    v_match:='FALSE';
    END IF;
    FETCH tbls_some_fields INTO table_name_n;
    END;
    END LOOP;
    WHILE tbls_all_fields%FOUND LOOP
    BEGIN
    IF upper (sql_stmt) like 'SELECT%' THEN
    BEGIN
    v_match:='FALSE';
    RETURN ('FALSE');
    END;
    ELSIF (sql_stmt LIKE table_name_y) THEN
    BEGIN
    v_match:='TRUE';
    RETURN ('TRUE');
    END;
    ELSE
    BEGIN
    v_match:='FALSE';
    RETURN ('FALSE');
    END;
    END IF;
    FETCH tbls_all_fields INTO table_name_y;
    END;
    END LOOP;
    RETURN (v_match);
    END;
    Eexampls that should should be true:
    select sens_entity_match ('update address_data set "EMAIL" = :24 where rowid= :old_rowid') from dual;
    {address_data is a sensitive_table that exists in "sensitive_tables" table and email is a sensitive column}
    select sens_entity_match ('isnert into legal (ssss) select bbbb from input where rowid = 666;') from dual;
    {legal  is a sensitive_table that exists in "sensitive_tables" table and all its columns are sensitive}
    An example that shouldn't should be true:
    select sens_entity_match ('select bank from bank_details where bank_id= 11;') from dual;
    {The SQL text is a select statement}
    The function complies and works, but it doesn't catch all the SQL Statements that are relevant.
    How can I improve it?
    What should I change?
    I would appriricate any help.
    Thanks,
    Roni.

    Hi user611218!
    If I understud right, then you want to have some kind of auditing. I suggest if want auditing than you should use the auditing capabilities of Oracle (Standard auditing and Fine Grained Auditing). It's much easier to generate a report from an Auditingtrail than to create a "Self-Made-Function".
    But if you prefer the soluting with your function then you should change the following:
    ELSIF( ((sql_stmt LIKE '%ID_NUMBER%' ) OR (sql_stmt LIKE '%id_number%' )) AND (sql_stmt LIKE table_name_n) )
    CHANGE IT TO
    ELSIF ((INSTR(LOWER(sql_stmt), 'id_number') > 0)) AND (INSTR(LOWER(sql_stmt), LOWER(table_name_n))))
    Change all the LIKE ... Statements to INSTR ... like above.
    Hope this helps!

  • Need example report program using PNPCE LDB in SAP HR

    Need example report program using PNPCE LDB in SAP HR.
    and how to create a report category in sap hr for using it as cutomised selection screen.

    Hi,
    Go through the following links, i hope it will help you.....
    /people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
    http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/893908#
    A sample prog with LDB PNP
    *& Report ZH_REPT_PAYMENT *
    report zh_rept_payment line-size 80 no standard page
    heading.
    tables: pernr, " Standard Selections for HR Master Data Reporting
    pcl1, " HR Cluster 1
    pcl2, " HR Cluster 2
    pa0009,
    PA9001,
    PA9006,
    pa0002,
    pc260 , " Cluster Directory for Payroll Results
    bnka .
    Infotypes
    infotypes: 0001. " Organizational Assignment
    Declaration of Internal Tables
    data : bnka1 like bnka occurs 0 with header line .
    data: begin of t_int_rep occurs 100,
    bankl like pc209-bankl, " Bank Number
    zlsch like pc209-zlsch, " Payment method
    pernr like pernr-pernr, " Employee Number
    ename like pernr-ename, " Employee Name
    bankn like pc209-bankn, " Bank Account Number
    betrg like pc209-betrg, " Amount to be transfered
    zweck like pa0009-zweck, " Purpose
    end of t_int_rep.
    data: begin of int_rep occurs 100,
    bankl like pc209-bankl, " Bank Number
    zlsch like pc209-zlsch, " Payment method
    pernr like pernr-pernr, " Employee Number
    ename like pernr-ename, " Employee Name
    bankn like pc209-bankn, " Bank Account Number
    betrg like pc209-betrg, " Amount to be transfered
    zweck like pa0009-zweck, " Purpose
    begda like pa0009-begda, "Begin date
    end of int_rep.
    Declaration of Data Variables
    data: ws_betrg like pc209-betrg, " BT Amount
    w_val like spell occurs 0 with header line,
    int_rep1(6), " TYPE I, " Employee Number
    cnt type i value 0, " Counter
    calcmolga like t500l-molga value '40', " Country Grouping
    v_id(15),
    calc_currency like t001-waers value 'INR'. " Currency
    data : ctr type i,
    dt_merge like pa0009-begda.
    data: ws_totemp(6) type c,
    ws_totamt(20) type c,
    r_mth(9) type c,
    ws_fpbeg(6) type c,
    ws_fpend(6) type c,
    ws_mthyr(6) type c,
    ws_mthyr_r(14) type c,
    r_mth_t(3) type c,
    ws_amt(8) type c,
    ws_bankl(14) type c,
    ws_date(6) type c,
    amount_word(500),
    total_page type i,
    pages type i,
    remain type i.
    data begin of i_spell.
    include structure spell .
    data end of i_spell .
    data : c_molga type t500l-molga value '40',
    c_banks type bnka-banks value 'IN'.
    Standard Includes
    include rpc2cd09. "Cluster CD data definition
    include pc2rxin0.
    include rpc2rx09.
    include rpppxd00. " Data Definition buffer PCL1/PCL2
    include rpppxd10. " Common Part buffer PCL1/PCL2
    include rpppxm00. " Buffer Handling RoutinePCL1/PCL2
    include zrpc2rox2. " Data Definition POCLSTERS (not J,K,U)
    Selection Screen
    selection-screen begin of block b1 with frame title text-001.
    parameter: pa_mth(2) type c default sy-datum+4(2) obligatory,
    pa_year(4) type c default sy-datum(4) obligatory,
    p_bankl like pc209-bankl, " Bank Number
    p_zlsch like pc209-zlsch. " Payment method
    selection-screen end of block b1.
    save_calc_currency = calc_currency.
    count_top = 0.
    get_pernr_flag = 0.
    Top-Of-Page
    top-of-page.
    perform convert_month using pa_mth(2) r_mth.
    ws_mthyr_r = r_mth.
    concatenate ws_mthyr_r pa_year into ws_mthyr_r separated by space.
    SKIP 5.
    skip 1.
    skip 4.
    if int_rep-bankl eq ' '.
    if int_rep-zlsch eq 'C' or int_rep-zlsch eq 'E' or
    int_rep-zlsch eq ' '.
    write: /1(85) 'CHEQUE PAYMENT STATEMENT'(047) centered.
    elseif int_rep-zlsch eq 'L'.
    write: /1(85) 'DEMAND DRAFT STATEMENT'(047) centered.
    endif.
    else.
    write: /1(85) 'BANK TRANSFER STATEMENT'(002) centered.
    endif.
    skip.
    write: /34 ws_mthyr_r,
    62 'Page :'(008),69(2) sy-pagno intensified off,
    ' Of ',78(2) pages intensified off.
    clear pages.
    read table bnka1 with key bankl = int_rep-bankl .
    if sy-subrc = 0.
    if int_rep-zlsch eq 'T'.
    write:/03(10) 'Bank Name : ', bnka1-banka.
    write:/03(10) 'Branch : ', bnka1-brnch.
    write:/03(10) 'Address : ', bnka1-stras.
    endif.
    endif.
    skip.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 2(5) 'Sl.No'(002),
    7 sy-vline, 8(8) 'Emp.No.'(003),
    16 sy-vline,17(35) 'Employee Name'(004).
    *--added for Demand Draft
    if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
    write : 47 sy-vline, 48(15) 'Payable at'(005).
    else.
    write : 47 sy-vline,48(15) 'Account No.'(005).
    endif.
    write: 63 sy-vline,64(16) 'Amount'(006),
    80 sy-vline.
    write:/1(80) sy-uline.
    end-of-page.
    write:/1(80) sy-uline.
    write:/2 'Printed on ', sy-datum.
    Start-of-selection.
    start-of-selection.
    *perform h_headr.
    ctr = 0.
    set margin 5.
    call function 'RP_GET_CURRENCY'
    exporting
    molga = calcmolga
    importing
    waers = calc_currency
    exceptions
    others.
    if sy-subrc ne 0.
    calc_currency = 'DEM'.
    calc_currency = save_calc_currency.
    endif.
    get pernr.
    cd-key-pernr = pernr-pernr.
    perform import_cluster.
    get_pernr_flag = 1.
    check : ocd-version-molga eq calcmolga.
    The table 'tabpernr' is filled with the personnel numbers
    and is used after selection is finished.
    move-corresponding pernr to tabpernr.
    append tabpernr.
    The table 'tab_rgdir' is filled
    loop at rgdir.
    rx-key-pernr = pernr-pernr.
    unpack rgdir-seqnr to rx-key-seqno.
    perform int_tab. "fill tab_rgdir
    perform import_bt.
    perform validate.
    endloop.
    End of Selection
    end-of-selection.
    *perform h_headr.
    perform convert_date_a using pa_mth r_mth_t.
    sort int_rep by bankl zlsch pernr betrg descending.
    delete adjacent duplicates from int_rep
    comparing bankl zlsch pernr .
    sort int_rep by bankl zlsch bankn . "PERNR.
    loop at int_rep.
    at new bankl.
    select single * into bnka1 from bnka
    where banks = c_banks and
    bankl = int_rep-bankl .
    append bnka1.
    clear bnka1.
    endat.
    endloop.
    for Demand Draft - purpose added
    loop at int_rep.
    concatenate pa_year(4) pa_mth(2) '01' into dt_merge.
    select single * "zweck into int_rep-zweck
    from pa0009 where
    pernr = int_rep-pernr and
    bankl = int_rep-bankl and
    zlsch = int_rep-zlsch
    and begda <= dt_merge and
    endda >= dt_merge .
    if sy-subrc = 0.
    int_rep-zweck = pa0009-zweck.
    modify int_rep.
    endif.
    endloop.
    *-for DD and Chq sorted by PAyable at and EMPNO wise
    if p_zlsch = 'T' .
    sort int_rep by bankl zlsch bankn . "PERNR.
    else. "added for "payable at" for DD/Chq
    else.
    sort int_rep by zweck pernr . "PERNR.
    endif.
    *delete adjacent duplicates from int_rep.
    t_int_rep] = int_rep[.
    loop at int_rep.
    *-for page of page no.
    total_page = 0.
    loop at t_int_rep where bankl = int_rep-bankl
    and zlsch = int_rep-zlsch.
    total_page = total_page + 1.
    endloop.
    pages = total_page div 25.
    remain = total_page mod 25.
    comment bcoz its adding one extra page no.
    done as on 29/11/2004
    if remain > 0.
    pages = pages + 1.
    endif.
    **-end
    at new bankl.
    ctr = 0 .
    new-page.
    endat.
    at new zlsch.
    ctr = 0 .
    new-page.
    endat.
    clear v_id.
    select single natio
    into pa0002-natio
    from pa0002
    where pernr eq int_rep-pernr.
    *-testing......for soma
    if ctr > 24.
    ctr = 0 .
    write:/1(80) sy-uline.
    new-page .
    endif.
    ctr = ctr + 1 .
    cnt = cnt + 1.
    pack int_rep-pernr to int_rep1.
    write:/1 sy-vline, 2(3) cnt intensified off,
    7 sy-vline, 9(6) int_rep1 intensified off,
    16 sy-vline,17(35) int_rep-ename intensified off .
    if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
    write : 47 sy-vline,48(15) int_rep-zweck intensified off.
    else.
    write:
    47 sy-vline,48(15) int_rep-bankn intensified off .
    endif.
    write: 63 sy-vline,64(16) int_rep-betrg
    intensified off currency 'INR',
    80 sy-vline.
    ws_betrg = ws_betrg + int_rep-betrg.
    *-testing......for soma
    skip.
    write :
    /1 sy-vline, 7 sy-vline ,16 sy-vline ,47 sy-vline,63 sy-vline,80
    sy-vline .
    *-end testing......for soma
    at end of zlsch.
    if int_rep-bankl = ' '.
    call function 'HR_IN_CHG_INR_WRDS'
    exporting
    amt_in_num = ws_betrg
    importing
    amt_in_words = amount_word
    EXCEPTIONS
    DATA_TYPE_MISMATCH = 1
    OTHERS = 2
    w_val-word = amount_word.
    concatenate 'INR.' w_val-word into w_val-word
    separated by space.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 7 'Total transfer:'(009),
    64(16) ws_betrg intensified off currency 'INR',
    80 sy-vline.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
    80 sy-vline.
    write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
    80 sy-vline.
    write:/1(80) sy-uline.
    clear: ws_betrg,cnt.
    skip 2.
    write: /2 'Prepared by :'(010), '_______________'(013),
    45 'Checked by :'(011),'_______________'(013).
    skip 2.
    write: /2 'Printed On ', sy-datum,
    45 'Approved by :'(012),'_______________'(013).
    clear sy-pagno.
    endif.
    endat.
    at end of bankl.
    if int_rep-bankl ' '.
    call function 'HR_IN_CHG_INR_WRDS'
    exporting
    amt_in_num = ws_betrg
    importing
    amt_in_words = amount_word
    EXCEPTIONS
    DATA_TYPE_MISMATCH = 1
    OTHERS = 2
    w_val-word = amount_word.
    concatenate 'INR.' w_val-word into w_val-word
    separated by space.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 7 'Total transfer:'(009),
    64(16) ws_betrg intensified off currency 'INR',
    80 sy-vline.
    write:/1(80) sy-uline.
    write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
    80 sy-vline.
    write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
    80 sy-vline.
    write:/1(80) sy-uline.
    clear: ws_betrg,cnt.
    skip 2.
    write: /2 'Prepared by :'(010), '_______________'(013),
    45 'Checked by :'(011),'_______________'(013).
    skip 2.
    write: /2 'Printed on ', sy-datum,
    45 'Approved by :'(012),'_______________'(013).
    clear sy-pagno.
    NEW-PAGE.
    endif.
    endat.
    endloop.
    End of Page
    end-of-page.
    write: /2 'Prepared by :'(010), '_______________',
    45 'Checked by :'(011),'_______________'.
    *& Form IMPORT_CLUSTER
    Importing Data from Cluster *
    form import_cluster.
    sy-subrc = 0.
    rp-imp-c2-cd.
    if sy-subrc eq 0.
    if cd-version-number ne ocd-version-number.
    endif.
    endif. " SY-SUBRC EQ 0
    endform. " IMPORT_CLUSTER
    *& Form INT_TAB
    Filling internal table tab_rgdir form int_tab.
    *Fill internal table tab_rgdir.
    move-corresponding rgdir to tab_rgdir.
    tab_rgdir-pernr = pernr-pernr.
    append tab_rgdir.
    endform. " INT_TAB
    *& Form IMPORT_bt
    Import Values from Bank Transactions Table (BT) form import_bt.
    rp-init-buffer.
    RP-IMP-C2-RX.
    rp-imp-c2-in.
    if rp-imp-in-subrc eq 0.
    if in-version-number ne oin-version-number.
    write: / 'Schlüssel des Clusters RX:'(015),
    rx-key-pernr, rx-key-seqno.
    write: / 'The imported version of the cluster'(016), 'RX',
    'is not current'(017).
    write: / 'Imported version :'(018),
    oin-version-number.
    write: / 'Current version of cluster :'(019),
    in-version-number.
    stop.
    else.
    sy-subrc = 0.
    endif.
    else.
    sy-subrc = 8.
    write: /
    'Inconsistencies between cluster directory and directory for'(020).
    write: /
    'No payroll results found for data in cluster directory'(021).
    write : /
    'Please contact hotline to solve the current problem'(022).
    endif.
    ws_fpbeg(2) = versc-fpbeg+4(2).
    ws_fpbeg+2(4) = versc-fpbeg(4).
    ws_fpend(2) = versc-fpend+4(2).
    ws_fpend+2(4) = versc-fpend(4).
    ws_mthyr(2) = pa_mth.
    ws_mthyr+2(4) = pa_year.
    check ws_mthyr = ws_fpbeg.
    check ws_mthyr = ws_fpend.
    loop at bt. "from pc209
    int_rep-pernr = pernr-pernr.
    int_rep-ename = pernr-ename.
    int_rep-bankl = bt-bankl.
    int_rep-bankn = bt-bankn.
    int_rep-betrg = bt-betrg.
    int_rep-zlsch = bt-zlsch.
    append int_rep.
    endloop.
    IF P_BANKL ' ' AND P_ZLSCH ' '.
    DELETE INT_REP WHERE BANKL P_BANKL.
    ELSEIF P_BANKL = ' ' AND P_ZLSCH ' '.
    DELETE INT_REP WHERE ZLSCH P_ZLSCH.
    ELSEIF P_BANKL ' ' AND P_ZLSCH = ' '.
    DELETE INT_REP WHERE BANKL P_BANKL.
    ENDIF.
    endform. " IMPORT_BT
    *& Form CONVERT_MONTH
    Fetching Month Text form convert_month using mth t_mth.
    case mth.
    when '01'.
    t_mth = 'January'(023).
    when '02'.
    t_mth = 'February'(024).
    when '03'.
    t_mth = 'March'(025).
    when '04'.
    t_mth = 'April'(026).
    when '05'.
    t_mth = 'May'(027).
    when '06'.
    t_mth = 'June'(028).
    when '07'.
    t_mth = 'July'(029).
    when '08'.
    t_mth = 'August'(030).
    when '09'.
    t_mth = 'September'(031).
    when '10'.
    t_mth = 'October'(032).
    when '11'.
    t_mth = 'November'(033).
    when '12'.
    t_mth = 'December'(034).
    endcase.
    endform. " CONVERT_MONTH
    *& Form CONVERT_DATE_A
    Fetching Month Text * form convert_date_a using mth_t t_mth_t.
    case mth_t.
    when '01'.
    t_mth_t = 'Jan.'(035).
    when '02'.
    t_mth_t = 'Feb.'(036).
    when '03'.
    t_mth_t = 'Mar.'(037).
    when '04'.
    t_mth_t = 'Apr.'(038).
    when '05'.
    t_mth_t = 'May.'(039).
    when '06'.
    t_mth_t = 'Jun.'(040).
    when '07'.
    t_mth_t = 'Jul.'(041).
    when '08'.
    t_mth_t = 'Aug.'(042).
    when '09'.
    t_mth_t = 'Sep.'(043).
    when '10'.
    t_mth_t = 'Oct.'(044).
    when '11'.
    t_mth_t = 'Nov.'(045).
    when '12'.
    t_mth_t = 'Dec.'(046).
    endcase.
    endform. " CONVERT_DATE_A
    *& Form VALIDATE
    text
    --> p1 text
    <-- p2 text form validate .
    if p_bankl <> ' ' and p_zlsch ' '.
    delete int_rep where bankl p_bankl.
    elseif p_bankl = ' ' and p_zlsch ' '.
    delete int_rep where zlsch p_zlsch.
    elseif p_bankl ' ' and p_zlsch = ' '.
    delete int_rep where bankl p_bankl.
    endif.
    endform. " VALIDATE
    check this weblog.....
    /people/dj.adams/blog/2003/11/13/food-for-thought-ldbs-and-abap-objects
    Also , check the following link too.
    http://www.datamanagementgroup.com/Resources/Articles/Article_1005_2.asp
    Regards,
    Harish

  • Help with a Function-module

    Hi again forum:
       I have a program and i need to pass basic functionality to a set of funtion module.
       I have a description of a internal table in the program, that i need to use in the function-module
    Example:
         PROGRAM
    " In the top of the program i declared.
    "This the actual version
            TYPES: BEGIN OF t1
                         END OF t1.
            DATA:  it_some TYPE STANDARD TABLE of t1 with header line.
            SELECT *
            FROM
            INTO TABLE it_some.
          FUNCTION MODULE
    Now in the new version i need to declare an output paramter of type t1 in the exports parameters of the function ZMY_FUNCTION, and t1 is an internal_table, what can i do forum ?..
    The thing is that how can i declare an export parameter that is not know?
    please help
    Thanks
    Joshua

    hi,
    we can pass internal table to FM by using CHANGING or TABLE options.
    regards,
    AshokReddy.

  • HOW TO CREATE A DRILLDOWN PROGRAM NEED EXAMPLE

    HAI FRIENDS
      1  I WANT TO KNOW HOW TO CREATE A DRILLDOWN PROGRAM NEED EXAMPLE IN ABAP
      2 NEED ABAP PROGRAM EBOOK
    PLZ DO IT

    CHECK THIS ALV DRILL DOWN REPORT
    *& Report  ZHAI_SD_CUSTOMER_DETAILS_ALV
    REPORT  ZHAI_SD_CUSTOMER_DETAILS_ALV.
    TYPE-POOLS: SLIS.
        TYPES DECLARATIONS
    TABLES : KNA1.
    DATA : BEGIN OF IT_CUST OCCURS 0,
      KUNNR LIKE KNA1-KUNNR,
      NAME1 LIKE KNA1-NAME1,
      LAND1 LIKE KNA1-LAND1,
      ORT01 LIKE KNA1-ORT01,
      STRAS LIKE KNA1-STRAS,
      PSTLZ LIKE KNA1-PSTLZ,
           END OF IT_CUST.
    DATA:BEGIN OF IT_SALE OCCURS 0,
    VBELN LIKE VBAK-VBELN,"SALES DOC NO
    AUDAT LIKE VBAK-AUDAT,"DATE RECIEVED AND SENT
    AUART LIKE VBAK-AUART,"SALES DOC LIKE
    NETWR LIKE VBAK-NETWR,"NET VALUE IN DOC CURRENCY
    KUNNR LIKE VBAK-KUNNR,
          END OF IT_sale.
    TYPES: BEGIN OF TY_ITEM,
    VBELN TYPE VBAP-VBELN,
    POSNR TYPE VBAP-POSNR,"ITEM NO
    MATNR TYPE VBAP-MATNR,"MATERIAL NO
    CHARG TYPE VBAP-CHARG,"BATCH
    MATKL TYPE VBAP-MATKL,"MATERIAL GROUP
    MEINS TYPE VBAP-MEINS,"BASE UNIT OF MEASURE
    END OF TY_ITEM.
    SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR.
         INTERNAL TABLES
    DATA:
         IT_CUST  TYPE TABLE OF TY_CUST,
         IT_SALE  TYPE TABLE OF TY_SALE,
          IT_ITEM  TYPE TABLE OF TY_ITEM.
                       INTERNAL TABLES FOR ALV
    DATA: IT_FCAT   TYPE  SLIS_T_FIELDCAT_ALV,
          IT_FCAT1  TYPE  SLIS_T_FIELDCAT_ALV,
          IT_FCAT3  TYPE SLIS_T_FIELDCAT_ALV.
    DATA: IT_EVENTS TYPE TABLE OF   slis_alv_event,
          IT_EVENTS1 TYPE TABLE OF SLIS_ALV_EVENT,
          IT_EVENTS2 TYPE TABLE OF SLIS_ALV_EVENT.
    DATA: IT_LISTHEADER1 TYPE SLIS_T_LISTHEADER,
          IT_LISTHEADER TYPE TABLE OF slis_listheader,
          IT_LISTHEADER3 TYPE TABLE OF SLIS_LISTHEADER,
          IT_FOOTER TYPE TABLE OF SLIS_LISTHEADER.
    DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV,
          WA_SORT LIKE LINE OF IT_SORT.
                       WORK AREAS FOR ALV
    DATA: WA_LAYOUT  TYPE SLIS_LAYOUT_ALV,
          WA_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
          WA_FCAT    LIKE LINE OF IT_FCAT,
          WA_FCAT1   LIKE LINE OF IT_FCAT1,
          WA_FCAT3   LIKE LINE OF IT_FCAT3,
          WA_EVENTS  LIKE LINE OF IT_EVENTS,
          WA_EVENTS1 LIKE LINE OF IT_EVENTS,
          WA_EVENTS2 LIKE LINE OF IT_EVENTS.
            WORK VARIABLES
    DATA: W_REPID TYPE SY-REPID,
          W_KUNNR TYPE KNA1-KUNNR.
    $$**----
       WORK  AREAS
        MACROS
    DEFINE ADD_FCAT1..
    WA_FCAT1-COL_POS = &1.
    WA_FCAT1-FIELDNAME = &2.
    WA_FCAT1-TABNAME = &3.
    WA_FCAT1-REF_TABNAME = &4.
    WA_FCAT1-KEY = &5.
    WA_FCAT1-DO_SUM = &6.
    WA_FCAT1-HOTSPOT = &7.
    WA_FCAT1-EMPHASIZE = &8.
    APPEND WA_FCAT1 TO IT_FCAT1.
    END-OF-DEFINITION.
    START-OF-SELECTION.
      PERFORM F_GET_DATA.
      PERFORM F_BUILD_FCAT.
      PERFORM F_GET_EVENTS.
      PERFORM F_BUILD_LAYOUT USING WA_LAYOUT.
      PERFORM F_GET_DISPLAY.
    *&      Form  F_GET_DATA
    FORM F_GET_DATA .
    SELECT   KUNNR
              NAME1
              LAND1
              ORT01
              STRAS
              PSTLZ FROM KNA1
              INTO TABLE
    IT_CUST WHERE KUNNR IN S_KUNNR.
    ENDFORM.                    " F_GET_DATA
    *&      Form  F_GET_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM F_GET_DISPLAY .
    CLEAR W_REPID.
    MOVE SY-REPID TO W_REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = w_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
         I_CALLBACK_TOP_OF_PAGE            = 'F_TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = 'DUCK'
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = WA_LAYOUT
         IT_FIELDCAT                        = IT_FCAT
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
         IT_EVENTS                          = IT_EVENTS
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = IT_CUST
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " F_GET_DISPLAY
    *&      Form  F_GET_EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM F_GET_EVENTS .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE     = 0
        IMPORTING
          ET_EVENTS       = IT_EVENTS
        EXCEPTIONS
          LIST_TYPE_WRONG = 1
          OTHERS          = 2.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SORT IT_EVENTS.
    READ TABLE IT_EVENTS INTO WA_EVENTS
    WITH KEY NAME = 'TOP_OF_PAGE' BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    WA_EVENTS-FORM = 'F_TOP_OF_PAGE'.
    MODIFY  IT_EVENTS  INDEX SY-TABIX FROM
    WA_EVENTS TRANSPORTING FORM.
      ENDIF.
    READ TABLE IT_EVENTS INTO WA_EVENTS
    WITH KEY NAME = 'USER_COMMAND' BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    WA_EVENTS-FORM = 'F_USER_COMMAND'.
    MODIFY IT_EVENTS FROM WA_EVENTS INDEX
    SY-TABIX TRANSPORTING FORM.
    READ TABLE IT_EVENTS INTO WA_EVENTS
    WITH KEY NAME = 'USER_COMMAND' BINARY SEARCH.
    ENDIF.
    READ TABLE IT_EVENTS INTO WA_EVENTS WITH
    KEY NAME = 'END_OF_PAGE' BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    WA_EVENTS-FORM = 'F_END_OF_PAGE'.
    MODIFY IT_EVENTS FROM WA_EVENTS
    INDEX SY-TABIX TRANSPORTING FORM.
    ENDIF.
    ENDFORM.                    "F_GET_EVENTS
    *&      Form  F_BUILD_LAYOUT
    FORM F_BUILD_LAYOUT  USING P_WA_LAYOUT LIKE WA_LAYOUT .
    CLEAR P_WA_LAYOUT.
    P_WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    *P_WA_LAYOUT-F2CODE = '&ETA'.
    *p_wa_layout-detail_popup = 'X'.
    P_WA_LAYOUT-DETAIL_TITLEBAR = 'ALV REPORT'.
    *P_WA_LAYOUT-CONFIRMATION_PROMPT  = 'X'.
    ENDFORM.                    " F_BUILD_LAYOUT
    *&      Form  F_TOP_OF_PAGE
    FORM F_TOP_OF_PAGE .
    refresh it_listheader.
      DATA: LS_LIST TYPE SLIS_LISTHEADER.
      LS_LIST-TYP = 'H'.
      LS_LIST-INFO = TEXT-004.
      APPEND LS_LIST TO IT_LISTHEADER.
      LS_LIST-typ = 'S'.
      LS_LIST-key = 'Date: '.
      CONCATENATE sy-datum+6(2) '.'
      sy-datum+4(2) '.'
      sy-datum(4) INTO LS_LIST-info. "todays date
      append LS_LIST to IT_LISTHEADER.
      clear: LS_LIST.
      LS_LIST-TYP = 'S'.
      LS_LIST-KEY = 'DEVELOPED:'.
      LS_LIST-INFO = SY-UNAME.
      APPEND LS_LIST TO IT_LISTHEADER.
      CLEAR LS_LIST.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = IT_LISTHEADER
          I_LOGO             = 'GLOBAL'.
    ENDFORM.                    " F_TOP_OF_PAGE
    *&      Form  F_BUILD_FCAT
    FORM F_BUILD_FCAT .
    CLEAR: W_REPID,
           IT_FCAT.
      MOVE SY-REPID TO W_REPID.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         I_PROGRAM_NAME               = W_REPID
         I_INTERNAL_TABNAME           = 'IT_CUST'
         I_INCLNAME                   = W_REPID
        CHANGING
          CT_FIELDCAT                  = IT_FCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
      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.                    " F_BUILD_FCAT
    *&      Form  F_USER_COMMAND
    FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                              RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE  R_UCOMM.
    WHEN '&IC1'.
    IF RS_SELFIELD-FIELDNAME = 'KUNNR'.
    READ TABLE IT_CUST
    INDEX RS_SELFIELD-TABINDEX.
    MOVE rs_selfield-value TO W_KUNNR.
    IF IT_CUST IS NOT INITIAL.
       PERFORM F_GET_SECONDARY_DATA.
       PERFORM F_BUILD_FCAT1.
       PERFORM F_BUILD_EVENTS.
       PERFORM F_GET_SORT.
       PERFORM F_BUILD_LAYOUT1.
      PERFORM F_GET_DISPLAY1.
    ENDIF.
      ENDIF.
      ENDCASE.
    ENDFORM.                    " F_USER_COMMAND
    *&      Form  F_GET_SECONDARY_DATA
    FORM F_GET_SECONDARY_DATA .
    data:v_data.
    SELECT  VBELN
              AUDAT
              AUART
              NETWR
    KUNNR FROM VBAK INTO TABLE IT_SALE
    WHERE KUNNR EQ IT_CUST-KUNNR.
      IF IT_SALE[] IS INITIAL .
       CALL FUNCTION 'POPUP_TO_CONFIRM'
         EXPORTING
          TITLEBAR                    = SY-REPID
         DIAGNOSE_OBJECT             = ' '
           TEXT_QUESTION               = 'NO SALES FOR THIS CUSTOMER'
         TEXT_BUTTON_1               = 'Ja'(001)
         ICON_BUTTON_1               = ' '
         TEXT_BUTTON_2               = 'Nein'(002)
         ICON_BUTTON_2               = ' '
          DEFAULT_BUTTON              = '1'
          DISPLAY_CANCEL_BUTTON       = 'X'
         USERDEFINED_F1_HELP         = ' '
         START_COLUMN                = 25
         START_ROW                   = 6
         POPUP_TYPE                  =
         IV_QUICKINFO_BUTTON_1       = ' '
         IV_QUICKINFO_BUTTON_2       = ' '
        IMPORTING
          ANSWER                      = v_data
       TABLES
         PARAMETER                   =
        EXCEPTIONS
          TEXT_NOT_FOUND              = 1
          OTHERS                      = 2
       IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
    case v_data.
    when '2'.
    leave screen.
    when 'A'.
    leave to screen '0'.
    endcase.
      ENDIF.
    ENDFORM.                    " F_GET_SECONDARY_DATA
    *&      Form  F_BUILD_FCAT1
    FORM F_BUILD_FCAT1 .
    REFRESH IT_FCAT1.
    CLEAR WA_FCAT1.
    ADD_FCAT1:
    '1' 'VBELN' 'VBAK' 'VBAK' 'X' ' ' 'X' 'C500',
    '2' 'AUDAT' 'VBAK' 'VBAK' ' ' ' ' ' ' 'C400',
    '3' 'AUART' 'VBAK' 'VBAK' ' ' ' ' ' ' 'C100',
    '4' 'NETWR' 'VBAK' 'VBAK' ' ' 'X' ' ' 'C300'.
    ENDFORM.                    " F_BUILD_FCAT1
    *&      Form  F_GET_DISPLAY1
          text
    -->  p1        text
    <--  p2        text
    FORM F_GET_DISPLAY1 .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = SY-REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           =  'F_USER_COMMAND1'
         I_CALLBACK_TOP_OF_PAGE            = 'F_TOP_OF_PAGE1'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
         IT_FIELDCAT                       = IT_FCAT1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
       IT_SORT                            = IT_SORT
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
         IT_EVENTS                         = IT_EVENTS1
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = IT_SALE
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " F_GET_DISPLAY1
    *&      Form  F_BUILD_EVENTS
    FORM F_BUILD_EVENTS .
    clear wa_events1.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = IT_EVENTS1.
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SORT IT_EVENTS1.
      read table It_events1 with key name = 'TOP_OF_PAGE'
      into WA_eventS1.
      if sy-subrc = 0.
        move 'F_TOP_OF_PAGE1' to WA_EventS1-form.
        append WA_eventS1 to it_events1.
      endif.
      READ TABLE IT_EVENTS WITH KEY NAME = 'USER_COMMAND'
      INTO WA_EVENTS1.
      IF SY-SUBRC = 0.
      MOVE 'F_USER_COMMAND1' TO WA_EVENTS1-FORM.
      APPEND WA_EVENTS1 TO IT_EVENTS1.
      ENDIF.
    *READ TABLE IT_EVENTS WITH KEY NAME = 'SUBTOTAL_TEXT'
    INTO WA_EVENTS1.
    IF SY-SUBRC = 0.
    MOVE 'F_SUBTOTAL_TEXT' TO WA_EVENTS1-FORM.
    APPEND WA_EVENTS1 TO IT_EVENTS1.
    ENDIF.
    ENDFORM.                    " F_BUILD_EVENTS
    *&      Form  F_TOP_OF_PAGE1
    FORM F_TOP_OF_PAGE1 .
    DATA: LS_HEADER TYPE SLIS_LISTHEADER.
    REFRESH : IT_LISTHEADER1.
      LS_HEADER-TYP = 'H'.
      LS_HEADER-INFO = 'SALES ORDER DETAILS FOR CUSTOMER'.
      APPEND LS_HEADER TO it_listheader1.
      CLEAR LS_HEADER.
      LS_HEADER-TYP  = 'S'.
      LS_HEADER-KEY = 'CUSTOMER NO:'.
      LS_HEADER-INFO = W_KUNNR.
      APPEND LS_HEADER TO IT_LISTHEADER1.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER1
         I_LOGO                   = 'DUCK'
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.                    " F_TOP_OF_PAGE
    *&      Form  F_END_OF_PAGE
          text
    -->  p1        text
    <--  p2        text
    FORM F_END_OF_PAGE .
    DATA:LS_FOOTER TYPE SLIS_LISTHEADER.
    LS_FOOTER-TYP = 'S'.
    LS_FOOTER-KEY = SY-UNAME.
    LS_FOOTER-INFO = 'DEVELOPED BY:'.
    APPEND LS_FOOTER TO IT_FOOTER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = IT_FOOTER
    ENDFORM.                    " F_END_OF_PAG
    *&      Form  F_USER_COMMAND1
          text
    -->  p1        text
    <--  p2        text
    FORM F_USER_COMMAND1 USING R_UCOMM LIKE SY-UCOMM
                               RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
    WHEN '&IC1'.
    READ TABLE IT_SALE INDEX RS_SELFIELD-TABINDEX.
    PERFORM F_GET_SECONDARY2.
    PERFORM F_GET_FCAT3 USING:
    'VBELN' '1' 'C' '12' 'SALES_DOC'   'M'  'VBAP' 'X' 'C51' ' ',
    'POSNR' '2' ' '  '5' 'ITEM_NO'      'M'  'VBAP' ' ' 'C61' ' ',
    'MATNR' '3' ' '  '12' 'MATERIAL_NO' 'M'  'VBAP' ' ' 'C71' ' ',
    'CHARG' '4' ' ' '10' 'BATCH_NO'    'M'  'VBAP' ' ' 'C41' ' ',
    'MATKL' '5' ' ' '10' 'MAT_GROUP'   'M'  'VBAP' ' ' 'C31' ' ',
    'MEINS' '6' ' ' '12' 'BASE_UNIT'   'M'  'VBAP' ' ' 'C21' 'X' .
    PERFORM F_GET_EVENTS2 USING WA_EVENTS2
                         CHANGING IT_EVENTS2.
    PERFORM F_GET_DISPLAY3.
    REFRESH IT_FCAT3.
    ENDCASE.
    ENDFORM.                    " F_USER_COMMAND1
    *&      Form  F_GET_SECONDARY2
          text
    -->  p1        text
    <--  p2        text
    FORM F_GET_SECONDARY2 .
    SELECT VBELN
           POSNR
           MATNR
           MATKL
           MEINS
           FROM VBAP INTO
           TABLE IT_ITEM WHERE
           VBELN EQ IT_SALE-VBELN.
    IF SY-DBCNT EQ 0.
    MESSAGE E000(ZHAI) WITH TEXT-KO1.
    ENDIF.
    ENDFORM.                    " F_GET_SECONDARY2
    *&      Form  F_GET_DISPLAY3
          text
    -->  p1        text
    <--  p2        text
    FORM F_GET_DISPLAY3 .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = SY-REPID
       I_CALLBACK_PF_STATUS_SET          = 'F_PF_STATUS'
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = 'F_TOP_OF_PAGE3'
       I_CALLBACK_HTML_TOP_OF_PAGE       = 'F_TOP_OF_PAGE3'
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = WA_LAYOUT1
       IT_FIELDCAT                       = IT_FCAT3
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           = IT_SORT
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
       IT_EVENTS                         = IT_EVENTS2
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = IT_ITEM
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " F_GET_DISPLAY3
    *&      Form  F_GET_FCAT3
    FORM F_GET_FCAT3  USING    VALUE(P1)
                               VALUE(P2)
                               VALUE(P3)
                               VALUE(P4)
                               VALUE(P5)
                               VALUE(P6)
                               VALUE(P7)
                               VALUE(P8)
                               VALUE(P9)
                              VALUE(P10).
    CLEAR WA_FCAT3.
      WA_FCAT3-FIELDNAME = P1.
      WA_FCAT3-COL_POS = P2.
      WA_FCAT3-JUST = P3.
      WA_FCAT3-OUTPUTLEN = P4.
      WA_FCAT3-SELTEXT_M  = P5.
      WA_FCAT3-DDICTXT = P6.
      WA_FCAT3-REF_TABNAME = P7.
      WA_FCAT3-HOTSPOT = P8.
      WA_FCAT3-EMPHASIZE = P9.
      WA_FCAT3-DO_SUM  = P10.
      APPEND WA_FCAT3 TO IT_FCAT3.
    ENDFORM.                    " F_GET_FCAT3
    *&      Form  F_BUILD_LAYOUT1
          text
    -->  p1        text
    <--  p2        text
    FORM F_BUILD_LAYOUT1 .
    WA_LAYOUT1-totals_text = 'TOTAL'.
    wa_layout1-detail_popup = 'X'.
    ENDFORM.                    " F_BUILD_LAYO
    *&      Form  F_GET_EVENTS2
          text
         -->P_IT_EVENTS2  text
         <--P_WA_EVENTS2  text
    FORM F_GET_EVENTS2  USING    VALUE(P_WA_EVENTS2) LIKE WA_EVENTS2
                        CHANGING P_IT_EVENTS2 LIKE IT_EVENTS2.
    P_WA_EVENTS2-NAME = 'HTML_TOP_OF_PAGE'.
    P_WA_EVENTS2-FORM = 'F_TOP_OF_PAGE3'.
    APPEND P_WA_EVENTS2 TO P_IT_EVENTS2.
    CLEAR P_WA_EVENTS2.
    P_WA_EVENTS2-NAME = 'PF_STATUS'.
    P_WA_EVENTS2-FORM = 'F_PF_STATUS'.
    APPEND P_WA_EVENTS2 TO P_IT_EVENTS2.
    CLEAR P_WA_EVENTS2.
    P_WA_EVENTS2-NAME = 'USER_COMMAND'.
    P_WA_EVENTS2-FORM = 'F_USER_COMMAND3'.
    APPEND P_WA_EVENTS2 TO P_IT_EVENTS2.
    CLEAR P_WA_EVENTS2.
    p_wa_events2-name = 'HTML_END_OF_LIST'.
    P_WA_EVENTS2-FORM = 'F_HTML_END_OF_LIST'.
    APPEND P_WA_EVENTS2 TO P_IT_EVENTS2.
    CLEAR p_wa_events2.
    ENDFORM.                    " F_GET_EVENTS2
    *&      Form  F_TOP_OF_PAGE3
          text
    -->  p1        text
    <--  p2        text
    FORM F_TOP_OF_PAGE3 USING DOCUMENT TYPE REF TO cl_dd_document .
    data : link_area type ref to cl_dd_area,
           picture_area type ref to cl_dd_area.
    CALL METHOD DOCUMENT->ADD_TEXT
      EXPORTING
        TEXT          = 'ALV REPORT'
       TEXT_TABLE    =
       FIX_LINES     =
       SAP_STYLE     =
        SAP_COLOR     = cl_dd_area=>list_background_int
        SAP_FONTSIZE  = 'LARGE'
        SAP_FONTSTYLE = 'TIMES'
        SAP_EMPHASIS  = 'STRONG'
       STYLE_CLASS   =
    CHANGING
       DOCUMENT      =
    CALL METHOD DOCUMENT->NEW_LINE.
    CALL METHOD DOCUMENT->ADD_PICTURE
      EXPORTING
        PICTURE_ID       = 'LOGO1'
        WIDTH            = '10%'
    ENDFORM.                    " F_TOP_OF_PAGE3
    *&      Form  F_GET_SORT
          text
    -->  p1        text
    <--  p2        text
    FORM F_GET_SORT .
    WA_SORT-FIELDNAME = 'NETWR'.
    WA_SORT-SPOS  = 4.
    WA_SORT-UP = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    ENDFORM.                    " F_GET_SORT
    *&      Form  F_PF_STATUS
          text
    -->  p1        text
    <--  p2        text
    FORM F_PF_STATUS USING RS_EXTAB TYPE SLIS_T_EXTAB .
    SET PF-STATUS 'ZHAIALV' EXCLUDING RS_EXTAB.
    ENDFORM.                    " F_PF_STATUS
    *&      Form  F_USER_COMMAND3
          text
    -->  p1        text
    <--  p2        text
    FORM F_USER_COMMAND3 USING R_UCOMM LIKE SY-UCOMM
                               RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
    WHEN '&SALE'.
    IF RS_SELFIELD-FIELDNAME = 'VBELN'.
    SET parameter ID 'AUN' FIELD rs_selfield-value.
    CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
    ENDIF.
    WHEN '&MAT'.
    IF RS_SELFIELD-FIELDNAME = 'MATNR'.
    SET PARAMETER ID 'MAT' FIELD RS_SELFIELD-VALUE.
    CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
    ENDIF.
    ENDCASE.
    ENDFORM.                    " F_USER_COMMAND3
    *&      Form  F_HTML_END_OF_LIST
          text
    -->  p1        text
    <--  p2        text
    FORM F_HTML_END_OF_LIST USING DOCUMENT TYPE REF TO CL_DD_DOCUMENT.
    DATA : PAGE TYPE SDYDO_TEXT_ELEMENT.
    MOVE SY-PAGNO TO PAGE.
    CALL METHOD DOCUMENT->ADD_TEXT
      EXPORTING
        TEXT          = PAGE
       TEXT_TABLE    =
       FIX_LINES     =
       SAP_STYLE     =
       SAP_COLOR     =
       SAP_FONTSIZE  =
       SAP_FONTSTYLE =
       SAP_EMPHASIS  =
       STYLE_CLASS   =
    CHANGING
       DOCUMENT      =
    ENDFORM.                    " F_HTML_END_OF_LIS

  • OWB3i - Validate with DECODE function

    Hi,
    in OWB 3i when I validate an expression defined inside an expression operator with DECODE() function (which is not include in default transformation) come this error:
    Line 1, Col 1:
    PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only
    but it seems only a warning because when i generate the scripts and run no other error happen and all works fine.
    Regards

    Hi,
    Welcome to the forum!
    When you use a default value, the last argument to DECODE is the actual value you want as a default.
    For example:
    SELECT       ename
    ,       deptno
    ,       DECODE ( deptno
                 , 30     , 'Sales'
                      , 'All others'     -- Default value
                  )                 AS dname
    FROM      scott.emp
    ORDER BY  ename
    ;Output:
    ENAME          DEPTNO DNAME
    ADAMS              20 All others
    ALLEN              30 Sales
    BLAKE              30 Sales
    CLARK              10 All others
    FORD               20 All others
    JAMES              30 Sales
    JONES              20 All others
    KING               10 All others
    MARTIN             30 Sales
    MILLER             10 All others
    SCOTT              20 All others
    SMITH              20 All others
    TURNER             30 Sales
    WARD               30 Sales 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    If you can show the problem using commonly available tables (such as those in the scott schema) then you don't need to post any sample data; just the results and the explanation.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Problem with a function

    Hi people,
    If someone made a call job in the SM35 I need your help!
    I use this two function to call a job, but when I debug the program in the SM35 transaction the JOB CLOSE function get the 'X' of processed in the variable that the function return but if I use the same function in the SE37 with other job the function don't return me the 'X' and I pass all the parameters that the function need.
    Thanks for the help.
    call function 'JOB_OPEN'
          exporting
               jobgroup         = bi
               jobname          = jname
          importing
               jobcount         = jnumb
          exceptions
               cant_create_job  = 1
               invalid_job_data = 2
               jobname_missing  = 3
               others           = 99.
       call function 'JOB_CLOSE'
            exporting
                 jobcount                   = jnumb
                 jobname                    = jname
                 strtimmed                  = x
                 targetsystem               = batchsys
            importing
                 job_was_released           = jobrele
            exceptions
                 cant_start_immediate       = 1
                 invalid_startdate          = 2
                 jobname_missing            = 3
                 job_close_failed           = 4
                 job_nosteps                = 5
                 job_notex                  = 6
                 no_release_privilege_given = 7
                 others                     = 99.

    Hi Carlos,
    Please change this line code
       strtimmed                 = x
    to 
    <b>  strtimmed                  = 'X'</b>
    Also you need something it between 'JOB_OPEN' and 'JOB_ CLOSE'. For example, submit <program> ... or 'JOB_ SUBMIT'.
    Hope this will help.
    Regards,
    Ferry Lianto

  • Needed example working  code for  FM"LAST_DAY_IN_PERIOD_GET"

    needed example working  code for  FM"LAST_DAY_IN_PERIOD_GET"

    Hi,
    Go through this code
    *& Report  Z_FICO_REP_SHIPMENTS
    REPORT  z_fico_rep_shipments MESSAGE-ID sd.
    TYPE-POOLS : slis.
    TABLES : vbak,
             kna1,
             likp,
             vbfa.
    *>> DEFINE global Types
    TYPES : BEGIN OF gt_vbak,
              vbeln TYPE vbeln,
              kunnr TYPE kunnr ,
              spart TYPE spart,
              audat TYPE audat,
            END OF gt_vbak,
            BEGIN OF gt_kna1,
              kunnr TYPE kunnr,
              name1 TYPE name1,
            END OF gt_kna1,
            BEGIN OF gt_likp,
              vbeln     TYPE vbeln,
              wadat_ist TYPE wadat_ist,
            END OF gt_likp,
            BEGIN OF gt_vbfa,
              vbelv     TYPE vbelv,
              erdat     TYPE erdat,
              rfwrt     TYPE rfwrt,
           END OF gt_vbfa,
            BEGIN OF gt_final,
              kunnr   TYPE kunnr,
              name1   TYPE name1,
              cumon   TYPE monat,
              trcum   TYPE rfwrt,
              trcuy   TYPE rfwrt,
              perce   TYPE rfwrt,
              fiscy   TYPE gjahr,
              ftrcum  TYPE rfwrt,
              ftrcuy  TYPE rfwrt,
              fperce  TYPE rfwrt,
            END OF gt_final.
    DATA : gwa_vbak   TYPE gt_vbak,
           gwa_kna1   TYPE gt_kna1,
           gwa_likp   TYPE gt_likp,
           gwa_vbfa   TYPE gt_vbfa,
           gwa_final  TYPE gt_final,
           gwa_sort   TYPE slis_sortinfo_alv,
           gwa_layout TYPE slis_layout_alv.    "ALV Layout
    DATA : gi_vbak    TYPE STANDARD TABLE OF gt_vbak,
           gi_kna1    TYPE STANDARD TABLE OF gt_kna1,
           gi_likp    TYPE STANDARD TABLE OF gt_likp,
           gi_vbfa    TYPE STANDARD TABLE OF gt_vbfa,
           gi_likp1   TYPE STANDARD TABLE OF gt_likp,
           gi_vbfa1   TYPE STANDARD TABLE OF gt_vbfa,
           gi_final   TYPE STANDARD TABLE OF gt_final WITH HEADER LINE,
           gi_final1  TYPE STANDARD TABLE OF gt_final WITH HEADER LINE.
    *>> DEFINE INTERNAL TABLE
    DATA : gi_fieldcat    TYPE slis_t_fieldcat_alv,   "ALV Fieldcatalog
           gi_events      TYPE slis_t_event,          "ALV EventS
           gi_sort        TYPE slis_t_sortinfo_alv ,
           gi_top_of_page TYPE slis_t_listheader.     "ALV LIST HEADER
    DATA : gv_month(2) TYPE n.
    *>> GLOBAL CONSTANTS
    CONSTANTS: gc_day(2) TYPE n VALUE 01,
               gc_top_of_page  TYPE slis_formname VALUE 'TOP_OF_PAGE',
               gc_x TYPE c VALUE 'X'.
    SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_monat      TYPE     monat OBLIGATORY,
                p_gjahr     TYPE     gjahr OBLIGATORY.
    SELECT-OPTIONS : s_bukrs      FOR      vbak-bukrs_vf OBLIGATORY,
                     s_vkorg     FOR      vbak-vkorg,
                     s_spart     FOR     vbak-spart     OBLIGATORY,
                     s_audat   FOR    vbak-audat NO-DISPLAY.
    SELECTION-SCREEN:END OF BLOCK b1.
    SELECTION-SCREEN:BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
    PARAMETERS: p_det RADIOBUTTON GROUP grp DEFAULT 'X' ,
              p_sum RADIOBUTTON GROUP grp.
    SELECTION-SCREEN:END OF BLOCK b2.
    START-OF-SELECTION.
    *>> Take Period And year and find starting and ending date
      PERFORM fiscal_date.
      PERFORM collect_data.
      PERFORM manipulation_collect_data.
    END-OF-SELECTION.
    *>> Sort
      PERFORM gi_sort_table.
    *>> MEARGE FIELD CATALOG USING INTERNAL TABLE
      PERFORM mearge_field_catalog.
    *>> SET EVENTS
      PERFORM set_event.
    *>> FOR ALV HEADER
      PERFORM n_top_of_page USING gi_top_of_page[].
    *>>For ALV Layout
      PERFORM build_layout.
    *>>For output display
      PERFORM alv_grid_display.
    *&      Form  fiscal_date
    FORM fiscal_date.
      TYPES : BEGIN OF lt_fisc,
                bukrs TYPE bukrs,
                periv TYPE periv,
                bumon TYPE bumon,
                butag TYPE butag,
              END OF lt_fisc,
              BEGIN OF lt_t009b,
                periv TYPE periv,
                bumon TYPE bumon,
                butag TYPE butag,
                poper TYPE poper,
               END OF lt_t009b.
      DATA : lwa_fisc  TYPE lt_fisc,
             lwa_t009b TYPE lt_t009b.
      DATA : li_fisc  TYPE STANDARD TABLE OF lt_fisc,
             li_t009b TYPE STANDARD TABLE OF lt_t009b.
      DATA : lv_date(2) TYPE c,
             lv_mont(2) TYPE c,
             lv_year(4) TYPE c.
      SELECT bukrs periv FROM t001
                         INTO TABLE li_fisc
                         WHERE bukrs IN s_bukrs.
      IF sy-subrc EQ 0.
        SELECT * FROM t009b
                 INTO CORRESPONDING FIELDS OF TABLE li_t009b
                 FOR ALL ENTRIES IN li_fisc
                 WHERE periv EQ li_fisc-periv .
        IF sy-subrc NE 0.
          CLEAR li_t009b.
        ENDIF.
      ELSE.
        CLEAR li_fisc.
      ENDIF.
      SORT li_t009b BY periv poper.
      LOOP AT li_fisc INTO lwa_fisc.
        READ TABLE li_t009b INTO lwa_t009b WITH KEY periv = lwa_fisc-periv
                                                    poper = '001'
                                           BINARY SEARCH.
        IF sy-subrc = 0.
          s_audat-option = 'EQ'.
          s_audat-sign   = 'I'.
          CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
            EXPORTING
              i_gjahr = p_gjahr
              i_periv = lwa_t009b-periv
              i_poper = lwa_t009b-poper
            IMPORTING
              e_date  = s_audat-low.
        ENDIF.
        CLEAR lwa_t009b.
        READ TABLE li_t009b INTO lwa_t009b WITH KEY periv = lwa_fisc-periv
                                                    poper = '012'
                                           BINARY SEARCH.
        IF sy-subrc = 0.
          CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
            EXPORTING
              i_gjahr = p_gjahr
              i_periv = lwa_t009b-periv
              i_poper = lwa_t009b-poper
            IMPORTING
              e_date  = s_audat-high.
        ENDIF.
        CLEAR lwa_t009b.
        READ TABLE li_t009b INTO lwa_t009b WITH KEY periv = lwa_fisc-periv
                                                    poper = p_monat
                                            BINARY SEARCH.
        IF sy-subrc = 0.
          lv_date = s_audat-high+6(2).
          lv_mont = s_audat-high+4(2).
          lv_year = s_audat-high(4).
          lv_mont = lwa_t009b-bumon.
          lv_date = lwa_t009b-butag.
          CONCATENATE lv_year lv_mont lv_date INTO s_audat-high.
          APPEND s_audat.
          CLEAR: lwa_fisc,lwa_t009b,lv_date,lv_mont,lv_year.
        ENDIF.
      ENDLOOP.
      DELETE ADJACENT DUPLICATES FROM s_audat.
    ENDFORM.                    "fiscal_date
    *&      Form  collect_data
    FORM collect_data .
      SELECT vbeln kunnr spart audat
          FROM vbak
          INTO TABLE gi_vbak
          WHERE audat    GE s_audat-low  AND
                audat    LT s_audat-high AND
                vkorg    IN s_vkorg AND
                spart    IN s_spart AND
                bukrs_vf IN s_bukrs.
      IF sy-subrc EQ 0.
        SELECT kunnr name1
        FROM kna1
        INTO TABLE gi_kna1
        FOR ALL ENTRIES IN gi_vbak
        WHERE kunnr EQ gi_vbak-kunnr.
        IF sy-subrc NE 0.
          CLEAR gi_kna1.
        ENDIF.
        SELECT vbeln wadat_ist
        FROM likp
        INTO TABLE gi_likp
        WHERE wadat_ist  GE s_audat-low  AND
              wadat_ist  LT s_audat-high .
        IF sy-subrc EQ 0.
          SELECT vbelv erdat rfwrt
          FROM vbfa
          INTO TABLE gi_vbfa
          FOR ALL ENTRIES IN gi_likp
          WHERE vbeln   = gi_likp-vbeln AND
                 ( vbtyp_n = 'M' OR
                vbtyp_n = 'H' ) .
          IF sy-subrc NE 0.
            CLEAR gi_vbfa.
          ENDIF.
        ELSE.
          CLEAR gi_likp.
        ENDIF.
        PERFORM change_date.
        SELECT vbeln wadat_ist
        FROM likp
        INTO TABLE gi_likp1
        WHERE wadat_ist  GE s_audat-low  AND
              wadat_ist  LT s_audat-high .
        IF sy-subrc EQ 0.
          SELECT vbelv erdat rfwrt
          FROM vbfa
          INTO TABLE gi_vbfa1
          FOR ALL ENTRIES IN gi_likp1
          WHERE vbeln   = gi_likp1-vbeln AND
                 ( vbtyp_n = 'M' OR
                vbtyp_n = 'H' ) .
          IF sy-subrc NE 0.
            CLEAR gi_vbfa.
          ENDIF.
        ELSE.
          CLEAR gi_likp.
        ENDIF.
      ELSE.
        MESSAGE i261.
        LEAVE SCREEN.
      ENDIF.
    ENDFORM.                    "collect_data
    *&      Form  Manipulation_collect_data
    FORM manipulation_collect_data.
      SORT gi_vbak BY vbeln.
      SORT gi_kna1 BY kunnr.
      LOOP AT gi_vbak INTO gwa_vbak.
        MOVE-CORRESPONDING gwa_vbak TO gwa_final.
        READ TABLE gi_kna1 INTO gwa_kna1 WITH KEY kunnr = gwa_vbak-kunnr
                                       BINARY SEARCH.
        IF sy-subrc EQ 0.
          gwa_final-name1 = gwa_kna1-name1.
        ENDIF.
      ENDLOOP.
    *    v_month = gwa_vbak-audat+4(2).
    *    gwa_final-cumon = p_monat.
    *    gwa_final-fiscy = p_gjahr.
    *    IF v_month = p_monat.
    *      CLEAR wa_ckmlhd.
    *      READ TABLE i_ckmlhd INTO wa_ckmlhd WITH KEY matnr = wa_vbap-matnr
    *                                                  bwkey = wa_vbap-werks
    *                                                  BINARY SEARCH.
    *      IF sy-subrc EQ 0.
    *        CLEAR i_nckmlcr.
    *        READ TABLE i_nckmlcr INTO wa_nckmlcr
    *                             WITH KEY kalnr = wa_ckmlhd-kalnr
    *                             BINARY SEARCH.
    *        IF sy-subrc EQ 0.
    *          gwa_final-peinh = wa_nckmlcr-peinh.
    *          gwa_final-kzwi6 = wa_vbap-kzwi6 - wa_vbap-kzwi5.
    *          gwa_final-kzwi5 = wa_vbap-kzwi5.
    *          gwa_final-totre = gwa_final-kzwi6 + gwa_final-kzwi5.
    *          gwa_final-actco = ( wa_nckmlcr-pvprs / wa_nckmlcr-peinh ) *
    *                            wa_vbap-kwmeng.
    *          gwa_final-profit = gwa_final-totre - gwa_final-actco.
    *          gwa_final-prows  = ( gwa_final-profit - gwa_final-kzwi6 ) *
    *100.
    *        ENDIF.
    *      ENDIF.
    *    ELSE.
    *      CLEAR wa_ckmlhd.
    *      READ TABLE i_ckmlhd INTO wa_ckmlhd WITH KEY matnr = wa_vbap-matnr
    *                                                bwkey = wa_vbap-werks
    *                                                BINARY SEARCH.
    *      IF sy-subrc EQ 0.
    *        READ TABLE i_ckmlcr INTO wa_ckmlcr
    *                             WITH KEY kalnr = wa_ckmlhd-kalnr
    *                             BINARY SEARCH.
    *        IF sy-subrc NE 0.
    *          CLEAR wa_ckmlcr.
    *        ENDIF.
    *        CLEAR wa_nckmlcr.
    *        READ TABLE i_nckmlcr INTO wa_nckmlcr
    *                             WITH KEY kalnr = wa_ckmlhd-kalnr
    *                             BINARY SEARCH.
    *        IF sy-subrc EQ 0.
    *          gwa_final-fkzwi6  = wa_vbap-kzwi6 - wa_vbap-kzwi5.
    *          gwa_final-fkzwi5  = wa_vbap-kzwi5.
    *          gwa_final-ftotre  = gwa_final-fkzwi6 + gwa_final-fkzwi5.
    *          gwa_final-factco  = ( ( wa_nckmlcr-pvprs / wa_ckmlcr-peinh )
    *                               * wa_vbap-kwmeng ) / wa_nckmlcr-count.
    *          gwa_final-fprofit = gwa_final-ftotre - gwa_final-factco.
    *         gwa_final-fprows  = ( gwa_final-fprofit - gwa_final-kzwi6 ) *
    *100
    *        ENDIF.
    *      ENDIF.
    *    ENDIF.
    *    APPEND gwa_final TO gi_final.
    *    CLEAR : gwa_final,wa_nckmlcr,wa_ckmlcr,wa_ckmlhd,
    *            gwa_vbak,wa_vbap,gwa_kna1.
    *  ENDLOOP.
    *  gwa_final-matnr = space.gwa_final-vbeln = space.
    *  MODIFY gi_final FROM gwa_final TRANSPORTING vbeln matnr
    *                                WHERE matnr NE space.
    *  SORT gi_final BY kunnr vbeln matnr.
    *  IF p_sum = gc_x.
    *    LOOP AT gi_final INTO gwa_final.
    *      COLLECT gwa_final INTO gi_final1.
    *    ENDLOOP.
    *    CLEAR gwa_final.REFRESH gi_final.
    *    gi_final[] = gi_final1[].
    *  ENDIF.
    ENDFORM.                    "manipulation_collect_data
    *&      Form  change_date
    FORM change_date.
      DATA : lv_date(2) TYPE c,
             lv_mont(2) TYPE c,
             lv_year(4) TYPE n.
      lv_date = s_audat-low+6(2).
      lv_mont = s_audat-low+4(2).
      lv_year = s_audat-low(4).
      lv_year = lv_year - 1.
      CONCATENATE  lv_year lv_mont lv_date INTO s_audat-low.
      CLEAR : lv_date ,lv_mont,lv_year.
      lv_date = s_audat-high+6(2).
      lv_mont = s_audat-high+4(2).
      lv_year = s_audat-high(4).
      lv_year = lv_year - 1.
      CONCATENATE  lv_year lv_mont lv_date INTO s_audat-high.
      CLEAR : lv_date ,lv_mont,lv_year.
    ENDFORM.                    " change_date
    *&      Form  gi_sort_table
    FORM gi_sort_table.
      IF p_det = gc_x.
        gwa_sort-spos = '1'.
        gwa_sort-fieldname = 'KUNNR'.
        gwa_sort-tabname = 'gi_final'.
        gwa_sort-up = gc_x.
        gwa_sort-subtot  = gc_x.
        APPEND gwa_sort TO gi_sort.
        CLEAR gwa_sort.
        gwa_sort-spos = '2'.
        gwa_sort-fieldname = 'NAME1'.
        gwa_sort-tabname = 'gi_final'.
        gwa_sort-up = gc_x.
        APPEND gwa_sort TO gi_sort.
    *  ELSE.
    *    gwa_sort-spos = '1'.
    *    gwa_sort-fieldname = 'KUNNR'.
    *    gwa_sort-tabname = 'gi_final'.
    *    gwa_sort-up = gc_x.
    *    APPEND gwa_sort TO gi_sort.
    *    CLEAR gwa_sort.
    *    gwa_sort-spos = '2'.
    *    gwa_sort-fieldname = 'NAME1'.
    *    gwa_sort-tabname = 'gi_final'.
    *    gwa_sort-up = gc_x.
    *    gwa_sort-group = gc_x.
    *    gwa_sort-subtot  = gc_x.
    *    APPEND gwa_sort TO gi_sort.
      ENDIF.
    ENDFORM.                    "gi_sort_table
    *&      Form  mearge_field_catalog
    FORM mearge_field_catalog .
    *>> LOCAL WORK AREA FOR FIELDCATALOG
      DATA : lwa_fieldcata TYPE slis_fieldcat_alv.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'KUNNR'.
    *  lwa_fieldcata-col_pos      = 1.
      lwa_fieldcata-key          = 'X'.
      lwa_fieldcata-key_sel      = 'X'.
      lwa_fieldcata-ref_tabname  = 'KNA1'.
      lwa_fieldcata-seltext_l    = 'Customer No.'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'NAME1'.
    *  lwa_fieldcata-col_pos      = 2.
      lwa_fieldcata-ref_tabname  = 'KNA1'.
      lwa_fieldcata-seltext_l    = 'Customer Name'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      IF p_det = gc_x.
        CLEAR lwa_fieldcata.
        lwa_fieldcata-fieldname    = 'VBELN'.
    *    lwa_fieldcata-col_pos      = 3.
        lwa_fieldcata-ref_tabname  = 'VBAK'.
        lwa_fieldcata-seltext_l    = 'Sales Order Number'.
        APPEND lwa_fieldcata TO gi_fieldcat.
        CLEAR lwa_fieldcata.
        lwa_fieldcata-fieldname    = 'MATNR'.
    *    lwa_fieldcata-col_pos      = 4.
        lwa_fieldcata-ref_tabname  = 'VBAK'.
        lwa_fieldcata-seltext_l    = 'Material No.'.
        APPEND lwa_fieldcata TO gi_fieldcat.
      ENDIF.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'KWMENG'.
      lwa_fieldcata-col_pos      = 5.
      lwa_fieldcata-ref_tabname  = 'VBAP'.
      lwa_fieldcata-do_sum       = 'X'.
      lwa_fieldcata-seltext_l    = 'Order Quantity'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'PEINH'.
      lwa_fieldcata-col_pos      = 6.
      lwa_fieldcata-ref_tabname  = 'CKMLCR'.
      lwa_fieldcata-text_fieldname = 'PEINH'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'CUMON'.
      lwa_fieldcata-col_pos      = 7.
      lwa_fieldcata-ref_tabname  = 'VBKPF'.
      lwa_fieldcata-seltext_l    = 'Month'.
      lwa_fieldcata-no_sum       = gc_x.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'KZWI6'.
      lwa_fieldcata-col_pos      = 8.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Costed Sales'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'KZWI5'.
      lwa_fieldcata-col_pos      = 9.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Surcharges'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'TOTRE'.
      lwa_fieldcata-col_pos      = 10.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Total Revenues'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'ACTCO'.
      lwa_fieldcata-col_pos      = 11.
      lwa_fieldcata-ref_tabname  = 'VBAP'.
      lwa_fieldcata-seltext_l    = 'Actual Cost for Period'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'PROFIT'.
      lwa_fieldcata-col_pos      = 12.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Profit'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'PROWS'.
      lwa_fieldcata-col_pos      = 13.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Profit % w/surcharge'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'FISCY'.
      lwa_fieldcata-col_pos      = 14.
    *  lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Fiscal Year'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'FKZWI6'.
      lwa_fieldcata-col_pos      = 15.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Costed Sales'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'FKZWI5'.
      lwa_fieldcata-col_pos      = 16.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Surcharges'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'FTOTRE'.
      lwa_fieldcata-col_pos      = 17.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Total Revenues'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'FACTCO'.
      lwa_fieldcata-col_pos      = 18.
      lwa_fieldcata-ref_tabname  = 'VBAP'.
      lwa_fieldcata-seltext_l    = 'Actual Cost for Period'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'FPROFIT'.
      lwa_fieldcata-col_pos      = 19.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Profit'.
      APPEND lwa_fieldcata TO gi_fieldcat.
      CLEAR lwa_fieldcata.
      lwa_fieldcata-fieldname    = 'FPROWS'.
      lwa_fieldcata-col_pos      = 20.
      lwa_fieldcata-ref_tabname  = 'VBAK'.
      lwa_fieldcata-seltext_l    = 'Profit % w/surcharge'.
      APPEND lwa_fieldcata TO gi_fieldcat.
    ENDFORM.                    " mearge_field_catalog
    *&      Form  set_event
    FORM set_event .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 1
        IMPORTING
          et_events   = gi_events.
      SORT gi_events BY name.
    *-- To read Top of Page event
      PERFORM read_events USING slis_ev_top_of_page gc_top_of_page.
    ENDFORM.                    " set_event
    *&      Form  top_of_page
    FORM n_top_of_page USING lp_top_of_page TYPE slis_t_listheader.
      DATA: lwa_listhead TYPE slis_listheader,
            lv_ccode TYPE string,
            lv_sales TYPE string,
            lv_divis TYPE string.
      CONCATENATE 'From : ' s_bukrs-low  ' To: ' s_bukrs-high INTO lv_ccode.
      CONCATENATE 'From: ' s_vkorg-low       ' To: ' s_vkorg-high INTO lv_sales.
      CONCATENATE 'From: ' s_spart-low       ' To: ' s_spart-high INTO lv_divis.
      CLEAR lwa_listhead.
      lwa_listhead-typ  = 'H'.
      lwa_listhead-info = text-003.
      APPEND lwa_listhead TO lp_top_of_page.
      CLEAR lwa_listhead.
      lwa_listhead-typ  = 'S'.
      lwa_listhead-key  = 'Month'.
      lwa_listhead-info = p_monat.
      APPEND lwa_listhead TO lp_top_of_page.
      CLEAR lwa_listhead.
      lwa_listhead-typ  = 'S'.
      lwa_listhead-key  = 'Year'.
      lwa_listhead-info = p_gjahr.
      APPEND lwa_listhead TO lp_top_of_page.
      CLEAR lwa_listhead.
      lwa_listhead-typ  = 'S'.
      lwa_listhead-key  = 'Company Code'.
      lwa_listhead-info = lv_ccode.
      APPEND lwa_listhead TO lp_top_of_page.
      CLEAR lwa_listhead.
      lwa_listhead-typ  = 'S'.
      lwa_listhead-key  = 'Sales Org'.
      lwa_listhead-info = lv_sales.
      APPEND lwa_listhead TO lp_top_of_page.
      CLEAR lwa_listhead.
      lwa_listhead-typ  = 'S'.
      lwa_listhead-key  = 'Division'.
      lwa_listhead-info = lv_divis.
      APPEND lwa_listhead TO lp_top_of_page.
      IF p_det = gc_x.
        CLEAR lwa_listhead.
        lwa_listhead-typ  = 'A'.
        lwa_listhead-info = text-004.
        APPEND lwa_listhead TO lp_top_of_page.
      ELSE.
        CLEAR lwa_listhead.
        lwa_listhead-typ  = 'A'.
        lwa_listhead-info = text-005.
        APPEND lwa_listhead TO lp_top_of_page.
      ENDIF.
    ENDFORM.                    "top_of_page
    *&      Form  TOP_OF_PAGE
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'ENJOYSAP_LOGO'
          it_list_commentary = gi_top_of_page.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  build_layout
    FORM build_layout .
      gwa_layout-no_input          = gc_x.
      gwa_layout-colwidth_optimize = gc_x.
      gwa_layout-zebra             = gc_x.
    ENDFORM.                    "build_layout
    *&      Form  alv_grid_display
    FORM alv_grid_display .
    * Function module to display ALV report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = sy-repid
          is_layout          = gwa_layout
          it_fieldcat        = gi_fieldcat[]
          it_sort            = gi_sort
          i_save             = 'A'
          it_events          = gi_events[]
        TABLES
          t_outtab           = gi_final
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " alv_grid_display
    *&      Form  read_events
    FORM read_events  USING  pr_events    TYPE slis_alv_event-name
                             pr_eventname TYPE slis_formname.
      DATA: lwa_event TYPE slis_alv_event.
      CLEAR lwa_event.
      READ TABLE gi_events INTO lwa_event
                          WITH KEY name = pr_events BINARY SEARCH.
      IF sy-subrc = 0.
        MOVE pr_eventname TO lwa_event-form.
        MODIFY gi_events FROM lwa_event
                        TRANSPORTING form
                        WHERE name = pr_events.
      ENDIF.
    ENDFORM.                    " read_events
    Regards
    Sandipan

Maybe you are looking for

  • Invoice number and document number not printed in payment advice

    Hello Gurus,        I am executing reprint check through transaction fch7, In that Invoice number and document number not printed in payment advice. I have created zscript for that and also assinged regup-belnr and regup-xblnr and used standard progr

  • Importing from dvd disk

    I am very new to imovie and am trying to import my home videos from a disk. I have a sony camcorder that finalizes disks so you can view them on dvd players. I have no problem watching the disk on my computer, but when I try to import, a screen pops

  • Problem in uploading data to psa.

    Hi experts, im having problems in uploading data to psa using info package in HR info area. while monitoring the info package the following error comes with red traffic signal.. Request still running Diagnosis No errors found. The current process has

  • How to call a drill down report using hyperlink ?

    Can anyone please give an example to call a drill down report using hyper link in Reports 10g ? Regards Capri !!!

  • Full export of the CMS from Production to Development

    Hello All, We have to export the reports and universes from Production to Development. In short we need to sync the Development CMS repository with Production CMS repository. What is the best way to do this. Is Import Wizard the only way to export th