Abap logic for my report

Hi
i have 1 requirement,
i have one sales order
under saled order i have deffirent items
sales order
my costant values is 70000 rs i need report like
i spend 10000 rs for item 1 and 20000 for item 2  so i need item 1 is 70000-10000 = 60000  for item 2  60000-20000= 4000
item
1
2
3
ple let me know can i write any end routine or can i make any modification at reporting level
regards
suneel.

Use cell definition if u items are fixed... or else use restricted Key figures and use them in the calculations.
Khaja

Similar Messages

  • Need of ABAP logic for 0CDFY variable

    Hi Everyone,
    Iam trying to use the Current Fiscal Year--0CDFY variable in one of query.
    I want to know the ABAP logic for that variable.
    anyone please help me out
    Thankyou
    ARUN

    This variable brings in the current fiscal year.
    If you want to see code behind it than go to Tcode SE37
    type in RSVAREXIT_0CDFY and click on disply

  • Dynamic Logic for a report:  User Maintained Logic

    Hi All,
    I've come across a requirement that needs to build a report.
    However, the set of definitions defined for the report output might change over time.
    Now every time the Definitions change, the User might have to request the change in the report through a development.
    Is there a way, where the Users can maintain certain set of rules and which can be maintained easily, but also allow the report to dynamically pick up the logic that it needs to process the data to the required output layout.
    To explain a little more in detail;
    Data from ZTABLEA is reported out by issuing each line with a BucketID.
    The report will aggregate the data to each Bucket Levels in output.
    But, The Logic for issuing the ZTABLEA line with a BucketID can change over time.
    So, a ZTABLEA line which was issued a BucketID_1 initially when FIELD1 of ZTABLEA = A,
    can later be assigned to another BucketID when FIELD1 of ZTABLEA = A.
    And this assignment needs to be maintained by the Users.
    Some of these Logics can be complex in the sense that they Could span over several Fields for a condition.
    Please advice. Any and all suggestions are highly appreciated.
    Thanks,
    RK.
    Edited by: RK on Jul 17, 2008 7:16 PM

    Following in from what Kev said.
    There's dynamic SQL available  (which you should put in a TRY...CATCH....ENDTRY block), so they can effectively define a WHERE condition, which would be stored in your table.
    I'd suggest that you have a check when they save the new logic, that the where clause is valid.
    If you need some kind of other dynamic abap look at GENERATE, READ REPORT and other associated keywords in the ABAP help.
    matt

  • Abap logic for lookup

    Hi all,
    I have a requirement where i need to lookup for a value in ods1 and based on that value i should update in ods2. can anyone help me with any abap logic --- is there one for look-up ? any sample code would be really helpful.
    ~rahul

    the following method will give the ODS table name
    CALL METHOD cl_rsd_odso=>get_tablnm
                     EXPORTING
                       i_odsobject   = <ods name>
                       i_tabt        = '0'
                     IMPORTING
                       e_tablnm      = ods_tab_name .
    do a select from the ODS table to find whether infoobject A is there and get the value and based on that update ods2.
    Regards
    Raja

  • ABAP - Logic for finding out the active employee

    Hi,
    I am trying to write the program where i need to set the flag "YES" to active employee for the particular time period for the particular position.
    For example:
    Row     Employee     DateTo     DateFrom          Position     FLAG
    1     1     1.1.2009     31.1.2009          10     YES
    2     1     1.2.2009     1.3.2009          10     NO
    3     1     2.3.2009     31.3.2009          10     YES
    4     1     1.4.2009     31.12.2009                           11     YES
    5     2     1.1.2009     31.1.2009          12     YES          
    6     2     1.2.2009     1.3.2009          10     YES
    7     2     2.3.2009     31.12.2009                           13     YES
    Employee 2 gets assigned as of 1.2.2009 to the same position 10 on which employee 1 is already assigned. Therefore, as of 1.2.2009 emplyoee 1 is not anymore the primary employee of position 10. As employee 2 is leaving the position as of 2.3.09 employee 1 gets again primary employee of that position as of 2.3.2009.
    Can any1 suggest me the logic for this?
    Regards,
    Rashmi
    Edited by: Rashmi G P on Jul 13, 2009 9:13 AM

    Hi,
    I already have a customised table where i am  trying to set the flag.
    My logic is something like this:
    Declarations:
    DATA: pos_flag TYPE char5.
    select-OPTIONS : pos for /bic/qzemployee-/bic/zhrpostn.
    SELECT zemployee datefrom dateto pos_flag FROM zemployee INTO CORRESPONDING FIELDS OF TABLE
    it_QZEMPLOYEE where /bic/zhrpostn in pos.
    *Sort it_zhrpostn by postion and datefrom
    SORT it_QZEMPLOYEE BY /bic/zhrpostn datefrom.
    *Looping it_zhrpostn.
    LOOP AT it_QZEMPLOYEE.
    MOVE-CORRESPONDING : it_QZEMPLOYEE TO it_qzemployee_temp.
    *Appending it_zhrpostn_temp to collect each postion
    APPEND it_qzemployee_temp.
    *At end of position
    AT END OF pos_flag.
    *Looping it_zhrpostn_temp table
    SORT it_qzemployee_temp BY datefrom DESCENDING.
    pos_flag = 'YES'.
    LOOP AT it_qzemployee_temp into wa_qzemployees.
    IF pos_flag = 'YES' OR wa_qzemployees-/bic/zhrpostn EQ '00000000' OR wa_qzemployees-/bic/zhrpostn EQ '99999999'.
    set the flag to yes
    write:       pos_flag.
    INSERT into /BIC/AZPA_DS0600 VALUES wa_final.
    pos_flag = 'NO'.
    ELSE.
    set the flag to NO
    write:       pos_flag.
    ENDIF.
    endloop.
    refresh: it_qzemployee_temp.
    ENDAT.
    endloop.
    But here the problem is the it is taking the most recent datefrom and setting the flag as yes. How to check whether someother employee is active in the given time period and set the flag as YES? Only 1 employee can be active in the date period given.
    Thanks and Regards,
    Rashmi

  • Logic for a report with check boxes

    Hi All ,
    I m writting a report , I need to put FOUR check box in this report ,
    For example you  can say Check1 ( material1)
                                           Check2 ( material2)
                                           Check3 ( material3)
                                           Others
    In selection critriea I defined one select option ( eg materail )
    Now I have to diplay data accordingly checkboxes
    If Check box '<b>check1'</b> is selected -list must contains only material1
    If Check box '<b>check2'</b> is selected -list must contains only material2
    If Check box '<b>check3</b>' is selected -list must contains only material3
    If Check box '<b>check1</b>' or any other one is  selected -list must contains  material1 and other materail as per other selected check box .
    If Check box<b> others</b> is selected then all other fields ( except the selected check box ) are the out put of this report .
    IF you need more explaination of my query , plz let me know .
    Regards ,
    Narender

    REPORT ZTEST3 line-size 400.
    tables : mara.
    data i_mara like mara occurs 0 with header line.
    data i_marc like marc occurs 0 with header line.
    data i_mcha like mcha occurs 0 with header line.
    data i_mkol like mkol occurs 0 with header line.
    select-options: s_matnr for mara-matnr.
    parameters : p_check1 as checkbox.
    parameters : p_check2 as checkbox.
    parameters : p_check3 as checkbox.
    parameters : p_check4 as checkbox.
    start-of-selection.
    if p_check1 = 'X'.
    select * from mara into table i_mara where matnr in s_matnr.
    loop at i_mara.
    endloop.
    endif.
    if p_check2 = 'X'.
    select * from marc into table i_marc where matnr in s_matnr.
    loop at i_marc.
    endloop.
    endif.
    if p_check3 = 'X'.
    select * from mcha into table i_mcha where matnr in s_matnr.
    loop at i_mcha.
    endloop.
    endif.
    if p_check4 = 'X'.
    select * from mkol into table i_mkol where matnr in s_matnr.
    loop at i_mkol.
    endloop.
    endif.

  • Logic for Hr Report

    Hi All,
    I have one report that is executing every week by batch job.
    If the employee position is changed or new hire taken place in the previous week, then it has to fetch that data and send it an email to manager.
    For example: if the employee position has been changed three times in a week...and new hiring takes place...
    i have written code like this
    rp-provide-from-last space p0000 pn-begda pn-endda.
    rp-provide-from-last space p0001 pn-begda pn-endda.
    loop at p0000.
    endloop.
    loop at p0001.
    endloop.
    is there any possibility to fetch the old records also?...i mean resending the old data(sent data) again?

    Dear Sai
    Macro RP_PROVIDE_FRM_LAST is working based on the dates PN-BEGDA and PN_ENDDA. It will give the latest record between these two dates into the workarea of infotype.
    SO if you want to take old record then put different PN-BEGDA PN-ENDDA as per your requirement.
    looping at infotype table like
    Loop at P0000.
    will loop through all records available in that irrespective of date
    I think this will sole your issue.
    Regards,
    Chandrashekhar

  • ABAP logic for customer variables

    Dear Experts,
    I need a code for given screnario.
    There are 2 similar cubes under Multiprovider on which report is running.I am not supposed to restrict cube at query level in filters as both cubes are required.Here is an example.
    Examples:
    1)      The user selects APO Location DE03 in the Variable screen and DE03 has no flag in the masterdata,
     the variable based on Infoprovider does exclude the new Cube STSCAPOR2
    2)     The user selects APO Location GR03 in the Variable screen and GR03 has a flag in the masterdata,
     the variable based on Infoprovider does exclude the old Cube STSCAPORM
    3)     The user selects 2 different APO Locations DE03 and GR03 in the Variable screen and they are in different cubes (one has got a flag and one is empty)
     the user should get an information that he cannot select/Mix APO Locations from different Planning Areas!
    We have a infoobject APO location (/BI0/PAPO_LOCNO) and it has attribute(/BIC/STNEWPLA) which holds a value "1".
    Can you please help me with code.
    Thanks alot
    ACE

    to exclude the cubes.
    create a variable with customer exit as processing type and filter infoprovider with this variable and select exclude.
    and the sample code is given below
    DATA: l_s_range TYPE rsr_s_rangesid.
    If I_vnam = 'ZVAR_INFOPROVIDER' and I_step = 2.
    READ TABLE i_t_var_range INTO WA
    WITH KEY vnam = 'apo_location variable name'.
       If i_t_var_range -low = 'DE03'
              l_s_range-low = 'STSCAPOR2'.
       else If i_t_var_range -low = 'GR03'
              l_s_range-low = 'STSCAPORM'
        endif.
        L_S_RANGE-SIGN = 'I'.
        L_S_RANGE-OPT = 'EQ'.
        APPEND L_S_RANGE TO E_T_RANGE.
    Endif.

  • Anubhav-ABAP Books for programming/reporting

    Hello sap gurus,
    I am a starter of SAP-ABAP.
    which book is good other than 21 days.
    Plz suggest me.

    Hi Anubhav,
    Learn more from:
    http://help.sap.com/saphelp_46c/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm
    For ABAP FAQ:
    Please check these links.
    http://www.sap-img.com/abap/abap-interview-question.htm
    http://www.sap-img.com/abap/answers-to-some-abap-interview-questions.htm
    http://sap.ittoolbox.com/documents/document.asp?i=3240
    http://www.techinterviews.com/?p=198
    Suggest you to be in SDN and learn more by checking others discusion and posts.
    All the best.
    Reward points if this Helps.
    Manish

  • Abap Logic for performance tuning not working when using Internal tables

    Hi,
    I wrote this piece of code that is working correctly that is select SUM of cost from DSO where Plant is the same for Sales Items.
    LOOP AT RESULT_PACKAGE INTO rp.
    SELECT SUM( /N/S_STRDCOST ) FROM /N/ADSP_DPIT00 INTO
    rp-/N/S_STRDCOST
    WHERE /N42/S_SALESITEM = rp-/N42/S_ITEMID AND /N42/S_PLPLANT EQ
    rp-/N42/S_SOURCE.
    MODIFY RESULT_PACKAGE FROM rp.
    Clear rp.
    ENDLOOP.
    Now I try to rewrite it for performance tunning using internal table  but I am getting 0 values. can't figure out whats the problem and been struggling fixing it.
    TYPES : begin of ty_DSO_TABLE,
             /N42/S_STRDCOST TYPE /N/ADSP_DSPC00-/N/S_STRDCOST,
             /N42/S_ITEMID TYPE /N/ADSP_DSPC00-/N/S_ITEMID,
           end of ty_DSO_TABLE.
    DATA: it_DSO_TABLE type hashed table of ty_DSO_TABLE with unique key
    /N/S_ITEMID,
         wa_DSO_TABLE type ty_DSO_TABLE.
    Field-symbols:  <rp> TYPE tys_TG_1.
    LOOP AT RESULT_PACKAGE assigning <rp>.
      clear wa_DSO_TABLE.
    Read table IT_DSO_TABLE into wa_DSO_TABLE with table key /N/S_ITEMID
      = <rp>-/N/S_ITEMID.
      if sy-subrc ne 0.
          select SUM( /N/S_STRDCOST )  into CORRESPONDING
          FIELDS OF wa_DSO_TABLE from
          /N/ADSP_DPIT00 WHERE /N/S_SALESITEM =  <rp>-/N/S_ITEMID AND
          /N/S_PLPLANT EQ <rp>-/N/S_SOURCE.
         if sy-subrc eq 0.
              <rp>-/N/S_STRDCOST = wa_DSO_TABLE-/N/S_STRDCOST.
         endif.
    endif.
    ENDLOOP.
    Any idea whats wrong with the code
    thanks

    Hi Vaidya,
    According to the code which you have written, there is no value in table IT_DSO_TABLE when you are trying to read the values.And after the read statement you have given a condition for sy-subrc. Hence the select statement is actually not even getting executed. *Also you have not assigned the final value back to the ResultPackage.*_
    So Kindly correct your code as follows:
    Data: wa_dso type ty_DSO_TABLE.
    LOOP AT RESULT_PACKAGE assigning <rp>.
    clear wa_DSO_TABLE.
    select SUM( /N/S_STRDCOST ) into CORRESPONDING
    FIELDS OF wa_DSO_TABLE from
    /N/ADSP_DPIT00 WHERE /N/S_SALESITEM = <rp>-/N/S_ITEMID AND
    /N/S_PLPLANT EQ <rp>-/N/S_SOURCE.
    if sy-subrc eq 0.
    <rp>-/N/S_STRDCOST = wa_DSO_TABLE-/N/S_STRDCOST.
    MODIFY RESULT_PACKAGE FROM <rp>.
    endif.
    ENDLOOP.
    Hope this helps you.
    Regards,
    Satyam

  • ABAP Query for Asset Reporting - Error in generating Infoset

    Hi friends,
    While generating Infoset - for the SAP standad infoset (SAPQUERY/AM01 -FIAA - Inventory information)-I am getting an Error as
    "The field "BERDATUM" is unknown, but there is a field with the similar name". I am unable to resolve the error.
    It will be greate if this can be answered by someone.
    Regards,
    Sathish

    Hi Sathish,
    Please implement SAP note:                                                                               
    1161344 Query: Generation error for LDB InfoSets   
    It should solve that issue for you.
    Kind regards,
    Brigitte

  • In Fi Hw we wll interact with Abapers and hw we wll write logic for reports

    hi every body...
    my name is ravi prasad.  i need one help.in FI....in real time as a sap FI consultant how we will interact with Abapers.and
    how we will write Logic for the Reports. please send me step by step.
    My mail id is    [email protected]
    Thank you very much.
    Awaiting for your response.

    hi,
    Please give me one example , and how we enter into tables, and how we know which table we have to use, and we will write logic.
    Ex;---if our client needs total sales commission payed by him.... if it is below 100,
    and if it above hundred....like that
    for that purpose in which place we will write logic.; i need the place where we write the logic.
    please send me tcodes and step by steps.
    Thank you very much,
    awaiting for your reply.
    my mail id is      [email protected]

  • Selection screen for HR report with logical database PNP

    Hi All,
       I am writing a HR report. And I use the logical database PNP. Also I create a HR report category for this report. In the report category, I can define the selection screen field. But all these fields are selection option format. My question is How can I add parameters, radiobutton group and checkbox in the selection screen. Thanks.
    Alex

    Hi Alex,
    Sorry for replying so late. Please try this tutorial:
    w w w. s a p t e c h n i c a l. c o m -> tutorials -> ABAP-HR -> Creating HR Report category in PNP logical database
    Sorry, I put it like this, because direct link doens't let me post the answer. Don't know why.
    It can also be something with your custom code in selection screen. Though it works fine for, try to remove COMMENTs and observe the result. Maybe parameters are overlapping somehow. First try this:
    SELECTION-SCREEN begin of BLOCK blk2 WITH FRAME TITLE text-002.
    PARAMETERS RefDate type DATS.
    parameter BFlag type c RADIOBUTTON GROUP grp1.
    PARAMETER FFlag type c RADIOBUTTON GROUP grp1.
    parameters days type i.
    PARAMETERS spvsr like PA0001-MSTBR.
    selection-SCREEN end of BLOCK blk2.
    If that works together with the report category, try to extend it with adding a selection-screen comment, but do this in reversed order (comment goes first and FOR FIELD addition is supplied) like this:
    SELECTION-SCREEN begin of BLOCK blk2 WITH FRAME TITLE text-002.
    PARAMETERS RefDate type DATS.
    SELECTION-SCREEN begin of line.
    SELECTION-SCREEN COMMENT 3(10) text-003 for field bflag.  "FOR FIELD, and goes first
    parameter BFlag type c RADIOBUTTON GROUP grp1.
    SELECTION-SCREEN COMMENT 16(10) text-004 for FIELD fflag.  "here two
    PARAMETER FFlag type c RADIOBUTTON GROUP grp1.
    SELECTION-SCREEN end of line.
    parameters days type i.
    PARAMETERS spvsr like PA0001-MSTBR.
    selection-SCREEN end of BLOCK blk2.
    If still not working, see if text-003 and text-004 are not too long (you expect them to be 10 chars), This may somehow affect selection screen.
    You may also try with setting cursor position explicity by:
    SELECTION-SCREEN begin of line.
    SELECTION-SCREEN POSITION 3.
    SELECTION-SCREEN COMMENT (10) text-003 for field bflag. 
    parameter BFlag type c RADIOBUTTON GROUP grp1.
    SELECTION-SCREEN POSITION 16.
    SELECTION-SCREEN COMMENT (10) text-004 for FIELD fflag.  "here two
    PARAMETER FFlag type c RADIOBUTTON GROUP grp1.
    SELECTION-SCREEN end of line.
    It is really hard to identify where can be a bug as it is working fine for me. Keep trying with different variations, it should finally run with some.
    Regards
    Marcin

  • OO Design--do ABAP Persistent Classes make sense for ALV reports in NW2004?

    Hello experts,
    At our company, we started using ABAP OO in the last year.
    I am on NW-2004 .  We just acquired a business that is on 4.6C.
    We have a lot of customization to bring into our system. There are a lot of reports with common queries that span multiple tables.
    I would like to follow the best practice for OO design and create global classes for the data access layer  the business logic layer and the UI layer.  For the UI layer, I will be utilizing the SALV class, since NW2004 doesn't have ABAP WebDynpro (we don't have a java stack available for development and software change management).
    For the data access layer,  I would like to use the persistent classes,  but without the query manager, it just doesn't make sense.
    Thomas Jung said in a blog that he sometimes used SQL to get the keys and then used persistent classes to retrieve the remaining data.  But for straight ALV reporting, that just seems inefficient.  But it could be that I am just not familiar enough with the technology.
    I am looking for suggestions on how to design the data access layer for these intense  and commonly used queries.
    (Ironically, we will upgrade to NW2004s after this migration -- ouch!)
    All ideas are appreciated.
    Thanks.

    Hi Kimberly,
    the main advantage of persistent objects is that their state can be saved in the database. If a persistent object changes in your program, these changes can be reflected in the corresponding database field(s). Thus, persistent objects are very useful when doing CRUD (create, read, update and delete) operations with business objects.
    However, if you just want to read data (for simple reporting) but do not plan to implement any of the other CRUD operations, I doubt if a persistency layer is necessary since this causes extra effort during design time and runtime. In that case, simple SELECT statements seem to be more appropriate.
    Regards,
    David

  • How 2 Set the logic for report 2 run 1st of everymonth......

    Hi Experts,
    i ve developd a HR-ABAP report in that Some part of code will Mon-Fri, Excluding Public holidays and sat & sundays...( i.e no public holidays and no sat & sundays)
       and some part of should Run on 1st of everymonth.... but 2 parts of code should be in same report..
    How can set the logic to run the report respective times....
    Thanks in Advance....
    sudeer.

    you can code this but need some good expertise on fm's  , date handling techniques and subroutine call coding.
    1.
    to make the code run only on 1st of every month
    capture the rundate of ur prog .. take value of  sy-datum
    ex.. 01.xx.yyyy
    or date std will be yyyymmdd so check for dd = 01 ..
    so per logic first two chars show that its first of any month in any year ..
    if yes
    execute the logic for the first of every month ..
    endif.
    2.
    where the code needs to be run on mon-fri and not on public holidays / sun / sat ..
    first fetch the day based on date .. like mon or tue or wed .. except sat and sun..
    second check whether if m-t-w-th-fr if any of them is  a holiday or not
    u need to check the date in the calender list like tholi thoc and .. to check whether that is a holiday or not ..
    coming to sat and sundays .. u need to check the day for date using function modules and build the logic ...
    br,
    vijay..

Maybe you are looking for