BAPI_GOODSMVT_CREATE or BDC for MB1A not creating Accounting Doc

It is a strange scenario.  We can manually process a Goods Issue (without reference to a PO# - WBS Element used instead) via MB1A and have an Accounting Doc generated without a problem - movememt 415Q.  But for some reason, we can only create the Material Doc for Goods Issue when using BAPI_GOODSMVT_CREATE or BDC for MB1A (foreground or background).
Does anyone have any idea why in the world this would be happening?  Especially if we're using the exact same data used to manually create the Goods Issue via MB1A?

Thanks for the response.  Yes, I did try BAPI_TRANSACTION_COMMIT in all of my tests.  The Accounting Document simply will not get generated.
Again, what makes it strange is that we created a BDC for MB1A - based on data that worked & that produced an Accounting document.  However, when processing that BDC, either in the foreground or background - the Accounting document likewise does not get created.

Similar Messages

  • Cancel billing doc (S1) is not creating Accounting document

    Hi,
    I have cancelled F2 billing document with cancel billing type S1. But for that cancel billign doc S1 is still in open status only and it is not creating accounting document..
    I tried to release to accounting but it is showing error like " Document type is not defined"..
    Please any guess on this..
    regards
    sankar

    Hi sankar
    I am sure you might be aware of this but just to reiterate
    When you cancel documents in Logistics Invoice Verification, the document line items are not automatically cleared in Financial Accounting. We recommend that you periodically clear such items (using daily background jobs, for example).
    Kalpesh

  • Good Issue Using BAPI WS_DELIVERY_UPDATE  but didn't create accounting doc

    Hi Gurus,
    i have some problem using BAPI WS_DELIVERY_UPDATE.
    in our company. once finance unblock delivery block at sales order then that sales order should be automatic DO/GI.
    to accomodate this request i use BAPI BAPI_OUTB_DELIVERY_CREATE_SLS to create DO and BAPI WS_DELIVERY_UPDATE to create GI from DO in one function module. this method was succesfull. +but the problem is when i am only execute  BAPI WSDELIVERY_UPDATE to create GI (GI creation failed because : stock deficit,material already lock by another process). the GI document did not create accounting document.+
    can any one help me.
    thanks in advance
    Best Regard,
    Akbar.

    Dear Mr Akbar,
    Could we kindly verify for a possible update termination?
    The terminated transaction may be re-executed to complete the transaction!!
    Regards,
    K Gopidas.

  • How do MIRO and MR8M create Accounting doc?

    Hi guys,
    How MIRO and MR8M create accounting document?
    Does it use any FM or BAPI to create accounting doc? If yes, what FM or BAPI?
    Thanks a lot!
    Rgds,
    Mark

    Hi Mark,
    Try MRM_INVOICE_CREATE or MRM_INVOICE_POST
    Edited by: Joyreen Maceda on Feb 18, 2009 3:59 AM

  • Need help on BDC  for MB1A transaction.

    Hello Abapers,
    I need to create a BDC for t-code MB1A to do the Goods Issue with reference to reservation.
    I am not able to use the BAPI 'BAPI_GOODSMVT_CREATE' to do the goods issue as there are some additional functionalities (Stock Determination) to be included.
    The problem I am facing is, The stock determination will determine the Quantity, Storage Location and Valuation type for every item of the reservation. The quantity will be picked up from multiple storage locations and as a result the line item of reservation will be split into two or more for Goods Issue.
    When this happens, If the reservation is having multiple line items, tracking the next item becomes a problem.
    Please suggest a way to approach this problem.
    Usefull answers will be rewarded.
    Thanks in Advance,
    Vinutha.

    Hi
    The COMMIT before and after CALL TRANSACTION is useless, The transaction FB01 calls the commit by itself, so u need only:
    CALL TRANSACTION 'FB01' USING BDC_TAB
                                                   MODE 'N'
                                                   UPDATE 'S'
                                                   MESSAGE ITAB.
    Now ITAB is like structure BDCMSGCOLL, so after CALL Transaction u can use message statament in order to show a popup with message:
    CALL TRANSACTION 'FB01' USING BDC_TAB
                                                   MODE 'N'
                                                   UPDATE 'S'
                                                   MESSAGE ITAB.
    LOOP AT ITAB.
    MESSAGE ID ITAB-MSGID TYPE 'I' NUMBER ITAB-MSGNR
             WITH ITAB-MSGV1 ITAB-MSGV2 ITAB-MSGV3 ITAB-MSGV4.
    ENDLOOP.
    Max

  • Table control bdc for mb1a

    Hi All,
    Can anyone tell me is table control BDC possible for MB1A tcode
    Thanks in advance.

    well there may be 2 cases,
    1. if ur batch manahement is active and the batch is determined internally,in that case it is not possible.
    2.However if ur batch management is not active,then a bdc can be written.
    But i would suggest u use an LSMW and record using the BAPI method,SAP provides good standard BAPI's.

  • AD provisioning is not creating accounts

    Hi All,
    I am trying to provisiong AD resource using a simple Role.
    When I assign the Role directly to user in admin UI its working fine.
    The steps I have taken:
    1. get view
    2. assing the role
    3. reprovision call
    But in the workflow, its not, any clue why? Here is the provisioning code
    Any help is truely appreciated.
    --sFred
    <Action name='provisionUser view' application='com.waveset.session.WorkflowServices'>
    <Argument name='op' value='getView'/>
    <Argument name='type' value='User'/>
    <Argument name='id' value='$(provisionUserView.waveset.accountId)'/>
                             <Argument name="authorized" value="true"/>
    <Argument name='TargetResources'>
    <List>
    <String>Lighthouse</String>
    </List>
    </Argument>
                             <Argument name="Form" value="Empty User Form"/>
    <Return from='view' to='provisionUser'/>
    </Action>
    <Action>
    <expression>
    <block trace='true'>
    <dolist name='tRole'>
         <ref>targetRoles</ref>
                                            <append name='provisionUser.waveset.roles'>
                                                 <ref>tRole</ref>
                                            </append>
                                       </dolist>
                                       <set name='provisionUser.resourceAccounts.selectAll'>
                                            <s>true</s>
                                       </set>
    <dolist name='attr'>
    <ref>resourceList</ref>
                                            <set>
                                                 <expand><s>provisionUser.create.accounts[$(attr)].selected</s></expand>
                                                 <s>true</s>
                                            </set>
                                            <append>
                                                 <ref>provisionUser.waveset.resources</ref>
                                                 <ref>attr</ref>
                                            </append>
    </dolist>
    </block>
    </expression>
    </Action>
    <Action application='com.waveset.session.WorkflowServices'>
    <Argument name='op' value='refreshView'/>
    <Argument name='view' value='$(provisionUser)'/>
    <Return from='view' to='provisionUser'/>
    </Action>
                        <Action name='set map options'>
    <expression>
         <block trace='true'>
              <set name='provisionOptions'><new class='com.waveset.provision.ProvisioningOptions'/></set>
              <invoke name='setNoCreate'>
                   <ref>provisionOptions</ref>
                   <Boolean>false</Boolean>
              </invoke>
              <invoke name='setNoUpdate'>
                   <ref>provisionOptions</ref>
                   <Boolean>false</Boolean>
              </invoke>
              <invoke name='setNoDelete'>
                   <ref>provisionOptions</ref>
                   <Boolean>true</Boolean>
              </invoke>
         </block>
    </expression>
                        </Action>                    
                        <Action application='com.waveset.provision.WorkflowServices'>
                             <Argument name='op' value='reProvision'/>
                             <Argument name='user' value='$(provisionUser)'/>
                             <Argument name='accountId' value='$(provisionUser.waveset.accountId)'/>
                             <Argument name='options' value='$(provisionOptions)'/>
                             <Argument name='subject' value='Configurator'/>
                             <Argument name='retryEnable' value='true'/>
                             <Return from='WF_ACTION_ERROR' to='actionError'/>
                        </Action>

    As per Oracle the calender user synchronisation is only possible if we are integrationg ad users to cn=Users,dc=mil,dc=bh(for me) and is working fine.
    I had raised a tar and they called me and informed

  • Com.bea.xml.XmlException error for "could not create child element"

    In Workshop 9.2, after I created a project with XMLBeans Builder Builder against the xsd's and created a web service control against a wsdl, I inserted the control in a client project for consumption. However, when calling into a method of the control, I got a com.bea.xml.XmlException, saying "could not create child element" for an object parameter passed in the call to the method. The relevant info in the server console looks like this:
    Caused by: com.bea.xml.XmlException: could not create child element 'wirelessPhoneNumber' for Wrapped XMLBean operation on '<?xml version="1.0" encoding="UTF-8
    "?><m:sendSMSMessage xmlns:m="http://service.xyz.com/provider/mobile/abc/sendSMSMessage/200701/"><ns:behaviorVersion xmlns:ns="http://service.xyz.com/entity/message/2003/">0</ns:behaviorVersion><ns:custNbr xmlns:ns="http
    ://service.xyz.com/entity/party/2003/">Hello</ns:custNbr></m:sendSMSMessage>'
    Does any have an idea what this is trying to tell me?
    Thanks in advance for any help,
    Jason

    Looking into it further, I think it's the parameter wirelessPhoneNumber, which is a complex type from xsd and a java object passed to the call sendSMSMessage, that is having a namespace problem, or other problem.
    This parameter object was from XMLBeans java binding. I created and set it up like this before passing it to the call:
    PhoneNumberType phoneNumberType = phoneNumberType.Factory.newInstance();
    phoneNumberType.setFormat(PhoneNumberFormatEnum.FREEFORM);
    phoneNumberType.setFullNumber(phoneNumber);
    Obviously, com.bea.xbeanmarshal.buildtime.internal.util.XmlBeanUtil.createWrappedXBeanTopElement of XmlBeanUtil.java had a problem creating a wrapper element for it.
    Any clue from anyone?
    Jason

  • Unable to create accounting doc from invoice

    HI all,
       In creating an accounting doc from an invoice via VF02, i  got an error message:
    Cost Center SGCA/33150 does not exist on 7/7/2010.
    First of all, we don;t have a cost center 3150. 
    Can anyone suggest why I cannot create an accounting doc ?
    Why the message on cost center ?
    thanks
    Joyce

    Hello Joyce
    Identify  the GL accounts that are likely to be posted ( if the posting were to go through). Typically you will have GL accounts for Trade Sales, Tax payable etc. here.
    While displaying them using T code FSS0, click on the' Edit Cost element' tab and go into 'Display Cost Element: Basic screen". Now click on the tab, 'Default Account Assignment' tab and see if  the cost center tab has been filled with '33150. If so, remove it. after checking with your FI colleague. Repeat this for all the accounts (likely) to be posted. I am guessing that is the reason.
    Let me know how it goes.

  • BDC for ME21 Po create

    Hi ALL,
    Iam Creating BDC Program bu using ME21 for Uploading PO.
    Iam getting error at Income term2 in the Second Screen of ME21. Iam Passing this value through Excel Sheet But event then it is not picking. When i check in debugging the value of income term2 is populating.
    Let me know what are the mandotory fields for creating PO using Me21.
    Here iam also attaching the code, Please help us because it is very urgent.
    report ZPOUPLOADME21
    no standard page heading line-size 255.
    *include bdcrecx1.
    INCLUDE YMM_BDCRECX1.
    •     Internal Table T_BDCDATA to store BDC data
    •     Batchinputdata of single transaction
    DATA: T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    •     Internal Table T_BDC_MSG to store BDC messages
    DATA: T_BDC_MSG LIKE STANDARD TABLE OF BDCMSGCOLL INITIAL
    SIZE 0 WITH HEADER LINE.
    DATA: V_FILE LIKE RLGRAP-FILENAME ,
    V_COUNT(5) TYPE C,
    V_MESSAGE_CNT(5) TYPE C .
    DATA : BEGIN OF IT_DATA OCCURS 0,
    LIFNR LIKE EKKO-LIFNR, " Vendor
    BSART LIKE RM06E-BSART, " Order Type
    BEDAT(10) TYPE C, " Date
    EKORG LIKE EKKO-EKORG, " Purchasing Organization
    EKGRP LIKE EKKO-EKGRP, " Purchasing Group
    WERKS LIKE RM06E-WERKS, " Plant
    INCO2 LIKE EKKO-INCO2, " Inco Terms
    KNTTP LIKE EKPO-KNTTP, " A/C Assignment Category
    EMATN LIKE EKPO-EMATN, " Material Number
    MENGE LIKE EKPO-MENGE, " Purchase Order Quantity
    NETPR LIKE EKPO-NETPR, " Net Price
    MWSKZ LIKE EKPO-MWSKZ, " Tax Code
    NPLNR LIKE MSEG-NPLNR, " Network
    VORNR LIKE PSORDER-VORNR, " Operation
    END OF IT_DATA.
    START-OF-SELECTION.
    PERFORM OPEN_GROUP.
    PERFORM DATA_UPLOAD.
    PERFORM CALL_TRANSACTION.
    PERFORM CLOSE_GROUP.
    PERFORM WRITE_ERROR.
    *& Form DATA_UPLOAD
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM DATA_UPLOAD.
    *call function ws_upload to retrieve data from a flat file in the
    *presentation server into an internal table
    CALL FUNCTION 'UPLOAD'
    EXPORTING
    FILENAME = V_FILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = IT_DATA
    EXCEPTIONS
    CONVERSION_ERROR = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 6
    OTHERS = 7.
    •     if ws_upload fails then display appropriate message
    IF SY-SUBRC 0.
    •     MESSAGE E000 WITH 'Data not Uploaded into internal table'.
    ENDIF.
    ENDFORM. " DATA_UPLOAD
    *& Form CALL_TRANSACTION
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM CALL_TRANSACTION.
    DATA : V_IVDAT(10) TYPE C,
    V_AKTIV(10) TYPE C,
    V_MESSAGE(404) TYPE C.
    REFRESH T_BDCDATA.
    CLEAR T_BDCDATA.
    V_COUNT = 0.
    V_MESSAGE_CNT = 0.
    LOOP AT IT_DATA .
    V_COUNT = V_COUNT + 1.
    *perform open_group.
    perform bdc_dynpro using 'SAPMM06E' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06E-WERKS'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EKKO-LIFNR'
    IT_DATA-LIFNR.
    perform bdc_field using 'RM06E-BSART'
    IT_DATA-BSART.
    *perform bdc_field using 'RM06E-BEDAT'
    •     '24.01.2008'.
    perform bdc_field using 'RM06E-BEDAT'
    IT_DATA-BEDAT.
    perform bdc_field using 'EKKO-EKORG'
    IT_DATA-EKORG.
    perform bdc_field using 'EKKO-EKGRP'
    IT_DATA-EKGRP.
    *perform bdc_field using 'RM06E-LPEIN'
    •     'T'.
    perform bdc_field using 'RM06E-WERKS'
    IT_DATA-WERKS.
    perform bdc_dynpro using 'SAPMM06E' '0101'.
    perform bdc_field using 'BDC_CURSOR'
    'EKKO-INCO2'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKKO-EKGRP'
    •     IT_DATA-EKGRP1. "'SP3'.
    *perform bdc_field using 'EKKO-PINCR'
    •     IT_DATA-PINCR. "'10'.
    *perform bdc_field using 'EKKO-SPRAS'
    •     IT_DATA-SPRAS. "'EN'.
    *perform bdc_field using 'EKKO-UPINC'
    •     IT_DATA-UPINC. "'1'.
    *perform bdc_field using 'EKKO-ZTERM'
    •     IT_DATA-ZTERM.
    *perform bdc_field using 'EKKO-WAERS'
    •     IT_DATA-WAERS. "'INR'.
    *perform bdc_field using 'EKKO-ZBD1T'
    •     IT_DATA-ZBD1T. "'44'.
    *perform bdc_field using 'EKKO-WKURS'
    •     IT_DATA-WKURS. "' 1.00000'.
    *perform bdc_field using 'EKKO-INCO1'
    •     IT_DATA-INCO1.
    perform bdc_field using 'EKKO-INCO2'
    IT_DATA-INCO2.
    perform bdc_dynpro using 'SAPMM06E' '0120'.
    perform bdc_field using 'BDC_CURSOR'
    'EKPO-NETPR(01)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKPO-KNTTP(01)'
    •     'N'.
    perform bdc_field using 'EKPO-KNTTP(01)'
    IT_DATA-KNTTP.
    perform bdc_field using 'EKPO-EMATN(01)'
    IT_DATA-EMATN.
    perform bdc_field using 'EKPO-MENGE(01)'
    IT_DATA-MENGE.
    perform bdc_field using 'EKPO-NETPR(01)'
    IT_DATA-NETPR.
    perform bdc_dynpro using 'SAPMM06E' '0111'.
    perform bdc_field using 'BDC_CURSOR'
    'EKPO-MWSKZ'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKPO-KNTTP'
    •     'N'.
    *perform bdc_field using 'EKPO-TXZ01'
    •     'Clamps & Connector'.
    *perform bdc_field using 'EKPO-MENGE'
    •     '4'.
    *perform bdc_field using 'EKPO-SPINF'
    •     'A'.
    *perform bdc_field using 'EKPO-NETPR'
    •     '100.00'.
    *perform bdc_field using 'EKPO-PEINH'
    •     '1'.
    *perform bdc_field using 'EKPO-BPRME'
    •     'NO'.
    *perform bdc_field using 'EKPO-BPUMN'
    •     '1'.
    *perform bdc_field using 'EKPO-BPUMZ'
    •     '1'.
    *perform bdc_field using 'EKPO-PRSDR'
    •     'X'.
    *perform bdc_field using 'RM06E-EEIND'
    •     '24.01.2008'.
    *perform bdc_field using 'RM06E-LPEIN'
    •     'D'.
    *perform bdc_field using 'EKPO-WEPOS'
    •     'X'.
    perform bdc_field using 'EKPO-MWSKZ'
    IT_DATA-MWSKZ.
    *perform bdc_field using 'EKPO-REPOS'
    •     'X'.
    perform bdc_dynpro using 'SAPMM06E' '0511'.
    perform bdc_field using 'BDC_CURSOR'
    'EKKN-SAKTO'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTE'.
    *perform bdc_field using 'EKKN-SAKTO'
    •     '6034025'.
    *perform bdc_field using 'DKACB-FMORE'
    •     'X'.
    perform bdc_dynpro using 'SAPLKACB' '0002'.
    *perform bdc_field using 'BDC_CURSOR'
    •     'COBL-VORNR'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTE'.
    perform bdc_field using 'COBL-NPLNR'
    IT_DATA-NPLNR.
    perform bdc_field using 'COBL-VORNR'
    IT_DATA-VORNR.
    perform bdc_dynpro using 'SAPMM06E' '0111'.
    perform bdc_dynpro using 'SAPMM06E' '0120'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06E-EBELP'.
    perform bdc_field using 'BDC_OKCODE'
    '=BU'.
    *perform bdc_field using 'RM06E-EBELP'
    •     '10'.
    perform bdc_dynpro using 'SAPLSPO1' '0300'.
    perform bdc_field using 'BDC_OKCODE'
    '=YES'.
    perform bdc_transaction using 'ME21'.
    perform close_group.
    LOOP AT T_MESSTAB WHERE REC_NO IS INITIAL.
    AT FIRST.
    V_MESSAGE_CNT = V_MESSAGE_CNT + 1.
    T_MESSTAB-REC_NO = V_COUNT.
    ENDAT.
    MODIFY T_MESSTAB TRANSPORTING REC_NO.
    ENDLOOP.
    REFRESH T_BDCDATA.
    CLEAR T_BDCDATA.
    ENDLOOP.
    SKIP.
    WRITE : /10 'Record Number ', 30 'Error Message'.
    SKIP.
    endform.
    *& Form WRITE_ERROR
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM WRITE_ERROR.
    LOOP AT T_MESSTAB.
    WRITE : /10 T_MESSTAB-REC_NO , 30 T_MESSTAB-MESSAGE.
    ENDLOOP.
    ULINE /10(100).
    WRITE : /10 'No of Records : ' , V_COUNT.
    WRITE : /10 'No of Erroneous Records : ' , V_MESSAGE_CNT.
    ULINE /10(100).
    ENDFORM. " WRITE_ERROR
    *& Form CHECK_BDC
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM CHECK_BDC.
    DATA: L_CHECK LIKE YMMT_CHECK_BDC-YCHECK.
    SELECT SINGLE YCHECK INTO L_CHECK FROM YMMT_CHECK_BDC
    WHERE PROGRAMM EQ SY-REPID
    AND YCHECK EQ 'X'.
    IF SY-SUBRC NE 0.
    MESSAGE S000(YM) WITH 'Execution not possible'.
    STOP.
    ENDIF.
    ENDFORM. " CHECK_BDC
    <REMOVED BY MODERATOR>
    Thanks
    Rahul
    Edited by: Alvaro Tejada Galindo on Jan 24, 2008 9:38 AM

    it depends on your release whether you can use ME21N and/or the bapi.
    but why throw away what you have already achieved? ME21 still works also in later releases. to find out the mandatory fields in your system, check the customzing settings in tx. OLME -> Purchase Order -> Define Screen Layout at Document Level -> click on ME21 -> Terms of delivery and payment. Here are the incoterm-settings.
    Edited by: Mylene Euridice Dorias on Jan 24, 2008 5:19 PM

  • Invoice cancellation does not create accounting document.

    Hi. here's the scenario.
    A billing document has been creating in transaction VF01.When created, an accounting document and a controlling document have been generated(you can get the document numbers when you click on the 'Accounting' button in VF03 or through FB03).
    Problem:
    A cancellation has been carried out for the billing document (transaction VF11). However no accounting documents have been created for the cancellation.
    Any idea on the customising which was missing?thx.

    Hello,
    If you accounting period is block, you need to open the accounting period and transfer these documents manually from SD back to FI by using VFX3 transaction code. You need to release them manually to transfer the documents to FI. See the log if there are errors.
    It will give the reason when you run VFX3 the documents are not moved back to FI.
    Regards,
    Ravi
    Edited by: Ravi Sankar Venna on Apr 8, 2009 12:06 PM

  • BDC for FF67 not displaying the line itmes of second page

    Hi all,
    I am using the Z BDC report Manual Bank Statement Upload (FF67). The BDC is as mentioned below :
    We are using start variant in the BDC.
    The report is working fine but the issue is that suppose if their are 45 line items and on one page we can have only 30 line items . Then only 30 line items are been displayed . It is not taking the line items which have come on the second page. Please advsie . Below is the code of the BDC.
    REPORT  zfi_bank_recon.
    TABLES : febko.
    DATA: bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
    DATA : i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
           vgman TYPE febmka-vgman,
           valut TYPE char10, "febep-valut,
           kwbtr TYPE char17, "febmka-kwbtr,
           chect_kf TYPE febmkk-chect_kf,
           sgtxt_kf TYPE febmkk-sgtxt_kf,
           count(6) TYPE n,
           END OF itab.
    DATA : BEGIN OF error OCCURS 0,
           msg TYPE string,
          END OF error.
    DATA :flag,
          update VALUE 'A',
          mode VALUE 'N'.
    DATA : aznum1 TYPE aznum,
    lv_esbtr TYPE febko-esbtr,
    lv_esvoz TYPE febko-esvoz,
    lv_opening TYPE char17, "febmka-kwbtr,
    lv_closing TYPE char17. "febmka-kwbtr.
    *& Selection screen
    SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text.
    PARAMETERS :  bukrs LIKE febmka-bukrs OBLIGATORY,
                  hbkid LIKE febmka-hbkid OBLIGATORY,
                  hktid LIKE febmka-hktid OBLIGATORY,
                  azdat LIKE febmka-azdat OBLIGATORY,
                  aznum LIKE febmka-aznum OBLIGATORY,
                  budtm LIKE febmka-budtm OBLIGATORY  DEFAULT sy-datum.
    SELECTION-SCREEN :  END OF BLOCK blk.
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text1.
    PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN : END OF BLOCK blk1.
    AT SELECTION-SCREEN.
      SELECT SINGLE * FROM febko INTO febko
      WHERE bukrs = bukrs AND hbkid = hbkid AND
      hktid = hktid  AND aznum = aznum
           AND budtm = budtm
            AND azdat = azdat.
      IF sy-subrc EQ 0.
        MESSAGE e038(000) WITH 'Statement' aznum  'already uploaded; No further processing done'.
      ENDIF.
    At Selection Screen Event
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          file_name = p_file.
    *& Start of Selection
    START-OF-SELECTION.
      CLEAR : flag.
      PERFORM data_upload.
      PERFORM check_data.
      IF itab[] IS NOT INITIAL AND flag IS INITIAL..
        PERFORM open_group.
        REFRESH bdcdata.
        PERFORM bdcdata. " USING LV_OPENING LV_CLOSING.
      PERFORM bdc_insert.
        PERFORM close_group.
      ENDIF.
    *&      Form  check_data
    FORM check_data.
      LOOP AT itab.
        DATA : int(6) TYPE n.
        CLEAR : int.
        int = sy-tabix.
        IF itab-vgman  IS  INITIAL.
          CONCATENATE 'Transaction type should not be blank : Record no'  int INTO error-msg SEPARATED BY space.
          APPEND error.
          CLEAR : error.
        ENDIF.
        IF itab-valut IS INITIAL.
          CONCATENATE 'Value Date should not be blank : Record no'  int INTO error-msg SEPARATED BY space.
          APPEND error.
          CLEAR : error.
        ENDIF.
        IF itab-kwbtr IS INITIAL.
          CONCATENATE 'Amount should not be blank : Record no'  int INTO error-msg SEPARATED BY space.
          APPEND error.
          CLEAR : error.
        ENDIF.
        IF itab-chect_kf IS INITIAL.
          CONCATENATE 'Bank Reference should not be blank : Record no'  int INTO error-msg SEPARATED BY space.
          APPEND error.
          CLEAR : error.
        ENDIF.
         IF  itab-vgman  NE 'DLF1'
           AND itab-vgman  NE 'DLF2'.
          CONCATENATE 'A Transaction type is not used : Record no'  int INTO error-msg SEPARATED BY space.
          APPEND error.
          CLEAR : error.
        ENDIF.
         IF itab-vgman  EQ 'DLF1'
        AND itab-kwbtr LE 0.
          CONCATENATE 'As per Transaction type, the Amount should be Positive : Record no'  int INTO error-msg SEPARATED BY space.
          APPEND error.
          CLEAR : error.
        ENDIF.
         IF   itab-vgman  EQ 'DLF2'
        AND itab-kwbtr GE 0.
          CONCATENATE 'As per Transaction type, the Amount should be Negative : Record no'  int INTO error-msg SEPARATED BY space.
          APPEND error.
          CLEAR : error.
        ENDIF.
      ENDLOOP.
      IF error[] IS NOT INITIAL.
        WRITE : / 'Error found in upload file'.
        SKIP 2 .
        LOOP AT error.
          WRITE : / error-msg.
        ENDLOOP.
        flag = 'X'.
      ENDIF.
      CLEAR : lv_esbtr, lv_esvoz, aznum1, lv_opening, lv_closing.
      IF flag IS INITIAL.
        SELECT MAX(  DISTINCT  aznum )  FROM febko INTO aznum1
        WHERE bukrs = bukrs AND hbkid = hbkid  AND hktid = hktid.
        IF sy-subrc = 0.
          SELECT SINGLE esbtr esvoz  FROM febko INTO (lv_esbtr,lv_esvoz)
          WHERE bukrs = bukrs AND hbkid = hbkid  AND hktid = hktid AND aznum = aznum1 .
          IF lv_esvoz = 'S'.
            lv_opening = lv_esbtr * -1.
          ELSE.
            lv_opening = lv_esbtr.
          ENDIF.
          lv_closing = lv_opening.
        ENDIF.
        LOOP AT itab.
          lv_closing = lv_closing + itab-kwbtr.
          DATA : lv_count(6) TYPE n.
          lv_count = lv_count + 1.
          MOVE lv_count TO itab-count .
          MODIFY itab FROM itab.
          CLEAR : itab.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "check_data
    *&      Form  data_upload
    FORM data_upload.
      DATA: loc_filename TYPE string.
      loc_filename = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = loc_filename
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = itab
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    "data_upload
    *&      Form  bdcdata
    FORM bdcdata. " USING lv_opening TYPE febko-ssbtr
      "    lv_closing TYPE febko-esbtr.
      DATA : day(2),
             month(2),
             year(4),
             date(10).
      year = azdat+0(4).
      month = azdat+4(2).
      day = azdat+6(2).
      CONCATENATE day month year INTO date.
      CONDENSE : date.
    Comment
      PERFORM bdc_dynpro      USING 'SAPMF40K' '0101'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/EVORG'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'FEBMKA-AZDAT'.
      PERFORM bdc_dynpro      USING 'SAPMF40K' '0110'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'FEBMKA-VARI_START'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=ENTE'.
      PERFORM bdc_field       USING 'FEBMKA-KONT_INT'
                                    'X'.
      PERFORM bdc_field       USING 'FEBMKA-FDIS_SEL'
                                    'X'.
      PERFORM bdc_field       USING 'FEBMKA-VARI_START'
                                    'Z0001'.
      PERFORM bdc_field       USING 'FEBMKA-DEBI_MID'
                                    'D'.
      PERFORM bdc_field       USING 'FEBMKA-KRED_MID'
                                    'K'.
      PERFORM bdc_field       USING 'FEBMKA-WVAR_ART'
                                    '4'.
      PERFORM bdc_field       USING 'FEBMKA-BUCH_VAL'
                                    'X'.
      PERFORM bdc_dynpro      USING 'SAPMF40K' '0101'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'FEBMKA-ESALD'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM bdc_field       USING 'FEBMKA-BUKRS'
                                    bukrs.
      PERFORM bdc_field       USING 'FEBMKA-HBKID'
                                    hbkid.
      PERFORM bdc_field       USING 'FEBMKA-HKTID'
                                    hktid.
      PERFORM bdc_field       USING 'FEBMKA-AZNUM'
                                    aznum.
      PERFORM bdc_field       USING 'FEBMKA-AZDAT'
                                    date.
      PERFORM bdc_field       USING 'FEBMKA-SSALD'
                                    lv_opening.
      PERFORM bdc_field       USING 'FEBMKA-ESALD'
                                    lv_closing.
      PERFORM bdc_dynpro      USING 'SAPMF40K' '8000'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'FEBMKK-SGTXT_KF(01)'.
      SORT itab DESCENDING BY count.
      LOOP AT itab.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SICH'.
        PERFORM bdc_field       USING 'FEBMKA-VGMAN(01)'
                                      itab-vgman.
        PERFORM bdc_field       USING 'FEBEP-VALUT(01)'
                                      itab-valut.
        PERFORM bdc_field       USING 'FEBMKA-KWBTR(01)'
                                              itab-kwbtr.
        PERFORM bdc_field       USING 'FEBMKK-CHECT_KF(01)'
                                      itab-chect_kf.
        PERFORM bdc_field       USING 'FEBMKK-SGTXT_KF(01)'
                                      itab-sgtxt_kf.
        PERFORM bdc_dynpro      USING 'SAPMF40K' '8000'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'FEBMKK-SGTXT_KF(01)'.
      ENDLOOP.
      PERFORM bdc_dynpro      USING 'SAPMF40K' '8000'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'FEBMKA-KWBTR(01)'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=SICH'.
      PERFORM bdc_dynpro      USING 'SAPMF40K' '0101'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'FEBMKA-BUKRS'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=BACK'.
      PERFORM bdc_dynpro      USING 'SAPLSPO1' '0100'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=NO'.
    ENDFORM.                    "bdcdata
    *&      Form  OPEN_GROUP
    FORM open_group .
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          client = sy-mandt
          group  = 'BANK_STAT'
          user   = sy-uname.
         keep   = 'X'.
    ENDFORM.                    " OPEN_GROUP
    *&      Form  CLOSE_GROUP
    FORM close_group .
      CALL FUNCTION 'BDC_CLOSE_GROUP'.
      CALL TRANSACTION 'SM35'.
    ENDFORM.                    " CLOSE_GROUP
    *&      Form  bdc_insert
    FORM bdc_insert.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          tcode     = 'FF67'
        TABLES
          dynprotab = bdcdata.
    ENDFORM.                    " bdc_insert
           Start new screen                                              *
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "BDC_FIELD

    Hi,
    Use:
    If line item = 30.
    OKCODE = 'P++'. --->For next page after every 30 line items.
    endif.
    Or:(Sumilate in BDC)
    1 . New line.   -
    >Get the Fcode/Sy-ucomm value of New line(Icon on menu bar)
    2.Enter Line Item.
    Follow this after every line item.
    Hope this resolves the issue.
    Regards,
    Gurpreet

  • Posting Document not created account determi nation error is

    We have one issue pertaining to invoice could not able to post the Document.
    ISSUE :
    Wrong master dat is maintained due to which account determination is not happening and these invoice we have to post it to FI.
    We asked the user to maintain the materialmaster at sales view the acc.assignment group with correct value instead of blank.Since the account detemination key combination we have containes acc.assignment group as one of the field ,in all combination under account determination access sequence.
    After that user changed the data in material master but invoice could not able to post .
    i tried and maintained data in item detail of invoice with proper account assignment group manually for few items.since we are gettiing issue with few items .these itemas are having one special condition then when we release the the invoice posting is happening is there any way to do massively.
    We have checked few options:
    cancelling of invoice and recreate it which didnot worked.
    we checked the log in VFX3 transaction also the messag etype is VF051 .
    could any one suggest me the correct approach to this problem instead of identifying few items abnd correcting in vf02 .
    regards,
    kiran

    Hi,
    There is no G/L account for your order.
    First Goto VKOA T.Code.
    Select "Cust.Grp/MaterialGrp/AcctKey".Double click on this.
    Maintain the entry for "KOFI" and "KOFK".
    Check the account assignment group for customer also.
    It will be there in "Billing documents" tab.Under sales area data.
    Maintain the valid entries here in "VKOA".
    Next Goto VA03.
    Click on Environment>Analysis>Account determination.
    Check whether the G/L is present or not.
    Ensure that Cost centre and "WBS" or "IO" is also maintained.
    Regards,
    Krishna.

  • Select single for update not creating lock on entry

    Hi All,
    I want to update an entry from MARA table so what ii did is
    select single for update *   from mara where matnr = 'ZYS'.
    The for update is supposed to create a lock  for me and the the lock is released after the commit or roll back.
    I'm running this prg in debug mode and after the statment
    select single for update *   from mara where matnr = 'ZYS''.
    I opened MM02 for this material and could change the data which i'm not supposed to be as there is lock on this particular mater from single for update statemnt
    or
    I even tried from other program
    select single  *   from mara where matnr = 'ZYS'. in debug mode and it returned a sy-subrc eq 0.
    and i don't see a lock in SM12 FOR SELECT * FOR UPDATE.....
    Can anyone clarify on this
    Thanks
    David

    Hi All,
    I knew we can create a lock object but thought to give a shot without creating lock object.
    So i'm just curious to know when we can use select * for update
    F1 Help says select * for update creates an E type lock- which will prevent other locks(X AND S type locks) overwriting or even reading that entry
    Also ,
    can someone throw some light DB lock and SAP Lock ( is this same as SAP LUW and DB LUW)
    Thanks
    David

  • User Exit for transferring text from delivery -Item note to Accounting doc.

    Hi Experts ,
    I need an user exit where I can transfer the delivery item text (item note )  from outbound deliver to accounting document when the post goods issue (PGI ) is done .
    Please suggest.
    Thanks in advance
    Tanveer Khan

    I have got the function Exit EXIT_SAPMM07M_001. Which resolves the purpose...Thanks for your time..

Maybe you are looking for