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

Problem in user exit

Former Member
0 Likes
559

This is Include program ZXV56U18,

IMPORTING

**" VALUE(I_FCODE) LIKE T185F-FCODE

**" VALUE(I_XVTTK_WA) LIKE VTTKVB STRUCTURE VTTKVB

**" VALUE(I_XVTTS_WA) LIKE VTTSVB STRUCTURE VTTSVB OPTIONAL

**" VALUE(I_XVTTP_WA) LIKE VTTPVB STRUCTURE VTTPVB OPTIONAL

**" TABLES

**" I_XVTTK_TAB STRUCTURE VTTKVB

**" I_XVTTP_TAB STRUCTURE VTTPVB OPTIONAL

**" I_XTRLK_TAB STRUCTURE VTRLK OPTIONAL

**" I_XTRLP_TAB STRUCTURE VTRLP OPTIONAL

**" I_XVTTS_TAB STRUCTURE VTTSVB OPTIONAL

**" I_XVTSP_TAB STRUCTURE VTSPVB OPTIONAL

**" I_XVBPA_TAB STRUCTURE VBPAVB OPTIONAL

**" EXCEPTIONS

**" FCODE_NOT_PERMITTED

  • code written by me

DATA: BEGIN OF l_t_vlkpa OCCURS 0,

kunde LIKE vlkpa-kunde,

parvw LIKE vlkpa-parvw,

vbeln LIKE i_xvttp_tab-vbeln,

END OF l_t_vlkpa.

DATA : BEGIN OF l_t_temp OCCURS 0,

vbeln LIKE i_xvttp_tab-vbeln,

END OF l_t_temp.

CONSTANTS c_pfunc TYPE char2 VALUE 'SP'.

IF i_xvttp_tab[] IS NOT INITIAL.

*Fetch the partner number for the partner function 'CR'.

SELECT kunde parvw vbeln INTO TABLE l_t_vlkpa

FROM vlkpa

FOR ALL ENTRIES IN i_xvttp_tab

WHERE parvw = c_pfunc AND

vbeln = i_xvttp_tab-vbeln .

SORT l_t_vlkpa BY vbeln.

SORT i_xvttk_tab BY tknum.

LOOP AT i_xvttp_tab.

*Read those delivery numbers which has partner function 'CR'

READ TABLE l_t_vlkpa WITH KEY vbeln = i_xvttp_tab-vbeln BINARY SEARCH.

IF sy-subrc = 0.

READ TABLE i_xvttk_tab WITH KEY tknum = i_xvttp_tab-tknum BINARY SEARCH.

IF sy-subrc = 0.

*copy the partner number into the forwarding agent field of the overview screen.

i_xvttk_tab-tdlnr = l_t_vlkpa-kunde.

MODIFY i_xvttk_tab INDEX sy-tabix.

ENDIF.

ELSE.

MOVE i_xvttp_tab-vbeln TO l_t_temp-vbeln.

APPEND l_t_temp.

CLEAR:l_t_temp.

ENDIF.

ENDLOOP.

*Display the warning message as " Carrier Partner Function not found".

loop at l_t_temp.

READ TABLE i_xvttp_tab WITH KEY vbeln = l_t_temp-vbeln BINARY SEARCH.

MESSAGE w019(zvsales_as) WITH l_t_temp-vbeln.

endloop.

  • clear: g_flag.

ENDIF.

ENDIF.

In the output the message is getting displayed twice for every delivery..

Can anybody tell the reson for this ?

and solution...

Thanks

Sonal

3 REPLIES 3
Read only

Former Member
0 Likes
485

Hi ,

Before looping the table l_t_temp. Sort it and afte do this

Delete Adjacent duplicates l_t_temp comparing Vbeln.

Regards,

Jayaram...

Read only

Former Member
0 Likes
485

Put a break point and see whow many entries does the table: l_t_temp have.

Regards,

Ravi

Read only

Former Member
0 Likes
485

HEllo,

<b>In ur code if the table l_t-temp contains two records then the u will see the message twice</b>



*Display the warning message as " Carrier Partner Function not found".
loop at l_t_temp.
READ TABLE i_xvttp_tab WITH KEY vbeln = l_t_temp-vbeln BINARY SEARCH.
if sy-subrc = 0.        " Add these lines
MESSAGE w019(zvsales_as) WITH l_t_temp-vbeln.
exit.                         " Add these lines
endif.                       " Add these lines 
endloop.
* clear: g_flag.

If useful reward.

Vasanth