Posting header data for MIGO thru badi

Hi,
I'm using badi  ' MB_MIGO_BADI ' for posting header data for the T-Code MIGO.
I have created an extra tab for supplier details for header data. The details from dis tab should be stored in a ztable.
I have written the code for the same in the METHOD  'POST DOCUMENT'  of the badi, but m unable to store the data in the ztable. niether is the code for display working.
kindly help.

Hi,
you need to create an attribute where you will store data from your additional screen. In example there is an attribute GS_EXDATA_HEADER with structure MBLNR, MJAHR, BADI_NUMMER. So obviously the point is to enter some number on additional header tab screen. You can see that in the method PAI_HEADER that all data from screen are transferred to this structure and in the method PBO_HEADER are data transferred from internal structure to the screen. So in this internal structure you store the current values of the fields from your additional header tab.  Now when you store material document you want to also store your additional data into database. Until this point you store it only in memory. Hence you prepare a new FM which will store this data to DB and you will call this FM in UPDATE TASK. Here is an example
  CALL FUNCTION 'MIGO_BADI_EXAMPLE_UPDATE_HEAD' IN UPDATE TASK
    EXPORTING
      is_migo_badi_header_fields = gs_exdata_header.
Once again to summarize it:
1) Define your own structure to keep additional data as an attribute of BADI implementation class
2) Pass data from memory to screen and back using methods PBO_HEADER and PAI_HEADER
3) Store additional data into DB using FM called in UPDATE TASK from method POST_DOCUMENT
Cheers

