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

Fill customer fields in BAPI (BAPI_PRODORD_CREATE)

Former Member
0 Likes
5,025

i am using BAPI BAPI_PRODORD_CREATE

to create pord order from sales order(CO08). this works fine.

The thing is, i want to create Prod order from Sto.(CO01).

i'll use bapi, but how would i'll be able to fill cutsomer tab,

that i have created in Prod order.

there are customer field for Purchasing doc no and item,

to link sto with prod order.

these fields with values gets stored in table AUFK.

(they were appended using include)

moreover, i was wondering, there are no Extensionin and extensionout

parameters in BAPI>> BAPI_PRODORD_CREATE.

Please suggest how will i be able to fill these customer field through

this BApi or any other.

5 REPLIES 5
Read only

Former Member
0 Likes
2,675

Hi Abhishek,

Your understanding is correct that you cannot use the existing BAPI for populating Z fields. I do not know how you are associating Production Order data with Purchasing  Doc details but you can use

BAPI_ALM_ORDER_MAINTAIN to populate Z fields in AUFK. The table extension to be used is BAPI_TE_AUFK.

Ask further if not clear.

BR.

Read only

0 Likes
2,675

Your reply has evoked many question in my mind:

  • 1 why can we add extensionin and extensionoutparameters

          in the same bapi i.e BAPI_PO_CREATE1

          so that we can use the same bapi to fill zfields also.

  • 2. u said i can use BAPI_ALM_ORDER_MAINTAIN  to update fields

          of table AUFK.

          but rather why cant i simply use this method:

          first using BAPI_PO_CREATE1 to create prod order.

          then AUFK will container the AUfnr(order no)

          and i simply write update statement.

       

  *wa_aufk will contain zzebeln and zzebelp

          update aufk from wa_aufk.

               if sy-subrc is o.

                    commit work.

               endif.

what diff does it make if i am using bapi u mentioned.

  • 3.i am hardly trying to understand the concept of bapi table extension.

          infact i have read the sap documentation.

          firstly can u tell me from why is it like when i am using bapi_te* in SE11

          and f4. no results found.

how u been able to found bapi_te_aufk.(step followed to find this table extension).

moreover, can u please tell how i'll be able to use EXTENSION_IN paramter in bapi u mentioned.

suppose i want to fill zzebeln and zzebelp of AUFK.

please , what value to be passed in EXTENSION_IN and how to fill that value.

Read only

0 Likes
2,675

Hi,

Please find responses -

abhishek bansal wrote:

Your reply has evoked many question in my mind:

  • 1 why can we add extensionin and extensionoutparameters

          in the same bapi i.e BAPI_PO_CREATE1

          so that we can use the same bapi to fill zfields also.

You can very well use it, my previous response was for the BAPI BAPI_PRODORD_CREATE mentioned by you.

  • 2. u said i can use BAPI_ALM_ORDER_MAINTAIN  to update fields

          of table AUFK.

          but rather why cant i simply use this method:

          first using BAPI_PO_CREATE1 to create prod order.

          then AUFK will container the AUfnr(order no)

          and i simply write update statement.

       

  *wa_aufk will contain zzebeln and zzebelp

          update aufk from wa_aufk.
               if sy-subrc is o.
                    commit work.
               endif.

what diff does it make if i am using bapi u mentioned.

Same as above. As a practice you should never use update directly and use BAPIs/SAP provided FMs since the field values go in various tables. Since it is a custom one, you can do that but if you use BAPI_PO_CREATE1, i do not think you will need this.

  • 3.i am hardly trying to understand the concept of bapi table extension.

          infact i have read the sap documentation.

          firstly can u tell me from why is it like when i am using bapi_te* in SE11

          and f4. no results found.

how u been able to found bapi_te_aufk.(step followed to find this table extension).

BAPI_TE_AUFK (and BAPI_TE_etc etc) are table structures and not tables, Search them in Data Type option in SE11.

Now code snippet for you -

           

              ls_extensionsin_s-structure = 'BAPI_TE_AUFK'

              ls_extensionsin_s-valuepart1+0(12)   = <order id> " Key field  for you its orderid so it should be

              ls_extensionsin_s-valuepart1+12(<size of z field 1>) = <Zfield1>.

              APPEND ls_extensionsin_s TO lt_extensionsin_s.

           

moreover, can u please tell how i'll be able to use EXTENSION_IN paramter in bapi u mentioned.

suppose i want to fill zzebeln and zzebelp of AUFK.

please , what value to be passed in EXTENSION_IN and how to fill that value.

BR.

Read only

0 Likes
2,674

Indeed this was a helpful answer,

i'll use BAPI_ALM_ORDER_MAINTAIN to update field of AUFk  table.

Firstly there is a mandatory parameter IT_METHODS in tables tab.

how to fill this ??

              ls_extensionsin_s-structure = 'BAPI_TE_AUFK'

              ls_extensionsin_s-valuepart1+0(12)   = <order id> " Key field  for you its orderid so it should be

              ls_extensionsin_s-valuepart1+12(<size of z field 1>) = <Zfield1>.

"that is the value of zzebeln (purchasing doc no is filled), EBELN is of type char10.

ls_extensionin_s-valuepart+12(10) = '0000000001' "say P. Doc no."ebeln.

ls_extensionin_s-valuepart+22(5) = '00010' "say P. Doc no line item."ebelp.


              APPEND ls_extensionsin_s TO lt_extensionsin_s.

Upto this , i got it.

but    VALUEPART1   is of type char240. and now it is been filled with 12 + 10 + 5 = 27 character.

valuepart1 can still contain 213 letters more.

the. what is the use of fields

"all are of 240 char.

VALUEPART2

VALUEPART3

VALUEPART4

when are these fields get filled, if we have to pass the values of both doc no and item in the

very first field VALUEPART2 ???

shortly,if we have to pass all the customer field values in one single field, in a concatenated form, then what is the use of all other three fields.

Also, we are passing values of zzebeln and zzebelp. but we are not passing fields name of table aufk.

somewhere we need to pass that these both values 0000000001 and 00010 are to be filled in zzebeln and zzebelp fields of table AUFK.

Where the fields names are to be passed?

_____________________________

Another thing that i wonder,

by chance i have created a include in table AUFK and so i found a tbale extension BAPI_TE_AUFK.

what if i have appended these two fields in table AFPO.

then there does not exist any table extension BAPI_TE_AFPO.??? What then?

Read only

venkateswaran_k
Active Contributor
0 Likes
2,674

Dear Abhishek,

It would be easy to do as follows   (as you suggested as well).

After completion of the BAPI - successfully

If  BAPI_ORDER_KEY-ORDER_NUMBER is not initial  

    then assign your purchase order number details to the ZZ-table value and

    call the update statement.

endif.

Regards,

Venkat