Application Development 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: 

EXTENSIONIN parameter in BAPI_REQUISITION_CREATE and MEREQ001 Enhancement

Former Member
0 Kudos

Hello,

I want to use BAPI_REQUISITION_CREATE for creating Purchase Requisitions(PR).

We have added CI_EBANDB include structure in EBAN table and I want to update that include structure through BAPI_REQUISITION_CREATE.

Also there is no documentation available for EXTENSIONIN parameter of this BAPI_REQUISITION_CREATE.

CI_EBANDB structure is part of enhancement MEREQ001.

Can any tell me in updating CI_EBANDB include structure through BAPI_REQUISITION_CREATE.

CALL FUNCTION 'BAPI_REQUISITION_CREATE'

EXPORTING

  • SKIP_ITEMS_WITH_ERROR =

  • automatic_source = 'X'

IMPORTING

number = pr_number

TABLES

requisition_items = it_requisition_items

return = it_return

EXTENSIONIN = It_EXTENSIONIN

how should i fill IT_EXTENSIONIN table through passing CI_EBANDB structure fields syntactically?

Awaiting for solution ASAP.

Regards,

Mahesh

.

2 REPLIES 2

Former Member
0 Kudos

Hello Mahesh,

It is very simple.

You need to do the below steps:-

1) Create tee append structure in your SAP Table .

2) Then add the supporting structure in the BAPI structures as well if needed.

3) Then write the user exit code to pass the data properly to the EXTENSION INN tabel structure with proper lineitem details.

In your BAPI call you need to fill the EXTENSIONIN like this:

T_EXTENSIONIN-STRUCTURE = 'BAPI_TE_REQUISITION_ITEM'.
concatenate l_item FIELD1 FIELD2 into T_EXTENSIONIN-VALUEPART1.
APPEND T_EXTENSIONIN.

Check the below thread links as well :-

[|]

[|]

ht[|]

[|]

Hope this answers your question.

Thanks,

Greetson

0 Kudos

Thanks for your post.

Your solution was indeed helpful.

I used the structure BAPI_TE_REQUISITION_ITEM for uploading INCLUDE structure field of table EBAN.

as in BAPIPAREX structure there are FOUR VALUEPART fields.

Each field VALUEPART field has field lenght of 240 Char.

but, the structure BAPI_TE_REQUISITION_ITEM has many fields that altogether contain total length 1326.

and VALUEPART1, VALUEPART2, VALUEPART3, VALUEPART4 - their total length is 4*240 = 960.

so, even if I CONCATENATE all the structure ( BAPI_TE_REQUISITION_ITEM) fields and put it into VALUEPART1, VALUEPART2, VALUEPART3, VALUEPART4 sequentially, then End part of the structures(BAPI_TE_REQUISITION_ITEM) fields data does not get uploaded.

I have chosen to directly upload that fields data in to the table EBAN.

Check out the Following part of the code for uploading include structure of table EBAN

loop at it_eban into wa_eban.
* index for reading next record so new 10 ITEN CAN FIND OUT
    lv_tabix = sy-tabix + 1.
* ADDING VALUES TO BAPI INTERNAM TABLE
    wa_requisition_items-preq_item  = wa_eban-preq_item.
    wa_requisition_items-doc_type   =  wa_eban-doc_type.
    wa_requisition_items-pur_group   = wa_eban-pur_group.
    wa_requisition_items-preq_name   = wa_eban-preq_name.
    wa_requisition_items-preq_date  = wa_eban-preq_date.
    wa_requisition_items-material   = wa_eban-material.
    wa_requisition_items-store_loc  = wa_eban-store_loc.
    wa_requisition_items-plant        = wa_eban-plant.
    wa_requisition_items-quantity  = wa_eban-quantity.
    wa_requisition_items-deliv_date   = wa_eban-deliv_date.
    wa_requisition_items-c_amt_bapi = wa_eban-c_amt_bapi.     "Valuation price
    concatenate '00' wa_eban-fixed_vend into wa_eban-fixed_vend.
    wa_requisition_items-fixed_vend   = wa_eban-fixed_vend.
    wa_requisition_items-purch_org  = wa_eban-purch_org.
    wa_requisition_items-agreement  = wa_eban-agreement.
    wa_requisition_items-agmt_item  = wa_eban-agmt_item.

    append wa_requisition_items to requisition_items.

    move wa_eban to wa_eban_copy.

    append wa_eban_copy to it_eban_copy.



