Urgent : Bill Qty based on Fisrt day of Previous week to current week

Hi,
I have to create a Restricted Key figure.
Bill Qty is to be restricted on a day, which is first day of previous week.
(1) I have restricted KF, with Current Week SAP exit variable.
(2) Restricted KF, with Calendar Day (Variable ZDATE, customer exit type).
(3) I have written Customer Exit in CMOD...
data: LT_RANGE  type  RSR_S_RANGESID,
      LS_VAR_RANGE like RRRANGEEXIT.
case i_vnam.
when 'ZDATE'.
if i_step = 2.
break-point.
loop at i_t_var_range into ls_var_range where vnam = '0CWEEK'.
data: var1(2) type c,
      var2(4) type c,
      var3 LIKE SCAL-WEEK,
      date1 like scal-date,
      DATE2(10) TYPE C,
      MNTH(2) TYPE C,
      DAY(2) TYPE C,
      YEAR(4) TYPE C.
var1 = ls_var_range-low(2).
var2 = ls_var_range-low(4).
concatenate var2 var1 into var3.
CALL FUNCTION 'WEEK_GET_FIRST_DAY'
  EXPORTING
    WEEK               = var3
IMPORTING
   DATE               = date1
EXCEPTIONS
  WEEK_INVALID       = 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.
MNTH = DATE1+4(2).
DAY = DATE1+6(2).
YEAR = DATE1+0(4).
CONCATENATE DAY '/' MNTH '/' YEAR INTO DATE2.
lt_range-low = date2.
lt_range-high = date2.
lt_range-sign = 'I'.
lt_range-opt = 'eq'.
append lt_range to e_t_range.
endloop.
endif.
<b>BUT I AM GETTING ERROR -</b>
00010004              AError for variable in customer enhancement ZDATE
Please suggest any idea..
Thanks
saurabh

Hi Saurabh,
Please try this dample code
WHEN 'ZDATE'.
DATA: Z_WEEK TYPE SCAL-WEEK.
*Determine current week from SY-DATUM
        CALL FUNCTION 'DATE_GET_WEEK'
          EXPORTING
            DATE               = SY-DATUM
          IMPORTING
            WEEK               = Z_WEEK.
*Determine first day of current week 
        CALL FUNCTION 'WEEK_GET_FIRST_DAY'
          EXPORTING
            WEEK = Z_WEEK
          IMPORTING
            DATE = LT_RANGE-LOW.
LT_RANGE-SIGN = 'I'.
LT_RANGE-OPT = 'eq'.
APPEND LT_RANGE TO E_T_RANGE.
Regards
Joe

