Creation of po with mutiple line items using BDC

Hi Gurus,
      Can any body hav notes for creating po's using BDC with multiple line items in transaction ME21. I hav created po for single line item but if i tried to create multiple line items, it ll create multiple po's...
thanks in advance
arun

See the Below Logic for me22 and it is also same for me21
report zpochange.
data : i_error like bdcmsgcoll occurs 0 with header line.
data : i_bdcdata like bdcdata occurs 0 with header line.
tables : ekko, ekpo.
data :c1(10) value 'ME22',
      c2(1) value ',',c3(10).
data : var1(20). " LIKE EKKO-EBELN.
data : var2 like ekko-ebeln.
data : begin of i_ekko occurs 0,
          header(2),
          ebeln like ekko-ebeln,
          end of i_ekko.
data : begin of i_ekpo occurs 0,
item(2),
        ebeln like ekpo-ebeln,
        ebelp like ekpo-ebelp,
        menge(10), " LIKE EKPO-MENGE,
       end of i_ekpo.
data : v like ekpo-ebelp.
data: begin of itab occurs 0,
         text(300),
        end of itab.
parameters: p_file like ibipparms-path.
*PARAMETERS: PONUMBER LIKE EKPO-EBELN.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
  exporting
    program_name        = syst-cprog
    dynpro_number       = syst-dynnr
   FIELD_NAME          = ' '
  importing
    file_name           = p_file
start-of-selection.
*SELECT EBELN FROM EKKO INTO TABLE I_EKKO WHERE EBELN = PONUMBER.
      SELECT EBELN EBELP MENGE FROM EKPO INTO TABLE I_EKPO WHERE EBELN
*= PONUMBER.
perform get_data.
*LOOP AT ITAB.
WRITE :/ ITAB.
ENDLOOP.
loop at itab.
var1 = itab-text+0(1).
if var1 = 'H'.
*I_EKKO-EBELN = ITAB-TEXT.
split itab at c2 into i_ekko-header
                       i_ekko-ebeln.
SPLIT  ITAB AT ',' INTO I_EKKO-EBELN.
                    " I_EKPO-EBELP
                    " I_EKPO-MENGE
                    " var1.
append i_ekko.
else.
split itab at c2 into i_ekpo-item
                        i_ekpo-ebeln
                        i_ekpo-ebelp
                        i_ekpo-menge.
append i_ekpo.
endif.
*var2 = i_ekpo-ebeln.
  MOVE VAR1 TO I_EKPO-EBELN.
  MOVE VAR1 TO I_EKKO-EBELN.
APPEND: I_EKPO.
*if not var1 is initial.
    split var1 at ',' into i_ekpo-ebelp
                           i_ekpo-menge.
  i_ekpo-ebeln = var2.
append i_ekpo.
*endif.
endloop.
loop at i_ekpo.
write :/ i_ekpo.
endloop.
loop at i_ekko.
perform fill_data. " TABLES I_EKPO.
endloop.
LOOP AT I_EKPO.
WRITE :/ I_EKPO.
ENDLOOP.
*&      Form  GET_DATA
      text
-->  p1        text
<--  p2        text
*LOOP AT I_ERROR.
WRITE :/ I_ERROR.
ENDLOOP.
form get_data.
call function 'WS_UPLOAD'
exporting
   codepage                      = ' '
   filename                      = p_file
   filetype                      = 'ASC'
   headlen                       = ' '
   line_exit                     = ' '
   trunclen                      = ' '
   user_form                     = ' '
   user_prog                     = ' '
   dat_d_format                  = ' '
IMPORTING
  FILELENGTH                    =
  tables
    data_tab                      = itab
exceptions
   conversion_error              = 1
   file_open_error               = 2
   file_read_error               = 3
   invalid_type                  = 4
   no_batch                      = 5
   unknown_error                 = 6
   invalid_table_width           = 7
   gui_refuse_filetransfer       = 8
   customer_error                = 9
   others                        = 10
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
         with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform.                    " GET_DATA
