Can anybody help me with the product costing report... URGENt!!!!!

Hi,
Can anybody help me with the logic. teh present logic is given below. But as per the new requirement in the Selection screen when I add Material as Select Options then Logic should "expecting to get the report either in Product Group or (single/multiple/range) Material" . Please reply ASAP.
get the list of product groups based on the range entered by the user.
  SELECT KSTRG FROM CKPH INTO TABLE I_KSTRG
               WHERE KSTRG IN SO_KSTRG.
for each product explode the hierarchy get all sub product groups
  LOOP AT I_KSTRG.
    CLEAR I_CKPH. REFRESH I_CKPH.
    CALL FUNCTION 'K_CKPH_GET_HIERARCHY'
         EXPORTING
              DATBI     = '99991231'
              KSTRG     = I_KSTRG-KSTRG
         TABLES
              CKPH_I    = I_CKPH
         EXCEPTIONS
              NOT_FOUND = 1
              OTHERS    = 2.
    IF SY-SUBRC EQ 0.
    save all unique product groups within the hierarchy.
      LOOP AT I_CKPH.
        MOVE 'EQ' TO F_KSTRG-OPTION.
        MOVE 'I' TO F_KSTRG-SIGN.
        MOVE I_CKPH-KSTRG TO F_KSTRG-LOW.
        COLLECT F_KSTRG.
        MOVE I_CKPH-KSTRG TO KSTRG-LEVEL2.
        MOVE I_CKPH-UEKTR TO KSTRG-LEVEL1.
        COLLECT KSTRG. CLEAR KSTRG.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
SORT KSTRG BY LEVEL2 LEVEL1.
check if there are product groups extracted.
  CLEAR Z_LINES. DESCRIBE TABLE F_KSTRG LINES Z_LINES.
  IF Z_LINES GT 0.
get the materials attached to each product group.
    SELECT KSTRG WERKS MATNR
      INTO CORRESPONDING FIELDS OF TABLE I_CKPE
      FROM CKPE
      WHERE KSTRG IN F_KSTRG
        AND WERKS = PA_WERKS.
  IF NOT I_CKPE[] IS INITIAL.
get the order info order number & object number
      SELECT AFPOMATNR AUFKOBJNR
         INTO CORRESPONDING FIELDS OF TABLE I_AFPO
         FROM AFPO AS AFPO INNER JOIN AUFK AS AUFK
         ON AFPOAUFNR = AUFKAUFNR
         FOR ALL ENTRIES IN I_CKPE
       WHERE AFPO~MATNR = I_CKPE-MATNR.
    ENDIF.
    SORT I_AFPO BY MATNR.
    LOOP AT I_CKPE.
  get the division for the material.
      CLEAR: Z_SPART, MARA.
      SELECT SINGLE SPART
               INTO Z_SPART
               FROM MARA
              WHERE MATNR = I_CKPE-MATNR
                AND MTART = 'ZTFG'.
      MARA-SPART = Z_SPART.
    only proceed with processing if division is within users selection
      IF Z_SPART IN SO_SPART.
        LOOP AT I_AFPO WHERE MATNR = I_CKPE-MATNR.
          CLEAR: Z_MATERIAL_FLG, Z_EXPENSES_FLG, Z_SCRAP_FLG,
                 Z_OUTVAR_FLG, Z_ACTIVITY_FLG.
          LOOP AT I_COEP WHERE OBJNR = I_AFPO-OBJNR
                          AND  VRGNG NE 'KOAO'.   "changed by Kasturi
            PERFORM GET_DATA_FOR_REPORT TABLES I_DATA I_DATA_QTY.
            ENDLOOP.
          ENDLOOP.                       "afpo
        ENDIF.                           "division check
      ENDLOOP.                           "ckpe
    ELSE.
  no product groups extracted.
     MESSAGE i011.
  ENDIF.

Has this been resolved?
Your requirement is not clear. Could you please elaborate more about the output required?
Thanks,
F~Y

