Skip to Content
avatar image
Former Member

FM Z_EASYDMS_GETDOCDEFAULTS

Hi Gurus,

I am having problems in which when I create a document in a folder in Easy DMS. Site specific information from the folder are not copied in the new document. Can you please help me on this?

Thank you!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Mar 17, 2010 at 05:56 AM

    Which information are you referring to?? characteristic??

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 18, 2010 at 06:47 AM

    Hi Surjit,

    Right, characteristics are not copying from the folder where the documents are created.

    May I know your thoughts on this?

    Thanks.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      have you fileld the tables: CHARACTERISTICVALUES and CLASSALLOCATIONS from the parent characteristics??/

      please provide what code you have used...

  • avatar image
    Former Member
    Mar 19, 2010 at 06:41 AM

    Hi Surjit,

    Thanks for the response!

    Please see below the coding I have on the system.

    FUNCTION z_easydms_getdocdefaults .

    *"----


    ""Local interface:

    *" IMPORTING

    *" VALUE(FOLDERDOCUMENT) TYPE BAPI_DOC_KEYS OPTIONAL

    *" VALUE(DOCUMENTTYPE) LIKE BAPI_DOC_DRAW2-DOCUMENTTYPE OPTIONAL

    *" VALUE(ISFOLDER) LIKE BAPI_DOC_DRAW2-CADINDICATOR OPTIONAL

    *" EXPORTING

    *" VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2

    *" VALUE(DOCUMENTDATA) TYPE BAPI_DOC_DRAW2

    *" TABLES

    *" CLASSALLOCATIONS STRUCTURE BAPI_CLASS_ALLOCATION OPTIONAL

    *" CHARACTERISTICVALUES STRUCTURE BAPI_CHARACTERISTIC_VALUES

    *" OPTIONAL

    *"----


    • read document structure of source folder

    DATA: docdata LIKE bapi_doc_draw2,

    lt_charvalues TYPE TABLE OF bapi_characteristic_values,

    ret LIKE bapiret2,

    wa_charvalues TYPE bapi_characteristic_values.

    • Class data

    DATA : BEGIN OF lt_klah OCCURS 0,

    class TYPE klah-class,

    klart TYPE klah-klart,

    statu TYPE klah-statu,

    klagr TYPE klah-klagr,

    END OF lt_klah.

    • Class number & type

    DATA: lv_classnum LIKE tdwa-klasse,

    lv_classtype LIKE tdwa-klassenart.

    • Class Characteristic & Values Internal table

    DATA: lt_char LIKE TABLE OF klmerka WITH HEADER LINE,

    lt_values LIKE TABLE OF clx2v WITH HEADER LINE.

    CONSTANTS : c_doctype(3) TYPE c VALUE 'PQS',

    c_x(1) TYPE c VALUE 'X',

    c_wpqs(5) TYPE c VALUE 'WPQS-',

    c_017(3) TYPE c VALUE '017',

    c_wpqs_data(9) TYPE c VALUE 'WPQS_DATA',

    c_doc_num(7) TYPE c VALUE 'DOC_NUM',

    c_doc_type(4) TYPE c VALUE 'WPQS',

    c_1(1) TYPE c VALUE '1',

    c_facility(8) TYPE c VALUE 'FACILITY',

    c_nr_range_nr TYPE inri-nrrangenr VALUE '01',

    c_object TYPE inri-object VALUE 'ZWPQSDOCNU'.

    DATA: lv_value_int(7) TYPE n,

    lv_docnum(12) TYPE c.

    • Check document type for the new entry document

    IF folderdocument+0(3) = c_doctype.

    CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'

    EXPORTING

    documenttype = folderdocument+0(3)

    documentnumber = folderdocument+3(25)

    documentpart = folderdocument+30(3)

    documentversion = folderdocument+28(2)

    getclassification = c_x

    IMPORTING

    documentdata = docdata

    return = ret

    TABLES

    characteristicvalues = lt_charvalues.

    CALL FUNCTION 'NUMBER_GET_NEXT'

    EXPORTING

    nr_range_nr = c_nr_range_nr

    object = c_object

    IMPORTING

    number = lv_value_int

    EXCEPTIONS

    interval_not_found = 1

    number_range_not_intern = 2

    object_not_found = 3

    quantity_is_0 = 4

    quantity_is_not_1 = 5

    interval_overflow = 6

    buffer_overflow = 7

    OTHERS = 8.

    IF sy-subrc EQ 0.

    CONCATENATE c_wpqs lv_value_int INTO lv_docnum.

    characteristicvalues-classtype = c_017.

    characteristicvalues-classname = c_wpqs_data.

    characteristicvalues-charname = c_doc_num.

    characteristicvalues-charvalue = lv_docnum.

    APPEND characteristicvalues.

    ENDIF.

    • Check Facility Location

    SELECT class klart statu klagr

    INTO TABLE lt_klah FROM klah

    WHERE klart = c_017

    AND statu = c_1

    AND klagr = c_wpqs.

    IF sy-subrc EQ 0.

    SORT lt_klah BY class.

    ENDIF.

    *Get default classification for document type

    SELECT SINGLE klasse klassenart INTO (lv_classnum,lv_classtype) FROM tdwa

    WHERE dokar = folderdocument+0(3).

    *Get values for characteristics

    CALL FUNCTION 'CLME_FEATURE_ATTR_OF_CLASS'

    EXPORTING

    class = lv_classnum

    classtype = lv_classtype

    TABLES

    tfeatures = lt_char

    tvalues = lt_values

    EXCEPTIONS

    class_not_found = 1

    no_authority = 2

    OTHERS = 3.

    IF sy-subrc EQ 0.

    SORT lt_values BY atwtb.

    ENDIF.

    • Add Classification for facility characteristics

    LOOP AT lt_charvalues INTO wa_charvalues WHERE charname = c_facility.

    READ TABLE lt_values WITH KEY atwtb = wa_charvalues-charvalue

    BINARY SEARCH.

    IF sy-subrc EQ 0.

    READ TABLE lt_klah WITH KEY class = lt_values-atwrt

    BINARY SEARCH.

    IF sy-subrc EQ 0.

    classallocations-classtype = lt_klah-klart.

    classallocations-classname = lt_klah-class.

    classallocations-status = lt_klah-statu.

    APPEND classallocations.

    ENDIF.

    ENDIF.

    ENDLOOP.

    • Inherit Characteristic Values from Parent folder.

    LOOP AT lt_charvalues INTO wa_charvalues WHERE charname NE c_doc_num.

    characteristicvalues-classtype = c_017.

    characteristicvalues-classname = c_wpqs_data.

    characteristicvalues-charname = wa_charvalues-charname.

    characteristicvalues-charvalue = wa_charvalues-charvalue.

    APPEND characteristicvalues.

    ENDLOOP.

    ENDIF.

    ENDFUNCTION.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 28, 2010 at 09:13 AM

    solved

    Add comment
    10|10000 characters needed characters exceeded