Similar Messages

  • It is necessary to create one header data for each file to be sent to CDFS.

    hi GUYS
    my sce anrio is FILE-XI-PROXY
    REQUIREMENT IS
    SOURCE FILE                      TARGET FILE WILL BE
    H1                                             H1                        H1                    H1
    I1                                               I1                         I2                      I3
    I2                                                F1                        F1                    F1
    I3                                           
    F1
    It is necessary to create one header data for each file to be sent to TARGET. Each file will be related to only one SAP Company Code.
    Thanks
    NAG

    aa

  • SAP VBA interfacing - error: FI/CO interface: Inconsistent FI/CO document header data for updating

    Hello,
    Currently I'm working with excel SAP interfacing. For this I am using VBA to call different BAPI functions.
    I have already some interface scripts working, however I have also one which I cannot discover what I'm missing.
    The VBA code is to reach BAPI_ACC_DOCUMENT_POST
    My error is ---> FI/CO interface: Inconsistent FI/CO document header data for updating
    So I'm appealing to you SAP bapi VBA gurus whether you have any ideas how to fix my issue.
    I'm attaching below my code for you to review:
    Option Explicit
    ' Declaration for the necessary objects
    Dim objBAPICortrol, objConnection, objCreateMaterial, objReturn As Object
    Dim objPRFCT, objNTXT, objDTXT As Object
    Dim vLastRow, vRows As Integer
    Dim objMaterial1, objMaterial2, retMess As Object
    Sub Batch()
    ' Getting the last filled Row in Column
    vLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    ' Setting the necessary variables for R/3 connection
    Set objBAPICortrol = CreateObject("SAP.functions")
    Set objConnection = objBAPICortrol.Connection
    objConnection.System = "SYSTEM NAME"
    objConnection.Client = "Client number"
    objConnection.user = "USERNAME"
    objConnection.Password = "PASSWORD"
    objConnection.Language = "EN"
    ' Establish a connection
    If objConnection.logon(0, False) <> False Then
    'MsgBox "Connection Established"
    End If
    On Error Resume Next
    ' Assign the Parameters
    Set objCreateMaterial = objBAPICortrol.Add("BAPI_ACC_DOCUMENT_POST")
    Set objMaterial = objCreateMaterial.Exports.Item("DOCUMENTHEADER")
    Set objMaterial1 = objCreateMaterial.Tables.Item("ACCOUNTGL")
    Set objMaterial2 = objCreateMaterial.Tables.Item("CURRENCYAMOUNT")
    'Set Values
    objMaterial.Value("USERNAME") = "USERNAME"
    objMaterial.Value("HEADER_TXT") = "BAPITEST"
    objMaterial.Value("COMP_CODE") = "0001"
    objMaterial.Value("PSTNG_DATE") = "20140506"
    objMaterial.Value("TRANS_DATE") = "20140506"
    objMaterial.Value("DOC_DATE") = "20140506"
    objMaterial.Value("FISC_YEAR") = "2014"
    objMaterial.Value("DOC_TYPE") = "SA"
    objMaterial.Value("REF_DOC_NO") = "BAPITEST"
    objMaterial.Value("FIS_PERIOD") = "00"
    objMaterial1.Rows.Add
    objMaterial1.Value(1, "ITEMNO_ACC") = "1"
    objMaterial1.Value(1, "GL_ACCOUNT") = "0007180000"
    objMaterial1.Value(1, "ITEM_TEXT") = "BAPITEST1"
    objMaterial1.Value(1, "DOC_TYPE") = "SA"
    objMaterial1.Value(1, "COMP_CODE") = "0001"
    objMaterial1.Value(1, "PROFIT_CTR") = "AZ1111" ---->'profit center is normally having 10CHARS but as there are letters I'm not using zeros at the beginning
    objMaterial1.Value(1, "ITEMNO_ACC") = "2"
    objMaterial1.Value(1, "GL_ACCOUNT") = "0007180000"
    objMaterial1.Value(1, "ITEM_TEXT") = "BAPITEST1"
    objMaterial1.Value(1, "DOC_TYPE") = "SA"
    objMaterial1.Value(1, "COMP_CODE") = "0001"
    objMaterial1.Value(1, "PROFIT_CTR") = "AZ1111"
    objMaterial2.Rows.Add
    objMaterial2.Value(1, "ITEMNO_ACC") = "1"
    objMaterial2.Value(1, "CURRENCY") = "EUR"
    objMaterial2.Value(1, "AMT_DOCCUR") = "-1.00"
    objMaterial2.Value(1, "ITEMNO_ACC") = "2"
    objMaterial2.Value(1, "CURRENCY") = "EUR"
    objMaterial2.Value(1, "AMT_DOCCUR") = "1.00"
    ' Function call
    objCreateMaterial.call
    Set objReturn = objBAPICortrol.Add("BAPI_TRANSACTION_COMMIT")
    objReturn.call
    Set retMess = objCreateMaterial.Tables.Item("RETURN")
    If retMess Is Nothing Then
    MsgBox retMess.Value(1, "MESSAGE")
    End If
    ' Get return parameters & display in excel
    Set objReturn = objCreateMaterial.Tables("RETURN")
    ActiveSheet.Cells(5, 1) = retMess.Value(2, "MESSAGE")
    End Sub

    after some searching I've discovered that once I'm creating next line for accounting document it is not working properly.
    When I debug the BAPI in SE37 after inserting new line it is asking for GL account input, however if I run it using VBA and delete the account from the code, the return message is not giving me any error that GL account is missing.
    I appreciate any ideas.

  • Changing Exchange Rate for MIGO using BADI

    Hi all,
    While processing <b>IMPORTS GR</b>.....
    How can I change the Exchange Rate by using <b>BADI</b>
    Regards
    Rajkumar

    Hi,
    While creating Purchase order we mention the Exchange Rate there in Header Detail for Delivery/Invoice Tab. To do excahange rate before GR means Change the exchange rate in PO.B ecause in mIGO the excahnge rate will be taken from PO.  u can change the exchange rate in Me21n or in OB08.I f the excahange rate selectedas fixed you can't change the excahange rate keep as it is and fix the indactor as fixed.  Hope it works. Thanking you.

  • Post Temporary data for order calculation

    Hi
    Any body can help me.I want to store tempory data in run time . So we can calculate order calculation.
    1- we have master relation condition
    2-In detail block have 2 rows
    Item Code Rate Price Basic val
    A 10 100 1000
    B 5 2 10
    3-I want to total basic value(sum of basic val in header )
    4-If i will be change in rate and price then basic val and total basic val automatic should be refresh and post on data base so we can calculate tax and excise duty for this amount.
    Thanks in advance.
    Narayan

    Narayan,
    You give us no context whatsoever for your question. For all we know, you are programming in MicroFocus Cobol.
    What version of JDeveloper are you using?
    What technologies are you using to build your application?
    Give us more context for your question
    John

  • How to handle HTTP-POST encrypted data for ECC Using proxy or RFC

    I have a scenario HTTP-POST ->PI->ECC.sender is HTTP Post  send encrypted data i need to handle the data and stored in to SAP ECC  with out decrypt using PI .what should i take for receiver  can i use inbound proxy or RFC  and how can handle the encrypted data  for decrypt.
    Regards
    Ravi

    1. my sender is HTTP POST . what should i configure in sender communication channel in SAP PI .like SOAP or HTTP .What are the parameters i need to pass .
    >>>
    If you are on PI 7.3 and above, configure the HTTP AAE adapter - Configuring the Java HTTP Adapter on the Sender Channel - Advanced Adapter Engine - SAP Library
    2.while using inbound proxy for encrypted data  i need  store the data in to table , the same proxy can i call  another outbound  service for decrypt  same data.
    >>>>
    Yes you can always a proxy within a proxy.

  • Creating additional customised tabscreen under header data for me21n

    hi all.
    i have a requirement for adding extra tabscreen (subscreen) undr headr data of me21n purchase requisitions .
    and other thing is i want to know how we can raise an eror message if the user has filled all data in me21n except in customised tab screen that i am going to create.
    waiting for great answwr.
    bye.
    sita ram,

    Hi,
    you can find tons of general info BADIs on this forum. So basically go to transaction SE18 and enter name of your BADI - ME_GUI_PO_CUST. Please read carefully documentation. There is button for documentation. In documentation you can find following statement:
    The Business Add-In (BADI) ME_GUI_PO_CUST enables you to integrate your own subscreens into the Enjoy purchase order at both eader and item levels.
    So it looks like what you need. You have description for each method of BADI in documentation as well.Definitely you will have to implement method SUBSCRIBE. You will define your own screen in this method. Then you have to implement PBO and PAI logic (check methods TRANSPORT_TO_DYNP and TRANSPORT_FROM_DYNP). SAP provides examples for each BADI. You can read the example of BADIs implementation in Goto->Sample Code->Display. These examples are very well commented. I am pasting just example of SUBSCRIBE implementation
    DATA: ls_subscriber LIKE LINE OF re_subscribers.
    * we want to add a customer subscreen on the item detail tab
      CHECK im_application = 'PO'.
      CHECK im_element     = 'ITEM'.
    * each line in re_subscribers generates a subscreen. We add one subscreen in this example
      CLEAR re_subscribers[].
    * the name is a unique identifier for the subscreen and defined in this class definition
      ls_subscriber-name = subscreen1.
    * the dynpro number to use
      ls_subscriber-dynpro = '0001'.
    * the program where the dynpro can be found
      ls_subscriber-program = 'SAPLMEPOBADIEX'.
    * each subscreen needs his own DDIC-Structure
      ls_subscriber-struct_name = 'MEPO_BADI_STRUCT'.
    * a label can be defined
      ls_subscriber-label = text-001.
    * the position within the tabstrib can be defined
      ls_subscriber-position = 5.
    * the height of the screen can be defined here. Currently we suport two screen sizes:
    * value <= 7 a sevel line subscreen
    * value > 7  a 16 line subscreen
      ls_subscriber-height = 7.
      APPEND ls_subscriber TO re_subscribers.
    So basically you will define your new sub screen in this method. Do not forget that the BADI ME_PROCESS_PO_CUST is compulsatory for BADI ME_GUI_PO_CUST.
    Cheers

  • "Stocks" App posts wrong dates for news articles

    I often read the news articles shown under the stocks that I own. I have noticed that with the iPod's included Stock app, the date of the news articles are not accurate. I go to read what I think is a recent news article, only to find out that it is a month old. I also notice the same old news headlines each day being refreshed with the current day's date again and again.
    Just reporting this as a bug and an annoyance, making the Stocks App provided with the iPod basically useless.
    Are there any known solutions other than using a different Stock app?

    I know i posted a similar post earlier this week. But the tutorial I got pointed at didnt work for what im trying to accomplish...
    The other post (marked as answered) that didn't help the OP was the same reply...  

  • Aditional data for FS00 by BAdI

    hi guys,
    this is my problem:
    I need to show a screen for the user input extra data when creates a new account in FS00 (or, if a screen is not possible, at least create the account in a ztable).
    I was going to use the badi FI_LIMIT_ACCOUNT till I figured out thats it was for SAP internal use only, now I have no clues how to do it, any ideas?

    Hi Prabhu,
    Did you solve this. We are facing the same issue. We created a custom Scenario ZLEA and created a badi implementation ZQISR1 for it with filter value QSCENARIO = ZLEA for data population.
    However our badi is not processed. In debugging I found that the value passed to QSCENARIO filter is always SASR instead of my own scenario name.
    I have an OSS message open for this at SAP, but no satisfying answer yet.
    Did you find another solution/workaround ?
    Kind Regards,
    Igor Vernelen.

  • RECN: Conditions Tab: Header data for second section not appearing

    Hello,
    Need your kind advise please. I have entered a contract successfully. The contract type is Pay:Rates Payment. The contract has been successfully saved.
    The problem comes when I am trying to display the contract. Here is what's happening sequentially:
    Procedure 1
    1.  I am using TCode RECN and keying in the contract number.
    2. Upon pressing Enter, the General Data tab of the contract is opening.
    3. I am clicking on the icon to change the status from 'display' to 'change'. The mode successfully becomes the 'change mode'.
    4. I am clicking on the Conditions tab and I can see that the screen shows two sections. The top section shows the various conditions that I have created. The bottom section shows the details of the condition for the line item selected from the top section.
    5. I am making the necessary changes and successfully saving the changes made to the contract. Then I am pressing F3 and coming back to the main RECN screen.
    BUT:
    An error occurs when I modify the above procedure slightly.
    Procedure 2
    1. When I am entering the contract once more, the first screen that is opening is the Conditions tab of the contract (quite naturally as this was the last screen that i used just now).
    2. When I am then clicking on the icon to change the status from display to 'change', the system is issuing an error message "Please fill all the mandatory fields".
    3. Upon close examination i am finding that in the bottom section of the Conditions Tab (which is supposed to show the details of the condition on which the cursor has been selected in the top section) the field just above the 5 tabs (ie. Condition, Terms, Calculation, Distribution, Memo) is not populating with the name of the condition on which the cursor has been selected in the top section.
    4. Since this field is a mandatory field, the system naturally throws the error "fill up all mandatory fields".
    The point to be noted is that this field gets perfectly populated when i am following the procedure 1. But in the same contract, this field doesnt get populated and throws the error message when I am following the Procedure 2.
    Request you to please help me understand why in the procedure 2, the field is not getting populated.
    Regards.

    Hello Veman,
    Many thanks for the kind response. However in my case the problem is that when I am trying to go into the 'change' mode for an existing record (which has already been once successfully saved), it is STILL throwing the error message 'fill up all mandatory fields'. The only way to come out of the screen is to press the 'cancel' button.
    What is even more funny is that when I am trying to enter the contract directly using the menu RE Cntract - Change from the first RECN screen, then there is no problem coming.
    My question is WHY is the system throwing that error message when clearly there is no error existing in the record. I believe this will be a programming error. The problem that i am referringto matches very closely to the solution provided vide note number 1291666. The reason why I cant apply this note is because my SAP release is 600 whereas this remedy is for 602, 603 ans 604.
    Regards,
    Suvarghya Dutta

  • USER EXIT or BADI for MIGO

    Hi friends,
    The Issue is:
    User tries to execute Migo with 103 or 101 movement.
    I want to throw an error if the posting date of the item is Before its original Delivery date in PO.
    I tried exit MBCF0005 and applied 'break-point' but its not going to debugger..
    Is there any other way i can overcome this issue ? BADI or any other Exit ?
    I just don't want user to save the document by throwing Error MSG.
    Regards
    Snehal

    Hi..
    Enhancement/ Business Add-in            Description
    Enhancement
    MB_CF001                                Customer Function Exit in the Case of Updating a Mat. Doc.
    MBCF0011                                Read from RESB and RKPF for print list in  MB26
    MBCF0010                                Customer exit: Create reservation BAPI_RESERVATION_CREATE1
    MBCF0009                                Filling the storage location field
    MBCF0007                                Customer function exit: Updating a reservation
    MBCF0006                                Customer function for WBS element
    MBCF0005                                Material document item for goods receipt/issue slip
    MBCF0002                                Customer function exit: Segment text in material doc. item
    Business Add-in
    MB_DOCUMENT_UPDATE                      BADI when updating material document: MSEG and MKPF
    MB_DOC_BADI_INTERNAL                    BAdIs During Creation of a Material Document (SAP Internal)
    MB_ME_CSGMT_BADI_SAP                    BAdI: Consignment Processing - Stock Transfer
    MB_MIGO_ITEM_BADI                       BAdI in MIGO for Changing Item Data
    MB_PHYSINV_INTERNAL                     Connection: Core Inventory and Retail AddOn
    MB_QUAN_CHECK_BADI                      BAdI: Item Data at Time of Quantity Check
    MB_RESERVATION_BADI                     MB21/MB22: Check and Complete Dialog Data
    MB_RESERVATION_SCR                      Screen BAdI for Retrofit DFPS
    MB_RESERVATION_UPCHD                    BAdI for Creation and Changing of Manual Reservations
    MB_RES_BAPI_CHANGE                      BAdI: Execution of Changes to Reservation Fields
    MB_RES_BAPI_CREATE1                     BAdI: Adoption of Customer's Own Fields as Reserv. Fields
    MB_RES_BAPI_DETAIL1                     BAdI: Display of Customer's Own Fields in Reservations
    MB_STOR_LOC_BADI_GTS                    BADI to Check and Change Storage Location (GTS Fct. Only)
    MB_MIGO_BADI                            BAdI in MIGO for External Detail Subscreens
    MB_DOCUMENT_BADI_SAP                    BADI for Creation and Changing of a Material Document
    ARC_MM_EBAN_CHECK                       BAdI: Enhancement of Archivability Check (MM_EBAN)
    ARC_MM_EBAN_PRECHECK                    BAdI: Enhancement of Archivability Check (MM_EBAN)
    ARC_MM_EBAN_WRITE                       BAdI: Enhancement of Scope of Archiving (MM_EBAN)
    ARC_MM_EINA_CHECK                       BAdI: Enhancement of Archivability Check (MM_EINA)
    ARC_MM_EINA_WRITE                       BAdI: Enhancement of Scope of Archiving (MM_EINA)
    ARC_MM_INVBEL_CHECK                     BAdI: Enhancement of Archivability Check (MM_INVBEL)
    ARC_MM_INVBEL_WRITE                     BAdI: Enhancement of Scope of Archiving (MM_INVBEL)
    ARC_MM_MATBEL_CHECK                     Prüfung ADD-ON-spezifischer Kriterien für MM_MATBEL
    ARC_MM_MATBEL_WRITE                     Check Add-On-Specific Data for MM_MATBEL
    MB_CHECK_LINE_BADI                      BAdI: Check Line Before Copying to the Blocking Tables
    MB_CIN_LMBMBU04                         posting of gr
    MB_CIN_MM07MFB7                         BAdI for India Version exit in include MM07MFB7
    MB_CIN_MM07MFB7_QTY                     Proposal of quantity from Excise invoice in GR
    MB_DOCUMENT_BADI                        BAdIs During Creation of a Material Document
    No.of Exits:          8
    No.of BADis:         29
    Arunima

  • Field Exit For Migo Badi

    Hi to all experts,
    I need to assign F4 help to a headertext field for MIGO tcode . I have searched all the exits but couldnt find field exit for it. What are the different options fulfilling this requirement.Please help me out

    Hi,
        The following are the enhancement/Business Add ins,  Please use the appropriate exit for your requirement
      Enhancement/ Business Add-in            Description
    Enhancement
    MB_CF001                                Customer Function Exit in the Case of Updating a Mat. Doc.
    MBCF0011                                Read from RESB and RKPF for print list in  MB26
    MBCF0010                                Customer exit: Create reservation BAPI_RESERVATION_CREATE1
    MBCF0009                                Filling the storage location field
    MBCF0007                                Customer function exit: Updating a reservation
    MBCF0006                                Customer function for WBS element
    MBCF0005                                Material document item for goods receipt/issue slip
    MBCF0002                                Customer function exit: Segment text in material doc. item
    Business Add-in
    MB_DOCUMENT_UPDATE                      BADI when updating material document: MSEG and MKPF
    MB_DOC_BADI_INTERNAL                    BAdIs During Creation of a Material Document (SAP Internal)
    MB_ME_CSGMT_BADI_SAP                    BAdI: Consignment Processing - Stock Transfer
    MB_MIGO_BADI                            BAdI in MIGO for External Detail Subscreens
    MB_MIGO_ITEM_BADI                       BAdI in MIGO for Changing Item Data
    MB_PHYSINV_INTERNAL                     Connection: Core Inventory and Retail AddOn
    MB_QUAN_CHECK_BADI                      BAdI: Item Data at Time of Quantity Check
    MB_RESERVATION_BADI                     MB21/MB22: Check and Complete Dialog Data
    MB_RESERVATION_SCR                      Screen BAdI for Retrofit DFPS
    MB_RESERVATION_UPCHD                    BAdI for Creation and Changing of Manual Reservations
    MB_RES_BAPI_CHANGE                      BAdI: Execution of Changes to Reservation Fields
    MB_RES_BAPI_CREATE1                     BAdI: Adoption of Customer's Own Fields as Reserv. Fields
    MB_RES_BAPI_DETAIL1                     BAdI: Display of Customer's Own Fields in Reservations
    MB_STOR_LOC_BADI_GTS                    BADI to Check and Change Storage Location (GTS Fct. Only)
    MB_DOCUMENT_BADI_SAP                    BADI for Creation and Changing of a Material Document
    ARC_MM_EBAN_CHECK                       BAdI: Enhancement of Archivability Check (MM_EBAN)
    ARC_MM_EBAN_PRECHECK                    BAdI: Enhancement of Archivability Check (MM_EBAN)
    ARC_MM_EBAN_WRITE                       BAdI: Enhancement of Scope of Archiving (MM_EBAN)
    ARC_MM_EINA_CHECK                       BAdI: Enhancement of Archivability Check (MM_EINA)
    ARC_MM_EINA_WRITE                       BAdI: Enhancement of Scope of Archiving (MM_EINA)
    ARC_MM_INVBEL_CHECK                     BAdI: Enhancement of Archivability Check (MM_INVBEL)
    ARC_MM_INVBEL_WRITE                     BAdI: Enhancement of Scope of Archiving (MM_INVBEL)
    ARC_MM_MATBEL_CHECK                     Prüfung ADD-ON-spezifischer Kriterien für MM_MATBEL
    ARC_MM_MATBEL_WRITE                     Check Add-On-Specific Data for MM_MATBEL
    MB_CHECK_LINE_BADI                      BAdI: Check Line Before Copying to the Blocking Tables
    MB_CIN_LMBMBU04                         posting of gr
    MB_CIN_MM07MFB7                         BAdI for India Version exit in include MM07MFB7
    MB_CIN_MM07MFB7_QTY                     Proposal of quantity from Excise invoice in GR
    MB_DOCUMENT_BADI                        BAdIs During Creation of a Material Document

  • I am posting data for va01 and va02 using BDC session,what happens if

    Hi,
    I am posting some data for va01 and va02 using BDC session,but what happens  if i try to post same data using call transaction.

    Hi,
    That is just another method. You can post the data using Call Transaction as well.
    Just give it a try and in case you face some problem revert back with your issue.
    We will help you to solve the same.
    Hope this helps!!!
    Regards,
    Lalit

  • Bapi for migo transaction

    i have created a bapi to upload data for MIGO transaction.. (GOODS RECEIPT-->PURCHASE ORDER)
    i am getting the error " stock posting is not possible for this material "'.
    when i create directly, it is posted.. while uploading through the program it shows the above error.
    please suggest if anyone knows....
    Thanks in advance,
    Dhivya N.

    *& Report  ZR_MIGO_UPLOAD
    *& package name : zabap
    *& transport request number : MIDK901443
    *& program to upload goods movement
    REPORT ZR_MIGO_UPLOAD.
    ***DATA DECLARATION***
    type-POOLs:  icon.
    TYPES: BEGIN OF TY_GR_PO,
            EBELN(10) TYPE c ,     "'PO NUMBEr
            EBELP(10) TYPE c,     "PO ITEM NUMBER
    *       LGOBE TYPE LGOBE,     "STORAGE LOCATION DESCRIPTION
            LGORT(10) TYPE c,     "STORAGE LOCATION
            XFELD TYPE c,     "ITEM OK
            GERNR(10) TYPE c,     "SERIALNUMBER
            END OF TY_GR_PO.
    DATA: TA_GR_PO TYPE TABLE OF TY_GR_PO,    "TABLE FOR GOODS RECEIPT PURCHASE ORDER
           WA_GR_PO TYPE TY_GR_PO.
    DATA: BLDAT TYPE BLDAT,     "DOCUMENT DATE
            BUDAT TYPE BUDAT,     "POSTING DATE
            WEVER TYPE WEVER.     "VERSION FOR PRINTING GR SLIP
    ***BAPI DECLARATION***
    DATA: BEGIN OF GM_HEAD OCCURS 0.                    "Material Document Header Data
             INCLUDE STRUCTURE BAPI2017_GM_HEAD_01.
    DATA: END OF GM_HEAD.
    DATA: BEGIN OF GM_CODE OCCURS 0.
             INCLUDE STRUCTURE BAPI2017_GM_CODE.          "Assign Code to Transaction for Goods Movement
    DATA: END OF GM_CODE.
    DATA: BEGIN OF GM_RET OCCURS 0.
             INCLUDE STRUCTURE BAPI2017_GM_HEAD_RET.       "Material Document Number/Material Document Year
    DATA: END OF GM_RET.
    DATA: BEGIN OF GM_ITEM OCCURS 0.
             INCLUDE STRUCTURE BAPI2017_GM_ITEM_CREATE.    "Material Document Items
    DATA: END OF GM_ITEM.
    DATA: BEGIN OF GM_SER OCCURS 0.
             INCLUDE STRUCTURE BAPI2017_GM_SERIALNUMBER.    "Serial Number
    DATA: END OF GM_SER.
    data: BEGIN OF ta_bapireturn OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
    data: END OF ta_bapireturn.
    ***declaration of excel file handling table***
    FIELD-SYMBOLS: <fs> type any.    "field symbol for alsm_excel
    DATA: TA_EXCEL TYPE TABLE OF ALSMEX_TABLINE,  "table to contain excel sheet values
           WA_EXCEL TYPE ALSMEX_TABLINE.
    ***declaration of other parameters***
    data:       V_brow type i VALUE    2,    "BEGIN OF ROW
                 V_bcol type i value   1,     "BEGIN OF COL
                 V_erow type i value 65536,   "END OF ROW
                 V_ecol type i value 256.     "END OF COLUMN
    DATA:  V_sear type string,
            V_INDEX TYPE i,
            V_tabix type sy-tabix,     "current line.
            v_lines type i.          "total number of records
    DATA: DATE TYPE DATS.
    ***SELECTION SCREEN***
    ***SELECTION SCREEN DESIGN***
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 3.
    PARAMETERS: zCODE(2) TYPE C MATCHCODE OBJECT H_T158G,
                 zrefdoc type REFDOC,
                 version type WEVER.
    SELECTION-SCREEN skip 5.
    PARAMETERS: p_file type ibipparms-path.
    SELECTION-SCREEN SKIP 3.
    SELECTION-SCREEN END OF BLOCK b1.
    ***SELECTION SCREEN VALUE REQUEST***
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
       CALL FUNCTION 'F4_FILENAME'                                    "f4 help for file name
         EXPORTING
           PROGRAM_NAME  = SYST-CPROG
           DYNPRO_NUMBER = SYST-DYNNR
           FIELD_NAME    = 'P_FILE'
         IMPORTING
           FILE_NAME     = P_FILE.
    ***SELECTION SCREEN EVENT***
    AT SELECTION-SCREEN.                                 "validation
       if p_file <> ''.
         V_sear = p_file.
         SEARCH V_sear for '.xls'.
         if sy-subrc <> 0.
           message 'please provide excel file. it is not valid' type 'E'.
         ENDIF.
       ENDIF.
    INITIALIZATION.
    *   DATE = '17.04.14'.
       GM_HEAD-PSTNG_DATE = SY-DATUM.
       GM_HEAD-DOC_DATE   = SY-DATUM.
       gm_head-pr_uname = sy-uname.
    ***START OF SELECTION***
    START-OF-SELECTION.
       gm_head-REF_DOC_NO = zrefdoc.
       gm_head-VER_GR_GI_SLIP = version.
       GM_CODE-GM_CODE = zCODE.
       PERFORM EXCEL_UPLOAD.
       PERFORM EXCEL_CONVERSION.
       PERFORM NO_RECORDS.
    END-OF-SELECTION.
       PERFORM BAPI_ASSIGNMENT.
       PERFORM BAPI_FM.
    *&      Form  EXCEL_UPLOAD
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM EXCEL_UPLOAD .
       CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
         EXPORTING
           FILENAME                = P_FILE
           I_BEGIN_COL             = V_BCOL
           I_BEGIN_ROW             = V_BROW
           I_END_COL               = V_ECOL
           I_END_ROW               = V_EROW
         TABLES
           INTERN                  = TA_EXCEL
         EXCEPTIONS
           INCONSISTENT_PARAMETERS = 1
           UPLOAD_OLE              = 2
           OTHERS                  = 3.
    ENDFORM.                    " EXCEL_UPLOAD
    *&      Form  EXCEL_CONVERSION
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM EXCEL_CONVERSION .
       if ta_excel is NOT INITIAL.
         sort ta_excel by row col.
         clear wa_excel.
         clear wa_GR_PO.
         LOOP AT ta_excel INTO wa_excel.
           move wa_excel-col to v_index.
           ASSIGN COMPONENT v_index OF STRUCTURE wa_GR_PO to <fs>.
           if sy-subrc = 0.
             move wa_excel-value to <fs>.
           ENDIF.
           at END OF row.
             append wa_GR_PO to ta_GR_PO.
             clear wa_GR_PO.
           ENDAT.
         ENDLOOP.
       else.
         MESSAGE 'no data for conversion' type 'I'.
       ENDIF.
    ENDFORM.                    " EXCEL_CONVERSION
    *&      Form  NO_RECORDS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM NO_RECORDS .
       DESCRIBE TABLE ta_GR_PO LINES v_lines.
       if v_lines = 0.
         MESSAGE 'NO RECORDS TO UPLOAD' TYPE 'E'.
       ENDIF.
    ENDFORM.                    " NO_RECORDS
    *&      Form  BAPI_ASSIGNMENT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM BAPI_ASSIGNMENT .
       IF TA_GR_PO IS NOT INITIAL.
         LOOP AT TA_GR_PO INTO WA_GR_PO.
           gm_item-PO_NUMBER = wa_gr_po-ebeln.
           GM_ITEM-STGE_LOC = WA_GR_PO-LGORT.
           GM_ITEM-PO_ITEM = WA_GR_PO-EBELP.
           GM_ITEM-NO_MORE_GR = 'X'."WA_GR_PO-XFELD'.
    *      GM_SER-SERIALNO = WA_GR_PO-GERNR.
           gm_item-NO_MORE_GR =  1.
           gm_item-ENTRY_QNT = 2.
           gm_item-MOVE_TYPE = 101.
    *      gm_item-MVT_IND = 'B'.
           gm_item-plant = 'P001'.
           gm_item-move_stloc = 'FG01'.
    *      GM_ITEM-SPEC_STOCK = 'K'.
           APPEND GM_ITEM.
           APPEND GM_SER.
         ENDLOOP.
        ELSE.
          MESSAGE 'DATA IS NOT UPLOADED' TYPE 'I'.
        ENDIF.
    ENDFORM.                    " BAPI_ASSIGNMENT
    *&      Form  BAPI_FM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM BAPI_FM .
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
       EXPORTING
         GOODSMVT_HEADER               = gm_head
         GOODSMVT_CODE                 = gm_code
    *   TESTRUN                       = ' '
    *   GOODSMVT_REF_EWM              =
      IMPORTING
        GOODSMVT_HEADRET              = gm_ret
    *   MATERIALDOCUMENT              =
    *   MATDOCUMENTYEAR               =
       TABLES
         GOODSMVT_ITEM                 = gm_item
        GOODSMVT_SERIALNUMBER         =  gm_ser
         RETURN                        = ta_bapireturn
    *   GOODSMVT_SERV_PART_DATA       =
    *   EXTENSIONIN                   =
    if ta_bapireturn-type = 'S'.
         write:/ icon_green_light as icon,
                 'success: Material document',gm_ret-mat_doc,  'is created for the GOODS RECEIPT- po number : ', wa_gr_po-ebeln,
               / 'reason:' , ta_bapireturn-message.
    ELSEIF ta_bapireturn-type = 'E'.
         write:/ icon_red_light as icon,
                 'error: Material document',gm_ret-mat_doc , 'is not created for the GOOD RECEIPT- po number : ', wa_gr_po-ebeln,
               / 'reason:' , ta_bapireturn-message.
    ENDIF.
    ENDFORM.                    " BAPI_FM

  • Update Header Data in SMSY using LMDB

    Where in the LMDB can I update the "Production" checkbox that exists in SMSY on the Header Data for a Landscape Component? All of my systems (DEV, QA1, QA2 PROD) exist in both SMSY and the LMDB as well as in the TMS of the manage system. The QA2 and PROD are virtual systems in TMS.

    Hi Erin
    You can try in Transaction LMDB, there you have the Role,,

Maybe you are looking for