cancel
Showing results for 
Search instead for 
Did you mean: 

Bapi BAPI_POEC_CREATE I_PO_LIMIT problem

Former Member
0 Kudos

Hi all,

I have the problem with creation of BAPI_POEC_CREATE and limit position.

If I create the Purchase Order without Limit Position the badi work correctly, if I create the Purchase Order with limit position and I the structure I_PO_LIMIT is valued, the badi doesn't work and generate the below message:

BBP_PD 386 For purchase orders with limit, a limit must be specified (and only here)

Any suggestion?

Thanks.

Kindly regard.

Salvatore

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

<u>Which SRM version and scenario are you using ?</u>

<b>Please go through the Following SAP OSS Notes below -></b>

Note 864343 - Enter an expected value error during 'no limit' PR transfer

Note 505030 - Restrictions for the integration of external requirements

Note 860578 - Collective Note SRM 5.0 SP01 Team M.Dauscher

Hope this will help.

Do let me know.

Regards

- Atul

Former Member
0 Kudos

Hello,

my SRM version is 5.5 and I have an extended scenario.

Also, I have already checked the OSS note posting.

Thanks

Regards.

Former Member
0 Kudos

Hi

<u>Seems to be a bug incase of Limit items.</u>

<b>Please paste the BADI code and details in your next reply.</b>

Which R/3 version are you using ?

<u>See these SAP OSS Note -></u>

Note 1022458 - Limit PO ends in Error Status: Document Contains No Items

Note 1057398 - Delete indicator for service items not transfered to backend

Note 1058510 - Limit Order Line can be deleted when open confirmation

Note 801647 External services corrections with connection to SRM system

Also raise a Customer OSS message with SAP as well.

Do let me know.

Regards

- Atul

Former Member
0 Kudos

Hi Atul,

Thanks for your help.

Now I post my code, this is an example program for create PO from Contract, may be copy and past in abap editor on SRM 5.5 system.

Also, I have checked the new notes posted, but not work.

program ztest02.

DATA: event TYPE REF TO cl_htmlb_event,

head_ctr type BBP_PDS_ctr_HEADER_D,

org_data type HRS_OBJEC,

ctr_org type BBPT_PDS_ORG,

wa_ctr_org type BBP_PDS_ORG,

wa_obj type CRMD_ORDERADM_H-OBJECT_ID,

bapi_head_po type BAPI_PO_HEADER_C,

  • ret type table of BAPIRET2,

lt_item_ctr type table of BBP_PDS_CTR_ITEM_D,

wa_item_ctr type BBP_PDS_CTR_ITEM_D,

lt_item_po type table of BAPI_PO_ITEM_C,

wa_item_po type BAPI_PO_ITEM_C,

lt_part_ctr type table of BBP_PDS_PARTNER,

wa_part_ctr type BBP_PDS_PARTNER,

lt_part_po type table of BAPI_BUP_C,

wa_part_po type BAPI_BUP_C,

lt_org_ctr type table of BBP_PDS_ORG,

wa_org_ctr type BBP_PDS_ORG,

lt_org_po type table of BAPI_ORG_C,

wa_org_po type BAPI_ORG_C,

lv_item_number TYPE bbp_item_no,

lt_text type BBPT_PDS_LONGTEXT,

wa_text type BBP_PDS_LONGTEXT,

lt_po_text type TABLE OF BAPI_TEXT_I,

wa_po_text type BAPI_TEXT_I,

lt_att_ctr TYPE BBPT_PDS_ATT_T,

wa_att_ctr type BBP_PDS_ATT_T,

lt_att_po type TABLE OF BAPI_ATT_C,

wa_att_po type BAPI_ATT_C,

lt_limit type table of BAPI_LIMIT_C,

ls_limit type BAPI_LIMIT_C,

e_bapi_hpo type BAPI_PO_HEADER_D,

e_item_po type table of BAPI_PO_ITEM_D,

ewa_item_po type BAPI_PO_ITEM_D,

*event = cl_htmlb_manager=>get_event( runtime->server->request ) .

*DATA: event TYPE REF TO cl_htmlb_event,

  • head_ctr type BBP_PDS_ctr_HEADER_D,

  • org_data type HRS_OBJEC,

  • ctr_org type BBPT_PDS_ORG,

  • wa_ctr_org type BBP_PDS_ORG,

  • wa_obj type CRMD_ORDERADM_H-OBJECT_ID,

  • bapi_head_po type BAPI_PO_HEADER_C,

    • ret type table of BAPIRET2,

  • lt_item_ctr type table of BBP_PDS_CTR_ITEM_D,

  • wa_item_ctr type BBP_PDS_CTR_ITEM_D,

  • lt_item_po type table of BAPI_PO_ITEM_C,

  • wa_item_po type BAPI_PO_ITEM_C,

  • lt_part_ctr type table of BBP_PDS_PARTNER,

  • wa_part_ctr type BBP_PDS_PARTNER,

  • lt_part_po type table of BAPI_BUP_C,

  • wa_part_po type BAPI_BUP_C,

  • lt_org_ctr type table of BBP_PDS_ORG,

  • wa_org_ctr type BBP_PDS_ORG,

  • lt_org_po type table of BAPI_ORG_C,

  • wa_org_po type BAPI_ORG_C,