*&      Form  FILL_DATA
      text
     -->P_I_EKPO  text
form fill_data. " tables   i_ekpo .
perform bdcscreen using 'SAPMM06E' '0105'.
perform bdcfield using 'RM06E-BSTNR' i_ekko-ebeln.
perform bdcfield using 'BDC_OKCODE' '/00'.
loop at i_ekpo where ebeln = i_ekko-ebeln.
  V = I_EKPO-EBELP.
perform bdcscreen using 'SAPMM06E' 0120.
perform bdcfield using 'BDC_CURSOR' 'RM06E-EBELP'.
perform bdcfield using 'RM06E-EBELP' i_ekpo-ebelp.
perform bdcfield using 'BDC_OKCODE' '/00'.
perform bdcscreen using 'SAPMM06E' 0120.
perform bdcfield using 'BDC_CURSOR' 'EKPO-MENGE(01)'.
perform bdcfield using 'RM06E-EBELP' i_ekpo-ebelp.
perform bdcfield using 'EKPO-MENGE(01)' i_ekpo-menge.
perform bdcfield using 'BDC_OKCODE' '/00'.
*PERFORM BDCSCREEN USING 'SAPMM06E' 0120.
*PERFORM BDCFIELD USING 'BDC_CURSOR'  'RMO6E-EBELP'.
*CLEAR V.
endloop.
perform bdcfield using 'BDC_OKCODE' '=BU'.
call transaction  c1 using i_bdcdata mode 'A'
                                   messages into i_error.
refresh i_bdcdata.
endform.                    " FILL_DATA
*&      Form  BDCSCREEN
      text
     -->P_0140   text
     -->P_0120   text
form bdcscreen using    p_program p_screen.
i_bdcdata-program = p_program.
i_bdcdata-dynpro = p_screen.
i_bdcdata-dynbegin = 'X'.
append i_bdcdata.
clear i_bdcdata.
endform.                    " BDCSCREEN
*&      Form  BDCFIELD
      text
     -->P_0145   text
     -->P_I_EKPO_EBELN  text
form bdcfield using    fnam fval.
i_bdcdata-fnam = fnam.
i_bdcdata-fval = fval.
append i_bdcdata.
clear i_bdcdata.
endform.                    " BDCFIELD
Reward Points if it is helpful
Thanks
Seshu

