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: 

XD02

Former Member
0 Kudos

hello everyone,

i'm trying to feed the fields kna1-bahns ,in the transaction XD02,automaticly, i've tried to use the user-exit ZXF04U01, but when i save in the transaction XD02 the value that i gived for this fields is Missing , and so i can not update the table KNA1 .

thank you.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

It may help if you post the code of your zxf04u01 include...

But this is a quick guess - if you are setting BAHNS in the I_KNA1 structure then that won't be passed back into XD02 because it is an importing parameter only.

4 REPLIES 4

Former Member
0 Kudos

It may help if you post the code of your zxf04u01 include...

But this is a quick guess - if you are setting BAHNS in the I_KNA1 structure then that won't be passed back into XD02 because it is an importing parameter only.

0 Kudos

of course i can not change because it's just an import and not a changing parameter the structure i_kna1 , the code is follow

thank u.

TABLES : kna1.

DATA : gv_bahns(4) TYPE c,

gv_n TYPE n,"Compteur

kunnr TYPE KNA1-kunnr.

CONSTANTS :

gc_zhge(4) VALUE 'ZHGE',

gc_zhgf(4) VALUE 'ZHGF',

gc_zhgi(4) VALUE 'ZHGI',

gc_zhgp(4) VALUE 'ZHGP'.

IF i_kna1-ktokd = gc_zhge

OR i_kna1-ktokd = gc_zhgf

OR i_kna1-ktokd = gc_zhgi

OR i_kna1-ktokd = gc_zhgp.

CONDENSE i_kna1-sortl NO-GAPS.

IF STRLEN( i_kna1-sortl ) <= 7.

SELECT SINGLE kunnr FROM kna1 INTO kna1-kunnr

WHERE sortl = i_kna1-sortl

AND kunnr <> i_kna1-kunnr.

  • AND BAHNS <> i_kna1-BAHNS. " mus

*Si la valeur existe déjà alors message d'erreur

IF sy-subrc = 0.

MESSAGE i031(zmap) DISPLAY LIKE 'I'. "La valeur saisie dans la zone critère de recherche 1 existe déjà dans SAP

SET SCREEN '7000'.

SKIP .

ENDIF.

ELSE.

*Si la valeur de la zone est supérieur à 7 caractères alors message d'erreur

MESSAGE i032(zmap) DISPLAY LIKE 'I' . "La valeur de la zone "critère de recherche 1" doit être < ou = à 7 chars

SET SCREEN '7000'.

SKIP.

ENDIF.

*Génération du Critère de recherche 2 sur 4 caractère

gv_n = 0.

  • IF i_kna1-bahns IS INITIAL .

CLEAR i_kna1-bahns.

gv_bahns = i_kna1-name1+0(4).

SELECT SINGLE kunnr FROM kna1 INTO kna1-kunnr

WHERE kunnr <> i_kna1-kunnr

AND bahns = gv_bahns.

WHILE sy-subrc = 0.

CLEAR gv_bahns.

gv_n = gv_n + 1.

CONCATENATE i_kna1-name1+0(3) gv_n into gv_bahns.

SELECT SINGLE kunnr FROM kna1 INTO kna1-kunnr

WHERE kunnr <> i_kna1-kunnr

AND bahns = gv_bahns.

endwhile.

MOVE gv_bahns to i_kna1-bahns.

UPDATE KNA1

SET bahns = gv_bahns

WHERE kunnr EQ kunnr.

ENDIF.

0 Kudos

hi,

there is a trick to make the change inside the exit (even if it is an importing parameter). Add the following lines:

FIELD-SYMBOLS : <lv_bahns> TYPE kna1-bakns.

ASSIGN ('(SAPMF02D)KNA1-BAHNS') TO <lv_bahns>.
<lv_bahns> = gv_bahns.

hope this helps

ec

0 Kudos

Not sure why you are updating table KNA1 from within the exit as direct updates to SAP tables are not recommended! But probably your table update is being made before the standard XD02 update which occurs after the exit has processed. So it is being overwritten.

I'd remove the UPDATE KNA1 idea, and try Eric's trick to pass the station name into the standard XD02 update.