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: 

ODN Flag is always coming as 'X' in BADI J_1IG_CHANGE_ODN_CHECK.

arijitbarman
Participant
0 Kudos

Dear Abapers,

C_ODN_FLAG value by default is ‘X’ in BADI J_1IG_CHANGE_ODN_CHECK while creating billing from VF01 or VF04. My requirement is to disable the flag based on certain conditions in the billing document (i.e. if there is no GST condition found in the billing document then ODN number should not be generated and VBRK-XBLNR field should have the billing document number-VBELN ). I am changing the odn flag value to space successfully but xblnr is getting a default value I do not know from where. It is prepopulated even in the BADI vbrk structure. The value is already there in vbrk-xblnr field way before the ODN fm is called. Even if I am clearing these values, billing doc is getting posted with that default xblnr. Please help me to rectify this issue. Is there any other BADI or exit I need to develop for this scenario.

I am sharing my code in the BADI.

FIELD-SYMBOLS: <fs_xkomv> TYPE ANY TABLE.

DATA: lt_komv TYPE STANDARD TABLE OF komv.

DATA: lv_flag TYPE char1.


IF ( sy-tcode = 'VF01' OR sy-tcode = 'VF04' ).

IF ( i_vbrk-fkart = 'ZBRE' OR i_vbrk-fkart = 'ZCR1' OR i_vbrk-fkart = 'ZDR1' ).ASSIGN ('(SAPLV60A)XKOMV[]') TO <fs_xkomv>.IF <fs_xkomv> IS ASSIGNED.
lt_komv = <fs_xkomv>.
LOOP AT lt_komv ASSIGNING FIELD-SYMBOL(<ls_xkomv>) WHERE kschl = 'JOIG' OR kschl = 'JOCG' OR kschl = 'JOSG' OR kschl = 'JOUG'.CLEAR lv_flag.
lv_flag = 'X'.
ENDLOOP.
ENDIF.
ENDIF.

IF lv_flag = 'X'.
c_odn_flag = 'X'.
ELSE.

CLEAR c_odn_flag.
i_vbrk-xblnr = ''.
ENDIF.
ENDIF.

Thanks.

0 REPLIES 0