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: 

Regarding using of EXTENSION1 and EXTENSION2 in BAPI_OUTB_DELIVERY_CHANGE

Former Member
0 Kudos

Hi,

Can any one please help me how to code for zfields in EXTENSION1 and EXTENSION2 in BAPI_OUTB_DELIVERY_CHANGE

Thanks,

Nethaji.

1 ACCEPTED SOLUTION

jaideepsharma
Active Contributor
0 Kudos

Hi,

Please go through the link below. The bapi used is different but you can see how EXTENSION1 and EXTENSION2 are used.

[Extension|;

KR Jaideep,

16 REPLIES 16

jaideepsharma
Active Contributor
0 Kudos

Hi,

Please go through the link below. The bapi used is different but you can see how EXTENSION1 and EXTENSION2 are used.

[Extension|;

KR Jaideep,

0 Kudos

Hi Jaideep,

I have gone through all these and also i have enhanced for sales order also in the same way

But here the structures are different and also no documentation is given for that.

Thanks,

NN.

0 Kudos

Hello Nethaji,

If the idea is to use those structures to pass values to especific fields in order to be processed by the corresponding BTE/exit, you can just add an append structure to the mentioned structure/s (EXTENSION1 or EXTENSION2) and include the necesary fields (transaction SE11, name of the structure to be enhanced, then you see the button "Append structure"). Or you can use, for example, the fields available in EXTENSION1, using one or two to pass the field name and the remaining ones to pass the corresponding values.

For example, you can read this post:

"Re: BAPI_ACC_DOCUMENT_POST - Fixed Asset - Error directly posting"

/message/7181346#7181346

There, you will see a problem that was solved using a BTE, and adding an append structure to a similar EXTENSION1 structure used by a FI BAPI (this is not explicity said, but that is how the needed fields for the exit structure can be added).

Regards,

José Gabriel Martínez.

0 Kudos

Hi Gabriel,

I had gone through the link u have provieded it is helpful but unable to find the solution can u please explain in detail.

Thanks,

NN.

Edited by: Nethaji babu on Sep 9, 2009 11:21 AM

Former Member
0 Kudos

Hi,

EXTENSION1 and EXTENSION2 parameters are there to handle any custom fields that you have and you want to map those to database fields have a look at BADI 'SMOD_V50B0001' here if you see each method has the same parameters avaliable so lets say you ahve some custom fields that you have added to the Header data of Outbound Delivery you can give the based on the parameter you can map the field to the header data in the BADI and then when you are using you BAPI when you pass the same parameter name in BAPI_OUTB_DELIVERY_CHANGE with the field anme and values they are updated to the header data.

I hipe you got the idea the exits are used to map data that you would provide in the two parameters to the database fields.

Regards,

Himanshu

0 Kudos

Hi Himanshu,

I have seen this exit but could not find any idea how to update custome zfields can u explain in detail.

Thanks,

NN.

Former Member
0 Kudos

I had a requirement to change a Z field in LIKP by a BAPI call and found this thread.

Although the original participant probably have found alternative ways, I hope this can be helpful for others search for a solution to this.

These are my findings u2013 please correct me if I am wrong. The EXTENSION1 & EXTENSION2 can NOT be used to change LIKP Z-fields. These doesnu2019t do anything in themselves, but can be imported in BADI IF_EX_SMOD_V50B0001~EXIT_SAPLV50I_010 (Thereu2019s a corresponding CMOD in older versions).

However, the data available here are :

CS_VBKOK

CT_VBPOK

CT_VBSUPCON

EXTENSION1

EXTENSION2

So, for changes to delivery header, only fields in structure CS_VBKOK can be changed. As VBKOK does not have any customer appends, this is not possible. Furthermore is the BAPI BAPI_OUTB_DELIVERY_CHANGE only calling WS_DELIVERY_UPDATE anyway, so the BAPI can not do any magic the FM canu2019t. So what is the purpose with EXTENSION1/ EXTENSION2 ?

As I see it, itu2019s a handy way to transfer data to the BADI, so you can build logic to manipulate any of the existing CS_VBKOK fields. You could have done the same with a Memory export/import anyway.

/END-BAD-NEWS

/BEGIN-GOOD-NEWS

After some trial and error, I managed to use BAPI_OUTB_DELIVERY_CHANGE to change Z fields in LIKP. Before the call, I export the desired content to a memory ID, which I then import in MV50AFZ1, BAPI_OUTB_DELIVERY_CHANGE

See this working demonstration code :

Calling program :

&----


*& Report ZTEST_BAPI_DELIVERY_CHANGE

*&

&----


*&

*&

&----


report ztest_bapi_delivery_change.

data : gs_bapiobdlvhdrchg type bapiobdlvhdrchg.

data : gs_bapiobdlvhdrctrlchg type bapiobdlvhdrctrlchg.

data : gs_bapidlvcontrol type bapidlvcontrol.

data : gt_bapireturn type standard table of bapiret2.

data : gs_bapireturn type bapiret2.

data : gs_likp type likpvb.

data : ld_zzhuload type erlkz.

constants: gc_x(1) type c value 'X'.

parameter : p_vbeln like likp-vbeln.

  • Get relevant LIKP fields

select * from likp

into corresponding fields of gs_likp

where vbeln = p_vbeln.

endselect.

    • Fill header data - convert to BAPI format

call function 'MAP2E_LIKPVB_TO_BAPIOBDLVHDRCH'

exporting

likpvb = gs_likp

changing

bapiobdlvhdrchg = gs_bapiobdlvhdrchg.

  • Field to set as LIKP Z-field

ld_zzhuload = 'X'.

  • Memory-ID imported in MV50AFZ1

export ld_zzhuload to memory id 'ZZHULOAD'.

call function 'BAPI_OUTB_DELIVERY_CHANGE'

exporting

header_data = gs_bapiobdlvhdrchg

header_control = gs_bapiobdlvhdrctrlchg

delivery = gs_bapiobdlvhdrchg-deliv_numb

techn_control = gs_bapidlvcontrol

tables

return = gt_bapireturn

exceptions

communication_failure = 1

system_failure = 2

others = 3.

if gt_bapireturn[] is initial.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = gc_x.

else.

loop at gt_bapireturn into gs_bapireturn

where type = 'E'.

message id gs_bapireturn-id type 'S'

number gs_bapireturn-number with

gs_bapireturn-message_v1

gs_bapireturn-message_v2

gs_bapireturn-message_v3

gs_bapireturn-message_v4.

exit.

endloop.

endif.

MV50AFZ1, form USEREXIT_SAVE_DOCUMENT_PREPARE

data : ld_zzhuload type erlkz.

if xlikp-vbtyp = 'J' " outbound delivery

and t180-trtyp = 'V'. " Change

  • Memory-ID exported from program ZZZ...

import ld_zzhuload from MEMORY ID 'ZZHULOAD'.

if sy-subrc is initial

and not ld _zzhuload is initial.

LOOP AT xlikp.

xlikp-zzhuload = ld_zzhuload.

MODIFY xlikp transporting zzhuload.

ENDLOOP.

free MEMORY ID 'ZZHULOAD'.

endif.

endif.

I hope someone will find this helpful. Obviously I can not take responsibility for the functionality

Sorry for the format, I can not get the tags to work.....

0 Kudos

You should be able to update the LIKP or LIPS tables using the EXTENSION internal tables.

For this a BADI and an enhancement point are required.

Extend the fields in LIKP/LIKP and VBKOK/VBPOK with the custom fields.

Now implement the BADI SMOD_V50B0001/EXIT_SAPLV50I_010 to move the custom fields from EXTENSION1 or 2 to CS_VBKOK or CT_VKPOK.

Implement the enhancement spot LE_SHP_DELIVERY_UPDATE/UPDATE_HEADER to move custom fields from VBKOK/VBPOK to LIKP or LIPS.

0 Kudos

Hi,

reaction to

Implement the enhancement spot LE_SHP_DELIVERY_UPDATE/UPDATE_HEADER to move custom fields from VBKOK/VBPOK to LIKP or LIPS.

I's searching for enhancement spot LE_SHP_DELIVERY_UPDATE in SE20 but I've not found it. Then I tried to to search for BADI but I've found just LE_SHP_DELIVERY_PROC but there I've not found any good place to put the logic for copying Z-fileds from VBPO to LIPS.

Please may I ask you to help me to navigate to correct place (like FM or Program where this enhancement spot is placed).

Thank you very much

regards

Radek Hanus

Edited by: Radek Hanus on Nov 10, 2010 4:54 PM

eduardo_hinojosa
Active Contributor

HI,

Check SAP Note 143580 - Information on SD BAPIs and customer enhancement concept. I think that it will give idea how to do it.

Regards,

Eduardo

PD: I'm sorry, I forgot the SAP Note 700795 - Enhancement category of BAPI enhancement structures

Edited by: E_Hinojosa on Nov 9, 2010 6:29 PM

0 Kudos

Hallo

I know this is been long time since this subject, but could someone found a solution with using EXTENSION2 to update custom fields on LIPS? I have followed and try every post with regarding this except for setting memory id's as we don't want to go this route feel it is not secure with lots of users running this functionality at the same time. With this been said I therefore don't want to give up on trying to figure out what SAP was intended with this functionality.

What I did so far:

1. Append structure to LIPS and VBPOK with my custom fields.

2. When calling BAPI BAPI_OUTB_DELIVERY_CHANGE populate extension2 with my custom fields example:

       extension2-param     = 'LIPS'.

       extension2-row       = wa_lips-posnr.

       extension2-field     = 'ZZSLAB5'.           "Z FIELD 2

       extension2-value     = wa_lips-zzslab5.

       extension2-type = 'CHAR'.

       extension2-length = '20'.

       APPEND extension2.

3. In IF_EX_SMOD_V50B0001~EXIT_SAPLV50I_010 update CT_VBPOK from EXTENSION2 with custom fields.

4. I then tried to add code to move CT_VBPOK over to LIPS via LV50SFZ1 and LE_SHP_DELIVERY_UPDATE (UPDATE_ITEM) but none of these is breaking here therefore resulting in LIPS still not updated.

What is the solution to this last step?

Thanks in advance.

0 Kudos

Hi Anina,  You posted 3 years after the last thread and I'm doing worse...I'm posting almost 3 years after your thread.   I'm having the same exact problem that you had...I'm able to use EXIT_SAPLV501_010 to populate custom fields in CT_VBPOK from Extension2 but I cannot get a hard break-point to stop in BAdI implementation of LE_SHP_DELIVERY_UPDATE, method Update_Item.   Did you ever have any luck?   Thanks

0 Kudos

Hello Gretchen

I can remember the client where I had this situation but cannot remember the fix

Have you run the debugger by setting the "Debugger Settings" in "Update debugging and System Debugging". Also I don't know why I am thinking that to move the fields to XLIPS rather than LIPS fixed the problem.


Sorry I cannot be of any more help, I should have updated this post even for myself to use as future reference.


Good luck.

BAPI_OUTB_DELIVERY_CHANGE is one of the more obnoxious BAPI calls I have made to update custom fields.   I had custom fields on LIPS that needed to be updated.   My issue was that Business Function LOG_LE_INTEGRATION was not turned on and that meant that BAdI LE_SHP_DELIVERY_UPDATE was not being called.  This BAdI is crucial for updating LIPS with custom fields from table CT_VBPOK.

Steps for Updating Custom Fields on Delivery Line Item

  1. Append structure VBPOK with custom fields
  2. Create enhancement implementation of classic BAdI SMOD_V50B0001.  In method IF_EX_SMOD_V50B0001~EXIT_SAPLV50I_010 you will want to copy the values of your custom fields from Extenson1 or Extension2 to CT_VBPOK.
  3. Create enhancement implementation of BAdI LE_SHP_DELIVERY_UPDATE.  NOTE:  Business Function LOG_LE_INTEGRATION must be switched on.  This BAdI will allow you to update LIPS from CT_VBPOK.

Below are screen shots of my debugging that helped me figure this out:

I found the switch by looking at Enhancement Implementation VL_SFWS_LV50LF14

I then looked in table SFW_SW_BF to find the corresponding Business Function

Then T-code SFWF

nancy_kuchhal_ibm
Discoverer
0 Kudos

Hi Members:

If you want to update some other standard / customer fields data that are not a part of BAPI, please append following values to Extension2 structure of BAPI:

PARAM = Table name like LIKP for changes in Standard Outbound delivery

Field Name and Value in Fields named: FIELD and VALUE.

Pass Delivery Number in importing Variable DELIVERY

Abap_true in upd_ind of TECHN_CONTROL structure.

Regards,

Nancy Kuchhal

0 Kudos

Hi Nancy,

BAPI_OUTB_DELIVERY_CHANGE

Not work add field standard LIKP -->BEROT.

or strutured BAPIDLVHDR

Try is not work --

ls_extension-param = 'LIKP'.

ls_extension-field = 'BEROT'.
ls_extension-value = '332'. "TEST
ls_extension-row = '1'.
APPEND ls_extension TO lt_extension2.

ls_techn_control-upd_ind = 'U'.

B.Regards