Filling up segments of Idoc of Invoice List

Hi!
Invoices and Invoice List are beeing created... everything would be fine, but some fields are missing in the Invoice List while existing in Invoices.
I guess I need to find the code where these fields are filled up for Invoices and to add this code to appropriate place for Invoice List. How to do this?
I think that needed segments are existing for Invoice List, just not filled up...
By the way, how to find out Idoc number of Invoice List? If I have it, I could compare segments with Idocs of Invoices.
Any ideas?
Will reward,
Mindaugas.

I saw the Function module -
Please look at code at :
Include program : LVEDFF0R
FORM REDUCTION_TABLE_CREATE.
  PERFORM IDOC_SEGMENTS_READ.
  PERFORM IDOC_ACTIVE_SEGMENTS_SET.
ENDFORM.                    " REDUCTION_TABLE_CREATE
Keep the break point at form routine and debug the the function module
If you do not know how to do debugging then use following way :
keep the break point in form routine above as i said
Create invoice or invoice list
when you maintain output type in invoice or invoice list -
Now click on Further data ->select peridoc scheduling-> back and save it.
Run RSNAST00 Program
Output application : V3
Object key : Invoice or invoice list number
Output type : RD00 or LR00
Medium = 6(EDI) ,A (ALE)
when you execute the program and it will goto debugging.
Thanks
Seshu

