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

fm SO_OBJECT_INSERT: filename is empty

former_member205488
Active Participant
4,166

Hello!

I use fm SO_OBJECT_INSERT to store an attachment to an infotype record. Attachment is created sucessfully, but when I open the infotype record in PA30 I see the created attachment with empty filename:

If i create an attachment directly in PA30 using GOS the filename I get is not empty.

This is a code fragment containing fm call.

 

   DATA ls_folder_id TYPE soobjinfi1-object_id.

   DATA ls_folder TYPE soodk.

   DATA lt_head TYPE TABLE OF soli.

   DATA ls_obj_data TYPE sood1.

   DATA ls_obj_id TYPE soodk.

   CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'

     EXPORTING

       region                = 'B'                           "#EC NOTEXT

     IMPORTING

       folder_id             = ls_folder

     EXCEPTIONS

       OTHERS                = 1.

   ls_folder_id = ls_folder.

   ls_obj_data-objsns = 'O'.

   ls_obj_data-objla = sy-langu.

   ls_obj_data-objdes = ls_obj_data-objnam = 'MyFile.pdf'.

   ls_obj_data-file_ext = 'pdf'.

   ls_obj_data-objlen = iv_size//is provided, not empty

   CALL FUNCTION 'SO_OBJECT_INSERT'

     EXPORTING

       folder_id                  = ls_folder_id

       object_hd_change           = ls_obj_data

       object_type                = 'EXT'

     IMPORTING

       object_id                  = ls_obj_id

     TABLES

       objcont                    = it_cont   //is provided, not empty

       objhead                    = lt_head   //is empty

     EXCEPTIONS

       OTHERS                     = 1.



Has anyone faced this issue yet?

Thanks in advance.




1 ACCEPTED SOLUTION
Read only

former_member205488
Active Participant
1,880

Solved. I had to provide table OBJHEAD with values:

   APPEND INITIAL LINE TO lt_head ASSIGNING <ls_head>.

   CONCATENATE '&SO_FILENAME=' iv_filename INTO <ls_head>-line.

 

   APPEND INITIAL LINE TO lt_head ASSIGNING <ls_head>.

   <ls_head>-line = '&SO_FORMAT=BIN'.                      

Hello!

I use fm SO_OBJECT_INSERT to store an attachment to an infotype record. Attachment is created sucessfully, but when I open the infotype record in PA30 I see the created attachment with empty filename:

If i create an attachment directly in PA30 using GOS the filename I get is not empty.

This is a code fragment containing fm call.

 

   DATA ls_folder_id TYPE soobjinfi1-object_id.

   DATA ls_folder TYPE soodk.

   DATA lt_head TYPE TABLE OF soli.

   DATA ls_obj_data TYPE sood1.

   DATA ls_obj_id TYPE soodk.

   CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'

     EXPORTING

       region                = 'B'                           "#EC NOTEXT

     IMPORTING

       folder_id             = ls_folder

     EXCEPTIONS

       OTHERS                = 1.

   ls_folder_id = ls_folder.

   ls_obj_data-objsns = 'O'.

   ls_obj_data-objla = sy-langu.

   ls_obj_data-objdes = ls_obj_data-objnam = 'MyFile.pdf'.

   ls_obj_data-file_ext = 'pdf'.

   ls_obj_data-objlen = iv_size//is provided, not empty

   CALL FUNCTION 'SO_OBJECT_INSERT'

     EXPORTING

       folder_id                  = ls_folder_id

       object_hd_change           = ls_obj_data

       object_type                = 'EXT'

     IMPORTING

       object_id                  = ls_obj_id

     TABLES

       objcont                    = it_cont   //is provided, not empty

       objhead                    = lt_head   //is empty

     EXCEPTIONS

       OTHERS                     = 1.



Has anyone faced this issue yet?

Thanks in advance.




1 REPLY 1
Read only

former_member205488
Active Participant
1,881

Solved. I had to provide table OBJHEAD with values:

   APPEND INITIAL LINE TO lt_head ASSIGNING <ls_head>.

   CONCATENATE '&SO_FILENAME=' iv_filename INTO <ls_head>-line.

 

   APPEND INITIAL LINE TO lt_head ASSIGNING <ls_head>.

   <ls_head>-line = '&SO_FORMAT=BIN'.