ret type table of bapiret2.

*

*

data : msg type table of BBP_PDS_MESSAGES,

wa_msg type bapiret2.

*

*

*wa_obj = '4400001124'.

if 1 eq 1.

wa_obj = '4400001220'.

CALL FUNCTION 'BBP_PD_CTR_GETDETAIL'

EXPORTING

I_OBJECT_ID = wa_obj

IMPORTING

E_HEADER = head_ctr

ET_ATTACH = lt_att_ctr

  • ET_CONDITIONS =

TABLES

E_ITEM = lt_item_ctr

E_PARTNER = lt_part_ctr

E_LONGTEXT = lt_text

E_ORGDATA = lt_org_ctr

  • E_MESSAGES =

  • E_HCF =

  • E_ICF =

  • E_ACTVAL =

  • E_ACC_ACTVAL =

  • E_HEADER_REL =

  • E_ITMLIM_REL =

  • E_TOL =

  • E_DIS =

  • E_STATUS =

  • E_VERSION =

.

*controllare che l'Organizzazione acquisti dell'utente che crea ordine sia nel contratto

CALL FUNCTION 'BBP_OM_STRUC_GET_ORG_FROM_USER'

EXPORTING

USER = sy-uname

IMPORTING

ORGUNIT = org_data

EXCEPTIONS

PATH_NOT_FOUND = 1

ERROR_READING_STRUCTURE = 2

NO_ROOTS = 3

INVALID_ROOTS = 4

INTERNAL_ERROR = 5

USER_NOT_ASSIGNED = 6

OTHERS = 7.

read TABLE lt_org_ctr into wa_org_ctr index 1.

  • if wa_ctr_org-PROC_ORG_OT ne org_data-OTYPE or

  • wa_ctr_org-PROC_ORG_ID ne org_data-OBJID.

  • message = 'L\''utente non ha i permessi adeguati per la creazione dell\''ordine'.

  • endif.

if 1 eq 1.

MOVE-CORRESPONDING head_ctr to bapi_head_po.

bapi_head_po-process_type = 'ECPO'.

bapi_head_po-LOGSYS_FI = 'SV4CLNT100'.

bapi_head_po-EXT_DEM_LOGSYS = 'SV5_100'.

bapi_head_po-gr_ind = 'X'.

bapi_head_po-CO_CODE = 'Z001'.

bapi_head_po-BUSINESSPROCESS = head_ctr-guid.

clear lv_item_number.

loop at lt_item_ctr into wa_item_ctr.

lv_item_number = lv_item_number + 1.

MOVE-CORRESPONDING wa_item_ctr to wa_item_po.

wa_item_po-ITEM_GUID = wa_item_ctr-guid.

wa_item_po-ITEM_NUMBER = lv_item_number.

wa_item_po-category_guid = wa_item_ctr-category.

wa_item_po-PRODUCT_SRC_SYS = wa_item_ctr-LOGSYS_FI.

wa_item_po-CTR_NUMBER = head_ctr-object_id.

wa_item_po-CTR_GUID = head_ctr-GUID.

wa_item_po-CTR_ITEM_NUMBER = wa_item_ctr-NUMBER_INT.

  • wa_item_po-subtype = 'EP'.

wa_item_po-PRODUCT_SRC_SYS = 'SV5_100'.

append wa_item_po to lt_item_po.

MOVE-CORRESPONDING wa_item_po to ls_limit.

ls_limit-PARENT_GUID = wa_item_ctr-guid.

  • ls_limit-LIM_REF_H_GUID = wa_item_ctr-guid.

ls_limit-LIMIT = wa_item_ctr-PRICE.

ls_limit-EXP_VALUE = wa_item_ctr-PRICE * 50.

ls_limit-LIM_REF_LOG_SYS = 'SV4CLNT100'.

  • ls_limit-lim_type = 'G'.

  • ls_limit-unlimited = 'X'.

  • ls_limit-LIM_REF_H_ID = bapi_head_po-DOC_NUMBER.

  • ls_limit-LIM_REF_I_ID = wa_item_po-ITEM_NUMBER.

  • ls_limit-LIM_REF_H_GUID = head_ctr-guid.

  • ls_limit-LIM_REF_I_GUID = wa_item_po-ITEM_GUID.

