Hello,
I want to convert a structure to char for usage in a remote function call (rfc).
In my special case I have to confert a strucute type sofmk to char70.
The ABAP code (works well) looks like:
* Create main BO object_a
data: lo_is_object_a type borident.
lo_is_object_a-objkey = p_equnr.
lo_is_object_a-objtype = botype.
* Create attachment BO object_b
data: lo_is_object_b type borident.
* LO_IS_OBJECT_B-OBJKEY = LV_MESSAGE_KEY.
* LO_IS_OBJECT_B-OBJTYPE = DOCTY.
data: ls_folmen_k type sofmk.
data: lv_ep_note type borident-objkey.
ls_folmen_k-foltp = ls_fol_id-objtp.
ls_folmen_k-folyr = ls_fol_id-objyr.
ls_folmen_k-folno = ls_fol_id-objno.
ls_folmen_k-doctp = ls_obj_id-objtp.
ls_folmen_k-docyr = ls_obj_id-objyr.
ls_folmen_k-docno = ls_obj_id-objno.
lv_ep_note = ls_folmen_k.
lo_is_object_b-objtype = 'MESSAGE'.
lo_is_object_b-objkey = lv_ep_note.
call function 'BINARY_RELATION_CREATE_COMMIT'
exporting
obj_rolea = lo_is_object_a
obj_roleb = lo_is_object_b
relationtype = 'ATTA'<br>
Now I want to do this remote (in my case I am using python and pyrfc with nwrfcsdk). It is not possible to pass a SOFMK structure to BORIDENT-OBJKEY because BORIDENT-OBJKEY is type char70.
My question is how I have to format a char with the content of the sofmk fields?
FOLTP Type CHAR 3 Objekt Mappe: Objekttyp aus der ID. FOLYR Type CHAR 2 Objekt Mappe: Jahr aus der ID. FOLNO Type CHAR 12 Objekt Mappe: Nummer aus der ID. DOCTP Type CHAR 3 Objekt: Objekttyp aus der ID. DOCYR Type CHAR 2 Objekt: Jahr aus der ID. DOCNO Type CHAR 12 Objekt: Nummer aus der ID. FORTP Type CHAR 3 Weiterleitender: Objekttyp aus der ID. (not needed) FORYR Type CHAR 2 Weiterleitender: Jahr aus der ID. (not needed) FORNO Type CHAR 12 Weiterleitender: Nummer aus der ID. (not needed)
Example:
SOFMK:
'FOLTP': 'FOL',
'FOLYR': '20',
'FOLNO': ' 4',
'DOCTP': 'EXT',
'DOCYR': '47',
'DOCNO': '000000013710'
I thought the string should look like somithing like this:
BORIDENT-OBJKEY = "FOL20 4EXT47000000013701"
But this is not working.
Can someone explain to me how I can convert such structures. How does this look specifically in this example?