Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

error while creating service PO by BAPI_PO_CREATE1

former_member300258
Participant
0 Likes
2,522

Hi,

I am trying to create a service PO using the BAPI_PO_CREATE1 with reference to service PR and I am getting an "In case of account assignment, please enter acc. assignment data for item" for which i found so many threads but none had resolved this error in my case eventhough i filled up all the required structure such as



  LOOP AT gt_esll INTO gs_esll.
      gs_services-pckg_no    = gs_esll-packno.
      gs_services-line_no    = gs_esll-introw.
      gs_services-subpckg_no = gs_esll-sub_packno.
      gs_services-quantity   = gs_esll-menge.
      gs_services-base_uom   = gs_esll-meins.
      gs_services-gr_price   = gs_esll-brtwr.
      gs_services-outl_ind   = 'X'.
      APPEND gs_services TO gt_services.
      CLEAR gs_services.
  ENDLOOP.

  LOOP AT gt_esll1 INTO gs_esll1.

    gs_services-pckg_no  = gs_esll1-packno.
    gs_services-line_no  = gs_esll1-introw.
    gs_services-ext_line = gs_esll1-extrow.
    gs_services-quantity = gs_esll1-menge.
    gs_services-base_uom = gs_esll1-meins.
    gs_services-gr_price   = gs_esll1-brtwr.
    APPEND gs_services TO gt_services.
    CLEAR gs_services.

    gs_servalues-pckg_no   = gs_esll1-packno.
    gs_servalues-line_no   = gs_esll1-introw.
    gs_servalues-serno_line = '01'.
    gs_servalues-quantity  = gs_esll1-menge.
    gs_servalues-net_value = gs_esll1-brtwr.
    APPEND gs_servalues TO gt_servalues.
    CLEAR:  gs_servalues, gs_esll1.

  ENDLOOP.

  gs_poacct-po_item = gv_poitm.
  gs_poacct-serial_no = gs_ebkn-zebkn.
  gs_poacct-quantity  = gs_ebkn-menge.
  gs_poacct-gl_account = gs_ebkn-sakto.
  gs_poacct-costcenter = gs_ebkn-kostl.
  gs_poacct-co_area = gs_ebkn-kokrs.
  APPEND gs_poacct TO gt_poacct.
  CLEAR gs_poacct.

  gs_poacctx-po_item = gv_poitm.
  gs_poacctx-serial_no = gs_ebkn-zebkn.
  gs_poacctx-po_itemx = 'X'.
  gs_poacctx-serial_nox = 'X'.
  gs_poacctx-quantity  = 'X'.
  gs_poacctx-gl_account = 'X'.
  gs_poacctx-costcenter = 'X'.
  gs_poacctx-co_area = 'X'.
  APPEND gs_poacctx TO gt_poacctx.
  CLEAR : gs_poacctx, gs_ebkn.
 
LOOP AT gt_ppsitm INTO gs_ppsitm.
  CLEAR: gs_poitm. " gt_poitm.
  READ TABLE gt_matnr INTO gs_matnr WITH KEY banfn = gs_ppsitm-banfn bnfpo = gs_ppsitm-bnfpo.
  CLEAR: gs_poitm.
  gv_poitm = gv_poitm + 10.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT         = gv_poitm
   IMPORTING
      OUTPUT        = gv_poitm.

  gs_poitm-po_item    = gv_poitm.
  gs_poitm-quantity   = gs_ppsitm-menge.
  gs_poitm-po_unit    = gs_matnr-meins.
  gs_poitm-net_price  = gs_ppsitm-quote_price.
*  gs_poitm-price_unit = '1'.
  gs_poitm-tax_code   = gs_ppsitm-mwskz.
  gs_poitm-preq_no    = gs_ppsitm-banfn.
  gs_poitm-preq_item  = gs_ppsitm-bnfpo.

  IF gs_matnr-packno IS NOT INITIAL.
    gs_poitm-pckg_no    = gs_matnr-packno.        " ADDED BY SKE FOR SERVICE PO
  ENDIF.

  gs_poitm-item_cat    = gs_matnr-pstyp.
  gs_poitm-acctasscat = gs_matnr-knttp.

  APPEND gs_poitm TO gt_poitm.