append ls_limit to lt_limit.

endloop.

loop at lt_part_ctr into wa_part_ctr.

if wa_part_ctr-PARTNER_FCT ne 51 and

wa_part_ctr-PARTNER_FCT ne 38 and

wa_part_ctr-PARTNER_FCT ne 26.

MOVE-CORRESPONDING wa_part_ctr to wa_part_po.

wa_part_po-PARTNER_guid = wa_part_ctr-PARTNER_NO.

append wa_part_po to lt_part_po.

endif.

if wa_part_ctr-PARTNER_FCT eq 26.

MOVE-CORRESPONDING wa_part_ctr to wa_part_po.

wa_part_po-PARTNER_guid = wa_part_ctr-PARTNER_NO.

move '00000016' to wa_part_po-PARTNER_FCT.

append wa_part_po to lt_part_po.

endif.

clear : wa_part_ctr,wa_part_po.

endloop.

loop at lt_org_ctr into wa_org_ctr.

MOVE-CORRESPONDING wa_org_ctr to wa_org_po.

wa_org_po-parent_guid = head_ctr-guid.

append wa_org_po to lt_org_po.

endloop.

  • tabelle testi

loop at lt_text into wa_text.

wa_po_text-PARENT_GUID = wa_text-GUID.

wa_po_text-TEXT_ID = wa_text-TDID.

wa_po_text-TEXT_LINE = wa_text-TDLINE.

  • wa_po_text-LANGU_ISO = wa_text-TDSPRAS.

append wa_po_text to lt_po_text.

endloop.

  • tabella allegati

loop at lt_att_ctr into wa_att_ctr

where p_guid eq head_ctr-guid.

MOVE-CORRESPONDING wa_att_ctr to wa_att_po.

wa_att_po-PARENT_GUID = wa_att_ctr-P_GUID.

wa_att_po-url = wa_att_ctr-DISP_URL.

  • wa_att_po-classname = wa_att_ctr-phio_class.

wa_att_po-doc_id = wa_att_ctr-phio_objid.

append wa_att_po to lt_att_po.

endloop.

CALL FUNCTION 'BAPI_POEC_CREATE'

EXPORTING

I_PO_HEADER = bapi_head_po

  • I_PO_HEADER_CUST =

  • I_TESTRUN = 'X'

IMPORTING

E_PO_HEADER = e_bapi_hpo

  • E_PO_HEADER_CUST =

TABLES

I_PO_ITEMS = lt_item_po

  • I_PO_ITEMS_CUST =

  • I_PO_ACCASS =

  • I_PO_ACCASS_CUST =

I_PO_PARTNER = lt_part_po

I_PO_TEXT = lt_po_text

  • I_PO_ATTACH = lt_att_po

  • I_PO_ORGDATA = lt_org_po

  • I_PO_LIMIT = lt_limit

  • I_PO_SDLN =

E_PO_ITEMS = e_item_po

  • E_PO_ITEMS_CUST =

  • E_PO_ACCASS =

  • E_PO_ACCASS_CUST =

  • E_PO_PARTNER =

  • E_PO_ORGDATA =

  • E_PO_LIMIT =

  • E_PO_SDLN =

  • E_PO_TEXT =

  • E_PO_STATUS =

  • E_PO_ATTACH =

RETURN = ret

.

commit work AND WAIT.

endif.

endif.

Regards.

Former Member
0 Kudos

In your code below

Hi

I guess...

<u>You have mistakenly commented out the following line ... .

In calling the function module

CALL FUNCTION 'BAPI_POEC_CREATE'

...</u>

  • I_PO_LIMIT = lt_limit

It should be like this..

<b> I_PO_LIMIT = lt_limit</b>

Hope this will help.

Regards

- Atul

Former Member
0 Kudos

Hi,

I apologize for my error, but I already call the function without comment.

Regards

Former Member
0 Kudos

Hi

Then it must be some issues with the deleted contracts..

While loop at the contract table, don't loop at all items (not the deleted ones in this case..)

loop at lt_item_ctr into wa_item_ctr where del_ind = space.
....
.......
.............
endloop.

Hope this will help.

Regards

- Atul

Former Member
0 Kudos

Hi

<i> Seems <u>Contract items - with Limit</u> create various kind of problems..</i>

<b>Please see the following Related SAP OSS Notes as well -></b>

Note 1056979 - Invalid messages for deleted Contract limits in SC and PO

Note 1048092 - Contract cannot be deleted from limit SC item

Note 865497 - Check fail for limit PO with contract item for confirmation

Note 862459 - Unable to select contract for extended classic limit item

Do let me know.

Regards

- Atul