Similar Messages

  • How to input FI invoice with many line items using FB60

    Dear All,
    Currently the users are posting document consisting of 500 to 700 line items every period using transaction FB60. The line items that are posted every period are not repetitive in nature. It is consuming lot of time.
    Is there any efficient (simpler) way of posting the document with so many line items? could you please share your thoughts in this regard?
    Thanks & Regards
    Vasu

    Hi Vasu,
    Try to do a recording for a BDC program with Tcode SHDB.
    Then ask your ABAPer to developa program with this BDC recording.
    This will fix the purpose.
    Thanks,
    Srinu.

  • Standard text entry for Service line items using BDC

    Hi,
         I want to enter standard texts for service line items of RFQ created using BDC, if it is a line item i can pass RFQ_number+line_item number as TDNAME in SAVE_TEXT function module, but for Service line item what value we need to pass in TDNAME.
    Is there anyway we can capture the package number in BDC of ME41?
    Regards
    Bala Krishna

    .

  • Create ecatt script for one sales order creation with multiple line items

    Hi ,
    I want to create a ecatt script for one sales order creation with multiple line items. Preferably SAP GUI.
    This selection of data will be from an external file/ variants which will have only one row of data in it.
    Firstly: I have to sort the external file having same PO Numbers in an order.Group them together.
    Second: I have to create sales order for those many line items having same PO Number.
    Best Regard
    Taranum

    Hi Micky
    Firstl you should upload the Line items for a particular sales Order in an Internal table
    and then pass that internal table to your BAPI during your coding corresponding to a particu;lar sales order
    In case of any issues pls revert back
    Reward points if helpful
    Regards
    Hitesh

  • Service entry sheet creation thru bapi for multiple line items

    HI All,
    WE are using BAPI_ENTRYSHEET_CREATE bapi for the creation of service entry sheet against service PO.
    We are able to create the service entry sheet successfully with single sevice line item using this bapi,but when we are going for multiple service line items in item services tab in aPO, we are able to create the service entry sheet with only one service line item although there are 4 service line items in the item service tab in the po.
    We know that this bapi cannot support more than one po line item as it has provision for only one line item at the header leavel in the bapi
    will be rewarded for the best solution.
    Regards,
    velu

    Hi,
    Do you know the note 420334?. There you have very useful information.
    Best Regards,
    Arminda Jack

  • Creating POs with multiple line items

    Hi,
    Is it possible to create a PO with multiple line items from the Sharepoint. The developer guide shows sales order creation with a single line item. If yes, please let me know how it can be done.
    Thanks,
    Pranil

    Hi Pranil,
    You can achieve the user case to create a PO with multiple line items in 1 step by creating a custom solution UI in SharePoint. This is not possible if you simply use the out of box UI (as depicted in the guide).
    It depends on how to define the ESR data type. You can create a data type with header details of PO and collection of items with cardinality as 0..n and create a complex BDC model using SPD --> then create a custom UI.
    Other option would be keep it as 2 lists (2 step action). First create a PO header and then add item by item in 2 steps as foreign key relationship. You can see the example of Account and Activity in pre-shipped contents to get an idea.
    Thanks,
    Girimurugan

  • Order creation logic how to pass line items

    experts
    i have the following data in iternal table itab.
    po number ,customer number, matnr,quantity ,order date.
    1212838383  7494749  8383938833   20  20032009
    1212838383  7494749  8383938832   10  20032009
    1212838382  7494749  8383938833   20  20032009
    1212838384  7494745  8383938823   30  22032009
    1212838384  7494745  8584858588   05  22032009
    now i want to populate this data into idocs orders segement .
    for all po the customer will be the same and i need to create one order for that.
    in the above data first 2 lines have same po so i need to create order with 2 line items.
    sales org,division,distribution channnel,ordertype will be same for all the records.
    loop at itab into workarea.
    at new po. "for same po, same header data so i am using AT NEW
    edi_dd40-segnum = 1.
    edi_dd40-segnam = 'E2EDK14 '.
    edi_dd40-mandt = sy-mandt.
    edi_dd40-psgnum = psgnum.
    e2edk14-qualf = '008' .
    e2edk14-orgid = 'NN21.
    MOVE e2edk14 TO edi_dd40-sdata.
    append edi_dd40 to itab_output.
    edi_dd40-segnum = 1.
    edi_dd40-segnam = 'E2EDK14 '.
    edi_dd40-mandt = sy-mandt.
    edi_dd40-psgnum = psgnum.
    e2edk14-qualf = '006' .
    e2edk14-orgid = 'ni.
    MOVE e2edk14 TO edi_dd40-sdata.
    append edi_dd40 to itab_output.
    endat.
    now the item data comes , so i need to create items with same po.and afetr this i need to submit this data to fm before another diffent  po comes.below same customer and po so need to consider as one sales order and submit to fm.
    item1  1212838383  7494749  8383938833   20  20032009
    item2  1212838383  7494749  8383938833   20  20032009
    call function 'MAST_IDOC_DISTRIBUTE'
    My concern is how to tell to the system for the same po create the order with multipl line items , do i need to use to AT NEW
    or some other commands above?
    endloop.

    i have used at end of po. but my matnr is becoming *************. no date is showing in the internal table while populating the matnr to segments.
    Loop at itab into workarea.
    at end of po.
    here i am filling the matnr to the segment. here  workarea-matnr is showing ***********  only stars,
    endat.
    endloop.
    If i remove the at end of po , then the matnr is comming .
    Please sugggest me what to do.
    my fields sequence are like this.
    kunnr " customer
    bstnk "po
    matnr " material
    currency
    kwmeng "order quantity
    podate
    orderdate
    so how to handle this please suggest.

  • Confirmation of service PO with multiple line item

    Hi SAP Experts,
    We are using SRM 7EhP1(classic scenario).
    I have a question regarding confirmation of service shopping carts/POs with several line items.
    We created a SC (and successively a PO) with N service positions.
    When we try to create a SRM confirmation, it seems that we can only confirm one position at a time.
    For material SC, in the list of SCs open for confirmation we have a line for each shopping cart, and you can create a single confirmation for the whole shopping cart.
    On the contrary, for service SC we have a line for each SC line. In this case, we cannot process all the lines in a single confirmation, but we need to create multiple confirmations.
    Is that correct? Is there a way to confirm at the same time all the service positions of the SC?
    Thanks!
    Cinzia

    Hello Cinzia,
    Regarding creating service confirmations we can create only one confirmation for one line item of SC. If there are N line items we have to create N confirmations. This is because activation of Service bundling switch in SRM and this switch is irreversible. This switch is a facility/convenience for SRM PO's replicated to ECC to view all service line items in ECC without bundling. This scenario happens for both Service and Limit items.
    I hope service bundling switch in your SRM system 7 EHP1 is activated.
    There is no other way to create service confirmations for all items at one go.
    We do have this inconvenience and raised this concern with SAP and no reply.
    Hope, this answers your question.
    Best Regards,
    Kalyan

  • How to Restrict Single Delivery Date for PO with Multiple Line Items

    Dear Experts,
    How to Restrict Single Delivery Date for PO with Multiple Line Items.
    System needs to through Error Message if User Inputs Different Delivery Dates for PO with Multiple Line Items in ME21N Tcode.
    Can we achive this by Some Enhancement in SAP or Not ???
    If so how to do it.
    Any Inputs is highly appreciated.
    Thanks and Regards,
    Selvakumar. M

    Hi Selvakumar,
    we can resrict the PO to have a single delivery date in all the line items by means of giving a error message or overwiting the delivery date keyed/determined in the line item.
    You can use the BADI -> ME_PROCESS_PO_CUST. In which you need to implement the method PROCESS_SCHEDULE.
    (for technical aid - This method will be called for each and every PO line item, From the imporing parameter im_schedule we can get all the details of current PO line, even we can change the data in the current PO line. )
    Regards,
    Madhu.

  • The report in FI which contains Quantity field with every line item

    Hi Gurus,
    What are the reports in Finance which contains Qty field with every Line Item reports & reports that contains user name & System Id in it along with other informations e.g. G/L, Ar, AP
    Thanks & Regds,
    Santosh Rothe

    Hi
    Using the line item display report you can get the required details by changing layout in the output:
    FBL1N: Vendor line item
    FBL3N: G/L line item
    FBL5N: Customer line item
    VVR

  • Certificate of Origin with multiple line items in sapscript - Urgent Please

    Hi Everyone,
    Can you please help me with this issue in SAPSCRIPT.
    This is for billing document with multiple items with each line item with different country of origin.Right now the form is printing only one country of origin even if it has 3 line items each with different country.It's getting first line item's country and printing......but it should diplay each country with comma separated... But in debug it is showing all 3 different countries but in print it is printing only first country of origin.
       I have given text element as &VBDKR-TEXT& in form.
    In ABAP program I am getting country of origin like this,
    CLEAR : V_T005,VBRP , MARC  .
      LOOP AT TVBDPR.
      SELECT SINGLE * FROM VBRP
        WHERE VBELN = VBDKR-VBELN AND POSNR = TVBDPR-POSNR .
    begin of addiiton for ppr 13661
      CLEAR MCH1.
    SELECT SINGLE HERKL FROM MCH1 INTO MCH1-HERKL WHERE MATNR = VBRP-MATNR
                                           AND CHARG = VBdpR-CHARG.
      IF MCH1-HERKL NE ' '.
        CLEAR MARC-HERKL.
        MARC-HERKL = MCH1-HERKL.
      ELSE.
        NAME = VBDKR-VBELN.
          PERFORM HEADER_TEXT1 USING 'VBBK' 'Z065' NAME SY-LANGU.
        IF SY-SUBRC EQ 0.
          READ TABLE TEXT_LINES INDEX 1 .
          IF SY-SUBRC EQ 0.
            VBDKR-TEXT = TEXT_LINES-TDLINE.
          ENDIF.
        ELSE.
          SELECT SINGLE * FROM MARC WHERE MATNR = VBRP-MATNR
                                    AND   WERKS = VBRP-WERKS.
        ENDIF.                                                  "ppr 13661
      ENDIF.                               "PPR 13661 ADD
      CLEAR *T005T.
    data:SEP(3) VALUE ' , '.
    DATA: BEGIN OF ITAB OCCURS 100,
           LANDX LIKE VBDKR-TEXT,
          END OF ITAB.
    clear ITAB.
      SELECT  LANDX FROM T005T INTO table itab WHERE SPRAS = SY-LANGU  AND
    LAND1 = MARC-HERKL.
    LOOP AT itab.
    VBDKR-TEXT = ITAB-LANDX.
    *MOVE VBDKR-TEXT TO ZLAND.
    AT NEW LANDX.
       concatenate ITAB-LANDX sep into VBDKR-TEXT.
    ENDAT.
    modify ITAB.
    VBDKR-TEXT = ITAB-LANDX.
    ENDLOOP.
    endloop.
    Thanks in advance.

    Hi
    It depends on the size of the main in the page, you can set the high of main in order to print max a certain number of rows (so items).
    In this way you don't need the abap control, but the system automatically will print the first page with 15 row and the next with 25

  • Unable to create PO with multiple line items through LSMW-BAPI method

    Hi All,
    I have a requirement of creating PO through LSMW. I can't use LSMW standard batch input program since there are some fileds not available and also it has many limitations. I'm using LSMW-BAPI method ( Business object BUS2012) which create IDOC and uses BAPI_PO_CREATE1 to ultimately post the PO in the system. I am trying to create PO from a single file which contains both Header and Item data.
    Now my problem is that everytime PO is being created with Single line item only. Everytime I am giving multiple item data in the source file LSMW is preparing multiple IDOCs for multiple line items. As per my understanding this is happenng since header and item is in the same hierarchy level of IDOC type PORDCR102 and the control record is inserted for every line item in the source file.
    It seems that through LSMW-BAPI  it is not possible to create PO with multiple line items. Can anybody provide some input regarding this? Thanks in advance.
    BR,
    Atanu Mukherjee

    Solved by myself.
    Earlier the problem was that LSMW was not being able to recognize items under same header. It was creating new IDOCs every time it gets a new item. To enable this we need to create two structure HEADERDATA and ITEMDATA.  Two additional identifier fields with identifier value 'H' and 'I' should be added in these two structures respectively. Then we need one sequential file with the identifiers field followed by the header and Item data. Example:
    H~header data
    I~item data
    I~item data 
    This would help the standard program to understand what are the items under same header and ultimately create PO with multiple line items.
    BR,
    Atanu Mukherjee

  • FS10N balance not tie with FBl3N line item totals

    Hi
    I searched the forum for posting on FS10N and FBL3N incorrect balances and I did not any post appropriate for my issue. Hence I am posting my issue here.
    For a particular month, say 072010, FS10N GL balance does not tie with FBL3N line item totals. I am not sure why. In our case, we did not archive any line items and this is not related to year end carry forward. Year beginning GL balances look fine. We dont have any negative postings. Only few GL balances are off. We are using 4.7 version.
    Do you know why this inconsistency and how to rectify it? Is there any program which I run apart from Yead End carry forward?
    any ideas really appreciated.
    Thanks

    Hello
    We have already this trouble.
    To correct it you need to proceed like this (when NewGL is not activate, with new Gl there is one new programm)
    Without newGL
    - Block account to be posted (transaction FS00 Block for posting in the company view)
    - Delete open item, by using the programm RFSEPA03 (you need to adapt it by a copy because if you don't you can't run it), also this programm will unflag your account in the company view
    - Delete line item by the standrd program RFSEPA04
    - Create the line item by the standard program RFSEPA01
    - if this account is managed by open item, run the programm RFSEPA02 (you need to do the same adjustement of the RFSEPA03)
    With NewGL, there is something new. the program RFSEPA02 is linked with a new transaction and you don't have to adjust it FAGL_ACTIVATE_OP. The difference is when you create the open item, you have to define the default profit center and default value depending of the customizing of the leading ledger.
    BBest regards
    Philippe,
    Thanks for the rewards.

  • F-44 clearing with multiple line item

    Hi All,
    When I am trying to clear 24 invoices of one vendor with payment line item in f-44, in simulation mode it is showing only the last line item amount but when posting the same it is clearing all the invoices. Just need to clarify if it is correct or during simulation mode it should saw the total amount of all the invoices.
    eg. I make payment of Rs 1000 against 24 invoices of one vendor. In Simulation mode it shows Rs 150 of last line item (one invoice)
    Thanks in advance...
    Anish

    Why you want to pay and then clear?
    What transaction code you are using for payment?
    Why do not you use F-58, it will pay, clear and print the cheque also.

  • Adding a new schedule line for a line item using bapi_po_change

    hi experts,
    can i know how to add a new schedule line for a line item using<u> bapi_po_change</u>. what are the parameters that need to be filed. i filled poitem with total quantities and poschedule table with 2 different schedule lines and passing as the parameter.but then i get the error saying item 0000 doesnt exist

    Hi,
    Please check if you have properly populated the following fields in POSCHEDULE:
    PO_ITEM
    SCHED_LINE
    and the other fields required for your schedule line such as delivery date and quantity, etc.
    After that, make sure to properly populate fields in POSCHEDULEX:
    PO_ITEM -> same value as found in POSCHEDULE
    SCHED_LINE -> same value as found in POSCHEDULE
    All other values populated in POSCHEDULE should be ticked as 'X' in POSCHEDULEX.
    Kind Regards,
    Darwin
    Kind Regards,
    Darwin