ENDLOOP.

aftrer executing this bapi, the accounts structure has been cleared whereas other sturcture has values.

Please give me some hints to fix this.

Thanks in Advance,

Kalidass.

11 REPLIES 11
Read only

former_member222709
Contributor
0 Likes
2,175

Hi Kalidass,

You need to try the following:

1. Since you are using PR as the reference document, let the account assignment internal table be blank i.e. do not pass any data to 'gs_poacct' & 'gs_poacctx'.

2. As you are using 'BAPI_PO_CREATE1', the fields 'pckng_no' and subpckg_no' need not be entered. The BAPI determines them automatically.

3. Finally, you need to pass the Schedule Line Item data.

This should solve your problem.

Regards,

Pranav.

Read only

0 Likes
2,175

Hi Pranav,

Thanks for ur quick reply.

are you suggesting not to fill services and service values structure as well or just short_text for services is enough..?

but if i dint fill the services, then i get an error "Please maintain services or limits" and i even filled up the schedule item data.

Wouldn't you mind giving some more clarity on this.

Kalidass.

Read only

0 Likes
2,175

Hi Kalidass,

You will have to fill the following structures:

1. Header - POHEADER, POHEADERX

2. Item - POITEM, POITEMX

3. Schedule - POSCHEDULE, POSCHEDULEX

4. Services - POSERVICES

If you want to add any texts, then, the same can be added. For your reference, you can use 'BAPI_PR_GETDETAIL' to check the data returned from the PR to fill the Services structure.

Regards,

Pranav.

Read only

0 Likes
2,175

Hi Pranav,

I filled up structures that you mentioned. now the error is "No account assignment exists for service line 0000000010".

I have 4 service in my service PR. so my service structure contains totally 5 itmes incluing the main package and sub-package.

i also gave the main package no in item and itemx structire as well. main package - 520, sub-pack - 521.

Thanks in advance.

Read only

0 Likes
2,175

service line is like 2,12,22, etc by default.. not 10,20,30..

if you open the PO, i the services tab you will find the numbers...

so you have 5 line items or 5 service lines in the PR?

Read only

0 Likes
2,175

Hi Kalidass,

In this I would like to know, how do you identify package number. And if you are passing this value to the item & itemx structures, the same needs to be passed to the POSERVICES internal table.

Since, you are unable to create the PO without Account Assignment, for the Account Assignment use the data from 'BAPI_PR_GETDETAIL' and pass the same to 'BAPI_PO_CREATE1'. Try without the package number & sub-package number data also.

Regards,

Pranav.

Read only

0 Likes
2,175

I could see only 10 20 30 as service line no in service tab of PO.

I have only one 1 line item and for that i have 2 services. with the package No i am linking the items and their services.

Read only

0 Likes
2,175

Hi pranav,

from EBAN table i got the package no for a PR and passing that package No into ESLL table i am getting the subpaack No.


   SELECT banfn bnfpo txz01 matnr bsart ekgrp meins pstyp knttp packno FROM eban
     INTO TABLE gt_matnr
      FOR ALL ENTRIES IN gt_ppsitm
    WHERE banfn = gt_ppsitm-banfn
      AND bnfpo = gt_ppsitm-bnfpo.


    SELECT packno introw package sub_packno FROM esll
           INTO CORRESPONDING FIELDS OF TABLE gt_esll
           FOR ALL ENTRIES IN gt_matnr
           WHERE packno = gt_matnr-packno.

IF gt_esll IS NOT INITIAL.
    SELECT packno introw extrow package sub_packno menge meins brtwr ktext1 FROM ESLL
           INTO TABLE gt_esll1
           FOR ALL ENTRIES IN gt_esll
           WHERE packno = gt_esll-sub_packno.