Similar Messages

  • Invoice List, via EDI

    Hi,
    We are trying to create an IDOC for our INVOICE LIST,by using the function module IDOC_OUTPUT_INVOIC but is failling to popuplate IDOC segments with the line item data.
    The function module seem not ready to read the structure of INVOICE LIST, becasue it is slightly different from other Billing types documents. Manly regarding  the Item data.
    BILLING DOCUMENT: Display Transaction VF03
    -       Header Table:  VBRK
    -       Item Table:      VBRP
    INVOICE LIST: Display Transaction VF23
    -       Header Table:  VBRK
    -       Item Table:      VBRL
    We are about to engage on creating our own mapping for the IDOC. However would  like to confirm weather another function module have been desinged for that?  Found no mention about it in OSS.
    Thank you very much
    Eduardo

    You should have better searched this forum. Its "better" then OSS. Have a look at the thread that you reach by clicking on the following link.
    [Click here|Re: filling up segments of Idoc of Invoice List]

  • Invoice List data(VF21/VF22) as IDoc

    Hi,
    We have a typical scenario of converting Invoice List data in SAP into IDoc and to transmit it as an XML to the third party system. In the data to be transmitted, sub-totalling at the material (in the invoice items) and material+invoice date level is required and the sub-totals are to be populated in two kind of segments (for each of the sub-total type) in the IDoc.
    That is, a new IDoc structure will be defined with the segments/fields that the customer wants viz., a header segment with only few fields from the invoice list header, an item segment with only few fields from the invoice list item, and a sub-total segment with two fields, each to hold sub-total at material and material+date level respectively.
    We have output types which, when assigned in the invoice list should create the required Idocs.
    Invoice lists will be created for several partners, but each list will have only one partner.
    What are the steps to be carried out in order to achieve this objective? Please stress upon the FM parameters to be provided and NACE options to be selected.
    Vish.

    Hello ,
    Your requirement is very simple ,However before posting into sdn please do  a proper search on idoc.
    Now coming to your requirement as of now you have the invoice data coming up.
    1. In the NACE transaction create an output type related with the respective partner data.
    2.Create segments with the required fields and set its status to release.
    3.create  Idoc type and message type ..link the message and segents.
    4.Now link the message type and idoc type .
    5.
    6. Now assign process code to the partner function by defining a logical system and in the process code
    put your custom function module where you put your custom code which will filter and
    cumulate the data coming from the invoice into different fields
    using normal abap code,
    Now once you are done with the abap coding the
    function module has few parameters which you can pass  them as it is .
    control_in need to be passed to Control_out as it is.
    Now fill the segments with the required data and append the segment data to the
    EDI_DATA structure which is a exporting parameter for thefunction module .
    Now once you execute the invoice using this partner function and message type
    system would internally call the custom function module which you have assigned to
    the process code and would create an idoc.
    also go through saptechnical-com site for addition details on idoc creation.

  • Finding out Idoc number of the Invoice List

    Hi!
    how to find out Idoc numberr if I have number of Invoice List?
    For example, I have number of Invoice List for checking it in tcode VF22, but how to get Idoc number of the Invoice List in order to check it in WE02?
    Will reward,
    Mindaugas

    Hi,
         Use NAST with the invoice to get the latest record for that output type..
    use the table CMFP to get the IDOC number..The combination is
    NAST-CMFPNR = CMFP-NR..
    Then in the column CMFP-MSGV1 you can find the idoc number
    <b>Reward points</b>
    Regards

  • Adding fields in EDI output of Invoice List

    Hi!
    I am trying to find out what is a process of adding fields in EDI output of Invoice List...
    I mean that I need to add some extra fields to Invoice lists.
    The information I have is: name of Form, print program and output type.
    I guess I need to modify printing program, is it a correct way to go?
    Hope to avoid modifying of print form...
    Will reward,
    Mindaugas.

    I did not work on invoice list EDI,but i have done invoice.
    First you need to look at segment,if you want to add new fileds in output,then you need to create segment at WE31 Transaction.
    now create idoc type based on invoice idoc type ( WE30) here you need to use ur segment.
    Idoc has function module
    outbound - FM will start IDOC_OUTBOUND_inv*
    Inbound  - FM will Start IDOC_INBOUND_INV*
    in the FM,you will have user exit ,populate ur fields in user exit.
    Configuration :
    1 create or maintain logical system - SALE
    2. Create RFC Destination - Sm59
    3. Create port - WE21 - ( EDI - Port is FILE)
    6.Maintain partner profile - WE20 ( Give all required details like message type,idoc type)
    IDOC Status - WE02 or WE05
    Status Record - WE47
    Change pointer - BD52
    Message type : WE81
    Assign message type to idoc WE82
    finally when you create invoice list and output type medium is 6 then output will go to other system as text file.
    Note : Please maintain message control in Partner profile.

  • Adding new segment in IDOC

    Hi,
           i have a requirement where based on a condition i need to add a new segment dynamically in Inbound IDOC.
    I have written the code in the user exit of the inbound FM. Its adding new segments and process it perfectly.
    But when i see the IDOC in we02 or we19, i am not able to see the newly added segment.
    Will the newly added segment in FM appear in the We02?
    PS: i have changed the idoc_control-maxsegnum.
    Regards,
    Niyaz

    Hi Niyaz,
    Check out the below program ....Similar to your requirement
    IDoc creation from inbound file
    REPORT ZS7BM000006 message-id ZS7.
    */ Program Name: Creation of DESADV & INVOIC IDocs from file E021
    */ Description : This program reads in external file E021 containing
    *                shipping and invoice data from internal vendors and
    *                creates one DESADV and one INVOIC IDoc per invoice.
    */ Transaction : n/a - run from job Z_ccc_S7B_Annnnn, where
    *                'ccc' = 3-digit client and 'nnnnn' = zero-filled
    *                sequence number matching the scheduled job for E020.
    tables:  lfa1,
             lfm1,
             ekpo,
             eine,
             e1edk01,
             e1edk02,
             e1edk07,
             e1edk08,
             e1edk06,
             e1edk03,
             e1edka1,
             e1edka2,
             e1edp07,
             e1edp09,
             e1edp19,
             e1edp01,
             e1edp02,
             e1edp26,
             e1edp04,
             e1eds01,
             e1eds02,
             zst7f_ty_vendors.
    parameters:  p_path like PATH-PATHEXTERN
                       default '/ftp/atac/in/'.
    data:  INFILE LIKE PATH-PATHEXTERN,
           back_path(7) type c value 'backup/',
           offset like sy-fdpos,
           p07_ctr like sy-index,
           invoice_total type p decimals 3,
           d_seg_num like sy-index,
           i_seg_num like sy-index.
    data:  OUTFILE LIKE PATH-PATHEXTERN,
           today(8)     type c.
    data:  begin of uty_vendors occurs 10,
              lifnr like lfa1-lifnr,
              waers like lfm1-waers,
              name_abbr like zst7f_ty_vendors-name_abbr,
              ship_days like zst7f_ty_vendors-ship_days,
           end of uty_vendors.
    data:  iZSS7B21 like ZSS7B21.
    data:  desadvdata like edi_dd occurs 5 with header line.
    data:  invoicdata like edi_dd occurs 5 with header line.
    data:  dedidc like edi_dc occurs 1 with header line.
    data:  iedidc like edi_dc occurs 1 with header line.
    data:  begin of ie021 occurs 10,
            lifnr            like lfa1-lifnr,
            ship_days        like zst7f_ty_vendors-ship_days,
            invoice_no       like e1edk08-vbeln,
            stat             like e1edk01-action,
            po_number(10)    type n,
            po_lineno(5)     type n,
            slip_number      like e1edp09-vbeln,
            shipto_id        like e1edka1-partn,
            vendor_id        like e1edka1-partn,
            endcust_name     like e1edka1-name1,
            cust_partno      like e1edp09-kdmat,  "char 35
            vendor_partno    like e1edp09-matnr,  "char 35
            invoice_qty      like e1edp09-lfimg,
            qty_uom          like e1edp01-menee,
            unit_price       like e1edp01-vprei,
            price_uom        like e1edp01-pmene,
            price_qty        like e1edp01-peinh,
            line_amount      like e1edp26-betrg,
            currency         like e1edk01-curcy,
            etd              like e1edk06-datum, "ship date
            eta              like e1edk06-datum, "delivery date
            ship_id          like e1edk08-traid,
            ship_method      like e1edk08-traty,
            create_date      like e1edk03-datum,
            plant            like ekpo-werks,
           end of ie021.
    data: save_po like ie021-po_number,
          save_line like ie021-po_lineno,
          save_stat like ie021-stat,
          save_invoice like ie021-invoice_no.
    constants: hun_thou type p decimals 5 value '100000',
               thou type p decimals 3 value '1000'.
    *&      DEFINITION:  append_idoc_rec
    *       add a data record to the IDoc internal table
    define append_idoc_rec.
    &1-tabnam = &1-segnam.
    &2_seg_num = &2_seg_num + 1.
    &1-segnum = &2_seg_num.
    shift &1-segnum left deleting leading space.
    append &1.
    clear &1.
    end-of-definition.       " append_idoc_rec
    * MAIN PROCESSING LOOP
    START-OF-SELECTION.
    today = sy-datum.
    * find all internal vendors
    select a~lifnr
           b~waers
           c~name_abbr  c~ship_days
       into corresponding fields of table uty_vendors
         from lfa1 as a
              inner join lfm1 as b
                 on a~lifnr = b~lifnr
              inner join zst7f_ty_vendors as c
                 on a~lifnr = c~lifnr
         where a~ktokk = 'ZZTY' and
               b~ekorg = '7100' and
               c~ship_code = ' '.
    perform init_desadv.
    perform init_invoic.
    concatenate 'SAP' sy-sysid(3) into: iedidc-sndpor, dedidc-sndpor.
    loop at uty_vendors.
      clear ie021. refresh ie021.
      if not uty_vendors-name_abbr is initial.
    * datafiles are received with naming convention:
    * E020_<customer name abbreviation>_UTY
        concatenate p_path 'E021_' uty_vendors-name_abbr '_UTY'
            into infile.
        if not sy-subrc is initial.  "pathname too long
    * Filename too long: &
          message i016 with infile.
          continue.
        endif.
        condense infile.
        OPEN DATASET INFILE FOR INPUT IN TEXT MODE.
        if not sy-subrc is initial.
    *'Cannot open dataset & on &'
          message i013 with infile sy-datum.
          continue.
        else.
          concatenate p_path back_path 'E021_'
              uty_vendors-name_abbr '_UTY' today
                    into outfile.
          if not sy-subrc is initial.  "pathname too long
    * Filename too long: &
            message i016 with outfile.
            continue.
          endif.
          condense outfile.
          OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE.
    * if the datestamped file cannot be created, do not process the
    * input file, because the input file is deleted after processing,
    * and there would be no record of the data.
          if not sy-subrc is initial.
    *'ERROR opening file & for output'
            close dataset infile.
            message i033 with outfile.
            continue.  "process next vendor's file
          endif.
          do.
            read dataset infile into izss7b21.
            case sy-subrc.
              when 0.
                transfer izss7b21 to outfile.
                if izss7b21-datacode = 'T'. "trailer rec
                  perform process_one_vendor using infile.
                  exit.  "process next vendor's file
                endif.
                check: izss7b21-datacode = 'A'. "data rec
                case izss7b21-status.
                  when ' '.  "new
                    ie021-stat = '000'.
                  when 'M'.  "modification
                    ie021-stat = '002'.
                  when 'D'.  "deletion
                    ie021-stat = '003'.
                endcase.
                move-corresponding uty_vendors to ie021.
                move-corresponding izss7b21 to ie021.
                perform convert_po_no using izss7b21-pono_poline
                                   changing ie021-po_number
                                            ie021-po_lineno.
                perform convert_dates using ie021-lifnr
                                            izss7b21-etd
                                            izss7b21-eta
                                            izss7b21-ship_method
                                            izss7b21-create_date
                                   changing ie021-eta
                                            ie021-ship_days.
                perform quantity_conversion
                                    using izss7b21-qty_uom
                                          izss7b21-invoice_qty
                                          izss7b21-unit_price
                                    changing ie021-qty_uom
                                             ie021-invoice_qty
                                          izss7b21-line_amount.
                perform money_conversion
                                    using izss7b21-currency
                                          izss7b21-unit_price
                                          izss7b21-price_uom
                                          izss7b21-line_amount
                                    changing ie021-currency
                                             ie021-price_uom
                                             ie021-price_qty
                                             ie021-unit_price
                                             ie021-line_amount.
                perform SAP_vendor_partno
                                    changing ie021-cust_partno.
                append ie021.
              when 4.  "EOF
                perform process_one_vendor using infile.
                exit.  "process next vendor's file
              when others.
    *ERROR reading dataset & - &
                message i015 with infile sy-datum.
                exit.
            endcase.
          enddo.
          close dataset: infile, outfile.
          delete dataset infile.
        endif.
      endif.
    endloop. "UTY_VENDORS
    *&      Form  process_one_vendor
    *       Pre-processed records from one vendor file are now in the
    *       internal table ie021 - ready to create IDocs
    FORM process_one_vendor using value(infile).
      sort ie021 by invoice_no stat po_number po_lineno.
      loop at ie021.
        if ( ie021-invoice_no <> save_invoice or
             ie021-stat <> save_stat ).
          if sy-tabix > 1.
            perform post_idocs using ie021-stat.
          endif.
          perform idoc_header_segs using ie021-stat.
        endif.
        if ( ie021-stat <> save_stat or
             ie021-po_number <> save_po or
             ie021-po_lineno <> save_line or
             ie021-invoice_no <> save_invoice ).
          if ( sy-tabix > 1 and
               ie021-stat = '000' ).
            perform idoc_poheader_segs.
          endif.
        endif.
        perform idoc_item_segs using ie021-stat.
        save_po = ie021-po_number.
        save_line = ie021-po_lineno.
        save_invoice = ie021-invoice_no.
        save_stat = ie021-stat.
      endloop.
      perform post_idocs using ie021-stat.
    * File successfully processed: &
      message s035 with infile.
    ENDFORM.                    " process_one_vendor
    *&      Form  convert_po_no
    *       Break the PO number & line field into separate fields
    FORM convert_po_no using value(infield)
                       changing po_number like ie021-po_number
                                po_line like ie021-po_lineno.
    data:  cpos like sy-fdpos,
           lpos like sy-fdpos,
           cline(6) type c.
    * if the infield contains a hyphen, assume that the preceding characters
    * represent the po number, if they are numeric. The po line number is
    * assumed to be all numeric characters after the hyphen.
      if infield ca '-'.
        if infield(sy-fdpos) co ' 0123456789'.  "numeric
          po_number = infield(sy-fdpos).
          cpos = sy-fdpos + 1.
        endif.
      else.  "no hyphen - PTY
        if infield(2) = '71'.  "SAP number range
          cpos = 10.
        else.                  "SyteLine number
          cpos = 6.
        endif.
        if infield(cpos) co ' 0123456789'.  "numeric
          po_number = infield(cpos).
        endif.
      endif.
      if not po_number is initial.
        while infield+cpos(1) co '0123456789'.
          cline+lpos(1) = infield+cpos(1).
          lpos = lpos + 1.
          cpos = cpos + 1.
        endwhile.
        shift cline left deleting leading '0'.
        if not cline is initial.
          po_line = cline.
        endif.
      endif.
    * Put out a warning in the job log, but create the IDoc to save the data
      if ( po_number is initial or
           po_line is initial ).
    * PO number - line item conversion failed: &
        message i034 with infield.
      endif.
    ENDFORM.                    " convert_po_no
    *&      Form  convert_dates
    *       Convert ship date to delivery date, if necessary
    FORM convert_dates using value(vendor_no)
                             value(i_ship_date)
                             value(i_delivery_date)
                             value(i_ship_code)
                             value(i_create_date)
                    changing o_delivery_date
                             ship_days.
    data:  ship_date type d.
    * if delivery date not sent, calculate it from ship date plus
    * ship days.
    * Note that this logic could leave delivery date blank,
    * if ship date is not numeric.
      if ( i_delivery_date is initial or
           i_delivery_date co ' 0' ).  "no delivery date sent
        if ( i_ship_date co ' 0123456789' and
             i_ship_date cn ' 0' ).    "ship date sent
    * move the ship date into a date field to add days
          ship_date = i_ship_date.
        elseif ( i_create_date co ' 0123456789' and
                 i_create_date cn ' 0' ).
          ship_date = i_create_date.
        endif.
        if not i_ship_code is initial.
          select single ship_days from zst7f_ty_vendors
                   into ship_days
                  where lifnr = vendor_no
                    and ship_code = i_ship_code.
        endif.
        if not ship_date is initial.
          if ship_days > 0.
            ship_date = ship_date + ship_days.
            o_delivery_date = ship_date.
            shift o_delivery_date left deleting leading ' '.
          endif.
        endif.
      else.  "delivery date sent
        o_delivery_date = i_delivery_date.
      endif.
    ENDFORM.                    " convert_dates
    *&      Form  quantity_conversion
    *       The quantities in the input file are implied 3-decimal,
    *       so need to be converted into a "real" number.
    *       Also, the unit of measure may be 'KP' indicating that the qty
    *       is given in thousands.
    FORM quantity_conversion USING    value(i_UOM)
                                      value(i_invoice_qty)
                                      value(i_unit_price)
                        CHANGING o_uom like iE021-qty_UOM
                                 o_invoice_qty like IE021-INVOICE_QTY
                                 c_LINE_AMOUNT like izss7b21-line_amount.
    data:  f_invoice_qty type f.
    data:  n_invoice_qty like lips-kcmeng.
    data:  f_unit_price type f.
    data:  f_line_amt type f.
    data:  n_line_amt0 type p decimals 0.
      if ( i_invoice_qty co ' 0123456789' and
           i_invoice_qty cn ' 0' ).
        f_invoice_qty = i_invoice_qty.
    * if no extended price is sent, calculate it
        if c_line_amount is initial.
    * the qty is implied 3-dec, the price is still implied
    * 5-dec, and line amount should be implied 3-dec.
          f_unit_price = i_unit_price.
          f_line_amt = ( f_invoice_qty * f_unit_price ) / 100000.
          n_line_amt0 = f_line_amt.
          c_line_amount = n_line_amt0.
          shift c_line_amount left deleting leading space.
        endif.
    * if the invoice qty is per 1000, the implied 3-dec times 1000 equals
    * the unconverted value. Otherwise, divide by 1000 to get the PCE qty
        if i_uom = 'KP'.
          n_invoice_qty = f_invoice_qty.
        else.
          n_invoice_qty = f_invoice_qty / thou.
        endif.
      endif.
      o_uom = 'PCE'.
      if not n_invoice_qty is initial.
        o_invoice_qty = n_invoice_qty.
        shift o_invoice_qty left deleting leading space.
      else.
        clear o_invoice_qty.
      endif.
    ENDFORM.                    " quantity_conversion
    *&      Form  money_conversion
    *       Add the implied decimals and store price-per qty, if
    *       price per 1,000 is sent.
    FORM money_conversion USING    value(I_CURR)
                                   value(i_UNIT_PRICE)
                                   value(i_UOM)
                                   value(i_LINE_AMOUNT)
                          CHANGING o_CURRENCY like ie021-currency
                                   o_PRICE_UOM like ie021-price_uom
                                   o_PRICE_QTY like ie021-price_qty
                                   o_UNIT_PRICE like ie021-unit_price
                                   o_LINE_AMOUNT like ie021-line_amount.
    data:  n_unit_price type p decimals 5,
           n_line_amount type p decimals 3.
    * not all of the vendors send the currency code, so use the vendor
    * master default
      case i_curr(2).
        when 'US'.
          o_currency = 'USD'.
        when 'JP'.
          o_currency = 'JPY'.
        when others.
          o_currency = uty_vendors-waers.
      endcase.
    * unit price is implied 5-dec
      if ( i_unit_price cn ' 0' and
           i_unit_price co ' 0123456789' ).
        n_unit_price = i_unit_price.
        n_unit_price = n_unit_price / hun_thou.
      endif.
    * line price is implied 3-dec
      if ( i_line_amount co ' 0123456789' and
           i_line_amount cn ' 0' ).
        n_line_amount = i_line_amount.
        n_line_amount = n_line_amount / thou.
      endif.
    * 'KP' = price per thousand
      if i_uom = 'KP'.
        o_price_qty = '1000'.
      else.
        o_price_qty = '1'.
      endif.
      o_price_uom = 'PCE'.
      if not n_unit_price is initial.
        o_unit_price = n_unit_price.
        shift o_unit_price left deleting leading space.
      else.
        clear o_unit_price.
      endif.
      if not n_line_amount is initial.
        o_line_amount = n_line_amount.
        shift o_line_amount left deleting leading space.
      else.
        clear o_line_amount.
      endif.
    ENDFORM.                    " money_conversion
    *&      Form  SAP_vendor_partno
    *       replace UTY part number sent by vendor with SAP material no.
    *       from PO line item.
    FORM SAP_vendor_partno changing cust_partno like ie021-cust_partno.
    tables: makt.
    data: partno_sent like makt-maktx.
      partno_sent = cust_partno.
      clear: makt, cust_partno.
      select single matnr from ekpo into cust_partno
             where ebeln = ie021-po_number and
                   ebelp = ie021-po_lineno.
      if sy-subrc is initial.
    *compare material description to part number sent by vendor
        select single maktx from makt into makt-maktx
            where matnr = cust_partno.
        if partno_sent <> makt-maktx.
    * 'Part No. Mismatch: PO & - &, Part sent &, SAP mat.no. &'
          message i031 with ie021-po_number ie021-po_lineno
                            partno_sent makt-maktx.
        endif.
      else.  "PO line not found
    *try to find SAP material number using 20-char catalog no. sent
        select single matnr from makt into cust_partno
            where maktx = partno_sent.
        if not sy-subrc is initial.
    * 'SAP material no. not found for & - PO & - &'
          message i032 with partno_sent ie021-po_number ie021-po_lineno.
        endif.
      endif.
    *if not found, IDoc will go to workflow for missing material no.
    ENDFORM.                    " SAP_vendor_partno
    *&      Form  idoc_header_segs
    *       create internal table entries for header segments.
    *  DESADV:
    *          E1EDK07
    *          E1EDKA1
    *          E1EDK03
    *          E1EDK08
    *          E1EDKA2
    *          E1EDK06
    *  INVOIC:
    *          E1EDK01
    *          E1EDKA1(s)
    *          E1EDK02
    *          E1EDK03(s)
    FORM idoc_header_segs using value(desadv_ok).
    * INVOIC
      clear i_seg_num.
      invoicdata-segnam = 'E1EDK01'.
      e1edk01-action = ie021-stat.
      if ie021-currency(2) = 'US'.
        e1edk01-curcy = 'USD'.
      else.
        e1edk01-curcy = 'JPY'.
      endif.
      invoicdata-sdata = e1edk01.
      append_idoc_rec invoicdata i.
      clear e1edka1.
      invoicdata-segnam = 'E1EDKA1'.
      e1edka1-parvw = 'RE'.
      e1edka1-partn = ie021-shipto_id.
      invoicdata-sdata = e1edka1.
      append_idoc_rec invoicdata i.
      clear e1edka1.
      invoicdata-segnam = 'E1EDKA1'.
      e1edka1-parvw = 'LF'.
      e1edka1-partn = ie021-lifnr.
      e1edka1-lifnr = ie021-shipto_id.
      invoicdata-sdata = e1edka1.
      append_idoc_rec invoicdata i.
      if not ie021-endcust_name is initial.
        clear e1edka1.
        invoicdata-segnam = 'E1EDKA1'.
        e1edka1-parvw = 'WE'.
        e1edka1-name1 = ie021-endcust_name.
        invoicdata-sdata = e1edka1.
        append_idoc_rec invoicdata i.
      endif.
      clear e1edk02.
      invoicdata-segnam = 'E1EDK02'.
      e1edk02-qualf = '009'.
      e1edk02-belnr = ie021-invoice_no.
      invoicdata-sdata = e1edk02.
      append_idoc_rec invoicdata i.
      clear e1edk03.
      invoicdata-segnam = 'E1EDK03'.
      e1edk03-iddat = '012'.
      e1edk03-datum = ie021-create_date.
      invoicdata-sdata = e1edk03.
      append_idoc_rec invoicdata i.
      invoicdata-segnam = 'E1EDK03'.
      e1edk03-iddat = '024'.
      invoicdata-sdata = e1edk03.
      append_idoc_rec invoicdata i.
      check desadv_ok = '000'.
    * DESADV
      clear d_seg_num.
      desadvdata-segnam = 'E1EDK07'.
      e1edk07-action = ie021-stat.
      e1edk07-bolnr = ie021-invoice_no.
      desadvdata-sdata = e1edk07.
      append_idoc_rec desadvdata d.
      clear e1edka1.
      desadvdata-segnam = 'E1EDKA1'.
      desadvdata-sdata = e1edka1.
      append_idoc_rec desadvdata d.
      clear e1edk03.
      desadvdata-segnam = 'E1EDK03'.
      desadvdata-sdata = e1edk03.
      append_idoc_rec desadvdata d.
      clear e1edk08.
      desadvdata-segnam = 'E1EDK08'.
      e1edk08-vbeln = ie021-invoice_no.
      e1edk08-traid = ie021-ship_id.
      e1edk08-traty = ie021-ship_method.
      desadvdata-sdata = e1edk08.
      append_idoc_rec desadvdata d.
      clear e1edka2.
      desadvdata-segnam = 'E1EDKA2'.
      desadvdata-sdata = e1edka2.
      append_idoc_rec desadvdata d.
      clear e1edk06.
      desadvdata-segnam = 'E1EDK06'.
      e1edk06-iddat = '025'.  "document date
      e1edk06-datum = ie021-create_date.
      desadvdata-sdata = e1edk06.
      append_idoc_rec desadvdata d.
      if not ie021-eta is initial.
        clear e1edk06.
        desadvdata-segnam = 'E1EDK06'.
        e1edk06-iddat = '001'.  "delivery date
        e1edk06-datum = ie021-eta.
        desadvdata-sdata = e1edk06.
        append_idoc_rec desadvdata d.
      endif.
      if not ie021-etd is initial.
        clear e1edk06.
        desadvdata-segnam = 'E1EDK06'.
        e1edk06-iddat = '010'.  "ship date
        e1edk06-datum = ie021-etd.
        desadvdata-sdata = e1edk06.
        append_idoc_rec desadvdata d.
      endif.
    ENDFORM.                    " idoc_header_segs
    *&      Form  idoc_poheader_segs
    *       create internal table entries for DESADV PO/item segments
    *          E1EDP07
    FORM idoc_poheader_segs.
    *DESADV
      clear e1edp07.
      desadvdata-segnam = 'E1EDP07'.
      e1edp07-bstnk = ie021-po_number.
      e1edp07-posex = ie021-po_lineno.
      desadvdata-sdata = e1edp07.
      append_idoc_rec desadvdata d.
      p07_ctr = p07_ctr + 1.
    ENDFORM.                    " idoc_poheader_segs
    *&      Form  idoc_item_segs
    *       create internal table entries for PO item segments:
    *          DESADV:   E1EDP09
    *          INVOIC:   E1EDP01        Qtys
    *                    E1EDP02        ref nos. (PO number / line)
    *                    E1EDP19        part numbers
    *                    E1EDP26        amounts
    *                    E1EDP04        taxes
    FORM idoc_item_segs using value(desadv_ok).
    data:  n_line_amt  type p decimals 3.
    *INVOIC
      clear e1edp01.
      invoicdata-segnam = 'E1EDP01'.
      e1edp01-menee = ie021-qty_uom.
      e1edp01-menge = ie021-invoice_qty.
      e1edp01-vprei = ie021-unit_price.
      e1edp01-pmene = ie021-price_uom.
      e1edp01-peinh = ie021-price_qty.
      e1edp01-netwr = ie021-line_amount.
      invoicdata-sdata = e1edp01.
      append_idoc_rec invoicdata i.
      clear e1edp02.
      invoicdata-segnam = 'E1EDP02'.
      e1edp02-qualf = '001'.
      e1edp02-belnr = ie021-po_number.
      e1edp02-zeile = ie021-po_lineno.
      invoicdata-sdata = e1edp02.
      append_idoc_rec invoicdata i.
      clear e1edp19.
      invoicdata-segnam = 'E1EDP19'.
      e1edp19-qualf = '001'.
      e1edp19-idtnr = ie021-cust_partno.
      invoicdata-sdata = e1edp19.
      append_idoc_rec invoicdata i.
      clear e1edp19.
      invoicdata-segnam = 'E1EDP19'.
      e1edp19-qualf = '002'.
      e1edp19-idtnr = ie021-vendor_partno.
      invoicdata-sdata = e1edp19.
      append_idoc_rec invoicdata i.
      clear e1edp26.
      invoicdata-segnam = 'E1EDP26'.
      e1edp26-qualf = '003'.
      e1edp26-betrg = ie021-line_amount.
      invoicdata-sdata = e1edp26.
      append_idoc_rec invoicdata i.
    * dummy tax seg
      clear e1edp04.
      invoicdata-segnam = 'E1EDP04'.
      e1edp04-msatz = '0.00'.
      invoicdata-sdata = e1edp04.
      append_idoc_rec invoicdata i.
      n_line_amt = ie021-line_amount.
      invoice_total = invoice_total + n_line_amt.
      check desadv_ok = '000'.
    *DESADV
      clear e1edp09.
      desadvdata-segnam = 'E1EDP09'.
      e1edp09-vbeln = ie021-slip_number.
      e1edp09-matnr = ie021-vendor_partno.
      e1edp09-vrkme = ie021-qty_uom.
      e1edp09-lfimg = ie021-invoice_qty.
      desadvdata-sdata = e1edp09.
      append_idoc_rec desadvdata d.
    ENDFORM.                    " idoc_item_segs
    *&    Form  post_idocs
    *     create database IDocs from the idocdata tables and clear tables.
    FORM post_idocs using value(desadv_ok).
    *INVOIC
      clear e1eds01.
      invoicdata-segnam = 'E1EDS01'.
      e1eds01-sumid = '010'.
      e1eds01-summe = invoice_total.
      e1eds01-waerq = ie021-currency.
      shift e1eds01-summe left deleting leading space.
      invoicdata-sdata = e1eds01.
      append_idoc_rec invoicdata i.
      CALL FUNCTION 'INBOUND_IDOC_PROCESS'
        TABLES
          IDOC_CONTROL       =  iedidc
          IDOC_DATA          =  invoicdata.
      commit work.
    *DESADV
      if desadv_ok = '000'.
        clear e1eds02.
        desadvdata-segnam = 'E1EDS02'.
        e1eds02-sumid = '001'.
        e1eds02-summe = p07_ctr.
        shift e1eds02-summe left deleting leading space.
        desadvdata-sdata = e1eds02.
        append_idoc_rec desadvdata d.
        CALL FUNCTION 'INBOUND_IDOC_PROCESS'
          TABLES
            IDOC_CONTROL       =  dedidc
            IDOC_DATA          =  desadvdata.
        commit work.
      endif.
      refresh: desadvdata,
               invoicdata.
      clear:
        desadvdata,
        invoicdata,
        p07_ctr,
        invoice_total,
        save_stat,
        save_po,
        save_line,
        save_invoice.
    ENDFORM.                    " post_idocs
    *&      Form  init_desadv
    *       add a DESDAV control record and initialize fields
    FORM init_desadv.
    clear dedidc. refresh dedidc.
    * initialize control record:
    move:  '2'        to  dedidc-direct,
          'DESADV01'  to  dedidc-doctyp,
          'DESADV'    to  dedidc-mestyp,
          'F'         to  dedidc-std,
          'E021'      to  dedidc-stdmes,
          'LS'        to  dedidc-sndprt,
          'TY_VENDORS' to dedidc-sndprn,
          sy-datlo    to  dedidc-credat,
          sy-timlo    to  dedidc-cretim.
    append dedidc.
    ENDFORM.              " init_desadv
    *&      Form  init_invoic
    *       add a INVOIC control record and initialize fields
    FORM init_invoic.
    clear iedidc. refresh iedidc.
    * initialize control record:
    move:  '2'        to  iedidc-direct,
          'INVOIC01'  to  iedidc-doctyp,
          'INVOIC'    to  iedidc-mestyp,
          'MM'        to  iedidc-mescod,
          'F'         to  iedidc-std,
          'E021'      to  iedidc-stdmes,
          'LS'        to  iedidc-sndprt,
          'TY_VENDORS' to iedidc-sndprn,
          sy-datlo    to  iedidc-credat,
          sy-timlo    to  iedidc-cretim.
    append iedidc.
    ENDFORM.              " init_invoic
    REWARD POINTS IF HELPFUL
    Lakshmiraj.A

  • IDOC for Invoices

    Anyone out there able to help with an idoc data list for an invoice list
    output from SAP.
    Record format example
    001 Header-- Shipping/bottler loc 1001 total invoices 2, total qty--50
              005 Ticket/Invoice header --1
                        010 Invoice detail -- item 100-- qty 10
                        010 Invoice detail -- item 200-- qty 20
              005 Ticket/Invoice header --2
                        010 Invoice detail -- item 300-- qty 5
                        010 Invoice detail -- item 200-- qty 15
    For the above format I need which Basic IDOC type can I use?
    Pls help

    Use WE30 for seeing Idoc with segment
    INVOIC01 and INVOIC02
    below link might help you.
    http://www.sapgenie.com/sapedi/idoc_abap.htm
    <b>Reward points</b>
    Regards

  • Benefits Misc. segments of IDOC

    Hi - I am having an issue with the BM segments of the IDOC.  We do not use the Benefits module any longer, and yet there appears a BM segment on the IDOC's for each employee (which is a delimited segment) every time our payroll runs.  We are on R/3 47, and this just started occuring after our last support pack upgrade to HR support pack 55.  We run the payroll for outsourcers (OTMU).  I am not sure why these segments just started appearing after our upgrade.  They did not appear prior to the upgrade. 
    Help???

    I saw the Function module -
    Please look at code at :
    Include program : LVEDFF0R
    FORM REDUCTION_TABLE_CREATE.
      PERFORM IDOC_SEGMENTS_READ.
      PERFORM IDOC_ACTIVE_SEGMENTS_SET.
    ENDFORM.                    " REDUCTION_TABLE_CREATE
    Keep the break point at form routine and debug the the function module
    If you do not know how to do debugging then use following way :
    keep the break point in form routine above as i said
    Create invoice or invoice list
    when you maintain output type in invoice or invoice list -
    Now click on Further data ->select peridoc scheduling-> back and save it.
    Run RSNAST00 Program
    Output application : V3
    Object key : Invoice or invoice list number
    Output type : RD00 or LR00
    Medium = 6(EDI) ,A (ALE)
    when you execute the program and it will goto debugging.
    Thanks
    Seshu

  • Invoice List

    11.11.2008
    Hi Gurus,
    a) Does combining of invoices into invoice lists follow the same requirement that the header details should be same in all the invoices to be combined ?
    My requirement is creation of invoice lists of multiple invoices of  a customer irrespective of the header details i.e Division, Partners, Assignment number .....    These  could be different.  
    Is it possible to combine such invoices???  If so what changes needs to be carried out.???
    b)   Am i right in concluding there is going to be no accounting entry when an invoice list is generated.
    Please share your valuable knowledge.
    Sanjay

    Hi Sanjay
    In Invoice list Payer is same for all invoice ,so for that payer a list of Invoices are sent.
    When Head office of an organisation makes the payment for all its branches, instead of sending individual invoices, an "Invoice list" is sent to the Headoffice (PAYER).
    Invoice list is of two types .They are LR and LG.
    Under LR type Invoice list, all receiviable type of billing document like Invoice(F2) or F1 etc, Debit memo(L2) are listed.
    Whereas under LG type of Invoice list, all payable type of billing documents like Credit memo (G2) and Cancellation(S1) are listed.
    In the billing type (VOFA), you will find a field called "Invoice list type".
    In this field appropriate Invoice list type is filled for respective Billing documents.
    For example, if you go to F2, you will find value LR  as F2 is a receiviable type of Billing document and so on.
    So here, there is no other criterias except PAYER is one for all the branches, that means in the master data head office must have been assigned as their Payer.

  • Invoice List - Calculation of the Billing Date

    Hello,
    I'm facing some problems by setting up the invoice lists in our system. I added a factory calendar to the customer who has to receive invoice lists and the field VBRK-FKDAT_RL is filled so I'm able to create the list.
    My problem now is, that the system will ever use the Billing Date of the Real Invoice also as Billing Date for the Invlice List and if I try to create a list for e.g. four invoices created on four different days I will receive four Invoice Lists instead of one.
    How can I control the billing date for the invoice list so that, e.g. the customer receive an invoice list for every quarter? Or monthly? Or..?
    Thanks in advance for your help.
    Kind regards
    Sascha

    Hello,
    I know this is an old thread, and you were able so solve your problem.
    Neverthless, since I had more or less exactly the same problem and was only able to solve it, for e.g. a weekly periodicity after some try and error, I wanted to present the solution for this invoice list periodicity:
    Valid From      Valid To     Workday           Text
    01.05.2014  06.05.2014    (not checked)    First week May
    08.05.2014  13.05.2014    (not checked)    Second week May
    ... and so on.
    It is important to EXCLUDE the day in the definition of the weekly periods, that the is supposed to be the next available invoice list date, which is then filled in the invoice Header (FKDAT_RL in VBRK) at the time of invoice creation.
    At the same time I have all work days checked in the first screen of factory calendar maintenance.
    Hope this is helpful for people running into the problem.
    Cheers,
    Steffen

  • Problem in filling Custom segment data using User Exit for ZORDERS05

    Hi,
    I am using Process Code SD10 to generate the custom Idoc ZORDERS05.
    The function module used is IDOC_OUTPUT_ORDRSP.
    I am able to succesfully generate the Custom Idoc (VA02->Extras->Header->Edit) but unable to populate the custom segments in the IDOC.
    I have tried to write the code in User Exit EXIT_SAPLVEDC_003 -> ZXVEDU15. But still I'm unable to populate the Z segments.
    Even though I place a break point in the FM or in the User Exit during the generation of Idoc the control doesn't stop in FM nor in the User Exit.
    I am unable to understand how to go about this.
    Can anybody please help me with this?
    Thanks in Adavance,
    Rohan.

    Okay I under what you are speaking about NACE.
    Yes that configuration has been done and I am sucessfully able to generate the IDOC.
    But even though I know that in FM IDOC_OUTPUT_ORDRSP, I have to write code in User Exit EXIT_SAPLVEDC_003 to populate the Z segments; I'm unable to understand y the control doesn't pick the FM and Exit.
    Right now I have code in the Exit to fill Z segments.
    Thanks
    Rohan.

  • How to fill the segment name field in a data record

    Hi All,
    I am using pure java (jco) (not XI) to send idoc to R3. I know how to check the definition of Idoc type by using Tcode - we30, we05, BD......
    I am wondering if someone on this forum has the onhand experience about the following question:
    The "segment name" field in a data record should be filled with "Segment type" or "Segment Name". Sounds silly? huh? But this question is not always clear for me.
    For instance, E1MBXYH - Goods movements for Mobile data entry.
    There are three versions - E2MBXYH, E2MBXYH001 and E2MBXYH002.
    Should I use "E1MBXYH" or one of E2MBXYH, E2MBXYH001 and E2MBXYH002?
    I appreciate that you could give me a clear explanation.

    The EAN / UPC fields are part of the material master .. So if you hahve this fileds filled in MM02 , then automatically these fileds are taken where ever the material Number is referenced

  • Optional Segments in IDocs

    How do Optional segments in Idocs gets triggered ? Iam generating Idocs on R/3 Side and optional segments seems to be not getting created when I see on WE05 Tcode.
    My Question is does these segments will be created automatically if there is a data ?
    Please clarify

    Hi Ram,
    There needs to a specific coding for filling the segments be it optional or anyother. I believe the filling of the segment is being done in SAP R/3 and there might not be a code to fill these optional segments.
    Just simply write a code where you are filling other segmemts for the IDoc in case it's not there and it should work.
    Hope this helps.
    Nishant
    Message was edited by: Nishant Rustagi

  • EDI Invoice List

    Hello,
    Has anyone tried sending Invoice List via EDI?
    Does it work well?
    I noticed that it uses the same IDOC Type as a regular EDI Invoice (INVOIC02).
    The IDOC however does not generate E1EDP01segments.
    Is this standard behavior or am I missing something to get this to work correctly?
    Thanks,
    Anisha.

    Hai Anisha,
    Through MAIL output  type, the system will automatically sends to the customer mail while the invoice was generated.
    Revert for any.
    Kalyan

  • Invoice list cancellation-Srinivas Adavi Please check

    Hi all,
    When the invoice list(VF23) is cancelled the field vbrk-fksto should be set to x but its not updating this field.
    Could anybody tell me what the problem is? and for normal invoice(VF03) the flag is updated correctly.
    Thanks,
    Saichand
    Message was edited by: Sai Chand Pullepu

    Hi,
    the BDC code for the VF26 is.
    *       CLASS LCL_BDC DEFINITION
    *       For BDC Table Population
    class lcl_bdc definition.
      public section.
        methods:  bdc_dynpro              "Fill Dynpro Info
                      importing
                        i_program type bdcdata-program
                        i_dynpro  type bdcdata-dynpro,
                   bdc_field             "Fill Field Info
                     importing
                       value(i_fnam) type any "BDCDATA-FNAM
                       value(i_fval) type any,"BDCDATA-FNAM,
                   call_fun             "Call Transaction
                     importing
                       i_tcode type tstc-tcode.
    endclass.                    "LCL_BDC DEFINITION
    *       CLASS cl_bdc IMPLEMENTATION
    *          For BDC Table Population
    class lcl_bdc implementation.
    *--Fill Dynpro Data
      method bdc_dynpro.
        clear wa_bdcdata.
        wa_bdcdata-program  = i_program.
        wa_bdcdata-dynpro   = i_dynpro.
        wa_bdcdata-dynbegin = 'X'.
        append wa_bdcdata to it_bdcdata.
      endmethod.                    "BDC_DYNPRO
    *--Fill Screen Fields
      method bdc_field.
        clear wa_bdcdata.
        wa_bdcdata-fnam = i_fnam.
        wa_bdcdata-fval = i_fval.
        append wa_bdcdata to it_bdcdata.
      endmethod.                    "BDC_FIELD
    *--Call Transaction
      method call_fun.
        data : v_mode,l_msg(100).
        refresh it_messages.
        v_mode = 'N'.
        call transaction i_tcode using it_bdcdata
                         mode   v_mode
                         update 'S'
                         messages into it_messages.
        if not it_messages[] is initial.
          clear it_msg. refresh it_msg.
          loop at it_messages into x_messages.
            call function 'FORMAT_MESSAGE'
              exporting
                id        = x_messages-msgid
                lang      = x_messages-msgspra
                no        = x_messages-msgnr
                v1        = x_messages-msgv1
                v2        = x_messages-msgv2
                v3        = x_messages-msgv3
                v4        = x_messages-msgv4
              importing
                msg       = l_msg
              exceptions
                not_found = 1
                others    = 2.
            if sy-subrc <> 0.
            endif.
            x_msg-msg = l_msg.
            append x_msg to it_msg.
            clear x_msg.
          endloop.
        endif.
                x_msg-msg = l_msg.
              append x_msg to it_msg.
              clear x_msg.
            endloop.
        endif.
      endmethod.                    "CALL_FUN
    endclass.                    "LCL_BDC IMPLEMENTATION
    *--Create the Object Reference
        data:   o_bdc type ref to lcl_bdc.
    *--Creating the Object
        create object o_bdc.
        refresh it_bdcdata.
    *--Fill the BDC dynpro
        call method o_bdc->bdc_dynpro
          exporting
            i_program = 'SAPMV60A'
            i_dynpro  = '0202'.
    *--Fill the screen Fields
        call method o_bdc->bdc_field
          exporting
            i_fnam = 'BDC_OKCODE'
            i_fval = '=SICH'.
    *--Fill the Screen fields
        call method o_bdc->bdc_field
          exporting
            i_fnam = 'RV60A-SELKZ(01)'
            i_fval = 'X'.
        call method o_bdc->bdc_field
          exporting
            i_fnam = 'KOMFK-VBELN(01)'
            i_fval = p_vbeln.
    **--Fill the BDC dynpro
        call method o_bdc->bdc_dynpro
          exporting
            i_program = 'SAPMV60A'
            i_dynpro  = '0202'.
    *--Fill the screen Fields
        call method o_bdc->bdc_field
          exporting
            i_fnam = 'BDC_OKCODE'
            i_fval = '=BACK'.
    *--Call the Transaction
        call method o_bdc->call_fun
          exporting
            i_tcode = 'VF26'.
      endmethod.                    "EXECUTE_VF26
    Regards
    vijay

Maybe you are looking for