BDC on FK01 is not working in NO-SCREEN Mode

Hi gurus ,
i have a situation,
  A custom interface (built as per requirement) is facing some issues with BDC when executing in "NO-SCREEN mode".
    There was a requirement to include email adress while creating permitted payee vendors for corresponding Original vendors iN  sap.
    Now it used to create them . But after i retrieved the email details for a vendor and passsed in the BDC based on some condition, it doesnot work in "NO-SCREEN Mode" . For ALL Screen Mode it is working as expected ; when OK-CODES are given it asks with a pop-up which mode of communication reqd.
if  email is selected then it assigns onto the new payee vendor being created. What's the problemwith NO-SCREN Mode?
could somebody plz guiide here.
Thanx
kylie

Hi Sandra ,
Thanks for your suggestion throiugh the link.
Had checked the trouble shooting for  BDC : but the scenario in which i experienc eth eproblem is little different.
Well the Interface to create vendors was working perfectly in ALL Screen as well as NO-SCREEN mode.
But a small requirement seem to change its execution.
The Interface had a commented code snippet : retrieve email address from ADR6 table. Now according to the new requirement this code snippet needs to be utilized. So i uncommented that and duly passed th etable entries into the concerned screen (the code for that screen aldready exsits in the recording but not utilized since the retrieval was commented)
Collects the email address for any vendor from ADr6 table
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
now for linking the above created vendor, FK02 BDC is maintained. In this BDC the payment transaction screen is used to link payee vendors (above created vendor)  at company code level for any principal vendors (selected from lfa1 and lfb1 table). So only two screens for linking .
this entire code was working perfect in both A mode and  N mode  but after including the ADR6 code snippet i dont find teh similar execution in N mode.
Could you please guide me where could i ahve made some mistake.
thanks
Kylie
Edited by: kylietisha on Jun 6, 2010 5:27 PM
Edited by: kylietisha on Jun 6, 2010 5:42 PM
Edited by: Rob Burbank on Jun 6, 2010 4:33 PM