ENDIF.

  LOOP AT gt_esll INTO gs_esll.
      gs_services-pckg_no    = gs_esll-packno.
      gs_services-line_no    = gs_esll-introw.
      gs_services-subpckg_no = gs_esll-sub_packno.
      gs_services-quantity   = gs_esll-menge.
      gs_services-base_uom   = gs_esll-meins.
      gs_services-gr_price   = gs_esll-brtwr.
      gs_services-outl_ind   = 'X'.
      APPEND gs_services TO gt_services.
      CLEAR gs_services.
  ENDLOOP.

  LOOP AT gt_esll1 INTO gs_esll1.

    gs_services-pckg_no  = gs_esll1-packno.
    gs_services-line_no  = gs_esll1-introw.
    gs_services-ext_line = gs_esll1-extrow.
    gs_services-quantity = gs_esll1-menge.
    gs_services-base_uom = gs_esll1-meins.
    gs_services-gr_price   = gs_esll1-brtwr.
    APPEND gs_services TO gt_services.
    CLEAR gs_services.

    gs_servalues-pckg_no   = gs_esll1-packno.
    gs_servalues-line_no   = gs_esll1-introw.
    gs_servalues-serno_line = '01'.
    gs_servalues-quantity  = gs_esll1-menge.
    gs_servalues-net_value = gs_esll1-brtwr.
    APPEND gs_servalues TO gt_servalues.
    CLEAR:  gs_servalues, gs_esll1.

  ENDLOOP.

Edited by: Kalidass Etienne.S on Jan 31, 2012 11:07 AM

Read only

0 Likes
2,175

Hi Kalidass,

As you've mentioned, the package details you are using are from the PR as EBAN Table corresponds to PR data. Kindly verify with any existing PR and PO combination for their package numbers. If they are same, then, you can go ahead by passing them. Otherwise as I mentioned above, try without the package number & sub-package number data also.

Since, you are unable to create the PO without Account Assignment, for the Account Assignment use the data from 'BAPI_PR_GETDETAIL' and pass the same to 'BAPI_PO_CREATE1'. Try without the package number & sub-package number data also.

Regards,

Pranav.

Read only

Former Member
0 Likes
2,175

how many items you have?

for account table you are passing

gs_poacct-po_item = gv_poitm. " at this point what is the value of gv_poitm.?

for item table you are doing below in a loop. means its changing.

gv_poitm = gv_poitm + 10.

so accounting table also should get values of gv_poitm accordingly. else you will get this error

Read only

0 Likes
2,175

well soumya...you are correct..i did the same for account structure as well...i jus missed pasting it...here it is...



LOOP AT gt_ebkn INTO gs_ebkn.

  gv_poitm = gv_poitm + 10.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT         = gv_poitm
   IMPORTING
      OUTPUT        = gv_poitm.

  gs_poacct-po_item = gv_poitm.
  gs_poacct-serial_no = gs_ebkn-zebkn.
  gs_poacct-quantity  = gs_ebkn-menge.
  gs_poacct-gl_account = gs_ebkn-sakto.
  gs_poacct-costcenter = gs_ebkn-kostl.
  gs_poacct-co_area = gs_ebkn-kokrs.
  APPEND gs_poacct TO gt_poacct.
  CLEAR gs_poacct.

  gs_poacctx-po_item = gv_poitm.
  gs_poacctx-serial_no = gs_ebkn-zebkn.
  gs_poacctx-po_itemx = 'X'.
  gs_poacctx-serial_nox = 'X'.
  gs_poacctx-quantity  = 'X'.
  gs_poacctx-gl_account = 'X'.
  gs_poacctx-costcenter = 'X'.
  gs_poacctx-co_area = 'X'.
  APPEND gs_poacctx TO gt_poacctx.
  CLEAR : gs_poacctx, gs_ebkn.

ENDLOOP.