To Update the IDOC segment values through report program

My requirement is to update the Idoc segment through the report program. Any SAP provided standard function module is available to update the Idoc segment values. Please help needed.

DATA: LT_EDIDD TYPE STANDARD TABLE OF EDIDD."Local Table to Hold EDIDD
    LT_EDIDD = I_EDIDD. "table should have the data
*-- Opening the IDoc for Edit
    CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
      EXPORTING
        DOCUMENT_NUMBER               = X_EDIDC-DOCNUM
      TABLES
        IDOC_DATA                     = IT_EDIDD
      EXCEPTIONS
        DOCUMENT_FOREIGN_LOCK         = 1
        DOCUMENT_NOT_EXIST            = 2
        DOCUMENT_NOT_OPEN             = 3
        STATUS_IS_UNABLE_FOR_CHANGING = 4
        OTHERS                        = 5.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
*-- Editing the IDoc
    CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'
      TABLES
        IDOC_CHANGED_DATA_RANGE = LT_EDIDD
      EXCEPTIONS
        IDOC_NOT_OPEN           = 1
        DATA_RECORD_NOT_EXIST   = 2
        OTHERS                  = 3.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
*-- Closing the IDoc after Edit
    CALL FUNCTION 'EDI_DOCUMENT_CLOSE_EDIT'
      EXPORTING
        DOCUMENT_NUMBER  = X_EDIDC-DOCNUM
        DO_COMMIT        = 'X'
        DO_UPDATE        = 'X'
        WRITE_ALL_STATUS = 'X'
      EXCEPTIONS
        IDOC_NOT_OPEN    = 1
        DB_ERROR         = 2
        OTHERS           = 3.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
thanks
vijay

