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

Regarding a function exit

Former Member
0 Likes
449

hi guys,

i have extended an idoc and for this i am using a function exit to populate data in the added new segment z1segment under E!knvkm segment ( parent segment). I found which funtion exit to use but i could not make out the logic to populate the data in the segment z1segment.

can any one please help me regarding this

thank you very much

pavan

2 REPLIES 2
Read only

messier31
Active Contributor
0 Likes
412

Hi Pavan,

I fail to understand the req. You have found the proper function exit.. You have application data.. You have the idoc/segment details ....Check following code to update the idoc...

<b>STEP 1 - Open document to edit</b>

CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'

EXPORTING

document_number = t_docnum

IMPORTING

idoc_control = itab_edidc

TABLES

idoc_data = itab_edidd

EXCEPTIONS

document_foreign_lock = 1

document_not_exist = 2

document_not_open = 3

status_is_unable_for_changing = 4

OTHERS = 5.

<b>STEP 2 - Loop at itab_edidd and change data</b>

LOOP AT itab_edidd WHERE segnam = 'E1EDKA1'.

e1edka1 = itab_edidd-sdata.

IF e1edka1-parvw = 'LF'.

e1edka1-partn = t_eikto.

itab_edidd-sdata = e1edka1.

MODIFY itab_edidd.

EXIT.

ENDIF.

ENDLOOP.

<b>STEP 3 - Change data segments</b>

CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'

TABLES

idoc_changed_data_range = itab_edidd

EXCEPTIONS

idoc_not_open = 1

data_record_not_exist = 2

OTHERS = 3.

Hope this helps you..let me know if need more input on this...

Enjoy SAP.

Pankaj Singh.

Read only

Former Member
0 Likes
412

thanks for ur answer pankaj, i will explain you my requirement -

i need to add contact person business address in debmas05 idoctype and that is why i decided to extend the idoc by adding an extension type z1debmas where i need to populate fields from sadr table which contain business address details.

for this there is enhancement vsv00001 which consists of function exit exit_saplvv01_001 and in here i need to add code to populate z1debmas.

plss reply bk if u dunt understand and try to help me regarding this.

thanks

pavan