Application Development and Automation 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: 
Read only

BAPI_DOCUMENT_CREATE2 with CHARACTERISTICVALUES

Former Member
0 Likes
662

Hello

I'm trying to use the FM BAPI_DOCUMENT_CREATE2 filling the CHARACTERISTICVALUES table but i'm not sucessfull, anybody has an example or others?

The type of the characteristics is 017, values are stored in AUSP table but the characteristic is a date so is stored in a fixing point field named ATFLV (for example the date 20070915 is istored 2,007091500000000E+07)

3 REPLIES 3
Read only

chaouki_akir
Contributor
0 Likes
573

Hello,

did you find an answer to your question ?

cordialement,

Chaouki AKIR.

Read only

0 Likes
573

Here is a sample program, hope it helps

*& Report ZPRUEBAINTERFASEPS

*&

&----


*&

*&

&----


REPORT zpruebainterfaseps.

SELECTION-SCREEN: BEGIN OF BLOCK a1 WITH FRAME.

PARAMETERS: p_docu LIKE draw-doknr.

SELECTION-SCREEN: END OF BLOCK a1.

DATA: gv_documento LIKE draw-doknr,

gv_clase LIKE draw-dokar VALUE 'ZET',

gv_version LIKE draw-dokvr VALUE '00',

gv_part LIKE draw-doktl VALUE '000',

gv_descripcion LIKE drat-dktxt VALUE 'Descripcion de prueba',

gv_return LIKE bapiret2,

gv_ruta LIKE bapi_doc_files2-docfile VALUE 'C:\PRUEBA.XLS'.

DATA: gs_documentdata LIKE bapi_doc_draw2,

gt_characteristicvalues LIKE bapi_characteristic_values OCCURS 0 WITH HEADER LINE,

gt_classallocations LIKE bapi_class_allocation OCCURS 0 WITH HEADER LINE,

gt_documentfiles LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE.

AT LINE-SELECTION.

SET PARAMETER ID 'CV1' FIELD p_docu.

SET PARAMETER ID 'CV2' FIELD gv_clase.

CALL TRANSACTION 'CV02N' AND SKIP FIRST SCREEN.

START-OF-SELECTION.

gv_documento = p_docu.

gs_documentdata-documenttype = gv_clase.

gs_documentdata-documentnumber = gv_documento.

gs_documentdata-documentversion = gv_version.

gs_documentdata-documentpart = gv_part.

gs_documentdata-description = gv_descripcion.

gt_characteristicvalues-classtype = '017'.

gt_characteristicvalues-classname = 'ZDMS_DT'.

gt_characteristicvalues-charname = 'ZFEFIPRE'.

gt_characteristicvalues-charvalue = '15092007'.

APPEND gt_characteristicvalues.

gt_classallocations-classtype = '017'.

gt_classallocations-classname = 'ZDMS_DT'.

APPEND gt_classallocations.

gt_documentfiles-wsapplication = 'ZXL'.

gt_documentfiles-docfile = 'C:\PRUEBA.XLS'.

  • gt_documentfiles-docfile = '/tmp/pruebafondo'.

  • gt_documentfiles-docpath = 'zficherointerfaseps'.

gt_documentfiles-storagecategory = 'DMS_C1_ST'.

gt_documentfiles-checkedin = 'X'.

APPEND gt_documentfiles.

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

EXPORTING

documentdata = gs_documentdata

IMPORTING

return = gv_return

TABLES

characteristicvalues = gt_characteristicvalues

classallocations = gt_classallocations

documentfiles = gt_documentfiles.

IF gv_return-type CA 'AE'.

WRITE gv_return-message.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

  • LOOP AT gt_documentfiles.

*

  • gt_documentfiles-checkedin = 'X'.

  • MODIFY gt_documentfiles.

*

  • ENDLOOP.

*

  • CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN2'

  • EXPORTING

  • documenttype = gv_clase

  • documentnumber = gv_documento

  • documentpart = gv_part

  • documentversion = gv_version

    • HOSTNAME = ' '

    • STATUSINTERN = ' '

    • STATUSEXTERN = ' '

    • STATUSLOG = ' '

    • REVLEVEL = ' '

    • AENNR = ' '

    • PF_HTTP_DEST = ' '

    • PF_FTP_DEST = ' '

    • IMPORTING

    • RETURN =

  • TABLES

  • documentfiles = gt_documentfiles

    • COMPONENTS =

    • DOCUMENTSTRUCTURE =

  • .

*

  • CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • wait = 'X'.

FORMAT HOTSPOT ON.

WRITE: 'SE HA INTENTADO CREAR EL DOCUMENTO:' , p_docu.

FORMAT HOTSPOT OFF.

ENDIF.

Read only

0 Likes
573

Thank you.

Cordialement,

Chaouki AKIR.