Skip to Content
author's profile photo Former Member
Former Member

triggering of an idoc while saving the entries in ztable

hi,

While saving the entries in ztable, one idoc to be trigger for my requirement,what is the process for it

thanks in advance

Edited by: nandini devarasetti on Jan 25, 2008 12:46 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2008 at 06:13 AM

    Hi Nandini,

    check the below sample code for triggering the idoc..The same thing u can do for ur requirement..slect all then data from ur custom table and finally call the FM

    "MASTER_IDOC_DISTRIBUTE".

    &----


    *& Report ZZ_Program_To_Create_Idoc

    &----


    report zz_program_to_create_idoc .

    tables: ekko,ekpo.

    selection-screen skip 3.

    selection-screen begin of block b1 with frame title titl.

    selection-screen skip.

    select-options s_ebeln for ekko-ebeln.

    selection-screen skip.

    selection-screen end of block b1.

    data: header_segment_name like edidd-segnam value 'Z1EKKO',

    item_segment_name like edidd-segnam value 'Z1EKPO',

    idoc_name like edidc-idoctp value 'Z19838IDOC1'.

    data: header_segment_data like z1ekko,

    item_segment_data like z1ekpo.

    data: control_record like edidc.

    data: messagetyp like edmsg-msgtyp value 'ZZ9838MESG1'.

    data: i_communication like edidc occurs 0 with header line,

    i_data like edidd occurs 0 with header line.

    data: begin of i_ekko occurs 0,

    ebeln like ekko-ebeln,

    aedat like ekko-aedat,

    bukrs like ekko-bukrs,

    bsart like ekko-bsart,

    lifnr like ekko-lifnr,

    end of i_ekko.

    data: begin of i_ekpo occurs 0,

    ebelp like ekpo-ebelp,

    matnr like ekpo-matnr,

    menge like ekpo-menge,

    meins like ekpo-meins,

    netpr like ekpo-netpr,

    end of i_ekpo.

    start-of-selection.

    select ebeln aedat bukrs bsart lifnr from ekko

    into table i_ekko where ebeln in s_ebeln.

    select ebelp

    matnr

    menge

    meins

    netpr

    from ekpo

    into table i_ekpo

    where ebeln in s_ebeln.

    control_record-mestyp = messagetyp.

    control_record-rcvprt = 'LS'.

    control_record-idoctp = idoc_name.

    control_record-rcvprn = '0MART800'.

    loop at i_ekko.

    header_segment_data-ebeln = i_ekko-ebeln.

    header_segment_data-aedat = i_ekko-aedat.

    header_segment_data-bukrs = i_ekko-bukrs.

    header_segment_data-bsart = i_ekko-bsart.

    header_segment_data-lifnr = i_ekko-lifnr.

    i_data-segnam = header_segment_name.

    i_data-sdata = header_segment_data.

    append i_data.

    select ebelp

    matnr

    menge

    meins

    netpr

    from ekpo

    into table i_ekpo

    where ebeln = i_ekko-ebeln.

    loop at i_ekpo.

    item_segment_data-ebelp = i_ekpo-ebelp.

    item_segment_data-matnr = i_ekpo-matnr.

    item_segment_data-menge = i_ekpo-menge.

    item_segment_data-meins = i_ekpo-meins.

    item_segment_data-netpr = i_ekpo-netpr.

    i_data-segnam = item_segment_name.

    i_data-sdata = item_segment_data.

    append i_data.

    endloop.

    clear i_ekpo.

    refresh i_ekpo.

    endloop.

    call function 'MASTER_IDOC_DISTRIBUTE'

    exporting

    master_idoc_control = control_record

    • OBJ_TYPE = ''

    • CHNUM = ''

    tables

    communication_idoc_control = i_communication

    master_idoc_data = i_data

    exceptions

    error_in_idoc_control = 1

    error_writing_idoc_status = 2

    error_in_idoc_data = 3

    sending_logical_system_unknown = 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.

    else.

    loop at i_communication.

    write: 'IDOC GENERATED', i_communication-docnum.

    endloop.

    commit work.

    endif.

    initialization.

    titl = 'ENTER THE PURCHASE ORDER NUMBER'.

    kindly reward if found helpful.

    cheers,

    Hema.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2008 at 06:14 AM

    Also Nandini,

    You can send the IDocs manually.

    Use FM MASTER_IDOC_DISTRIBUTE

    Hope this helps.

    cheers,

    Hema.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 11:01 AM

    Hi Nandini,

    If you are getting the data from outbound to Inbound then if the idoc is generated in Outbound successfully then the idoc will be generated automatically in inbound side and the Z function module at Inbound Side will update the entries in the database table.

    Reward Points if Clear.

    Regards,

    Rehan Ahmed.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 11:12 AM

    Hi,

    I never seen this requirement, but to my knowledge what i suggest is as follows:

    After creating ur ztable, cretae Table maintenace generator.

    In the TMG, sceen ,under Menu, Utilities/Environment, u will find set of events, in which u need SAVE event to be triggered.

    with in the event SAVE, wrirte ur code with in the Editor to generate an O/b idoc with the FM 'MASTER_IDOC _DISTRIBUTE' .

    Revrt back if any issues,

    Regards,

    Naveen

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.