RMBP 15" right channel output not working properly

Hello,
I recently purchased a Retina Macbook Pro 15" no more than 3 months ago.
Today I just noticed that whenever I connect my headphones I can hear the left channel clearly but the right channel is a lower volume and distorted.
at first I thought it was the headphones, but have tried various ones and it doesn't seem to be that.
Also, output from the internal speakers sounds fine, same level on both channels and clear
Has anybody had this problem?
Thanks,
moih

Already tried zapping the PRAM, to no success...
I'll definitely bring it to a Genius bar since it also has a problem i didn't disclose here where the USB on the left hand side intermmitently connects and disconnects whenever i connect my iDevice...
Thanks anyways

Similar Messages

  • I HAVE IMAC 27 INCH MY MOUSE RIGHT CLICK IS NOT WORKING PROPERLY .ANY ONE HAVE HIS PROBLEM

    I HAVE IMAC 27 INCH MY MOUSE RIGHT CLICK IS NOT WORKING PROPERLY .ANY ONE HAVE THIS PROBLEM

    Have you tried going to System Preferences>Mouse and making sure that right click is set to secondary click?

  • Satellite Pro U200: VGA output not working properly when AC adapter was connected

    Hi,
    I have a problem with vga output. When I'm working on battery and connect my notebook to external monitor it's ok, but when I connect AC adaptor then start waving also bluetooth and wlan does not work properly. In other case when I remove battery from notebook and connect AC adaptor it works properly.
    thanks in advance

    As long as you use a CRT you should set the refresh rate new, at least 85Hz. Standard is 60Hz as far as I know, and that hurts in your eyes.
    The wireless lan behaviour is quite normal as long as your not right next to the access point. On battery power the wireless lan card reduces its energy consumption thus the connection will be poor if you dont have a perfect signal. You can turn this off in the iNTEL Pro/SET wireless software, where you can configure the adaptor. Try to change the powersafe mode to manual and full power, this should solve your problem.

  • Help!! T6060 5.1 Front right speaker is not working properly!!

    I have new Inspire t6060 5.1 speakers, but i have problems , because on riht side speaker is not working!! all speakers are working good, only one front right speaker is not working i have altec 97 (asus intergrated suond card), i have tryed to instal new audio drivers , but it has not solved the problem. there is the problem? plz help!!

    Here here, you are not the only one.
    Have absolutely no solution to this problem apart from sending it back and never buying anything Creative ever again.
    They refuse to acknowledge this problem.

  • RFC Sender Communication Channel is not Working Properly

    Hi All,
    I had a Small Problem.
    I had configured RFC Sender in Asyn mode as given in Weblog 5398
    The Scenario is working fine for 1 time, after the execution the Communication Channel should be made Active again to make it work for the next time.
    For every time to Execute the Scenario i had to Activate the RFC CC.
    It is some complicated one. So any one please suggest me what can be done to Resolve the issue.
    Thanks in Advance.
    Sriram

    Hi Bhavesh,
    when we test RFC connection it is Failing and giving this error
    Error Details     ERROR: timeout during allocate of registered program
    Error Details     LOCATION: SAP-Gateway on host p162845 / sapgw00
    Error Details     DETAIL: TP Flightdatasender init/busy for more than 60 sec
    Error Details     COMPONENT: SAP-Gateway
    Error Details     COUNTER: 31415
    If I Activate the RFC sender CC.It is working again.
    After 1 Execution.It is throwing this error.
    I even added Name as 'jco.server.max_startup_delay' and Value '1000' in advanced Mode of RFC sender CC.
    Please suggest me.
    Thanks in Advance.
    Sriram

  • Wired Keyboard: Right Arrow Key Not Working Properly

    The right arrow key on my new wired keyboard doesn't work on the first press. After the initial press it works, and if I'm only using the arrow keys themselves it works fine too. But otherwise it takes two presses to move the cursor initially.

    I found the problem, at least for my keyboard. Open Keyboard Viewer from the International menu, the one that displays a flag.
    Tap the right arrow key lightly. Nothing happens on the viewer. Tap any other key lightly. They display just fine. Now, give the right arrow key a firmer tap. You should see that it registers every time as long as you tap it a little harder than the other keys.
    So, at least in my case, it is keyboard specific. That probably explains why some have the problem and other's don't. I will exchange this keyboard for another one until I finally get one that works. Thank God for "Keyboard Viewer" or I never would have nailed this down.
    Poor quality control at play here me thinks.
    John

  • RH 5.5 output does not work properly in RH 7

    I inherited a WebHelp project created in RH 5.5. I have RH 7.
    When I open the files, make modifications, and recompile them, the
    output does not work properly once I put it on our hardware box.
    Those infamous red squares are present and there seems to be a lot
    of .js files being called, but even when I do a straight 1:1 copy
    and include all the files, and delete the red squares, it still
    doesn't work right.
    Also, oddly, when I open the original (5.5) files in my v7 --
    even without making ANY changes at all -- the TOC has
    disappeared.

    When you view the upgraded source files in RH7, are the red
    squares seen the editor?
    When you generate to a local folder and view the output
    there, are the red squares present? Are there any other issues with
    the generated output?
    Have you applied all three patches to RH7? Help About should
    show 7.0.3.

  • In photoshop cc is not working properly right button on the tablet stylus genius

    in photoshop cc is not working properly right button on the tablet stylus, when clicked, the menu appears and immediately disappears in Pshotosho CS6 everything was OK, and in other programs all OK.
    Tablet - Genius G-Pen M712X.

    have you participated on here before, smihop? -- do Adobe representatives ever provide a solution? I pay monthly for all adobe cloud applications <-- doesn't it seem like that should come w/some kind of support? (especially when they push out buggy releases <-- which make me wish I could go back a version)

  • After I upgraded to Mavericks my Epson 5000V scanner is not working properly.  I can scan by going into Preference/PrintersScanners to operate the scanner, but I cannot find the output.

    After I upgraded to Mavericks my Epson 5000V scanner is not working properly.  I can scan by going into Preference/PrintersScanners to operate the scanner, but I cannot find the output.  I am trying to save the scan as a PDF in Documents.

    Have you installed Apple's latest Epson drivers?
    They are here:
    http://support.apple.com/kb/DL1398

  • Left and right arrow keys are not working properly now

    I searched the forum and didn't see this posted. My left and right arrow keys are not working properly now.
    For example, when typing, left arrow does not produce the desired action (move cursor one spot to the left), and right arrow does not produce the desired action (move cursor one spot to the right). Also, control + left no longer activates spaces, and control + right no longer activates spaces.
    Interestingly, in investigating the problem, I noticed that my shortcut keys for activating spaces and for activating expose had been changed (software update?). Before, I had set F5 (without pressing fn) for expose and had set F6 (without pressing fn) for spaces. Now, I noticed spaces was set back to the default of F8 (requiring fn).
    The issue persists after shut down, and even when logged on to other users, e.g. Guest.
    All other keys seem to be working fine, including the up and down arrows.
    I don't think it's a cleaning issue because fn + left + right produces the "[" character on the screen.
    Any ideas?

    I'm having the same type of issue on my MacBook except not with arrow keys. The volume keys do different things when I click on them. For example, the mute key brings up the dashboard and the volume up key makes all the open screens smaller (don't know what this feature is called). I did a software update then restarted the computer when this starting happening. Any help would be greatly appreciated, thanks.

  • MSI 865PE NEO FISR2 Audio not working properly

    The audio on my board is not working properly.  I have it set for 6 channel and am using Creative Labs Inspire 5.1 Speakers that have 3 inputs that match the 3 output jacks on the mobo.  However, its just not right.  It is sending anything to all 5.1 speakers and also to the proper speaker at same time.  So every sound is coming through all speakers and it a tad louder on the speaker it should be coming out on.  Anyone else have any clue as to what setting I can change to correct this or is this something wrong with the cmedia drivers?

    The answer to all your suggestions is yes, already did it and in the demo app the sounds work fine.  Its just so odd, I may just go to Circuit City tomorrow and buy another set of speakers and see if it is possibly them that are causing the issue.  Then if so, I'll just return the Creative Labs ones as I just bought them 2 weeks ago and CC has great return policy
    Actually, one of your questions I did not either understand what you meant or did not see the option Quote
    Did you enable the output port correctly - LR to LR, surround to surround, center/lfe to center/lfe
     The only thing I see is setting phones, 2, 4 or 6 channel in the cmedia control panel and then I plugged in the proper cables.

  • Flash player does not work properly on Windows 7 32 bits

    Hello,
    My flash player does not work properly on Windows 7 32 bits with Firfox and IE8 (lasts versions).
    My Flash player version : 10.0.45.2, but I tried with version 9 too, with same problems.
    I have tried to uninstall, reboot, reinstall several times, ... witch did not worked.
    In fact, it works correctly on some sites, like youtube, but not on some others like :
    http://www.dailymotion.com/ => black screen instead of videos, right click gives flash context menu
    http://www.canalplus.fr/ => videos does not load, right click gives flash context menu
    http://www.myspace.com/ => no audio player, right click gives flash context menu
    some games in http://www.kongregate.com/ => black screen instead of games, right click gives flash context menu
    I have no problem with shockwave in http://www.adobe.com/shockwave/welcome/
    No problem too with flash player on http://www.adobe.com/software/flash/about/
    But in the Global Privacy Settings panel (http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.htm l), I cannot change any settings :
    I cannot check boxes,
    My changes are not saved.
    In most of flash animations, videos, ...,
    when I click on parameters, I cannot do anything, even closing.
    when I am in full screen mode, the message "press escape to exit...." does not disappear.
    Last thing, all those problems was not there when I was on Windows XP, few weeks ago, and appear with my registered Windows 7 premium familly edition, with the same hardware configuration...
    Thank you for your help

    Hi eidnolb
    Thanks for your answer.
    This is what I have :
    Verify user permissions
    I have an administrator account.
    I tried (uninstall, install and run) with super-administrator account for same results
    Install the most current version.
    I am running the latest version (10.0.45.2)
    Run the Clean Installer to Fix 3rd Party Flash Player Cleaners
    I did not "clean" my computer.
    Troubleshoot Pop-up blockers
    I have no Pop-up or esle blocker  software.
    Ensure that Internet utilities do not block Flash Player
    I tried (uninstall, install and run) without Avast.
    I have windows 7 firewall. I do not know where I can allow ActiveX  controls and Flash (SWF) content. I do not see anything relative to ActiveX an Flash in allowed program list.
    Fix machine crashes when displaying Flash content
    I have no freez or crash.
    Using IE, Shockwave Flash Object is Enabled and vs 10.0.45.2
    Using FF, I have SWF vs  10.0.45.2 and it is Enabled
    I really do not understand !!
    Thanks,
    Ju'

  • WRT1900 AC V1 - Linksys is aware that the router is not working properly. Help spread the word.

    I just had a conversation with Linksys' Customer Service via chat: Daphne L. J: Hello Fernando Paramo. My name is Daphne L..
    Daphne L. J: Welcome to Linksys Global Chat. Is this your initial contact or do you have a case number?
    You: Case number is 04971062
    Daphne L. J: Please give me 3-5 minutes to pull up and review your case.
    You: OK
    Daphne L. J: Thank you.
    You: I have a WRT1900 AC, V1. The router is not working properly. I have disconnections every few minutes.I already installed the new firmware version and I still have the same issues. I already reset the router to factory defaults and same issues. I have changed the settings back to my personal preferences: Changed the SSID, changed the wireless security settings, changed the DNS and deactivate WPS. That's it.I'm using 5 Ghz mode with my laptops (5 Ghz adapters) and 2-4 Ghz with a few devices (Chromecast, Nintendo 3DS).
    Daphne L. J: Thank you for waiting.
    Daphne L. J: Please confirm if the following information is correct:
    Name : Fernando Paramo
    Phone Number :
    E-Mail Address : 
    Model Number : WRT1900AC
    Serial Number : 13J10609406280
    Country : United States
    You: That's correct.
    Daphne L. J: Okay. Were you able to check if the devices have stable connection wired to the router?
    You: No. I do not have devices with Ethernet ports. Well, only the cable modem.
    You: But the modem is fine. No disconnections from my ISP.
    You: It is the router.
    Daphne L. J: Alright. What is the current firmware version of your router?
    You: I tried to return the router to Wal-Mart yesterday with no luck. This is a useless device. And I have been reading comments on the community forums and a lot of people are having problems.
    Daphne L. J: We are actually aware of the issue and are working on a resolution. What is the current firmware version of your router?
    You: Ver. 1.1.10.167514
    You: Latest one.
    Daphne L. J: Yes, so you reflashed the firmware, reset and then manually reconfigure it after, not using backup configuration, is that right?
    You: That's correct.
    Daphne L. J: And it is intermittent on all devices connected to both 2.4 and 5 Ghz networks, is that right?
    You: That's correct.
    Daphne L. J: Thank you for the information. Please give ,e 3-5 minutes to verify this with my superior.
    Daphne L. J: Thank you for waiting.
    You: I want to send you my WRT1900 AC and get a V2 or I want a EA8500 and pay the difference myseld.
    You: I do not want my current hardware.
    You: It is useless for my needs.
    You: I can't believe I had an older E3000 that didn't give me any problems.
    Daphne L. J: We have already exhausted all possible troubleshooting steps for your concern. As verified with my Supervisor, we will forward your case to our Customer Assurance Team. They are highly technical and knowledgeable when it comes to advanced troubleshooting. They will contact you in the next 24 to 48 hours. By the way, who is your Internet Service Provider? And do you Cable or DSL connection?
    You: Cable connection.
    Daphne L. J: Who is your Internet Service Provider?
    You: A company called .
    You: How are they going to contact me?
    Daphne L. J: Alright. By the way, on the device itself, on its FCC ID, please check if you have WRT1900AC or WRT1900AC v2.
    You: Are you paying attention to me?
    You: I already told you it's V1.
    Daphne L. J: They will call or email you. Please double check if these informations are correct:
    Name :
    Phone Number :
    E-Mail Address :
    You: I told you I want to send you my WRT1900 AC and get a V2 or I want a EA8500 and pay the difference myself.
    You: I want them to contact me to my email. I can't answer the phone during work hours.
    Daphne L. J: We can't assure you if we will be able to replace it with Version 2 or if you are allowed to have the EA8500 instead.
    Daphne L. J: Just in case, do you also have an alternate number?
    Daphne L. J: Also, what time zone are you in? And what is your preferred time and day for them to contact you?
    You: I have the one from my office in Mexico. Central Time. Any time is good.
    Daphne L. J: So, you are currently in Mexico?
    You: I work in Mexico but I have the house in USA. I live in the border.
    Daphne L. J: I see. Do you have any other questions or clarifications?
    You: I live 10 minutes away from the International Bridge. But that's not an issue. I bought the router at Walmart in Laredo, TX.
    Daphne L. J: Thank you for the information. Would that be all for now?
    You: I want a clarification: Do you realize that there is an issue with the current WRT1900 AC? Are you aware of that?
    You: Because this is a very expensive router that is not working as it should be.
    Daphne L. J: Yes, we are aware of the issue and are working on a resolution.
    Daphne L. J: Would there be anything else you need?
    You: That would be it. I will wait for you to contact me.
    You: Thanks.
    Daphne L. J: Alright. Thank you for giving us an opportunity to serve you through Linksys Live Chat. You may also visit our support site at www.linksys.com. For your reference, your case number is 04980394. Thank you for choosing Linksys and have a great day! We paid $250 for this piece of equipment. That's a lot of money for a device that doesn't work. I just want to get a V2 replacement, or better yet, an exchange for a EA8500. We should all demand this. It is not fair for us. The current WRT1900 AC is a useless device. They even should do a recall of the product. I will wait for them to contact me, but I'm thinking if I should send the information to The Consumerist or someone else. What to do?

    FernandoRocker wrote:
    Well... instead of looking into this with Engineering, I would prefer you to talk about this with the Sales department and exchange my WRT1900AC for an EA8500 (I will pay the difference if needed).  Seriously. The device is useless. Not just a paperweigt... an expensive paperweight.Actually I looking into the swap for you because I think that would be best in your case. Keep this in perspective. There is laterally millions of WRT1900AC V1 out there with very few issues with latest firmwares and of course the odd exception. In your case it could be a defective WRT1900AC.

  • WRT1900AC V1 - Linksys is aware that the router is not working properly. Help spread the word.

    I just had a conversation with Linksys' Customer Service via chat: Daphne L. J: Hello Fernando Paramo. My name is Daphne L..
    Daphne L. J: Welcome to Linksys Global Chat. Is this your initial contact or do you have a case number?
    You: Case number is 04971062
    Daphne L. J: Please give me 3-5 minutes to pull up and review your case.
    You: OK
    Daphne L. J: Thank you.
    You: I have a WRT1900AC, V1. The router is not working properly. I have disconnections every few minutes.I already installed the new firmware version and I still have the same issues. I already reset the router to factory defaults and same issues. I have changed the settings back to my personal preferences: Changed the SSID, changed the wireless security settings, changed the DNS and deactivate WPS. That's it.I'm using 5 Ghz mode with my laptops (5 Ghz adapters) and 2-4 Ghz with a few devices (Chromecast, Nintendo 3DS).
    Daphne L. J: Thank you for waiting.
    Daphne L. J: Please confirm if the following information is correct:
    Name : Fernando Paramo
    Phone Number :
    E-Mail Address : 
    Model Number : WRT1900AC
    Serial Number : 13J10609406280
    Country : United States
    You: That's correct.
    Daphne L. J: Okay. Were you able to check if the devices have stable connection wired to the router?
    You: No. I do not have devices with Ethernet ports. Well, only the cable modem.
    You: But the modem is fine. No disconnections from my ISP.
    You: It is the router.
    Daphne L. J: Alright. What is the current firmware version of your router?
    You: I tried to return the router to Wal-Mart yesterday with no luck. This is a useless device. And I have been reading comments on the community forums and a lot of people are having problems.
    Daphne L. J: We are actually aware of the issue and are working on a resolution. What is the current firmware version of your router?
    You: Ver. 1.1.10.167514
    You: Latest one.
    Daphne L. J: Yes, so you reflashed the firmware, reset and then manually reconfigure it after, not using backup configuration, is that right?
    You: That's correct.
    Daphne L. J: And it is intermittent on all devices connected to both 2.4 and 5 Ghz networks, is that right?
    You: That's correct.
    Daphne L. J: Thank you for the information. Please give ,e 3-5 minutes to verify this with my superior.
    Daphne L. J: Thank you for waiting.
    You: I want to send you my WRT1900AC and get a V2 or I want a EA8500 and pay the difference myseld.
    You: I do not want my current hardware.
    You: It is useless for my needs.
    You: I can't believe I had an older E3000 that didn't give me any problems.
    Daphne L. J: We have already exhausted all possible troubleshooting steps for your concern. As verified with my Supervisor, we will forward your case to our Customer Assurance Team. They are highly technical and knowledgeable when it comes to advanced troubleshooting. They will contact you in the next 24 to 48 hours. By the way, who is your Internet Service Provider? And do you Cable or DSL connection?
    You: Cable connection.
    Daphne L. J: Who is your Internet Service Provider?
    You: A company called .
    You: How are they going to contact me?
    Daphne L. J: Alright. By the way, on the device itself, on its FCC ID, please check if you have WRT1900AC or WRT1900AC v2.
    You: Are you paying attention to me?
    You: I already told you it's V1.
    Daphne L. J: They will call or email you. Please double check if these informations are correct:
    Name :
    Phone Number :
    E-Mail Address :
    You: I told you I want to send you my WRT1900AC and get a V2 or I want a EA8500 and pay the difference myself.
    You: I want them to contact me to my email. I can't answer the phone during work hours.
    Daphne L. J: We can't assure you if we will be able to replace it with Version 2 or if you are allowed to have the EA8500 instead.
    Daphne L. J: Just in case, do you also have an alternate number?
    Daphne L. J: Also, what time zone are you in? And what is your preferred time and day for them to contact you?
    You: I have the one from my office in Mexico. Central Time. Any time is good.
    Daphne L. J: So, you are currently in Mexico?
    You: I work in Mexico but I have the house in USA. I live in the border.
    Daphne L. J: I see. Do you have any other questions or clarifications?
    You: I live 10 minutes away from the International Bridge. But that's not an issue. I bought the router at Walmart in Laredo, TX.
    Daphne L. J: Thank you for the information. Would that be all for now?
    You: I want a clarification: Do you realize that there is an issue with the current WRT1900AC? Are you aware of that?
    You: Because this is a very expensive router that is not working as it should be.
    Daphne L. J: Yes, we are aware of the issue and are working on a resolution.
    Daphne L. J: Would there be anything else you need?
    You: That would be it. I will wait for you to contact me.
    You: Thanks.
    Daphne L. J: Alright. Thank you for giving us an opportunity to serve you through Linksys Live Chat. You may also visit our support site at www.linksys.com. For your reference, your case number is 04980394. Thank you for choosing Linksys and have a great day! We paid $250 for this piece of equipment. That's a lot of money for a device that doesn't work. I just want to get a V2 replacement, or better yet, an exchange for a EA8500. We should all demand this. It is not fair for us. The current WRT1900AC is a useless device. They even should do a recall of the product. I will wait for them to contact me, but I'm thinking if I should send the information to The Consumerist or someone else. What to do?

    Hello. I sent my WRT1900AC V1 to Linksys four days ago (Monday) via UPS with a RMA. Linksys paid the shipping and everything. The router is still in route, and it should arrive to their offices tomorrow. Once they receive the WRT1900 AC V1, they are going to send me an EA8500 as a replacement. But I have been reading the comments about the EA8500 here in the forum and it seems to have the same problems. I guess the firmware is extremely flawed in both routers (maybe it is almost the same code?). Anyway, I will try the EA8500 and I hope it works. I bought a temporary router from Walmart and I paid $35 for it. It is a Belink N600 DB. I can't believe that a $35 router is working a lot, lot, lot better than my previous $250 WRT1900AC router. Unbelievable. If the EA8500 doesn't work, I'm going to try and get my money back from Linksys, or contact The Consumerist or someone to get my money back and get a Nighthawk instead.

  • Hi ALL i have a BDC code  it is not working properly

    this BDC code is not working properly , when ever the file is transfering BDC is aborting in the case of   invalid material/batch comes into teh picture... so please could you ''Check for invalid material/batch combinations so they are not processed by the BDC in the program and correctly output in an exception report''
    *****************************CODE HERE*****************************
    S E L E C T I O N S C R E E N
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_file LIKE rlgrap-filename,
    p_arch LIKE rlgrap-filename. "RM080107
    SELECTION-SCREEN SKIP.
    PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N'.
    SELECTION-SCREEN END OF BLOCK b1.
    I N C L U D E S
    INCLUDE zwm_np_stock_recon_top.
    INCLUDE zwm_np_stock_recon_f01.
    I N I T I A L I Z A T I O N
    INITIALIZATION.
    PERFORM get_interface_filename USING c_interface_file p_file.
    PERFORM get_interface_filename USING c_archive_file p_arch."RM080107
    S T A R T O F S E L E C T I O N
    START-OF-SELECTION.
    PERFORM read_file USING p_file.
    PERFORM pre_processing.
    E N D O F S E L E C T I O N
    END-OF-SELECTION.
    PERFORM process_checks.
    IF w_no_change = 'X'.
    WRITE: / text-b03.
    WRITE: / sy-uline(34).
    ELSE.
    PERFORM bdc_mi09.
    PERFORM file_check_report.
    PERFORM bdc_report.
    ENDIF.
    PERFORM post_process_checks.
    *-- Move the processed file to archive directory
    PERFORM move_file.
    ...*************.........first include...................************
    INCLUDE ZWM_NP_STOCK_RECON_TOP *
    Data declaration ----------------------------------------------
    TYPES: st_rawdata(2000) TYPE c.
    TYPES: BEGIN OF st_stck_cnt,
    werks TYPE iseg-werks, "plant
    lgort TYPE iseg-lgort, "storage location
    matnr TYPE iseg-matnr, "material number
    charg TYPE iseg-charg, "batch
    vfdat TYPE mch1-vfdat, "Sell by date
    lwedt TYPE mch1-lwedt, "Manufacture date
    quarn(8) TYPE n, "qaunrantine quantity
    menge(8) TYPE n, "quantity on hand
    message(1), "Message Type (E/W/I)
    msg_txt TYPE t100-text, "Message Text
    zerostck(1), "Zero stock identifier "RM220307
    END OF st_stck_cnt.
    TYPES: BEGIN OF st_batch_errors,
    matnr TYPE iseg-matnr, "material number
    charg TYPE iseg-charg, "batch
    clabs TYPE mchb-clabs, "Stock Balance
    END OF st_batch_errors.
    DATA:
    t_rawdata TYPE TABLE OF st_rawdata,
    w_rawdata TYPE st_rawdata,
    t_stck_cnt TYPE TABLE OF st_stck_cnt,
    d_stck_cnt TYPE TABLE OF st_stck_cnt, "RM191006
    w_stck_cnt TYPE st_stck_cnt,
    t_batch_errors TYPE TABLE OF st_batch_errors,
    w_batch_errors TYPE st_batch_errors,
    t_messtab LIKE bdcmsgcoll OCCURS 0,
    w_messtab LIKE LINE OF t_messtab,
    w_no_change.
    CONSTANTS: c_interface_file(26) TYPE c VALUE 'ZNP_STOCK_RECON',
    c_archive_file(26) TYPE c
    VALUE 'ZNP_STOCK_RECON_ARCHIVE'. "RM080107
    .*************................second include..........************
    ***INCLUDE ZWM_NEXTPHARMA_STOKRECON_F01 .
    *& Form read_file
    reads NextPharma file sent through via webmethods
    -->P_FILENAME
    FORM read_file USING p_filename.
    CLEAR: t_rawdata,
    w_rawdata.
    REFRESH: t_rawdata.
    OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
    IF sy-subrc <> 0.
    MESSAGE e720(01).
    ENDIF.
    DO.
    READ DATASET p_filename INTO w_rawdata.
    IF sy-subrc <> 0.
    EXIT.
    ELSE.
    APPEND w_rawdata TO t_rawdata.
    ENDIF.
    ENDDO.
    CLOSE DATASET p_filename.
    ENDFORM. " read_file
    *& Form pre_processing
    Read file values into internal table
    FORM pre_processing.
    DATA: lw_matnr TYPE iseg-matnr.
    LOOP AT t_rawdata INTO w_rawdata.
    lw_matnr = w_rawdata+21(20). "RM031006
    lw_matnr = w_rawdata+22(18). "RM031006
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
    input = lw_matnr
    IMPORTING
    output = lw_matnr
    EXCEPTIONS
    length_error = 1
    OTHERS = 2.
    MOVE: lw_matnr TO w_stck_cnt-matnr.
    w_stck_cnt-werks = w_rawdata+14(4).
    w_stck_cnt-lgort = w_rawdata+18(4).
    w_stck_cnt-charg = w_rawdata+84(25).
    w_stck_cnt-vfdat = w_rawdata+109(8).
    w_stck_cnt-lwedt = w_rawdata+117(8).
    w_stck_cnt-quarn = w_rawdata+141(8).
    w_stck_cnt-menge = w_rawdata+125(8).
    APPEND w_stck_cnt TO t_stck_cnt.
    CLEAR w_stck_cnt.
    ENDLOOP.
    SORT t_stck_cnt BY werks
    lgort
    matnr
    charg.
    DELETE ADJACENT DUPLICATES FROM t_stck_cnt.
    ENDFORM. " pre_processing
    *& Form bdc_mi09
    Run file data via BDC TCODE: MI09
    FORM bdc_mi09.
    DATA: t_bdcdata TYPE TABLE OF bdcdata,
    w_bdcdata TYPE bdcdata,
    lw_datum(10) TYPE c,
    lw_count(2) TYPE n.
    WRITE sy-datum TO lw_datum DD/MM/YYYY.
    Front Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0700'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Enter
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '/00'.
    APPEND w_bdcdata TO t_bdcdata.
    Count Date
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'RM07I-ZLDAT'.
    w_bdcdata-fval = lw_datum.
    APPEND w_bdcdata TO t_bdcdata.
    Document Date
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'RM07I-BLDAT'.
    w_bdcdata-fval = lw_datum.
    APPEND w_bdcdata TO t_bdcdata.
    Plant
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'IKPF-WERKS'.
    w_bdcdata-fval = w_stck_cnt-werks.
    APPEND w_bdcdata TO t_bdcdata.
    Storage Location
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'IKPF-LGORT'.
    w_bdcdata-fval = w_stck_cnt-lgort.
    APPEND w_bdcdata TO t_bdcdata.
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    Do not submit items with Errors against them
    CHECK w_stck_cnt-message NE 'E' AND
    w_stck_cnt-zerostck NE 'X'.
    "RM220307
    lw_count = lw_count + 1.
    Input Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0731'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Page Down
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '=P+'.
    APPEND w_bdcdata TO t_bdcdata.
    Material
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-MATNR(01)'.
    w_bdcdata-fval = w_stck_cnt-matnr.
    APPEND w_bdcdata TO t_bdcdata.
    Batch
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-CHARG(01)'.
    w_bdcdata-fval = w_stck_cnt-charg.
    APPEND w_bdcdata TO t_bdcdata.
    IF w_stck_cnt-menge NE 0.
    Quantity
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-ERFMG(01)'.
    w_bdcdata-fval = w_stck_cnt-menge.
    APPEND w_bdcdata TO t_bdcdata.
    *-- Begin RM220307 - We need to create an item when the quantity is zero
    *-- in file and is non-zero in SAP
    ELSE.
    Zero Stock indicator
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-XNULL(01)'.
    w_bdcdata-fval = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    *-- End RM220307
    ENDIF.
    ENDLOOP.
    CHECK lw_count NE 0.
    After all line items have been input
    Final Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0731'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Save Document
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '=BU'.
    APPEND w_bdcdata TO t_bdcdata.
    CALL TRANSACTION 'MI09' USING t_bdcdata
    MODE p_mode
    MESSAGES INTO t_messtab.
    ENDFORM. " bdc_mi09
    *& Form bdc_report
    Write BDC Messages.
    FORM bdc_report.
    DATA: lw_text TYPE t100-text.
    SKIP.
    WRITE: / text-b01.
    WRITE: / sy-uline(21).
    SKIP.
    Write BDC Messages
    LOOP AT t_messtab INTO w_messtab WHERE msgspra = sy-langu.
    MESSAGE ID w_messtab-msgid TYPE w_messtab-msgtyp
    NUMBER w_messtab-msgnr
    WITH w_messtab-msgv1
    w_messtab-msgv2
    w_messtab-msgv3
    w_messtab-msgv4
    INTO lw_text.
    WRITE: / lw_text.
    ENDLOOP.
    ENDFORM. " bdc_report
    *& Form process_checks
    Perform process check before creating BDC Session
    FORM process_checks.
    DATA: lw_clabs LIKE mchb-clabs,
    lw_menge LIKE mchb-clabs,
    lw_matnr LIKE mara-matnr,
    lw_charg LIKE mch1-charg,
    lw_fail,
    lw_vfdat TYPE mch1-vfdat,
    lv_sell TYPE c, "RM191006
    lv_qty(8) TYPE c. "RM191006
    CLEAR: d_stck_cnt[], d_stck_cnt. "RM191006
    Check if any of the stock figures differ from current stock figures
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    lw_menge = w_stck_cnt-menge.
    SELECT SINGLE clabs INTO lw_clabs
    FROM mchb
    WHERE matnr = w_stck_cnt-matnr
    AND werks = w_stck_cnt-werks
    AND lgort = w_stck_cnt-lgort
    AND charg = w_stck_cnt-charg.
    IF sy-subrc = 0.
    IF lw_clabs NE lw_menge.
    lw_fail = 'X'.
    *-- Begin RM220307 - Do not create PI item if the stock is zero in the
    *-- file and is zero in SAP
    EXIT.
    ELSEIF lw_clabs = 0 AND lw_menge = 0.
    w_stck_cnt-zerostck = 'X'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    ENDIF.
    *-- End RM220307
    ELSE.
    lw_fail = 'X'.
    ERROR
    ENDIF.
    ENDLOOP.
    If no differences are found set NO CHANGE Flag
    IF lw_fail NE 'X'.
    w_no_change = 'X'.
    EXIT.
    ENDIF.
    Check for Errors in file data
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    CLEAR lv_sell. "RM191006
    SELECT SINGLE matnr INTO lw_matnr
    FROM mara
    WHERE matnr = w_stck_cnt-matnr.
    IF sy-subrc NE 0.
    Invalid Material (E)
    w_stck_cnt-message = 'E'.
    w_stck_cnt-msg_txt = 'Invalid Material'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    ENDIF.
    SELECT SINGLE charg vfdat
    INTO (lw_charg, lw_vfdat)
    FROM mch1 "KOB01 - changed from MCHA
    WHERE matnr = w_stck_cnt-matnr
    AND charg = w_stck_cnt-charg.
    AND werks = w_stck_cnt-werks.
    IF sy-subrc NE 0.
    Invalid Material Batch (E)
    w_stck_cnt-message = 'E'.
    CONCATENATE 'Invalid Material Batch for plant' w_stck_cnt-werks
    INTO w_stck_cnt-msg_txt SEPARATED BY space.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    ELSE.
    IF w_stck_cnt-vfdat <> lw_vfdat.
    Sell by dates do not match (W)
    w_stck_cnt-message = 'W'.
    w_stck_cnt-msg_txt =
    'Sell by Date does not match Shelf life Expiry Date'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    lv_sell = 'X'. "RM191006
    CONTINUE. "RM191006
    ENDIF.
    ENDIF.
    IF w_stck_cnt-quarn > 0.
    Quarantine balance not Zero (W)
    w_stck_cnt-message = 'W'.
    *-- Begin RM191006
    *-- We do want all warning messages on the report
    lv_qty = w_stck_cnt-quarn.
    CONDENSE lv_qty NO-GAPS.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
    EXPORTING
    input = lv_qty
    IMPORTING
    output = lv_qty.
    w_stck_cnt-msg_txt = 'Quarantine balance is not zero'.
    CONCATENATE 'Quarantine balance is ' lv_qty '- not zero'
    INTO w_stck_cnt-msg_txt SEPARATED BY space.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    IF lv_sell = 'X'.
    APPEND w_stck_cnt TO d_stck_cnt.
    CLEAR lv_sell.
    ELSE.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    ENDIF.
    *-- End RM191006
    ENDIF.
    ENDLOOP.
    *-- Begin RM191006
    *-- Finally get all the records into dummy table to report
    APPEND LINES OF t_stck_cnt TO d_stck_cnt.
    SORT d_stck_cnt.
    DELETE ADJACENT DUPLICATES FROM d_stck_cnt.
    *-- End RM191006
    ENDFORM. " process_checks
    *& Form file_check_report
    Write warning and Error messages from File checks
    FORM file_check_report.
    WRITE: /2 'Material',
    22 'Batch',
    32 'Sell By',
    45 'Message Text'.
    WRITE: /2 sy-uline(115).
    SKIP.
    LOOP AT t_stck_cnt INTO w_stck_cnt. "RM191006
    LOOP AT d_stck_cnt INTO w_stck_cnt. "RM191006
    CHECK w_stck_cnt-message NE ' '.
    WRITE: /2 w_stck_cnt-matnr,
    22 w_stck_cnt-charg,
    32 w_stck_cnt-vfdat,
    43 w_stck_cnt-message,
    45 w_stck_cnt-msg_txt.
    ENDLOOP.
    ENDFORM. " file_check_report
    *& Form post_process_checks
    Check Material Batches in SAP against NP File
    FORM post_process_checks.
    RANGES: r_matnr FOR mchb-matnr,
    r_lgort FOR mchb-lgort,
    r_werks FOR mchb-werks.
    SORT t_stck_cnt.
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    AT END OF matnr.
    r_lgort-sign = 'I'.
    r_lgort-option = 'EQ'.
    r_lgort-low = w_stck_cnt-lgort.
    APPEND r_lgort.
    r_werks-sign = 'I'.
    r_werks-option = 'EQ'.
    r_werks-low = w_stck_cnt-werks.
    APPEND r_werks.
    r_matnr-sign = 'I'.
    r_matnr-option = 'EQ'.
    r_matnr-low = w_stck_cnt-matnr.
    APPEND r_matnr.
    ENDAT.
    ENDLOOP.
    Select all material batches for NP Materials
    SELECT matnr charg clabs
    INTO TABLE t_batch_errors
    FROM mchb
    WHERE werks IN r_werks
    AND lgort IN r_lgort.
    IF sy-subrc EQ 0.
    Check if the Material Batches are in the NP file
    LOOP AT t_batch_errors INTO w_batch_errors.
    Disregard Batches without positive unrestricted stock
    IF w_batch_errors-clabs LE 0.
    DELETE t_batch_errors.
    CONTINUE.
    ENDIF.
    READ TABLE t_stck_cnt INTO w_stck_cnt
    WITH KEY matnr = w_batch_errors-matnr
    charg = w_batch_errors-charg.
    IF sy-subrc = 0.
    DELETE t_batch_errors.
    ENDIF.
    ENDLOOP.
    ENDIF.
    CHECK NOT t_batch_errors[] IS INITIAL.
    Write Batch chak results to report
    SKIP.
    WRITE: / text-b02.
    WRITE: / sy-uline(74).
    WRITE: /2 'Material',
    22 'Batch'.
    WRITE: /2 sy-uline(32).
    SKIP.
    LOOP AT t_batch_errors INTO w_batch_errors.
    WRITE: /2 w_batch_errors-matnr,
    22 w_batch_errors-charg.
    ENDLOOP.
    ENDFORM. " post_process_checks
    G E T _ I N T E R F A C E _ F I L E N A M E
    FORM get_interface_filename USING filename lw_path.
    DATA: i_file TYPE filename-fileintern,
    out_filename LIKE v_path-pathextern.
    CLEAR: out_filename.
    i_file = filename.
    get the interface filename to be used when creating file
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    logical_filename = i_file
    IMPORTING
    file_name = out_filename
    EXCEPTIONS
    file_not_found = 1
    OTHERS = 2.
    IF sy-subrc = 0.
    MOVE out_filename TO lw_path.
    IF filename NE c_archive_file. "RM080107
    CONCATENATE lw_path 'NP_StockBalance.dat'
    INTO lw_path.
    *-- Begin RM080107 - Add timestamp to the archived file
    ELSE.
    CONCATENATE lw_path 'NP_StockBalance' sy-datum sy-uzeit '.dat'
    INTO lw_path.
    ENDIF.
    *-- End RM080107
    ELSE.
    ENDIF.
    ENDFORM. "get_interface_filename
    *& Form move_file RM080107
    Move the processed file to archive directory
    FORM move_file.
    *-- At last move the file to archive directory
    OPEN DATASET p_arch FOR OUTPUT IN TEXT MODE.
    IF sy-subrc = 0.
    LOOP AT t_rawdata INTO w_rawdata.
    TRANSFER w_rawdata TO p_arch.
    ENDLOOP.
    ENDIF.
    CLOSE DATASET p_arch.
    DELETE DATASET p_file.
    ENDFORM. " move_file

    Hi,
    S E L E C T I O N S C R E E N
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_file LIKE rlgrap-filename,
    p_arch LIKE rlgrap-filename. "RM080107
    SELECTION-SCREEN SKIP.
    PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N'.
    SELECTION-SCREEN END OF BLOCK b1.
    I N C L U D E S
    INCLUDE zwm_np_stock_recon_top.
    INCLUDE zwm_np_stock_recon_f01.
    I N I T I A L I Z A T I O N
    INITIALIZATION.
    PERFORM get_interface_filename USING c_interface_file p_file.
    PERFORM get_interface_filename USING c_archive_file p_arch."RM080107
    S T A R T O F S E L E C T I O N
    START-OF-SELECTION.
    PERFORM read_file USING p_file.
    PERFORM pre_processing.
    E N D O F S E L E C T I O N
    END-OF-SELECTION.
    PERFORM process_checks.
    IF w_no_change = 'X'.
    WRITE: / text-b03.
    WRITE: / sy-uline(34).
    ELSE.
    PERFORM bdc_mi09.
    PERFORM file_check_report.
    PERFORM bdc_report.
    ENDIF.
    PERFORM post_process_checks.
    *-- Move the processed file to archive directory
    PERFORM move_file.
    ...*************.........first include...................************
    INCLUDE ZWM_NP_STOCK_RECON_TOP *
    Data declaration ----------------------------------------------
    TYPES: st_rawdata(2000) TYPE c.
    TYPES: BEGIN OF st_stck_cnt,
    werks TYPE iseg-werks, "plant
    lgort TYPE iseg-lgort, "storage location
    matnr TYPE iseg-matnr, "material number
    charg TYPE iseg-charg, "batch
    vfdat TYPE mch1-vfdat, "Sell by date
    lwedt TYPE mch1-lwedt, "Manufacture date
    quarn(8) TYPE n, "qaunrantine quantity
    menge(8) TYPE n, "quantity on hand
    message(1), "Message Type (E/W/I)
    msg_txt TYPE t100-text, "Message Text
    zerostck(1), "Zero stock identifier "RM220307
    END OF st_stck_cnt.
    TYPES: BEGIN OF st_batch_errors,
    matnr TYPE iseg-matnr, "material number
    charg TYPE iseg-charg, "batch
    clabs TYPE mchb-clabs, "Stock Balance
    END OF st_batch_errors.
    DATA:
    t_rawdata TYPE TABLE OF st_rawdata,
    w_rawdata TYPE st_rawdata,
    t_stck_cnt TYPE TABLE OF st_stck_cnt,
    d_stck_cnt TYPE TABLE OF st_stck_cnt, "RM191006
    w_stck_cnt TYPE st_stck_cnt,
    t_batch_errors TYPE TABLE OF st_batch_errors,
    w_batch_errors TYPE st_batch_errors,
    t_messtab LIKE bdcmsgcoll OCCURS 0,
    w_messtab LIKE LINE OF t_messtab,
    w_no_change.
    CONSTANTS: c_interface_file(26) TYPE c VALUE 'ZNP_STOCK_RECON',
    c_archive_file(26) TYPE c
    VALUE 'ZNP_STOCK_RECON_ARCHIVE'. "RM080107
    .*************................second include..........************
    ***INCLUDE ZWM_NEXTPHARMA_STOKRECON_F01 .
    *& Form read_file
    reads NextPharma file sent through via webmethods
    -->P_FILENAME
    FORM read_file USING p_filename.
    CLEAR: t_rawdata,
    w_rawdata.
    REFRESH: t_rawdata.
    OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
    IF sy-subrc <> 0.
    MESSAGE e720(01).
    ENDIF.
    DO.
    READ DATASET p_filename INTO w_rawdata.
    IF sy-subrc <> 0.
    EXIT.
    ELSE.
    APPEND w_rawdata TO t_rawdata.
    ENDIF.
    ENDDO.
    CLOSE DATASET p_filename.
    ENDFORM. " read_file
    *& Form pre_processing
    Read file values into internal table
    FORM pre_processing.
    DATA: lw_matnr TYPE iseg-matnr.
    LOOP AT t_rawdata INTO w_rawdata.
    lw_matnr = w_rawdata+21(20). "RM031006
    lw_matnr = w_rawdata+22(18). "RM031006
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
    input = lw_matnr
    IMPORTING
    output = lw_matnr
    EXCEPTIONS
    length_error = 1
    OTHERS = 2.
    MOVE: lw_matnr TO w_stck_cnt-matnr.
    w_stck_cnt-werks = w_rawdata+14(4).
    w_stck_cnt-lgort = w_rawdata+18(4).
    w_stck_cnt-charg = w_rawdata+84(25).
    w_stck_cnt-vfdat = w_rawdata+109(8).
    w_stck_cnt-lwedt = w_rawdata+117(8).
    w_stck_cnt-quarn = w_rawdata+141(8).
    w_stck_cnt-menge = w_rawdata+125(8).
    APPEND w_stck_cnt TO t_stck_cnt.
    CLEAR w_stck_cnt.
    ENDLOOP.
    SORT t_stck_cnt BY werks
    lgort
    matnr
    charg.
    DELETE ADJACENT DUPLICATES FROM t_stck_cnt.
    ENDFORM. " pre_processing
    *& Form bdc_mi09
    Run file data via BDC TCODE: MI09
    FORM bdc_mi09.
    DATA: t_bdcdata TYPE TABLE OF bdcdata,
    w_bdcdata TYPE bdcdata,
    lw_datum(10) TYPE c,
    lw_count(2) TYPE n.
    WRITE sy-datum TO lw_datum DD/MM/YYYY.
    <b>select single MATNR
                       WERKS
                       CHARG
               from MCHA
               into (l_matnr, l_werks, l_charg)
               where matnr = w_stck_cnt-matnr
                  and werks = w_stck_cnt-werks.
                  and charg =  w_stck_cnt-charg.
    if sy-subrc ne 0.
    continue.
    endif.</b>
    Front Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0700'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Enter
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '/00'.
    APPEND w_bdcdata TO t_bdcdata.
    Count Date
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'RM07I-ZLDAT'.
    w_bdcdata-fval = lw_datum.
    APPEND w_bdcdata TO t_bdcdata.
    Document Date
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'RM07I-BLDAT'.
    w_bdcdata-fval = lw_datum.
    APPEND w_bdcdata TO t_bdcdata.
    Plant
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'IKPF-WERKS'.
    w_bdcdata-fval = w_stck_cnt-werks.
    APPEND w_bdcdata TO t_bdcdata.
    Storage Location
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'IKPF-LGORT'.
    w_bdcdata-fval = w_stck_cnt-lgort.
    APPEND w_bdcdata TO t_bdcdata.
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    Do not submit items with Errors against them
    CHECK w_stck_cnt-message NE 'E' AND
    w_stck_cnt-zerostck NE 'X'.
    "RM220307
    lw_count = lw_count + 1.
    Input Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0731'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Page Down
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '=P+'.
    APPEND w_bdcdata TO t_bdcdata.
    Material
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-MATNR(01)'.
    w_bdcdata-fval = w_stck_cnt-matnr.
    APPEND w_bdcdata TO t_bdcdata.
    Batch
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-CHARG(01)'.
    w_bdcdata-fval = w_stck_cnt-charg.
    APPEND w_bdcdata TO t_bdcdata.
    IF w_stck_cnt-menge NE 0.
    Quantity
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-ERFMG(01)'.
    w_bdcdata-fval = w_stck_cnt-menge.
    APPEND w_bdcdata TO t_bdcdata.
    *-- Begin RM220307 - We need to create an item when the quantity is zero
    *-- in file and is non-zero in SAP
    ELSE.
    Zero Stock indicator
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-XNULL(01)'.
    w_bdcdata-fval = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    *-- End RM220307
    ENDIF.
    ENDLOOP.
    CHECK lw_count NE 0.
    After all line items have been input
    Final Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0731'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Save Document
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '=BU'.
    APPEND w_bdcdata TO t_bdcdata.
    CALL TRANSACTION 'MI09' USING t_bdcdata
    MODE p_mode
    MESSAGES INTO t_messtab.
    ENDFORM. " bdc_mi09
    *& Form bdc_report
    Write BDC Messages.
    FORM bdc_report.
    DATA: lw_text TYPE t100-text.
    SKIP.
    WRITE: / text-b01.
    WRITE: / sy-uline(21).
    SKIP.
    Write BDC Messages
    LOOP AT t_messtab INTO w_messtab WHERE msgspra = sy-langu.
    MESSAGE ID w_messtab-msgid TYPE w_messtab-msgtyp
    NUMBER w_messtab-msgnr
    WITH w_messtab-msgv1
    w_messtab-msgv2
    w_messtab-msgv3
    w_messtab-msgv4
    INTO lw_text.
    WRITE: / lw_text.
    ENDLOOP.
    ENDFORM. " bdc_report
    *& Form process_checks
    Perform process check before creating BDC Session
    FORM process_checks.
    DATA: lw_clabs LIKE mchb-clabs,
    lw_menge LIKE mchb-clabs,
    lw_matnr LIKE mara-matnr,
    lw_charg LIKE mch1-charg,
    lw_fail,
    lw_vfdat TYPE mch1-vfdat,
    lv_sell TYPE c, "RM191006
    lv_qty(8) TYPE c. "RM191006
    CLEAR: d_stck_cnt[], d_stck_cnt. "RM191006
    Check if any of the stock figures differ from current stock figures
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    lw_menge = w_stck_cnt-menge.
    SELECT SINGLE clabs INTO lw_clabs
    FROM mchb
    WHERE matnr = w_stck_cnt-matnr
    AND werks = w_stck_cnt-werks
    AND lgort = w_stck_cnt-lgort
    AND charg = w_stck_cnt-charg.
    IF sy-subrc = 0.
    IF lw_clabs NE lw_menge.
    lw_fail = 'X'.
    *-- Begin RM220307 - Do not create PI item if the stock is zero in the
    *-- file and is zero in SAP
    EXIT.
    ELSEIF lw_clabs = 0 AND lw_menge = 0.
    w_stck_cnt-zerostck = 'X'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    ENDIF.
    *-- End RM220307
    ELSE.
    lw_fail = 'X'.
    ERROR
    ENDIF.
    ENDLOOP.
    If no differences are found set NO CHANGE Flag
    IF lw_fail NE 'X'.
    w_no_change = 'X'.
    EXIT.
    ENDIF.
    Check for Errors in file data
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    CLEAR lv_sell. "RM191006
    SELECT SINGLE matnr INTO lw_matnr
    FROM mara
    WHERE matnr = w_stck_cnt-matnr.
    IF sy-subrc NE 0.
    Invalid Material (E)
    w_stck_cnt-message = 'E'.
    w_stck_cnt-msg_txt = 'Invalid Material'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    ENDIF.
    SELECT SINGLE charg vfdat
    INTO (lw_charg, lw_vfdat)
    FROM mch1 "KOB01 - changed from MCHA
    WHERE matnr = w_stck_cnt-matnr
    AND charg = w_stck_cnt-charg.
    AND werks = w_stck_cnt-werks.
    IF sy-subrc NE 0.
    Invalid Material Batch (E)
    w_stck_cnt-message = 'E'.
    CONCATENATE 'Invalid Material Batch for plant' w_stck_cnt-werks
    INTO w_stck_cnt-msg_txt SEPARATED BY space.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    ELSE.
    IF w_stck_cnt-vfdat <> lw_vfdat.
    Sell by dates do not match (W)
    w_stck_cnt-message = 'W'.
    w_stck_cnt-msg_txt =
    'Sell by Date does not match Shelf life Expiry Date'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    lv_sell = 'X'. "RM191006
    CONTINUE. "RM191006
    ENDIF.
    ENDIF.
    IF w_stck_cnt-quarn > 0.
    Quarantine balance not Zero (W)
    w_stck_cnt-message = 'W'.
    *-- Begin RM191006
    *-- We do want all warning messages on the report
    lv_qty = w_stck_cnt-quarn.
    CONDENSE lv_qty NO-GAPS.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
    EXPORTING
    input = lv_qty
    IMPORTING
    output = lv_qty.
    w_stck_cnt-msg_txt = 'Quarantine balance is not zero'.
    CONCATENATE 'Quarantine balance is ' lv_qty '- not zero'
    INTO w_stck_cnt-msg_txt SEPARATED BY space.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    IF lv_sell = 'X'.
    APPEND w_stck_cnt TO d_stck_cnt.
    CLEAR lv_sell.
    ELSE.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    ENDIF.
    *-- End RM191006
    ENDIF.
    ENDLOOP.
    *-- Begin RM191006
    *-- Finally get all the records into dummy table to report
    APPEND LINES OF t_stck_cnt TO d_stck_cnt.
    SORT d_stck_cnt.
    DELETE ADJACENT DUPLICATES FROM d_stck_cnt.
    *-- End RM191006
    ENDFORM. " process_checks
    *& Form file_check_report
    Write warning and Error messages from File checks
    FORM file_check_report.
    WRITE: /2 'Material',
    22 'Batch',
    32 'Sell By',
    45 'Message Text'.
    WRITE: /2 sy-uline(115).
    SKIP.
    LOOP AT t_stck_cnt INTO w_stck_cnt. "RM191006
    LOOP AT d_stck_cnt INTO w_stck_cnt. "RM191006
    CHECK w_stck_cnt-message NE ' '.
    WRITE: /2 w_stck_cnt-matnr,
    22 w_stck_cnt-charg,
    32 w_stck_cnt-vfdat,
    43 w_stck_cnt-message,
    45 w_stck_cnt-msg_txt.
    ENDLOOP.
    ENDFORM. " file_check_report
    *& Form post_process_checks
    Check Material Batches in SAP against NP File
    FORM post_process_checks.
    RANGES: r_matnr FOR mchb-matnr,
    r_lgort FOR mchb-lgort,
    r_werks FOR mchb-werks.
    SORT t_stck_cnt.
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    AT END OF matnr.
    r_lgort-sign = 'I'.
    r_lgort-option = 'EQ'.
    r_lgort-low = w_stck_cnt-lgort.
    APPEND r_lgort.
    r_werks-sign = 'I'.
    r_werks-option = 'EQ'.
    r_werks-low = w_stck_cnt-werks.
    APPEND r_werks.
    r_matnr-sign = 'I'.
    r_matnr-option = 'EQ'.
    r_matnr-low = w_stck_cnt-matnr.
    APPEND r_matnr.
    ENDAT.
    ENDLOOP.
    Select all material batches for NP Materials
    SELECT matnr charg clabs
    INTO TABLE t_batch_errors
    FROM mchb
    WHERE werks IN r_werks
    AND lgort IN r_lgort.
    IF sy-subrc EQ 0.
    Check if the Material Batches are in the NP file
    LOOP AT t_batch_errors INTO w_batch_errors.
    Disregard Batches without positive unrestricted stock
    IF w_batch_errors-clabs LE 0.
    DELETE t_batch_errors.
    CONTINUE.
    ENDIF.
    READ TABLE t_stck_cnt INTO w_stck_cnt
    WITH KEY matnr = w_batch_errors-matnr
    charg = w_batch_errors-charg.
    IF sy-subrc = 0.
    DELETE t_batch_errors.
    ENDIF.
    ENDLOOP.
    ENDIF.
    CHECK NOT t_batch_errors[] IS INITIAL.
    Write Batch chak results to report
    SKIP.
    WRITE: / text-b02.
    WRITE: / sy-uline(74).
    WRITE: /2 'Material',
    22 'Batch'.
    WRITE: /2 sy-uline(32).
    SKIP.
    LOOP AT t_batch_errors INTO w_batch_errors.
    WRITE: /2 w_batch_errors-matnr,
    22 w_batch_errors-charg.
    ENDLOOP.
    ENDFORM. " post_process_checks
    G E T _ I N T E R F A C E _ F I L E N A M E
    FORM get_interface_filename USING filename lw_path.
    DATA: i_file TYPE filename-fileintern,
    out_filename LIKE v_path-pathextern.
    CLEAR: out_filename.
    i_file = filename.
    get the interface filename to be used when creating file
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    logical_filename = i_file
    IMPORTING
    file_name = out_filename
    EXCEPTIONS
    file_not_found = 1
    OTHERS = 2.
    IF sy-subrc = 0.
    MOVE out_filename TO lw_path.
    IF filename NE c_archive_file. "RM080107
    CONCATENATE lw_path 'NP_StockBalance.dat'
    INTO lw_path.
    *-- Begin RM080107 - Add timestamp to the archived file
    ELSE.
    CONCATENATE lw_path 'NP_StockBalance' sy-datum sy-uzeit '.dat'
    INTO lw_path.
    ENDIF.
    *-- End RM080107
    ELSE.
    ENDIF.
    ENDFORM. "get_interface_filename
    *& Form move_file RM080107
    Move the processed file to archive directory
    FORM move_file.
    *-- At last move the file to archive directory
    OPEN DATASET p_arch FOR OUTPUT IN TEXT MODE.
    IF sy-subrc = 0.
    LOOP AT t_rawdata INTO w_rawdata.
    TRANSFER w_rawdata TO p_arch.
    ENDLOOP.
    ENDIF.
    CLOSE DATASET p_arch.
    DELETE DATASET p_file.
    ENDFORM. " move_file
    Best regards,
    Prashant