Similar Messages

  • Account Based PA Billing Qty

    Hello Guruu2019s:
    If I have multiple condition types in a pricing procedure, when I release billing to accounting in account based PA, I see Sales Qty associated with the account mapped to first condition type in my procedure. Is there anyway to replicate billing qty to all Accounts mapped in account based PA?
    Regards
    Raghu

    Hi,
        Please read the note 160011. It explains how you can change the standard behavior in this regard.
      I quote from the note:
      "customer can influence the quantity update in CO in the SD user exit  for the G/L account item (EXIT_SAPLV60B_004): Set indicator XACCIT-XMFRW (quantities in accounting) to 'X' for all rows of the accounting document (structure ACCIT), for which the quantity should be updated in CO. "
    Please test this throughly in test system and see if it meets your requirements.
    regards
    Waman

  • Increased Qty in sales order than the Billed qty..  urgent

    Hi folks,
    When I am creating a return sales doc. with reference to a Billing doc,
    everything is getting copied on to the return sales doc.
    The Qty of the item is also getting copied on to the sales doc.
    But when i increase the qty of the item , it is giving me a warning message  saying " Qty is more than the billed qty." and thus allowing me to take it.
    The client want that this should be an error message and hence shouldnot allowed to take the increased qty.
    Can anyone tell how to make it an error message.
    thanx
    sourav

    Hi Sourav,
                  Check copy control settings in the transaction VTAF.
    In that you go to item level copy control check the field Pos./neg.quantity whether this field set as '-' or not.
    If not set enter - (Minus) then try
    If already enter you need to go for the User exits to cahnge the warning message to error message.
    I hope it will help you
    Regards,
    Murali.

  • Diffrence in incomming order qty and billing qty in cube 0sd_c03 & 0sd_c01

    Dear All.
    i have uploaded 2 cubes 0SD_C01 & 0SD_C01 from our R/3 data, SAP recommed for 0SD_C03 for sales analysis and their best practice is also based on 0SD_C03  but it is very strange the values of both the cubes are not the same when i run the report but the values of 0SD_C01 is 100% same as R/3 values i.e. mcsi reports show the same incomming and billing qty as i can see in report for 0SD_C01 but strang to see in 0SD_C03 there is diffrence in these values.
    can any one explain why did this happen as SAP recommed to use lbwe data sources and their best practice also base on 0SD_C03 and the other one i.e. 0SD_C01 is based on old LIS structures.
    during exploration i come to know that in some material orders incomming and billing quantaties are same but diffrence in most of them.
    any help will be highly appreciated.
    thanks & best regards,
    Zeeshan

    Hi,
    There are somany Routines for Keyfigures in both Cubes, I hope you may using 0QUANT_B key figure for Qty, the reason is there may be some difernece in Routines in both cubes, so you need to check it tehn you check in teh reports, whether is there any restrictions, you need to iopen the each node and check i nthe both reports.
    I also faced teh same problem with MCSI and BW reports, MCSI, we can customizi it an dut is just InfoStructure and having routines internally. So you need to take one material, plant and date where the diffrenece is coming then track it.
    Check OSS NOTES:
    Note 166996 - BW InfoCube 0SD_C03: incorrect incoming order qty
    Note 1156259 - Update rules incorrect for InfoCube 0SD_C03
    Thanks
    Reddy
    Edited by: Surendra Reddy on Aug 10, 2009 7:19 AM

  • Third Party Orders not appearing in billing due list. Item Cat billing rel 'F' & VTFA Billing Qty E

    I had a requirement to do my customer billing for third party scenario before doing the invoice verification.
    The solution that was proposed was to make the following changes,
    In VOV7 (For TAS )item category the billing relevance should be (G) and
    in the copy control VTFA  at item level  for item cat (TAS)maintain the billing qty(E).
    http://scn.sap.com/thread/3522580
    The problem I faced with the above config change was that nothing was appearing in the billing due list and when I tried to do a billing from the order directly, it would not let me.
    Then I made the following change,
    In VOV7 (For TAS )item category the billing relevance as (F) and
    in the copy control VTFA  at item level  for item cat (TAS)maintained the billing qty(E).
    Now after the MIGO is done based on the PO, the system allows me to do a customer billing from the SO before the invoice verification. But still this SO is still not appearing in the billing due list. Have any of you experts faced the same problem? How can I get this to appear in the billing due list? Or in other words, how do I identify open third party sales orders that are due for billing?
    Thanks and regards
    ES

    @ Joan, in that case invoice verification would now be necessary anymore right? In my case i need the invoice verification to happen...but at a later stage
    With the existing config...i.e. F as billing relevance and E as billing quantity, I now tried doing a MIRO immediately after the MIGO and then it appears in the billing due list. So basically I think its the billing relevance F...and if I want it to come in VFO4 before MIRO, perhaps a tweak in the logic of VFO4 to include billing relevance F + billing quantity E ?

  • Calculation of due date based on Business Days for FICA documents

    Hi All,
    I am working on project where SD - FICA integration is in picture. We post some charges through SD and FICA document gets posted on relevant Contract Account.
    Normally we create Sales Order using transaction VA01 and then we do Billing for this Sales Order through VF01. After billng is done, FICA document automatically gets generated.
    We have following requirement to be fulfilled.
    For the SD bills posted as above, I want to calculate due date of these bills based on Business Days for FICA document generated (SAP Standard calculate due date based on Calander days). We can use factory calander for calculating business days in relevant function module.
    I have checked in the system and it seems that event 1330 ( FM - ISU_DUE_DATE_DETERMINE) is not working in this scenario. Is there any other FM which I can use?
    Can anyone help me on this?
    Regards,
    Pradeep

    Hello Praeva ,
    The event 1330 has a sample FM FKK_SAMPLE_1330. It doesnt even have a Standard Function Module.
    You need to create a Installation-Specific FM and put your code to determine the Due Date based on the logic.
    Rgds
    Ram Kumar.

  • Billing Qty in Third party sales

    Hi ,
    I am MM person , executing a Cycle for third party Sales.
    I have query regarding Item category , in std SAP Billing relevance field value for Item category TAS is set as F ... what does it mean ? What if i set it to B , what would be difference ?
    Also , at my end , I have creates a Sales order - > PR - > PO and now i am changing Qty in PO and expecting that it will automatically update my Sales order but it is not happening.
    Is it Std functionality
    regards
    Shrey

    Hi
    SAP Billing relevance field value for Item category TAS is set as F ...
    what does it mean ?
    F: Order-related billing doc. - status according to invoice quantity
    Relevant for order-related billing documents based on the invoice receipt quantity (third-party business transaction). The system transfers the order into the billing due list only after the vendor invoice has been received and processed in the purchasing department. After the receipt of each invoice, a  customer invoice is created for the quantity that appears on the vendor invoice. The order has status "Billed" until the next vendor invoice is received.
    Item category TAS (Third party item) is set up with billing relevance "F" in the standard system.
    This process can also be related to the quantity of goods receipt.
    This is self explanatory
    F means system will check whether MIRO has been done for that item
    What if i set it to B , what would be difference ?
    Billing relevance B is wrong for third party because if the sales order is for 5 qty qnd the vendor PO is for 5 units but the vendor delivers only 3  to your customer directly and he gives you bill for only 3 and you do MIRO for 3
    If you make Billing relevance B system will make customer invoice for 5 qty which is wrong
    If you make Billing relevance F system will make customer invoice for 3 qty which is correct
    Also , at my end , I have creates a Sales order - > PR - > PO and now
    i am changing Qty in PO and expecting that it will automatically update
    my Sales order but it is not happening.
    Is it Std functionality
    Yes if you update po qty system will not update the sales order qty
    you need to go for some development here
    Regards
    Raja

  • * Values for Billing QTY in a Report

    Dear SDN,
    I am getting some values for Billing Qty as star (*)...in a Credit memos Report (SD)..
    I am using 0SD_C03 InfoCube..
    I have checked in the PSA also.. Data is available... Some value should come...but * is coming
    Help will be greatly appreciated with points..
    Thanks in advance...

    Thanks...
    But after doing the same way .. i am not getting any Units...
    Not getting * but values are ok...But without any units
    But Now client may ask to me..How to identify which are expressed in NO and TO and KG...
    Please help me out to resolve it
    Indeed, Thanks a lot for your help...

  • Factoring based on 26 days

    Hi friends
    The client requirement is to calculate payroll based on 26 days flat.  I am sure we will face issues in the month of February where we have only 24 working days and month like March(27 days), April(25 days), May(27 days) and August(27 days). Could anyone please adivse me on the possibile problems which can occur if we go for this.  Would like to understand the scenarios in case if some employees leaves or joins in the middle of the month and what would be the payroll calculation.
    Friends please help.
    Santhosh.S

    Hi
    Could you please help me with an example like if the employee join on 12th Feb what would be his salary for that month likewise if an employee resigns in the month of March. 
    Regards
    Santhosh.S

  • BAPI for displaying materian/description/Bin storage/ qty based on producti

    Hii All,
    please gv which bapi we use to display Bin storage, Material n qty based on production order number
    its very urgent

    Hi,
         You can try with user exit MWMBAP02
    <b>Reward points</b>
    Regards

  • Calculation of po qty based on material in  Reuse_alv_grid_dispay report

    Hi friends,
    This is the requirement
    I need to calculate the total Quantity(ekpo-menge) on open stores orders(doc type) with today's delivery date + (today's date + 1).
    help me out in giving the mandatory fields that need to be taken and  the code to calculate the total quantity based on material.say there are 3line items for one purchase order then how to calculate the total qty based on material.
    thanks in advance,
    meghna

    thanks for your replies
    I have already seen tcode gral but my requirement is simpler
    When we execute any ALV Report, the report is displayed in ALV Grid by defalut and then we can change the view using Grapcial View option in the menu bar
    I want to display this graphical view by default instead of that in the report form when the report is executed
    I hope my requirement is clear
    Ur valuable suggestions will definately be appriciated
    Thanks in advance

  • Order qty Based on ROH qty

    Hi I want to round off my order qty based on ROH. Say ROH is available multiples of 0.6 TONS.My Fert is need to plan so to that it consumes  0.6 ,1.2 , 1.8 etc TONS.
    Without using Material-Qty calculatiuon is it possible?? Because I am using Discrete Mfg.

    Hi,
    You must be having the Lot-size as EX.
    In this situation, For your lot size : EX, in OPI4, Activate the MTO Lot size as "1" (Lot-for-lot with Rounding).
    Maintain the Rounding Value in MRP1 View.
    Now the Order will be created with Multiples of your rounding Value.
    Hope this helps..
    Regards,
    Siva

  • How to change the billing qty directly during VF01 in AFS?

    Dear experts:
       Can anyone advise how we can change the billing qty directly during VF01 in AFS? Can anybody tell me why i can modify the billing qty in SAP R/3 ECC6.0, but it fail to in AFS, why?
    The operation was:
    1、I have  to done one customising, in VOV7 for my Item category change the Billing Relevance to "K";
    2、We setting up as Delivery note  related billing and would like to change the qty at the point of billing;
    3、Enter the Delivery note number Do not Press Enter, Then Click on u201Cselection listu201D, however , the field of "open quantity"  is in greyed out mode !
    In SAP R/3 ECC6.0 ,In transaction VF01 put the Delivery note NO. and before entering or executing go to "selection list" and we will find the quantities in editable mode and we can change there and then execute billing,but in AFS,the field of "open quantity"  is in greyed out mode ! I asked a lot of friends in AFS, they also  have this problem!
    Thanks
    Peter.lee
    Edited by: peter.lee on Nov 19, 2011 3:05 AM

    Hi Guys,
    Contrary to others IS (retail, oil etc...), AFS has been almost fully redesigned in some areas. That's why SAP releases first EHP business functions for standard and then try to enhanced the new created features later in AFS EHP.
    In regards to the change of the billing quantity, from my prospective this is not supported. Quantity always comes from preceding document.
    AFS is implemented in many industries like workwear, fashion high fashion, sportwear, underwear, bags etc...However I never got the same requirement to change the billing quantity.
    For which reasons do you need to change the billing quantity ? Can this be done in the sales order (in case of debit/credit memo request) or in the delivery ?
    The billing area has some restrictions, such as doing a pricing redetermination, in AFS it must be done in the sales order for example.
    You could potentially ask SAP and see whether an advanced modification could be provided (this is chargeable).
    Hope this might help.
    Regards,
    Mehdi

  • VF01-How to change intercompany billing qty.

    Hi, how we can change the intercompany billing qty directly during VF01 in STO business model ?
    We are setting up as delivery related billing and sales item category DLN Billing Relevance K,
    VTFL copy control  Data VBRK/VBRP 007.
    when VF01 click on selection list , the  qty field only display cannot change.

    Hi,
    I believe you cant change the QUANTITY in the INTERCOMPANY once the Customer invoice was generated.
    You can split the Quantity and do partial invoice at the Customer invoice and check whether it allows or not.
    regards
    santosh

  • Proforma Invoice Billing Qty CO-PA

    Hi,
    We have used BAPI to flow Proforma Invoice Billing Qty & Revenue to CO-PA through KE21n. We have developed other CO-PA in ke35 to capture other proforma invoice billing qty & value field. But billing qty of proforma is also reflecting in other co-pa report. I cannot assign more than one sd biiling qty field in ke4m. Is there any way to flow this qty to co-pa other report. I tried KEDR but unable to derive the rule.  For this report we have used record type z. is there any way to include this only record type z for proforma invoice reporting.
    Kindly suggest.
    Also when the CHR for this report moved to PRD, sales qty of other co-pa report got replaced with this sales qty & hence my ke24 & ke30 sales qty not matching. Now I want to bring ke24 sales qty to ke30 report. Is there any way through summarization or any thing else. Please suggest.
    Regards,
    Varsha

    Hi Varsha..
    We go with summarization level, when we want to avoid the message (related to "selection may take a while") that we get when opening the report and get the updated report online without delay.
    Its OK anyhow nothing wrong in doing summarization level and moving to PRD.
    I still wonder why the problem persists, when you have not used record type for the earlier FORM/REPORT. When we don't use specific record types, system has to consider all.
    But I heard some where saying its better to refresh FORM and REPORT (refresh in the sense open them and save again) to update the results when there happens any changes to characteristic values or reporting parameters. Why don't you try?
    Regards..
    Jose

Maybe you are looking for

  • Check out Jon Stewart of The Daily Show Celebrating the announcement of iPhone 4

    Verizon iPhone Announcement - The Daily Show with Jon Stewart Click here to view the video

  • Download of Studio not working

    Tried downloading the Studio eval, but got a 500 Internal Server Error when I clicked on the link. Is there something that I did wrong here? :-(

  • Need information abt ESS/MSS services?

    need information abt ESS/MSS services?

  • TOC Generated in Wrong Order

    Using FM 10 with a generated TOC.  The first page of a chapter has 2 flows, "Chapter Title" and "Body Text".  "Chapter Title" is above "Body Text".  The 2 flows are not connected, as I don't want a large title to encroach on the text and mess up its

  • N97 mini cutting out

    N97 Mini cuts out when using GPS. Phone gets quite hot & has happened twice since the recent upgrade to Ovi maps. This happened once before the upgrade but never since I started using a genuine Nokia car charger. All software is up to date, charger &