cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with 'BAPI_ENTRYSHEET_CREATE' - Mass Upload

Mahmoud-Farag
Participant
0 Kudos
317

Dears,

I have Issue with BAPI_ENTRYSHEET_CREATE that I need help with,
I have create a program for mass upload sheet for Creating Entry Sheet, by uploading PO , Item, Service Item. every thing goes well, and entry sheet created successfully.
The Issue is: sometimes the same PO Item have the same service many times with different Gross price and Network.
The custom program behaver is take the first service line`s (Gross price & Network) and replicate it to the other service lines.
which is not correct as the service lines are found many time with different networks.
However Tcode: ML81N could handle this by select the item service, and everything goes well with standard.
but the custom program, I can not found the way to handle this.

Appreciate any support with this matter.
Thanks
Mahmoud

raymond_giuseppi
Active Contributor
0 Kudos

How do you fill ENTRYSHEETSERVICES itab?

  • Could you post relevant part of the code
  • 'Service lines are assigned to the outline levels via the fields PCKG_NO (of the service line) and SUBPCKG_NO (of the outline level)
Mahmoud-Farag
Participant
0 Kudos

  CALL FUNCTION 'BAPI_PO_GETDETAIL'
      EXPORTING
        purchaseorder    ws_po
        items            'X'
        services         'X'
      IMPORTING
        po_header        wa_po_header
      TABLES
        po_items         po_items
        po_item_services po_services
        return           bapi_return_po.
*    BREAK-POINT.
    "------------------------------------------------------------
    IF line_existspo_items[ po_item wa_file2-ebelp ] )..
      pckg_no po_items[ po_item wa_file2-ebelp ]-pckg_no.
      IF line_existspo_services[ pckg_no pckg_no ] )..
        sub_pckg_no =  po_services[ pckg_no pckg_no ]-subpckg_no.
      ENDIF.
    ENDIF.
    "------------------------------------------------------------
*
    wa_header-po_number wa_file2-ebeln.
    wa_header-po_item wa_file2-EBELP.
    wa_header-short_text wa_file2-short_text.
    wa_header-doc_date wa_file2-doc_date.
    wa_header-post_date wa_file2-post_date.
    wa_header-begdate wa_file2-begdate.
    wa_header-enddate wa_file2-enddate.
    wa_header-acceptance wa_file2-acceptance.
    wa_header-pckg_no 1.
    wa_header-pckg_no pckg_no.

    serial_no 0.
    line_no 1.
*
    bapi_esll-pckg_no 1.
    bapi_esll-pckg_no pckg_no.
    bapi_esll-line_no line_no.
    bapi_esll-outl_level '0'.
    bapi_esll-outl_ind 'X'.
    bapi_esll-subpckg_no 2.
    bapi_esll-subpckg_no sub_pckg_no.
    APPEND bapi_esll.

    "------------------------------------------------------------
    DATAext_line LIKE wa_file-line_no.
    LOOP AT it_file INTO wa_file WHERE ebeln wa_file2-ebeln AND  ebelp wa_file2-ebelp.

      IF line_existspo_services[ ext_line wa_file-line_no ] )..
        wa_po_services =  po_services[ ext_line wa_file-line_no  pckg_no sub_pckg_no ] .
      ENDIF.
      line_no line_no + 1.
      ext_line ext_line + 10.
      CLEAR bapi_esll.
 MOVE-CORRESPONDING wa_po_services TO bapi_esll.
* bapi_esll-gr_price = '456'.
      bapi_esll-pckg_no 2.
      bapi_esll-pckg_no sub_pckg_no.
      bapi_esll-ext_line =  ext_line  .
      bapi_esll-line_no line_no.
*      bapi_esll-PLN_LINE = line_no.
      bapi_esll-service wa_po_services-service.
      bapi_esll-quantity wa_file-quantity.
      bapi_esll-quantity wa_po_services-quantity.
      bapi_esll-subpckg_no wa_po_services-subpckg_no.
*      bapi_esll-quantity = 1.
      CLEARbapi_esll-gr_price ." = wa_po_services-gr_price.
      CLEARbapi_esll-price_unit ."= wa_po_services-price_unit.

      APPEND bapi_esll.
    ENDLOOP.


    CALL FUNCTION 'BAPI_ENTRYSHEET_CREATE'
      EXPORTING
        entrysheetheader   wa_header
*       testrun            = 'X'
      IMPORTING
        entrysheet         ws_entrysheet_no
      TABLES
*       ENTRYSHEETACCOUNTASSIGNMENT =
        entrysheetservices bapi_esll
*       entrysheetsrvaccassvalues = i_service_acc
        return             i_return
*       entrysheetservicestexts = i_service_text
*       ENTRYSHEETHEADERTEXT =
      .

Mahmoud-Farag
Participant
0 Kudos

  CALL FUNCTION 'BAPI_PO_GETDETAIL'
      EXPORTING
        purchaseorder    ws_po
        items            'X'
        services         'X'
      IMPORTING
        po_header        wa_po_header
      TABLES
        po_items         po_items
        po_item_services po_services
        return           bapi_return_po.
    IF line_existspo_items[ po_item wa_file2-ebelp ] )..
      pckg_no po_items[ po_item wa_file2-ebelp ]-pckg_no.
      IF line_existspo_services[ pckg_no pckg_no ] )..
        sub_pckg_no =  po_services[ pckg_no pckg_no ]-subpckg_no.
      ENDIF.
    ENDIF.
*
    wa_header-po_number wa_file2-ebeln.
    wa_header-po_item wa_file2-EBELP.
    wa_header-short_text wa_file2-short_text.
    wa_header-doc_date wa_file2-doc_date.
    wa_header-post_date wa_file2-post_date.
    wa_header-begdate wa_file2-begdate.
    wa_header-enddate wa_file2-enddate.
    wa_header-acceptance wa_file2-acceptance.
    wa_header-pckg_no 1.
    wa_header-pckg_no pckg_no.

    serial_no 0.
    line_no 1.

    bapi_esll-pckg_no 1.
    bapi_esll-pckg_no pckg_no.
    bapi_esll-line_no line_no.
    bapi_esll-outl_level '0'.
    bapi_esll-outl_ind 'X'.
    bapi_esll-subpckg_no 2.
    bapi_esll-subpckg_no sub_pckg_no.
    APPEND bapi_esll.

    DATAext_line LIKE wa_file-line_no.
    LOOP AT it_file INTO wa_file WHERE ebeln wa_file2-ebeln AND  ebelp wa_file2-ebelp.

      IF line_existspo_services[ ext_line wa_file-line_no ] )..
        wa_po_services =  po_services[ ext_line wa_file-line_no  pckg_no sub_pckg_no ] .
      ENDIF.
      line_no line_no + 1.
      ext_line ext_line + 10.
      CLEAR bapi_esll.
 MOVE-CORRESPONDING wa_po_services TO bapi_esll.
* bapi_esll-gr_price = '456'.
      bapi_esll-pckg_no 2.
      bapi_esll-pckg_no sub_pckg_no.
      bapi_esll-ext_line =  ext_line  .
      bapi_esll-line_no line_no.
*      bapi_esll-PLN_LINE = line_no.
      bapi_esll-service wa_po_services-service.
      bapi_esll-quantity wa_file-quantity.
      bapi_esll-quantity wa_po_services-quantity.
      bapi_esll-subpckg_no wa_po_services-subpckg_no.
      bapi_esll-gr_price  = wa_po_services-gr_price.
     bapi_esll-price_unit  = wa_po_services-price_unit.

      APPEND bapi_esll.
    ENDLOOP.


    CALL FUNCTION 'BAPI_ENTRYSHEET_CREATE'
      EXPORTING
        entrysheetheader   wa_header
      IMPORTING
        entrysheet         ws_entrysheet_no
      TABLES
        entrysheetservices bapi_esll
        return             i_return
      .

Mahmoud-Farag
Participant
0 Kudos

  CALL FUNCTION 'BAPI_PO_GETDETAIL'
      EXPORTING
        purchaseorder    ws_po
        items            'X'
        services         'X'
      IMPORTING
        po_header        wa_po_header
      TABLES
        po_items         po_items
        po_item_services po_services
        return           bapi_return_po.
    IF line_existspo_items[ po_item wa_file2-ebelp ] )..
      pckg_no po_items[ po_item wa_file2-ebelp ]-pckg_no.
      IF line_existspo_services[ pckg_no pckg_no ] )..
        sub_pckg_no =  po_services[ pckg_no pckg_no ]-subpckg_no.
      ENDIF.
    ENDIF.
*
    wa_header-po_number wa_file2-ebeln.
    wa_header-po_item wa_file2-EBELP.
    wa_header-short_text wa_file2-short_text.
    wa_header-doc_date wa_file2-doc_date.
    wa_header-post_date wa_file2-post_date.
    wa_header-begdate wa_file2-begdate.
    wa_header-enddate wa_file2-enddate.
    wa_header-acceptance wa_file2-acceptance.
    wa_header-pckg_no 1.
    wa_header-pckg_no pckg_no.

    serial_no 0.
    line_no 1.

    bapi_esll-pckg_no 1.
    bapi_esll-pckg_no pckg_no.
    bapi_esll-line_no line_no.
    bapi_esll-outl_level '0'.
    bapi_esll-outl_ind 'X'.
    bapi_esll-subpckg_no 2.
    bapi_esll-subpckg_no sub_pckg_no.
    APPEND bapi_esll.

    DATAext_line LIKE wa_file-line_no.
    LOOP AT it_file INTO wa_file WHERE ebeln wa_file2-ebeln AND  ebelp wa_file2-ebelp.

      IF line_existspo_services[ ext_line wa_file-line_no ] )..
        wa_po_services =  po_services[ ext_line wa_file-line_no  pckg_no sub_pckg_no ] .
      ENDIF.
      line_no line_no + 1.
      ext_line ext_line + 10.
      CLEAR bapi_esll.
 MOVE-CORRESPONDING wa_po_services TO bapi_esll.
* bapi_esll-gr_price = '456'.
      bapi_esll-pckg_no 2.
      bapi_esll-pckg_no sub_pckg_no.
      bapi_esll-ext_line =  ext_line  .
      bapi_esll-line_no line_no.
*      bapi_esll-PLN_LINE = line_no.
      bapi_esll-service wa_po_services-service.
      bapi_esll-quantity wa_file-quantity.
      bapi_esll-quantity wa_po_services-quantity.
      bapi_esll-subpckg_no wa_po_services-subpckg_no.
      bapi_esll-gr_price  = wa_po_services-gr_price.
     bapi_esll-price_unit  = wa_po_services-price_unit.

      APPEND bapi_esll.
    ENDLOOP.


    CALL FUNCTION 'BAPI_ENTRYSHEET_CREATE'
      EXPORTING
        entrysheetheader   wa_header
      IMPORTING
        entrysheet         ws_entrysheet_no
      TABLES
        entrysheetservices bapi_esll
        return             i_return
      .

Accepted Solutions (0)

Answers (0)