Maybe you are looking for

  • How can I open ports on my AirPort Extreme, from WINDOWS?

    I have an Airport Extreme as my router, and I have a Windows-based computer. I need to open ports on the router (ironically, it is for my Apple TV). However, even though I can use the Airport Utility for Windows (latest version 5.5.3), I cannot open

  • Billing document not relevant at delivery header level

    Hi, In one of regular scenario i got the Billing document not relevant at delivery header level in processing tab. can plz advice me that what's the cause for this ? I am using item category tan at both sales order and delivery level. Thanks Bhushan

  • Speakable items help

    this is completely pointless but i think it would be cool. I like to use the speech tools to just talk to my mac and have it open things for me. It would be cool if after doing something I could say "Thank you" and my mac would say "You're welcome".

  • Apex 3.2 installation in Oracle 11g

    I had installed oracle 11g on my PC. I replaced the apex directory with the apex3.2 directory. Followed all steps mentioned in Apex 3.2 installation guide, but got error while executing the apex_epg_config.sql sript, due to which i am not able to log

  • Wierd behavior of LikeFilter

    It seem LikeFilter has wierd behavior, or am I used it incorrectly? I test used 2 objects in cache and with key name "TEST_1" and "TEST12" ValueExtractor extractor = new KeyExtractor(IdentityExtractor.INSTANCE); Filter filter = new LikeFilter(extract