Similar Messages

  • BDC not working in NO screen mode

    Hi All,
    We have a BDC in which we need to enter a multiple selection for a document field.
    For this we are using the table control concept.
    However, how do we fill in more than 8  single selections  (the number of input rows available on the screen)?
    We have tried to use the ok code "LINS" that inserts a line at a time. This is working perfectly in ALL screen mode.
    However, in NO screen mode what we observed is that the values get overwritten and only 1 document is eventually selected.
    Thanks & Regards,
    Sana.

    Hi,
    plz have a look at the below code...
    FORM bdc_data .
    Work area for data record.
      DATA : lwa_header1 TYPE t_header.
    Declaration of local variable.
      DATA : lv_index TYPE sytabix.
      IF NOT i_header[] IS INITIAL.
        v_item_cntr = 1.
        v_cond_cntr = 2.
        v_scale_cntr = 1.
        v_cong_flg = 2.
        LOOP AT i_header INTO wa_header.
          lv_index = sy-tabix + 1.
          CASE wa_header-rec_type.
            WHEN c_h.
    -- For header of contracts--
              PERFORM header_data_upload USING wa_header.
    --For items of contarcts--
            WHEN  c_i.
    If the number of lines in the line item screen exceeds
    14 then we need to use the newpage okcode for adding
    new line items
              IF v_item_cntr GE 15.
                PERFORM bdc_dynpro      USING 'SAPMM06E' '0220'.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                                      '=NP'.
                v_item_cntr = 2.
              ENDIF.
    For uploading the item data
              PERFORM item_data_upload USING wa_header.
    Read the internal table for next record
              READ TABLE i_header INTO lwa_header1 INDEX lv_index.
              IF lwa_header1-rec_type = c_h OR sy-subrc <> 0.
    if no more line items found then the data should be saved
                PERFORM bdc_dynpro      USING 'SAPMM06E' '0220'.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                                    'BU'.
    If there exists condition record for that line item
    then go to condition screen with OKCODE '=KO'
              ELSEIF lwa_header1-rec_type = c_c.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                         '=KO'.
              ENDIF.
    --for items conditions--
            WHEN c_c.
    Upload the condition data
              PERFORM conditions_data_upload USING wa_header.
    Read the internal table for next record
              READ TABLE i_header INTO lwa_header1 INDEX lv_index.
    If the next record is an item go back to item screen
              IF lwa_header1-rec_type = c_i.
                PERFORM bdc_dynpro      USING 'SAPMV13A' '0201'.
                PERFORM bdc_field  USING 'BDC_OKCODE'
                                         'BACK'.
    If the next record is header then save the data
              ELSEIF lwa_header1-rec_type = c_h OR sy-subrc <> 0.
                PERFORM bdc_dynpro      USING 'SAPMV13A' '0201'.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                        'BACK'.
                PERFORM bdc_dynpro      USING 'SAPMM06E' '0220'.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                                    'BU'.
    If there exists scale record for that condition
    then go to scale screen with OKCODE '=PSTF'
              ELSEIF lwa_header1-rec_type = c_s.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=PSTF'.
              ENDIF.
    --for items Scales--
            WHEN c_s.
    Upload the scales data
              PERFORM scales_data_upload USING wa_header.
    Read the internal table for next record
              READ TABLE i_header INTO lwa_header1 INDEX lv_index.
    If the next record is condition record then go to condition
    screen
              IF lwa_header1-rec_type = c_c .
                v_cong_flg = v_cong_flg + 1.
                v_scale_cntr = 1.
                PERFORM bdc_dynpro      USING 'SAPMV13A' '0303'.
                PERFORM bdc_field  USING 'BDC_OKCODE'
                                         'BACK'.
    If the next record is header the go back to item screen
    and save the data
              ELSEIF lwa_header1-rec_type = c_h OR sy-subrc <> 0.
                PERFORM bdc_dynpro      USING 'SAPMV13A' '0303'.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                        'BACK'.
                PERFORM bdc_dynpro      USING 'SAPMV13A' '0201'.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                        'BACK'.
                v_cond_cntr = 2.
                v_scale_cntr = 1.
                v_cong_flg = 2.
                PERFORM bdc_dynpro      USING 'SAPMM06E' '0220'.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                                    'BU'.
    If the next record is item the go back to item screen
              ELSEIF lwa_header1-rec_type = c_i.
                PERFORM bdc_dynpro      USING 'SAPMV13A' '0303'.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                        'BACK'.
                PERFORM bdc_dynpro      USING 'SAPMV13A' '0201'.
                PERFORM bdc_field       USING 'BDC_OKCODE'
                                        'BACK'.
                v_cond_cntr = 2.
                v_scale_cntr = 1.
                v_cong_flg = 2.
              ENDIF.
          ENDCASE.           "CASE wa_header-rec_type.
    If the next record is header or no next record found then
    call the transaction
          READ TABLE i_header INTO lwa_header1 INDEX lv_index.
          IF lwa_header1-rec_type = c_h OR sy-subrc NE 0.
            v_cong_flg = 2.
            v_scale_cntr = 1.
            v_item_cntr = 1.
            PERFORM call_transaction USING wa_header2 .
            CLEAR lv_index.
          ENDIF.
        ENDLOOP.               "LOOP AT i_header INTO wa_header.
      ENDIF.                   "IF NOT i_header[] IS INITIAL.
    ENDFORM.                   "bdc_data
           Start new screen                                              *
    FORM bdc_dynpro USING pv_program LIKE bdcdata-program
                          pv_dynpro LIKE bdcdata-dynpro.
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = pv_program.
      wa_bdcdata-dynpro   = pv_dynpro.
      wa_bdcdata-dynbegin = c_x.
      APPEND wa_bdcdata TO i_bdcdata.
      CLEAR wa_bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM bdc_field USING pv_fnam LIKE bdcdata-fnam
                         pv_fval TYPE any.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam = pv_fnam.
      wa_bdcdata-fval = pv_fval.
      APPEND wa_bdcdata TO i_bdcdata.
      CLEAR wa_bdcdata.
    ENDFORM.                    "BDC_FIELD
    Declaration of local constants
      CONSTANTS : lc_tcode  TYPE tstc-tcode VALUE 'ME31K',
                  lc_n      TYPE ctu_mode   VALUE 'N'.
    Declaration of local variables
      DATA: lv_msg   TYPE string,
            lv_opt   TYPE ctu_params.
      lv_opt-defsize = c_x.
      lv_opt-dismode = lc_n.
      lv_opt-updmode = c_l.
      REFRESH i_messtab.
    Call the transaction to create the Purchasing Contracts
      CALL TRANSACTION lc_tcode USING i_bdcdata
                       OPTIONS FROM lv_opt
                       MESSAGES INTO i_messtab.
      IF NOT i_messtab[] IS INITIAL.
        READ TABLE i_messtab WITH KEY msgtyp = 'E'.
        IF sy-subrc EQ 0.
          CALL FUNCTION 'FORMAT_MESSAGE'
            EXPORTING
              id   = i_messtab-msgid
              lang = sy-langu
              no   = i_messtab-msgnr
              v1   = i_messtab-msgv1
              v2   = i_messtab-msgv2
              v3   = i_messtab-msgv3
              v4   = i_messtab-msgv4
            IMPORTING
              msg  = lv_msg.
          MOVE: p_wa_header-lifnr TO wa_error-lifnr,
                p_wa_header-evart TO wa_error-evart,
                p_wa_header-vedat TO wa_error-vedat,
                p_wa_header-ekorg TO wa_error-ekorg,
                p_wa_header-ekgrp TO wa_error-ekgrp,
                p_wa_header-epstp TO wa_error-epstp,
                p_wa_header-knttp TO wa_error-knttp,
                p_wa_header-bukrs TO wa_error-bukrs,
                p_wa_header-kdatb TO wa_error-kdatb,
                p_wa_header-kdate TO wa_error-kdate,
                p_wa_header-ktwrt TO wa_error-ktwrt,
                p_wa_header-waers TO wa_error-waers,
                p_wa_header-wkurs TO wa_error-wkurs,
                p_wa_header-inco1 TO wa_error-inco1,
                p_wa_header-inco2 TO wa_error-inco2,
                p_wa_header-ihran TO wa_error-ihran,
                p_wa_header-angnr TO wa_error-angnr,
                lv_msg            TO wa_error-msg.
          APPEND wa_error TO i_error.
          CLEAR wa_error.
        ELSE.
          READ TABLE i_messtab WITH KEY msgtyp = 'S'.
          IF sy-subrc EQ 0.
            CALL FUNCTION 'FORMAT_MESSAGE'
              EXPORTING
                id   = i_messtab-msgid
                lang = sy-langu
                no   = i_messtab-msgnr
                v1   = i_messtab-msgv1
                v2   = i_messtab-msgv2
                v3   = i_messtab-msgv3
                v4   = i_messtab-msgv4
              IMPORTING
                msg  = lv_msg.
            MOVE: p_wa_header-lifnr TO wa_success-lifnr,
                  p_wa_header-evart TO wa_success-evart,
                  p_wa_header-vedat TO wa_success-vedat,
                  p_wa_header-ekorg TO wa_success-ekorg,
                  p_wa_header-ekgrp TO wa_success-ekgrp,
                  p_wa_header-epstp TO wa_success-epstp,
                  p_wa_header-knttp TO wa_success-knttp,
                  p_wa_header-bukrs TO wa_success-bukrs,
                  p_wa_header-kdatb TO wa_success-kdatb,
                  p_wa_header-kdate TO wa_success-kdate,
                  p_wa_header-ktwrt TO wa_success-ktwrt,
                  p_wa_header-waers TO wa_success-waers,
                  p_wa_header-wkurs TO wa_success-wkurs,
                  p_wa_header-inco1 TO wa_success-inco1,
                  p_wa_header-inco2 TO wa_success-inco2,
                  p_wa_header-ihran TO wa_success-ihran,
                  p_wa_header-angnr TO wa_success-angnr,
                  i_messtab-msgv2   TO wa_success-ebeln.
            APPEND wa_success TO i_success.
            CLEAR wa_success.
          ENDIF.
        ENDIF.
      ENDIF.
      REFRESH i_bdcdata.
    ENDFORM.                    " call_transaction
    Regards,
    Nagaraj

  • BDC for CT04/BAPI_CHARACT_CREATE not working

    Hi Guys
    I need to create some characteristics in the ECC6 system. I have tried BDC but that does not go to second screen at all and I have also tried BAPI_CHARACT_CREATE BAPI but nothing is working here.
    Please please tell me how can I create them in the system Please help me immediately.. I need to finsih them by monday.
    Sincerely,
    Avinash

    Hi ,
    Here is sample code to execute the BAPI.
    REPORT ZCHAR_CREATE .
    DATA : CHARACTDETAIL LIKE BAPICHARACTDETAIL,
           CHANGENUMBER  LIKE BAPICHARACTKEY-CHANGENUM,
           CHARACTDESCR  TYPE TABLE OF BAPICHARACTDESCR WITH HEADER LINE,
           CHARACTVALUESCHAR TYPE TABLE OF BAPICHARACTVALUESCHAR WITH HEADER
    LINE,
           CHARACTVALUESDESCR TYPE TABLE OF BAPICHARACTVALUESDESCR WITH
    HEADER LINE,
           RETURN TYPE TABLE OF BAPIRET2.
    CHARACTDETAIL-CHARACT_NAME = 'TEST_CHAR'.
    CHARACTDETAIL-DATA_TYPE    = 'CHAR'.
    CHARACTDETAIL-LENGTH       = 10.
    CHARACTDETAIL-STATUS       = 1.
    CHARACTDETAIL-VALUE_ASSIGNMENT = 'R'.
    CHARACTDETAIL-ENTRY_REQUIRED = 'X'.
    CHANGENUMBER = '500000000000'.
    CHARACTDESCR-LANGUAGE_INT   = 'EN'.
    CHARACTDESCR-LANGUAGE_ISO   = 'EN'.
    CHARACTDESCR-DESCRIPTION    = 'DECRIPTION'.
    APPEND CHARACTDESCR.
    CHARACTVALUESCHAR-VALUE_CHAR = 'VAL1'.
    APPEND CHARACTDESCR.
    CHARACTVALUESCHAR-VALUE_CHAR = 'VAL2'.
    APPEND CHARACTVALUESCHAR.
    CHARACTVALUESDESCR-LANGUAGE_INT  = 'EN'.
    CHARACTVALUESDESCR-LANGUAGE_ISO  = 'EN'.
    CHARACTVALUESDESCR-VALUE_CHAR    = 'VAL1'.
    CHARACTVALUESDESCR-DESCRIPTION   = 'VAL1 DESC'.
    APPEND CHARACTVALUESDESCR.
    CHARACTVALUESDESCR-LANGUAGE_INT  = 'EN'.
    CHARACTVALUESDESCR-LANGUAGE_ISO  = 'EN'.
    CHARACTVALUESDESCR-VALUE_CHAR    = 'VAL2'.
    CHARACTVALUESDESCR-DESCRIPTION   = 'VAL2 DESC'.
    APPEND CHARACTVALUESDESCR.
    CALL FUNCTION 'BAPI_CHARACT_CREATE'
      EXPORTING
        CHARACTDETAIL             = CHARACTDETAIL
        CHANGENUMBER              = CHANGENUMBER
      KEYDATE                   = SY-DATUM
      TABLES
        CHARACTDESCR              = CHARACTDESCR
      CHARACTVALUESNUM          =
        CHARACTVALUESCHAR         = CHARACTVALUESCHAR
      CHARACTVALUESCURR         =
        CHARACTVALUESDESCR        = CHARACTVALUESDESCR
      CHARACTREFERENCES         =
      CHARACTRESTRICTIONS       =
        RETURN                    = RETURN          .
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT          =
    IMPORTING
      RETURN        =
    Reward me if it is useful to you.
    All the Best.
    Uma.

  • BDC for KE51 is not working

    Hi all,
    BDC for KE51 is not working.I did recording with my Func Consultant and I created the program,all the data is coming correctly in th structure RECORD.But when Iam running the transaction,in foreground mode(Display all screens) the data is not getting entered into the fields of the screen,few got entred and few are blank.When I tried to reprocess the recording,then also data is not getting entered into the fields.Data is there in the recording.
    What might be the problem?

    Hello Techies,
    i m having the same problem but in my program i have to extract the data from SAP server and again have to upload in other table on SAP so please help me how would i extract the data and after that upload it using BDC.
    Thanks

  • Cannot log in to Nationwide internet banking in Firefox. I get the front page but Login says internet banking is not working. Next screen says it's ok and sends you back to the first screen, which says it isn't. Works throughInternet explorer

    Question
    Cannot log in to Nationwide internet banking. I get the front page but Login says internet banking is not working. Next screen says it's ok and sends you back to the first screen, which says it isn't. Works throughInternet explorer

    That issue can be caused by corrupted cookies.
    *https://support.mozilla.org/kb/Cannot+log+in+to+websites
    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"

  • To whom it may concern      Hi my name is Silvana Pires,I purchased an I Phone 4 S Model A 1387 EMC 2430 SCC.ID DCG E  2430 AIC.579 C-E 243 A in California one year ago,Unfortunately its Not working well the screen is getting black,and the phone is in goo

    To whom it may concern
    Hi my name is Silvana Pires,I purchased an I Phone 4 S Model A 1387 EMC 2430 SCC.ID DCG E
    2430 AIC.579 C-E 243 A in California one year ago,Unfortunately its Not working well the screen is getting black,and the phone is in good shape I can prove it,the Apple support in Brazil doenst work like in USA.
    I look forward to your reply and a resolution of this problem.
    Thank you very much!!!

    You are welcome. I'm glad you got it back up.
    (1) You say you did the symbolic link. I will assume this is set correctly; it's very important that it is.
    (2) I don't know what you mean by "Been feeding the [email protected] for several weeks now, 700 emails each day at least." After the initial training period, SpamAssassin doesn't learn from mail it has already processed correctly. At this point, you only need to teach SpamAssassin when it is wrong. [email protected] should only be getting spam that is being passed as clean. Likewise, [email protected] should only be getting legitimate mail that is being flagged as junk. You are redirecting mail to both [email protected] and [email protected] ... right? SpamAssassin needs both.
    (3) Next, as I said before, you need to implement those "Frontline spam defense for Mac OS X Server." Once you have that done and issue "postfix reload" you can look at your SMTP log in Server Admin and watch as Postfix blocks one piece of junk mail after another. It's kind of cool.
    (4) Add some SARE rules:
    Visit http://www.rulesemporium.com/rules.htm and download the following rules:
    70sareadult.cf
    70saregenlsubj0.cf
    70sareheader0.cf
    70sarehtml0.cf
    70sareobfu0.cf
    70sareoem.cf
    70sarespoof.cf
    70sarestocks.cf
    70sareunsub.cf
    72sare_redirectpost
    Visit http://www.rulesemporium.com/other-rules.htm and download the following rules:
    backhair.cf
    bogus-virus-warnings.cf
    chickenpox.cf
    weeds.cf
    Copy these rules to /etc/mail/spamassassin/
    Then stop and restart mail services.
    There are other things you can do, and you'll find differing opinions about such things. In general, I think implementing the "Frontline spam defense for Mac OS X Server" and adding the SARE rules will help a lot. Good luck!

  • HT4865 Have tried to verify my icloud account, but its not working the Verifying screen is just scrolling round, but not doing anything

    Have tried to verify my icloud account, but its not working, the Verifying screen has been scrolling for ages now, it seems stuck, but it wont let me do anything, please help

    " I ordered the Snow Leopard software and tried installing it, but it stopped and said to clean the disk."
    First off, your installation disc is in all likelihood faulty.
    This has been a known issue in the past:
    Faulty Snow Leopard install discs - Apple has no timeline on ...
    http://store.apple.com/us/help/returns_refund#policy:
    *You can return software, provided that it has not been installed on any computer. Software that contains a printed software license may not be returned if the seal or sticker on the software media packaging is broken.

  • In the middel of updateing my IPod the connectione stopd and since then the device is not working. only white screen no connectivity to win or to the Appstore

    In the middel of updateing my IPod the connectione stopd and since then the device is not working. only white screen no connectivity to win or to the Appstore

    Try:
    - iOS: Not responding or does not turn on
    - If not successful and you can't fully turn the iPod fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.

  • My imac is not working well, the screen is  flashing.I can´t open any program.there is a monsterflashing

    my imac is not working well, the screen is  flashing.I can´t open any program.there is a monsterflashing

    Hello,
    One way to test is to Safe Boot from the HD, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, Test for problem in Safe Mode...
    PS. Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive
    Reboot, test again.
    If it only does it in Regular Boot, then it could be some hardware problem like Video card, (Quartz is turned off in Safe Mode), or Airport, or some USB or Firewire device, or 3rd party add-on, Check System Preferences>Accounts>Login Items window to see if it or something relevant is listed.
    Check the System Preferences>Other Row, for 3rd party Pref Panes.
    Also look in these if they exist, some are invisible...
    /private/var/run/StartupItems
    /Library/StartupItems
    /System/Library/StartupItems
    /System/Library/LaunchDaemons
    /Library/LaunchDaemons

  • Safari will not open in full screen mode

    After installing the 3-1-14 update from the Apps Store, Safari will not open in full screen mode when I click the double arrow in the upper right corner of the screen. If I try the View>Enter Full Screen it still will not open full screen. Prior to this update, everything was fine. I know the info on the update says it deals with iTunes and iBooks, but after installing it my problems began.
    I am running the Mavericks (all updates installed) on an Mac mini (late 2013 edition), 16GB RAM.
    Any suggestions?

    Please disregard my question. The issue disappeared after a cold boot. Thanks.

  • 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

  • BDC for J1IEX is not working in production

    HI,
    i  captured bdc for transaction J1IEX. its working in development client but not in production client.
    it shows error message input fields not found. how could i resolve it.
    <<text removed>>
    Edited by: Matt on Jun 7, 2009 4:41 PM - "answer me quickly" text removed.

    In future, please do not post the subject in all capitals
    I've edited it for you this time.  Please take the time to read the Rules of Engagement.
    matt

  • BDC with call transaction VD02 works fin in A mode but not in N mode

    Hi All,
        I have BDC program developed in 4.6c using call transaction VD02 works fine with mode A but not with mode N.
    Now we upgraded to ECC 6.0.Do I need to change anything?

    No, you don't have to change anything for ECC. BTW, I wonder why VD02 is not working in the background for you?

  • BDC - not working in 'No Display' mode

    Hi Friends,
    I have written a BDC for TCode O3URV_SS0.I have used CALL TRANSACTION for that.For capturing messages I have used application log.
    In 'N' mode this BDC is not performing properly.For a new set of line item and  a header data it should save that  records and generate a document number.But in 'N' mode the BDC is working for 1st line item only.
    This BDC is working fine in 'A' mode.
    Please help me to solve this problem.

    Moderator message - Welcome to SCN
    But please search before asking - post locked
    Please read [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement], How to post code in SCN, and some things NOT to do... and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.
    Rob

  • BDC program on COGI not working in ECC-need help

    Hi,
    We are doing a SAP upgrade from 4.6c to ECC. One of the custom tcodes which were using BDC programming on COGI is now broken.Since , COGI is now changed in Ecc 6.0 with respect to the output which is now inALV and the earlier Date funtionaliy button is no more there in ECC6.0.
    We are still not to able to find relevant BAPI/function module/alternative for that matter.Rerecording COGI for new environment is not working since it involves alv call functions, which cannot be recorded in BDC.
    Please provide any inputs/valuable suggestions for same.

    Hello AlbertMarsh,
    I've tried, and wasn't able to locate your My Best Buy Member ID with the information you provided to the forums.  I'm going to need you to send me a private message by clicking the blue box at the end of my signature with your My Best Buy member ID. 
    I’m going to add more clarity to enuf's Trade-In post. The 10% bonus is on the total amount prior to the additional 30% promotion. So if you got $10 Trade-In credit and had 30% bonus ($13), you would get $1 additionally from original base value for Gamers Club Unlocked not $1.30.  I hope that makes sense.  
    Blake|Social Media Specialist | Best Buy® Corporate
     Private Message

Maybe you are looking for