Similar Messages

  • Please help me on the  Product costing report .... URGENT!!!

    Hi,
    Can anybody help me with the logic. teh present logic is given below. But as per the new requirement in the Selection screen when I add Material as Select Options then Logic should "expecting to get the report either in Product Group or (single/multiple/range) Material" . Please reply ASAP.
    get the list of product groups based on the range entered by the user.
      SELECT KSTRG FROM CKPH INTO TABLE I_KSTRG
                   WHERE KSTRG IN SO_KSTRG.
    for each product explode the hierarchy get all sub product groups
      LOOP AT I_KSTRG.
        CLEAR I_CKPH. REFRESH I_CKPH.
        CALL FUNCTION 'K_CKPH_GET_HIERARCHY'
             EXPORTING
                  DATBI     = '99991231'
                  KSTRG     = I_KSTRG-KSTRG
             TABLES
                  CKPH_I    = I_CKPH
             EXCEPTIONS
                  NOT_FOUND = 1
                  OTHERS    = 2.
        IF SY-SUBRC EQ 0.
        save all unique product groups within the hierarchy.
          LOOP AT I_CKPH.
            MOVE 'EQ' TO F_KSTRG-OPTION.
            MOVE 'I' TO F_KSTRG-SIGN.
            MOVE I_CKPH-KSTRG TO F_KSTRG-LOW.
            COLLECT F_KSTRG.
            MOVE I_CKPH-KSTRG TO KSTRG-LEVEL2.
            MOVE I_CKPH-UEKTR TO KSTRG-LEVEL1.
            COLLECT KSTRG. CLEAR KSTRG.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
    SORT KSTRG BY LEVEL2 LEVEL1.
    check if there are product groups extracted.
      CLEAR Z_LINES. DESCRIBE TABLE F_KSTRG LINES Z_LINES.
      IF Z_LINES GT 0.
    get the materials attached to each product group.
        SELECT KSTRG WERKS MATNR
          INTO CORRESPONDING FIELDS OF TABLE I_CKPE
          FROM CKPE
          WHERE KSTRG IN F_KSTRG
            AND WERKS = PA_WERKS.
      IF NOT I_CKPE[] IS INITIAL.
    get the order info order number & object number
          SELECT AFPOMATNR AUFKOBJNR
             INTO CORRESPONDING FIELDS OF TABLE I_AFPO
             FROM AFPO AS AFPO INNER JOIN AUFK AS AUFK
             ON AFPOAUFNR = AUFKAUFNR
             FOR ALL ENTRIES IN I_CKPE
           WHERE AFPO~MATNR = I_CKPE-MATNR.
        ENDIF.
        SORT I_AFPO BY MATNR.
        LOOP AT I_CKPE.
      get the division for the material.
          CLEAR: Z_SPART, MARA.
          SELECT SINGLE SPART
                   INTO Z_SPART
                   FROM MARA
                  WHERE MATNR = I_CKPE-MATNR
                    AND MTART = 'ZTFG'.
          MARA-SPART = Z_SPART.
        only proceed with processing if division is within users selection
          IF Z_SPART IN SO_SPART.
            LOOP AT I_AFPO WHERE MATNR = I_CKPE-MATNR.
              CLEAR: Z_MATERIAL_FLG, Z_EXPENSES_FLG, Z_SCRAP_FLG,
                     Z_OUTVAR_FLG, Z_ACTIVITY_FLG.
              LOOP AT I_COEP WHERE OBJNR = I_AFPO-OBJNR
                              AND  VRGNG NE 'KOAO'.   "changed by Kasturi
                PERFORM GET_DATA_FOR_REPORT TABLES I_DATA I_DATA_QTY.
                ENDLOOP.
              ENDLOOP.                       "afpo
            ENDIF.                           "division check
          ENDLOOP.                           "ckpe
        ELSE.
      no product groups extracted.
         MESSAGE i011.
      ENDIF.

    Has this been resolved?
    Your requirement is not clear. Could you please elaborate more about the output required?
    Thanks,
    F~Y

  • I cannot open iCal because of a problem. Can anybody help me? The computer will not allow it to open and sends a message to apple each time. The icon has gone from the dock, but ical works on my iPad and I am afraid to sync it with my computer.?

    I cannot open iCal because of a problem. Can anybody help me? The computer will not allow it to open and sends a message to apple each time. The icon has gone from the dock, but ical works on my iPad and I am afraid to sync it with my computer in case it wipes everything .

    I have the exact same problem. I have not changed anything. This is probably a bug or something that has gone bad with Mac OS X (10.7.2). I have not found any solution for this on the web.
    MacBook Pro, Mac OS X (10.7.2).

  • I can't sign into iTunes on this pc so I can authorize it. I wan't to do this so I can transfer purchased iTunes music on my iPad mini to this pc. When I try to do this the response I get is just to try again later. Can anybody help me with this?

    I can't seem to sign into iTunes on this pc so that I can authorize it. I want to do this so I can transfer purchased iTunes music on my iPad mini to this pc. The response I keep getting is to try again later but its been days so I don't think that is the problem. I know I am using the correct user name and password so I don't know what's wrong. Can anybody help me with this?

    Hello
    It seems as though your account has been hacked.
    please contact Skype customer service and change your password.
    TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
    I recommend that you always run the latest Skype version: Windows & Mac
    If my advice helped to fix your issue please mark it as a solution to help others.
    Please note that I generally don't respond to unsolicited Private Messages. Thank you.

  • I urgently need a contact email for the sales team can anybody help me with this

    I urgently need a contact email for the sales team regarding an outstanding query, can anybody help me with this please? Thanks in advance.

    Hello 
    Welcome to the EE Community! I'm afraid there isn't an e-mail you can contact the EE Mobile Sales team on, but here's how you can get in touch with them:
    If you're on Twitter, you can tweet them @EE, however If you'd prefer to talk to someone, you can dial:
    150 from your EE mobile phone
    If you're ringing from another phone, it's 01707 315000
    For handy text codes & more, check out this page: http://ee.co.uk/help/get-in-touch Cheers,
    Titanium
    Was my post helpful? Please take 2 seconds to hit the 'Kudos' button below

  • I'm using iphoto9.1.3 but now it doesn't seem to work, whenever I try to open it, it just shows loading, but never loads. Can anybody help me with this ?

    I'm using iphoto9.1.3 but now it doesn't seem to work, whenever I try to open it, it just shows loading, but never loads. Can anybody help me with this ?    

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • Can anybody help me with admin password.. on my apple mini mac? [was:help]

    can anybody help me with admin password.. on my apple mini mac

    Hi, Jc
    If you want know how to transfer music from iphone to itunes, just follow this.
    Connect the iPhone to your computer then launch iTunes. Select the iPhone under Devices left side of the iTunes window. From the iTunes menu bar click File > Devices > Transfer Purchases

  • Hello, we have both Creative Cloud and Creative Cloud for teams. Can you help me with the difference and if i need to have both?

    Hello, we have both Creative Cloud membership and Creative Cloud for team. Can you help me with the difference and if i need to have both? We have 9 employees that are using it. Just not sure if i'm paying for something i don't need.
    Thank you

    Please refer to Creative Cloud Help | Creative Cloud / Common Questions
    CC is for retail use with 20 GB of storage space, CCT is where number of seats are purchased & assigned by one program admin where each seat gets 100GB of storage space.
    You can not have both the CC & team in one account as it will only provide you added storage space of 120 GB but you can activate the CC any of them or either of them twice as CC is based on Adobe ID.
    Regards
    Rajshree

  • HT201210 Hey,I've got a problem on my iPad mini for a few days now?My iPad is in recovery mode at the moment and I Cannot restore my Ipad with iTunes...Can anyone help me with the solution?Each of your helps will be appreciate

    Hey,I've got a problem on my iPad mini for a few days now?My iPad is in recovery mode at the moment and I Cannot restore my Ipad with iTunes...Can anyone help me with the solution?Each of your helps will be appreciate...Thanks for all the helps...

    Follow step 1 to 6 closely to recover your iPad.
    http://support.apple.com/kb/HT1808
    Note: You may have to repeat the above a few times

  • How to Setup Forward Error Handling in PI Scenarios. Can you help me with the same with screen shots if possible?

    Dear all
    How to Setup Forward Error Handling in PI Scenarios. Can you help me with the same with screen shots if possible?
    Thanks
    Regards
    karan

    Hello
    These are the following errors
    1. Trace level="1" type="T">no interface action for sender or receiver found</Trace>
    2. <Trace level="1" type="System_Error">Application-Error exception return from pipeline processing!
    3.
    <Trace level="1" type="T">Application Error at Receiver... => ROLLBACK WORK</Trace>  
    <Trace level="1" type="T">System Error at Receiver... => ROLLBACK WORK</Trace>  
    <Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_LOG_TO_PERSIST" />  
    <Trace level="1" type="System_Error">Application-Error exception return from pipeline processing!</
    Trace level="3" type="T">No persisting of message after plsrv call, because of config</Trace>Trace level="3" type="T">Error of the prevous version:</TraceTrace level="3" type="T">Error ID APPLICATION_ERROR</Trace>
    tThere are repeating errors also.
    TThanks
    Regards
    kkaran

  • Can anyone help me with the commands to import and restore  backup from  another administrative server

    Dear all.
                         Can anyone help me with the commands to import and restore  backup from  another administrative server

    I tried, even with code tags it looks the same since the 2500 character limit is exceeded.
    Please post just the relevant parts inside tags as mentioned, and choose a descriptive subject line.
    I'm locking this thread.
    Thomas

  • I want to delete OS X Lion and install OS X Snow Leopard again, can anybody help me with this?

    I want to delete OS X Lion and install OS X Snow Leopard again, can anybody help me with this?

    See Kappy's going back to SL from Lion guide.

  • I try to restore my ipod mini 4gb  but i get the 1437 error? can anybody help me with this problem?

    ok i have had the ipod fr a while and when i try and restore it gives me the 1437 error? i have no clue what this mean, can anybody help me? when is specifys the ipods components like the name and capacity etc.. under capacity it says N/A?  get back to me please i miss having an ipod:((

    I wish I could offer a solution, because I too am about to go crazy trying to fix the same problem. I have tried everything in the support section, sometimes twice, to no avail. Now I have an empty ipod that won't connect to my computer much less iTunes.
    Any suggestions?

  • Can anybody help me with iSight

    Hi all … I'm new to this, but have been a mac user for years. Just recently had my eMac go on me so I have bought the iMac 17' Widescreen… I updated everything from my old mac to this one and then the computer wouldn't start… so I blanked the hardrive and start again by just transfering the email and settings over… updated to the latest patches from apple and instant my messengers from Yahoo and MSN and now my iSight camera doesn't work… doesn't turn on via the green light on boot up either… it just say when I launch Photo Booth or the others that uyuou can use it with, that it's being used by another program. Can anybody help me? Please save me?
    Cheers Dave

    Good plan, Dave.
    Sorry iSight is still not working. You have been certainly been thorough in your efforts.
    Before you visit your Apple Service Technician, you may want to check this Apple KBase article. Be certain that none of the apps that can use iSight are launching automatically because they have been set as System Preference... > Accounts > Login Items.
    If that does not correct your problem, and if you did not use the "Combo Updater" after you reinstalled your system software, repair permissions and apply this Mac OS X 10.4.8 Combo Update (Intel) now. Finish with another Permissions Repair and check your iSight again.
    Using the appropriate Combo Updater (there are different ones for iNtel and PowerPC Macs) to update to the most current version of Mac OS X often seems to correct problems that may persist after updating via OS X via the "Software Update..." feature.
    If the above suggestions do not help, I can think of no better suggestion than the visit to the Apple Service Tech that you suggest.
    It is very good of you to consider others that may share your problem. We will be watching for your report on how you get sorted.
    Cheers,
    Jim

  • I am trying to install a demo loop on a iPhone 5, can anybody help me with this?

    I am trying to download a demo loop for the iPhone 5, can anybody help me?

    I went to Setting, General, and reset, I select Reset all settings and contents and it asked me for a 4 digit code but when i use the one on my current iphone 5 id doest work.

Maybe you are looking for