Maybe you are looking for

  • Ldap Synch Error in attribute conversion operation Issue in OIM 11g R2 PS1

    Hi All, We have enabled LDAP Synch in OIM11g R2 PS1 environment. We have requirement of users getting created through Web Services. When we create a user through Webservices, and provide all the attributes required to create user then we are getting

  • New MX892 Scan to PDF

    While researching printers to replace my worn out MX700, I thought that I remembered seeing something about "SCAN TO PDF" ability on the MX892.  So far, I have had to scan to my computer thru Adobe Elements, then "print" to a PDF file. Is there a mor

  • T540p - "optimize battery lifespan" option is missing in Power Manager / Win7

    Hello, I have a strange issue with Energy Manager on my T540p / Windows 7 Ultimate Energy Manager 6.64.2 / System Setting German In The Battery Maintainance Window the "middle Option" "optimize Battery Lifespan" is missing You can see the empty space

  • BADI Upgrade Error

    Hi,    I am facing an issue in upgrading the Custom BADI from 4.7 to ECC6.  In the SPAU i am getting the Green Light for all the Custom BADI's but when I tried to do Adjust modification, it is asking for Enhancement Implementation.  I don't know how

  • Campaign and emailform :file export

    Hi, Working on CRM 7.1.Im creating emailform with usage type as 'file export',now only attributes are available.I need to include text elements,images,subject of the emailform.Can I achieve this by implementing Badi: Maintain Additional Attributes fo