* THIS LOGIC TO FIND NEXT RECORE OF CURRENT LOOP SO IF NEXT LINE ITEM IS 10 PR CAN BE CREATED
    read table it_eban into wa_eban_copy index lv_tabix.
* NEXT LINE ITEM IS 10 OR ITS A LAST RECORD OF LOOP.
    if wa_eban_copy-preq_item = '10' or lv_tabix = lv_table_legth.
* BAPI FOR CREATING PR
      call function 'BAPI_REQUISITION_CREATE'
*       EXPORTING
*         SKIP_ITEMS_WITH_ERROR                =
*         AUTOMATIC_SOURCE                     = 'X'
       importing
         number                               = pr_number
        tables
          requisition_items                    = requisition_items
*         REQUISITION_ACCOUNT_ASSIGNMENT       =
*         REQUISITION_ITEM_TEXT                =
*         REQUISITION_LIMITS                   =
*         REQUISITION_CONTRACT_LIMITS          =
*         REQUISITION_SERVICES                 =
*         REQUISITION_SRV_ACCASS_VALUES        =
         return                               =  it_return
*         REQUISITION_SERVICES_TEXT            =
*         REQUISITION_ADDRDELIVERY             =
         extensionin                          = extensionin
                .


* PASSING PR NUMBER TO CURRENT DATA SO Z FIELDS CAN AGAIN BE MODIFIED IN EBAN
      loop at requisition_items into wa_requisition_items.
        wa_requisition_items-preq_no = pr_number.
        move-corresponding wa_requisition_items to wa_pr_items.
        append wa_pr_items to it_pr_items.
        clear: wa_requisition_items, wa_pr_items.
      endloop.

      loop at it_eban_copy into wa_eban_copy.

        move-corresponding wa_eban_copy to wa_eban_copy_final.
        wa_eban_copy_final-preq_no = pr_number.
**        MOVE-CORRESPONDING wa_return TO wa_pr_items.
        if pr_number is initial.
          clear l_return.
          loop at it_return into wa_return.
            wa_eban_copy_final-type = wa_return-type.
            wa_eban_copy_final-message = wa_return-message.
**            MOVE-CORRESPONDING wa_return TO wa_eban_copy_final.
          endloop.
        endif.
        append wa_eban_copy_final to it_eban_copy_final.
        clear: wa_eban_copy, wa_eban_copy_final.
      endloop.
      refresh requisition_items[].
      refresh it_eban_copy[].
    endif.
  endloop.


*this loop will upload include structure fields in to the EBAN table 
  loop at it_eban_copy_final into  wa_eban_copy_final.

    select single * into wa_db_eban from eban client specified
      where mandt = sy-mandt
      and banfn = wa_eban_copy_final-preq_no
      and bnfpo = wa_eban_copy_final-preq_item .

    wa_db_eban-zzinvno  =  wa_eban_copy_final-zzinvno  .
    wa_db_eban-zzinvdt  =  wa_eban_copy_final-zzinvdt  .
    wa_db_eban-zzcountryorigin  =  wa_eban_copy_final-zzcountryorigin  .
    wa_db_eban-zzportl  = wa_eban_copy_final-zzportl  .
    wa_db_eban-zzportd  = wa_eban_copy_final-zzportd  .
    wa_db_eban-zzplace  = wa_eban_copy_final-zzplace  .
    wa_db_eban-zzeddel  = wa_eban_copy_final-zzeddel  .
    wa_db_eban-zzedarr  = wa_eban_copy_final-zzedarr  .
    wa_db_eban-zzatdepart	=	wa_eban_copy_final-zzatdepart	.
    wa_db_eban-zzblnum  = wa_eban_copy_final-zzblnum  .
    wa_db_eban-zzship	=	wa_eban_copy_final-zzship	.
    wa_db_eban-zzcontainer  = wa_eban_copy_final-zzcontainer  .
    wa_db_eban-zzadvdocdat  = wa_eban_copy_final-zzadvdocdat  .
    wa_db_eban-zztarce  =  wa_eban_copy_final-zztarce  .
    wa_db_eban-zzoblrecdat  =  wa_eban_copy_final-zzoblrecdat  .
    wa_db_eban-zzbank  	=	wa_eban_copy_final-zzbank	.
    wa_db_eban-zzvessel  =   wa_eban_copy_final-zzvessel  .

    modify eban from wa_db_eban.
    clear: wa_eban_copy_final, wa_db_eban.
  endloop.

  call function 'BAPI_TRANSACTION_COMMIT'
   exporting
     wait          = 'X'

            .

Once again thanking for your support.

Regards,

Mahesh