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

Document component save without SAPGui

Former Member
0 Likes
656

Hello everybody,

I would like to save an document component (data in interne Table on server). Do you know how can I do it ? Know any one a relevant BAPI?

Best regards

Bogdan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
626

Hi Bogdan,

try this:


  DATA: l_file(60) VALUE '/tmp/example.txt'.

*write table to file
  OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
  LOOP AT itab.
    TRANSFER itab TO l_file.
  ENDLOOP.
  CLOSE DATASET l_file.


*read file to table
  DO.
    READ DATASET l_file INTO itab.
    IF sy-subrc NE 0.
      EXIT.
    ELSE.
      APPEND itab.
    ENDIF.
  ENDDO.

That's basically it.

regards,

Edgar

4 REPLIES 4
Read only

Former Member
0 Likes
627

Hi Bogdan,

try this:


  DATA: l_file(60) VALUE '/tmp/example.txt'.

*write table to file
  OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
  LOOP AT itab.
    TRANSFER itab TO l_file.
  ENDLOOP.
  CLOSE DATASET l_file.


*read file to table
  DO.
    READ DATASET l_file INTO itab.
    IF sy-subrc NE 0.
      EXIT.
    ELSE.
      APPEND itab.
    ENDIF.
  ENDDO.

That's basically it.

regards,

Edgar

Read only

0 Likes
626

Hello Edgar,

well, this way it is possible to load e filke - I know it. I wolud like to save a Data from Table in KPRO as a Original's Componont.

Best Regards

Boguslaw

Read only

0 Likes
626

Sorry Bogdan,

I've miss understood you.

I've never worked with KPRO components, but I'm actually building a code to place a document stored in the DMS to place inside a smartform. I'll post it when finished, it might be helpfull.

I'm checking this functions: [http://help.sap.com/saphelp_nw04/helpdata/en/3c/4d26696ab411d3aece0000e82deb58/frameset.htm] and bapi's BAPI_DOCUMENT_*

You might be interested in this link, although it doesn't answer to your question: [https://www.sdn.sap.com/irj/sdn/wiki?path=/label/snippets/kpro]

best regards,

Edgar

Read only

Former Member
0 Likes
626

It was with function SDOK_PHIO_STORE_NEW_VERSION implemented