cancel
Showing results for 
Search instead for 
Did you mean: 

USER EXIT for Version Increment

former_member185558
Active Participant
0 Kudos

Hi,

I am trying to use User Exit for custom version increment.

tried using BADI

DOCUMENT_NUMBER01

IF_EX_DOCUMENT_NUMBER01--> DOCVERSION_CHECK

but it is not working correctly and assume this is not correct place.

Please suggest right approach / badi / exit for the same.

Thanks and regards,

Niketan

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

    Already you have got the correct method DOCVERSION_CHECK of BADI DOCUMENT_NUMBER01.

   One more thing, you can check method BEFORE_READ_DATA of the BADI DOCUMENT_MAIN01 for any validations.

Regards,

Saravana

former_member185558
Active Participant
0 Kudos

Thanks Saravana,

But I missing the approach here...following are issues with DOCVERSION_CHECK

It is getting called twice when I create document. So my Program is running twice and version Is incremented twice

Also if I don't mention version and hit on create new version , it should take last version,

but in this DOCVERSON_CHECK it takes version blank and then obviously throws error.

looking for solution.

Thanks and regards

christoph_hopf
Advisor
Advisor
0 Kudos

Hi,

I've tested the version assignment also once again in your system and

please note that the first time your BADI is triggered is during the

process of assigning a valid document version. The second time the

BADI is executed is for checking the choosen document version. However

I think that in your BADI method, a check for an maybe already entered

document version is necessary to avoid that the pop-up is displayed

twice. So I think that before the follwoing coding there needs to be

a check if there is already a document version entered.

Main Program     YCL_IM_OM_DOCUMENT_VERSION====CP

Source code of   YCL_IM_OM_DOCUMENT_VERSION====CM002

METHOD           IF_EX_DOCUMENT_NUMBER01~DOCVERSION_CHECK

* Popup user for the custom version name

      CALL FUNCTION 'POPUP_GET_VALUES'

        EXPORTING

          popup_title     = 'Document Version'(001)

        IMPORTING

          returncode      = l_rc

        TABLES

          fields          = tl_fields

        EXCEPTIONS

          error_in_fields = 1

          OTHERS          = 2.

      IF sy-subrc <> 0.

        RAISE cancel.

      ELSE.

        READ TABLE tl_fields

          WITH KEY tabname = c_draw fieldname = c_dokvr

          INTO wl_fields.

This check could maybe look like a small IF...ELSE... statement like

IF doc_version NE '*'

"no pop-up"

ELSE

* Popup user for the custom version name

      CALL FUNCTION 'POPUP_GET_VALUES'

So from DMS standard point of view I can only confirm that the coding

in the includes is correct and the implementation of the note is

necessary. The only suggestion I can provide you is to modify your

BADI implementation and insert a check to avoid the second pop-up.

I hope that this information could be useful for you.

Best regards,
Christoph

former_member185558
Active Participant
0 Kudos

Thanks Christoph, I am changing DOC_VERSION not by pop up with little bit of programming.

As you suggested I need to avoid second iteration of DOCVERSION_CHECK.

I am unable to find a way how to do that.

(it s not passing DOKNR or else I would have checked latest version using BAPI).

Thanks and regards,

Niketan Maral