Similar Messages

  • Modify the standard segment value

    Hi Experts,
    I have a piece of code to modify the standard idoc segment value.
            wa_idoc_data_mon-segnam = c_segale_e1edl24.
            wa_in_e1edl24 = idoc_data-sdata.
            wa_in_e1edl24-matnr = wa_in_e1edl24-matnr+11(7).
            wa_idoc_data_mon-sdata = wa_in_e1edl24.
           MODIFY idoc_data FROM wa_idoc_data_mon INDEX g_indx.
    This modify statement works but it will change the normal structure of idoc type as we have in WE30 and put the status in RED.
    If i use transporting sdata then it will not modify the material to last 7 char.
    Thanks,
    Sahil

    Hi,
    It's not advisable to modify the standard tables through program. If you want you can do using MODIFY.
    MODIFY database_table FROM TABLE itab.
    Thanks,
    Sri.

  • How to default the KFF segment values based on other field's value

    Hi,
    I would need to reset the 5th segment value of "Liability Account" field on R12 Supplier Page under "Accounting" link.
    Condition: And it has to be based on some other value like "GLOBAL CONTEXT VALUE and TaxPayer ID Type" under "Organization" link.
    Right now; as per the seeded page it defaults the Liability Account to "BL-130-0000-2110-0000-0000" under accounting link; I need to change this default value to "BL-130-0000-2110-2641-0000" based on above condition.
    I have tried using the below code:
    OAKeyFlexBean oakeyflexbean = (OAKeyFlexBean)oawebbean.findIndexedChildRecursive("LiabilityFlex");
    oakeyflexbean.setText()
    But this one does not work.
    Can anyone suggest me some option to acheive this requirement.
    Thanks
    Edited by: 880860 on May 21, 2012 2:23 PM

    Hi everyone,
    Any thoughts? any help is appreciated...
    Thanks

  • Can we update the Category attribute values of a file

    Can we update the Category attibute values of a file with out checkout the file?
    I have set the version configuration to folder and try to update the category attribute values of a file under that folder,
    It is asking to checkout the file before modifying the category attibute values.
    Is it required to checkout the file before modifying the category attribute values of that file?
    Is there any way to update the category attribute values without checkout the file?
    Please help on this

    One of the ways i can think of is using Batch Loader script for large number of files. Mention such files in Batch Loader script, and it will update category and all meta-data required in terms of next revision.
    In case number of files are less manual checkout and check-in will help.

  • Steps For Updating the IDOC Status using ALEAUD

    Hi all,
    My Scenario  is : R/3(IDOC)--> Legacy System(File).After the IDOC is received successfully on the Receiver System.I should Update the Status of IDOC on the Sender System.
    Can anyone help me out :
    What all the Steps & Configurations involved for Sending an Acknowledgement & Updating the IDOC status  from the Legacy System.
    Thanks in Advance,
    Dattatreya.

    Hi,
      You may need to set up another flow (a reverse one), where the Legacy sends a msg to XI with the Idoc number of the initial idoc you sent (onward flow).
      now, you can map the idoc number in E1ADHDR/E1STATE/DOCNUM and other statuses as required (in various tags) and also other information as per your environment. Pls see the below links
    Re: Acknowledgements ever switch to Status 39
    Re: Asyncronous acknowledge from file adapter
    Re: R3<->XI<->Auto-ID:How to check result of Idocs sending out from R3 in aii ?
    Regards
    Vishnu

  • How can we pass the select-option value to modulepool program?

    hi,
      how can we pass the select-option value to modulepool program ?
      Because if i declared select-options in executable program and i used SSCRFIELDS to define push buttons in selection screen.
               My requirement if enter the values to select-options and press UPDATE pussbotton then i want call screen which contains tablecontrol.
               How i get select-option values to PAI of call screen for getting the data from database table to my internal table?

    Oh I thought that you have selection-screen and again you are working on dialog programming.
    if you want to use select-option directly in module pool then it is not possible.
    but you can do other way.
    create two varaiables
    data : v_kun_low like kna1-kunnr,
             v_kun_high like kna1-kunnr.
    use these two variables in layout ,let user knows that he can not give options like gt,lt,eq ,it will be always BT.
    and also when you see normal report program,you can use multiple values in either low or high,but here it is not possibel.
    use can enter only low value and high value.
    when you come to program point of view
    declare one range
    ranges r_kunnr for kna1-kunnr.
    do the coding like
    r_kunnr-low = v_kun_low.
    r_kunnr-high = v_kun_high.
    r_kunnr-options = 'BT'.
    r_kunnr-sign = 'I'.
    append r_kunnr.
    now you can use r_kunnr in select query ,it will work like select-option.
    other than this there is no option.
    Thanks
    Seshu

  • Can we create purchase order through report programming?

    hi experts.....
    can we create purchase order through report programming?If yes plz give me the thread details?

    Hi,
    Use this code in a program by using a BAPI function module
    Anothe rway is using classical/ALV report using call transaction from a report for changing the PO
    loop at i_header.
        header-ref_1         = i_header-legacy.
        headerx-ref_1        = c_x.
        header-doc_type      = i_header-bsart.
        headerx-doc_type     = c_x.
        header-comp_code     = i_header-bukrs.
        headerx-comp_code    = c_x.
        header-purch_org     = i_header-ekorg.
        headerx-purch_org    = c_x.
        header-pur_group     = i_header-ekgrp.
        headerx-pur_group    = c_x.
        header-vendor        = i_header-lifnr.
        headerx-vendor       = c_x.
        concatenate i_header-bedat+4(4)
                    i_header-bedat+0(2)
                    i_header-bedat+2(2)
                    into header-doc_date.
        headerx-doc_date     = c_x.
        header-created_by    = i_header-ernam.
        headerx-created_by   = c_x.
        header-currency      = i_header-waers.
        headerx-currency     = c_x.
        concatenate i_header-kdatb+4(4)
                    i_header-kdatb+0(2)
                    i_header-kdatb+2(2)
                    into header-vper_start.
        headerx-vper_start   = c_x.
        loop at i_items where legacy = i_header-legacy.
          item-po_item            =  i_items-ebelp.
          itemx-po_item           =  i_items-ebelp.
          itemx-po_itemx          =  c_x.
          if i_header-bsart = 'NB'.
            item-material            =  i_items-ematn.
            itemx-material           =  c_x.
            schedule-quantity        =  i_items-menge * 1000.
            schedulex-quantity       =  c_x.
          else.
            item-short_text          = i_items-ematn.
            itemx-short_text         = c_x.
            item-matl_group          = '1000'.
            itemx-matl_group         = c_x.
            schedule-quantity        =  '1'.
            schedulex-quantity       =  c_x.
          endif.
          item-plant               =  i_items-werks.
          itemx-plant              =  c_x.
          schedule-po_item         = i_items-ebelp.
          schedule-sched_line      = '1'.
          schedulex-po_item        = i_items-ebelp.
          schedulex-sched_line     = '1'.
          schedulex-po_itemx       = c_x.
          schedulex-sched_linex    = c_x.
          concatenate  i_items-eildt+0(2)
                       i_items-eildt+2(2)
                       i_items-eildt+4(4)
                       into schedule-delivery_date.
          schedulex-delivery_date  =  c_x.
          item-price_unit          =  i_items-peinh * 100.
          itemx-price_unit         =  c_x.
          item-tax_code            =  i_items-mwskz.
          itemx-tax_code           =  c_x.
          item-shipping            =  i_items-evers.
          itemx-shipping           =  c_x.
          account-po_item          = i_items-ebelp.
          accountx-po_item         = i_items-ebelp.
          accountx-po_itemx        = c_x.
          if i_header-bsart = 'FO'.
            item-pckg_no  = sy-tabix.
            itemx-pckg_no = 'X'.
            limits-pckg_no        = sy-tabix.
            limits-limit          = i_items-overalllimit.
            limits-exp_value      = i_items-expectedoverall.
            posrvaccessvalues-pckg_no    = sy-tabix.
            posrvaccessvalues-line_no    = '0'.
            posrvaccessvalues-serno_line = '00'.
            posrvaccessvalues-percentage = '100.0'.
            posrvaccessvalues-serial_no  = '01'.
            account-serial_no     = '1'.
            accountx-serial_no    = '1'.
            accountx-serial_nox   = c_x.
            account-quantity  = '1'.
            accountx-quantity = c_x.
            call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                input  = i_items-kostl
              importing
                output = account-costcenter.
            accountx-costcenter   = c_x.
            call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                input  = i_items-sakto
              importing
                output = account-gl_account.
            accountx-gl_account   = c_x.
            item-acctasscat       = i_items-knttp.
            itemx-acctasscat      = c_x.
            item-item_cat         = i_items-epstp.
            itemx-item_cat        = c_x.
          endif.
          append:item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.
          clear :item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.
        endloop.
        call function 'BAPI_PO_CREATE1'
          exporting
            poheader                     = header
            poheaderx                    = headerx
    *   POADDRVENDOR                 =
    *   TESTRUN                      =
    *   MEMORY_UNCOMPLETE            =
    *   MEMORY_COMPLETE              =
    *   POEXPIMPHEADER               =
    *   POEXPIMPHEADERX              =
    *   VERSIONS                     =
    *   NO_MESSAGING                 =
    *   NO_MESSAGE_REQ               =
    *   NO_AUTHORITY                 =
    *   NO_PRICE_FROM_PO             =
            importing
            exppurchaseorder             = ponumber
    *   EXPHEADER                    =
    *   EXPPOEXPIMPHEADER            =
            tables
            return                       = return
            poitem                       = item
            poitemx                      = itemx
    *   POADDRDELIVERY               =
            poschedule                   = schedule
            poschedulex                  = schedulex
            poaccount                    = account
    *   POACCOUNTPROFITSEGMENT       =
            poaccountx                   = accountx
    *   POCONDHEADER                 =
    *   POCONDHEADERX                =
    *   POCOND                       =
    *   POCONDX                      =
            polimits                     = limits
    *   POCONTRACTLIMITS             =
    *   POSERVICES                   =
       posrvaccessvalues            = posrvaccessvalues.
    *   POSERVICESTEXT               =
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
    *   POEXPIMPITEM                 =
    *   POEXPIMPITEMX                =
    *   POTEXTHEADER                 =
    *   POTEXTITEM                   =
    *   ALLVERSIONS                  =
    *   POPARTNER                    =
        if ponumber eq space.
          loop at return where type = 'E'.
            clear buffer.
            move-corresponding return to e_return.
            concatenate i_header-legacy e_return into buffer.
            transfer buffer to p2_file.
          endloop.
          move-corresponding i_header to i_eheader.
          transfer i_eheader to p3_file.
          loop at i_items where legacy = i_header-legacy.
            move-corresponding i_items to i_eitems.
            transfer i_eitems to p4_file.
          endloop.
        else.
          commit work and wait.
        endif.
        clear:ponumber,header,headerx,item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.
        refresh:item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.
      endloop.
      close dataset p2_file.
      close dataset p3_file.
      close dataset p4_file.
    Regards
    Krishna

  • Want to create a Quotation through Report programming

    Hi Expert,
    I need to create an Quotation in my ERP system through report programming. I just want to know, what are the FM Used for this purpose or any idea about this. I really welcome your great ideas.
    <removed by moderator>
    Thanks and Regards,
    Shakun
    Moderator message: please search for available information/documentation before asking.
    Edited by: Thomas Zloch on Oct 23, 2010 6:05 PM

    Hi Niji,
    refer to the following link:
    /people/kevin.wilson2/blog/2007/08/31/what-mechanisms-are-available-to-you-in-order-to-create-a-business-object-event
    hope this will help you.........

  • BOPF - Functionallity through Report Program

    Hi,
    I wants to perform a create functionality through report program which is currently through BOPF.
    Please anyone help me to achieve.
    Regards,
    Sakthi

    Hi Sakthi,
    You can perform Create functionality using Service Manager and Save it using Transaction Manager.
    Kindly refer following code.
    DATA LO_SRV TYPE REF TO /BOBF/IF_TRA_SERVICE_MANAGER.
    DATA LO_TRA TYPE REF TO /BOBF/IF_TRA_TRANSACTION_MGR.
    DATA: LR_DATA TYPE REF TO <combine structure of resp. node> ,
                LW_KEY_NEW TYPE /BOBF/CONF_KEY ,
    DATA: LO_CHANGE TYPE REF TO /BOBF/IF_TRA_CHANGE,
                LO_MESSAGE TYPE REF TO /BOBF/IF_FRW_MESSAGE.
    DATA: LT_MODIF TYPE /BOBF/T_FRW_MODIFICATION,
                LW_MODIF TYPE /BOBF/S_FRW_MODIFICATION.
    LO_TRA = /BOBF/CL_TRA_TRANS_MGR_FACTORY=>GET_TRANSACTION_MANAGER( ). LO_SRV = /BOBF/CL_TRA_SERV_MGR_FACTORY=>GET_SERVICE_MANAGER( IV_BO_KEY = <constant_interface_name>=>SC_BO_KEY ).
    LW_KEY_NEW = LO_SRV->GET_NEW_KEY( ).
    LR_DATA-><field1> = abc.
    LR_DATA-><field2> = xyz.
    LR_DATA-><field3> = 123.
    LW_MODIF-NODE = <constant Interface name>=>SC_NODE-<node name>.
    LW_MODIF-CHANGE_MODE = 'C'.
    LW_MODIF-KEY = LW_KEY_NEW.
    LW_MODIF-DATA = LR_DATA.
    LW_MODIF-SOURCE_KEY = <parent_key_of_instance>.
    LW_MODIF-SOURCE_NODE = <const. inf name>=>SC_NODE-<parent_node name>.
    LW_MODIF-ASSOCIATION = <const. inf name>=>SC_ASSOCIATION-<parent_node>-<child_node>.
    LW_MODIF-ROOT_KEY = <root_key_of _instance>.
    APPEND LW_MODIF TO LT_MODIF.
    LO_SRV->MODIFY (
    EXPORTING
    IT_MODIFICATION = LT_MODIF
    IMPORTING
    EO_CHANGE = LO_CHANGE
    EO_MESSAGE = LO_MESSAGE ).
    LO_TRA->SAVE( ).
    Thanks and regards,
    Chetan P. Patil.

  • Multiple idoc segment values to field fixed length FCC

    Friends,
    I need help to resolve a mapping issue. here is the brief about the scenario.
    Scenario: IDoc to Flat file Fixed length fields
    Issue: Idocs has values in multiple segments. i need to check condition for each segment occurrence if value exists then pass value if not then pass constant (i have to pass constant so that i can get the actual column width after FCC)
    Iam using the following logic.
    If condition then value1 -> remove contexts -> split by value -> target
    My scenario works fine for the above mapping however when i try introduction a constant in "if then else" then all my contexts in the target structure messes up.
    Thanks for your help.
    Regards,
    Pavan

    Did you tried MapWithDefault before Remove Contexts? To give more perfect solution , we would like to see a sample structure.
    raj.

  • Find the idoc segment link with Sap Table

    Dear Abaers,
    I am new to Idoc. i have one Idoc (Orders01) for creating sales order.
    I had seen the t-codes WE 30 and WE 60 to know the field description.
    The fielddescription shows names like name1 name2 ort01 etc.
    i want to know what are the db tables involved for that particular idoc segment.
    Thanks in Advance,
    Arati

    Hi Arati,
    to get the description name:
    WE30 transaction and check the segments name available.
    With the segment name, go to WE31 and check the fields used and column 'Data element'.
    Double-click in data element (or inform in se11), you have the description value of the field.
    About the tables involved:
    Click in 'Where use list' os this data element.

  • How to change the IDOC segment data

    How to change the segment data for all IDOCs at one shot J.
    For exmple E1EDK02-QUALF - 004
                       E1EDK02-RGID  -  100000008 (Inquiry No)
                   to
           E1EDK02-QUALF - 004
                       E1EDK02-RGID  -  200000005 (Quotation)
    Any hints, tips….Appreciate your help and more rewards.
    Regards,
    Cris

    Hi,
    You can change the IDOC values using the transaction WE09
    Give the IDOC number..
    Press F8..
    Expand the tree..
    Double click on the segment..
    Then in the menu..DATA RECORD -> DISPLAY/CHANGE..
    It will go in change mode..Change the IDOC value..
    Thanks,
    Naren

  • To delete the IDOC Segment in the Inbound i.e.Item Data

    Hi All,
    Idoc is received for orders05 as inbound.
    The IDoc Data contains two levels of item data
    i.e. Segment E1EDP01 - In this we Pass only the quantity.
          in the Sub Segment of item E1EDP19 - Customer Material in the segment IDTNR with qualifier 002.
    The same segment is repeated again but the customer material is different.
    Now need to check the material, if it is different, i need to delete the entire second item segment and put the customer material in the Segment E1EDP19 which has empty field.
    His there any Function Module or so to delete the incoming data of the idoc through inbound?.
    Could you please let me know if there any way to do the same.
    Thank you.
    Regards,
    Dinesh.

    yes here you can access only one segment, if you don't control that here, then the information will be populated to xvbap. or else you can even try to implement the error handling exit EXIT_SAPLVEDA_008 /EXIT_SAPLVEDA_011
    already item information will be populated to xvbap  table . so try to delete the item from xvbap also

  • How to update the Customer field value of PO Item under the Delivery Address Tab?

    Hi Friends,
         i tried to update the Customer field Using Bapi_PO_change.I passed the PO Order no,POADDRDELIVERY data with Item no,Adrees no,Customer no.But i am getting no data changed message from return table.I attached the screen shots.So please suggest me the helpful information for resoving this issue.
    Thanks,
    Dinesh

    Thank you friends,
                My Problem was resolved.In my case i have passed the customer value in BAPI_PO_CHANGE POITEM Table with updated customer value.
    Thanks,
    Dinesh

  • Automatic (EDI) vendor posting fails - can I update the IDOC mapping?

    Hi -- I am testing a new intercompany sales process and having trouble with returns. The INVOIC01 IDOC for the vendor posting (document type VC - Vendor Credit FI) is failing because text is required on the line item (field SGTXT on BSEG). So it appears that the IDOC doesn't have this text field mapped.
    If I can identify a field in the existing IDOC to use for the text, is there a way that I can add that mapping? For example, let's say I want to populate the BSEG text with field BELNR on segment E1EDP01, is there a way to specify in the INVOIC01 idoc that this field should be plugged into BSEG-SGTXT? I don't have EDI experience, so this is all new to me!
    Thanks
    Allison

    Hi Allison,
    Since it's just for testing, just change the Text field on FI field status group become optional entry. It will solve your problem rather than modifying the standard IDOC
    Regards,
    Gumanti

Maybe you are looking for

  • Financial Report to get data of previous 2 months

    Hi, I got a requirement to create a report to show the data of previous 2 months based on the prompted month and year. Suppose if user selects March and year as *2009* then my report should show data for Mar followed by Feb and Jan of *2009*. I am ab

  • Flow of condition records in the sale order

    Dear All, I had created two condition types (ex : RL1 & RL2) for Royalty exp and Royalty Payable, these are Required Fields. so that whenever user create the Sale order those condition types amounts are automatically fetch into the sale Order with pl

  • Request for Skype and Camera Controls on Nokia 808...

    Hi Yvonne, One of the major issues I have with my Nokia 808 is the lack of compatibility of some basic apps like Skype. Some of us need them for business as well as personal needs. Request you to look into rectifying this. The other major issue in a

  • Business process check-in/check-out - who has checked out and when?

    We have been using the business process check-in/check-out functionality for 18 months and there are an increasing number of process's that have been checked out to the maintenance project and never checked in again. Is there a straight forward way i

  • Redemption of iTune card cannot be read

    Need find the code numbers and letters for iTune card I purchased