cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
Read only

IF_EX_DOCUMENT_MAIN01

Former Member
0 Likes
2,296

Hello experts,

I am trying to check the value of a characteristic when I save a document in CV01N/CV02N.

I am using  IF_EX_DOCUMENT_MAIN01~BEFORE_SAVE but I have no access to classification information.

I have seen that in the same implementation there is a method call BEFORE_SEARCH_DATA that has the classification data.

How can I acces that information??

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

here is my piece of code

may be it will help You

I use badi  DOCUMENT_MAIN01 and its method ADD_ADDITIONAL_CLASSES

I  need to check authorizations for Company Code characteristic from Classification Tab of DMS document in CV02N

data ls_ausp type rmclausp.
   data lt_ausp_tab type standard table of rmclausp.
   data lv_object type kssk-objek.
   data: ls_doc_key type dms_doc_key.

   move-corresponding ls_draw to ls_doc_key.
   lv_object = ls_doc_key.

   call function 'CLAP_DDB_GET_BUFFER_PARAMS'
     exporting
       object                = lv_object
       classtype             = '017'
       obtab                 = 'DRAW'
*     OBJ_EQ_CLASS          = ' '
*   IMPORTING
*     E_OBJ_IN_BUFFER       =
*     E_CHANGE_OBJ          =
*     E_CHANGE_ANY          =
*     E_CHANGENO_USED       =
*     E_DATE_USED           =
    tables
*     E_KSSK_TAB            =
       e_ausp_tab            = lt_ausp_tab
*     E_DELCL_TAB           =
*     E_DELOB_TAB           =
             .
   loop at lt_ausp_tab into ls_ausp
                       where atinn = '0000000013'.
     exit.
   endloop.

   if sy-subrc = 0.

     authority-check object 'F_BKPF_BUK'
              id 'BUKRS' field ls_ausp-atwrt
              id 'ACTVT' field '01'.

     if sy-subrc <> 0.
       call function 'C14Z_MESSAGES_SHOW_AS_POPUP'
         exporting
           i_msgid = 'ZPAY_1149'
           i_msgty = 'E'
           i_msgno = '002'
           i_msgv1 = text-001
           i_msgv2 = ls_ausp-atwrt.
       message e001(zpay_1149).

     endif.

   endif.

Former Member
0 Likes

Thanks Vasily,

This code seems to work perfect!!!

Now my problem is that in DOCUMENT_MAIN01 I am trying to acces drad info in method BEFORE_SAVE and I am having some problems.

Although I hace define a private structure (i_drad) and I update it with the infor, in DOCUMENT_MAIN01 th structure is empty.

Do you know if it is possible??

Regards.

Former Member
0 Likes
hi,

for filling and updating drad I used user-exit CV110001
in function  exit_saplcv110_002 (program ZXCV110U02)

at the very beginning

I read db table drad

if gv_start = space.
   gv_start = 'X'.

   select * into table gt_drad
     from drad
     where dokar = draw-dokar
       and doknr = draw-doknr
       and dokvr = draw-dokvr
       and doktl = draw-doktl
       and dokob = 'IFLOT'.

endif.

gt_drad and gv_start declared in program ZXCV110TOP

  data gt_drad type standard table of drad with header line.

data gv_start.

later in program ZXCV110U02

I fill gt_drad with my new values
            clear gt_drad.
           gt_drad-mandt = sy-mandt.
           gt_drad-dokar = draw-dokar.
           gt_drad-doknr = draw-doknr.
           gt_drad-dokvr = draw-dokvr.
           gt_drad-doktl = draw-doktl.
           gt_drad-dokob = 'IFLOT'.
           gt_drad-obzae = '0000'.
          gt_drad-  objky = my_key.

                    read table gt_drad from gt_drad.
             if sy-subrc <> 0.
               append gt_drad.
             endif.

             pt_drad[] = gt_drad[].

when I save current DMS document all my changes update db table drad

With best regards, Vasil

Answers (2)

Answers (2)

Former Member
0 Likes

in my last example I used function CLAP_DDB_GET_BUFFER_PARAMS

it's not really correct because this function returns old values of characteristics and doesn't take into account new changes

You should use function CLFM_GET_INTERNAL_TABLES

CALL FUNCTION 'CLFM_GET_INTERNAL_TABLES'
     EXPORTING
       i_allausp     = 'X'
*     I_ALLKSSK     =
*     I_DELOB       =
*     I_DELCL       =
     TABLES
       exp_ausp_tab  = lt_ausp_tab
*     EXP_KSSK_TAB  =
*     EXP_DELCL_TAB =
*     EXP_DELOB_TAB =

all unchanged characteristics values     have lt_ausp_tab-statu = ""

old values for changed characteristics   have lt_ausp_tab-statu = "L"

new values for changed characteristics have lt_ausp_tab-statu = "H"


Former Member
0 Likes

Maybe IF_EX_DOCUMENT_MAIN01~ADD_ADDITIONAL_CLASSES is what you want. It gets the already existing classes which you can then check or change and even add new classes. In case of error simply throw the exception CANCEL.

Former Member
0 Likes

Hello Samuli,

There is no method call ADD_ADDITIONAL_CLASSES in DOCUMENT_MAIN01 (or I do not find ir).

The only methods I see are:


BEFORE_READ_DATA

AFTER_READ_DATA

ASSIGN_NUMBER

BEFORE_SAVE

BEFORE_DELETE

AFTER_SAVE

AFTER_DETERMINE_VALID_VERSION

AFTER_SEARCH_DATA

AFTER_CHANGE_NUMBER_CHECK

BEFORE_SEARCH_DATA

DOCUMENT_DELETE

SET_KPRO_UPDATE_MODE

Are you  sure that method is in DOCUMENT_MAIN01, where can I find it??

Thanks in advance.

Laura.


Former Member
0 Likes

What is your SAP version incl. SP level? SAP note 1630402 needs to be in the system. You should also make sure SAP note 1839361 is applied, otherwise the BAdI gets called too late.

https://service.sap.com/sap/support/notes/1630402

https://service.sap.com/sap/support/notes/1839361

Former Member
0 Likes

Hello Samuli,

First of all, thanks for you answer. I have implemented the note 1630402 and now I have the method ADD_ADDITIONAL_CLASSES in DOCUMENT_MAIN01 . I have set a break-point and I can see that it works.

Then problem is that when executing CV02N, it seems that parameters CHAR_VALUES and CLASS_VALUES should have the characteristics and the class associated with the document, but they are empty!!

Coupled with this, the note 1839361 cannot be implemented in my system.

Could you give me more information to know if I have done something wrong??

Thanks again.

Former Member
0 Likes

It might be that the parameters do not contain the existing classes, I just assumed they do. I will have to test it myself and get back to you.