Notes
Notes - notes.io |
CLEAR: lv_strbody.",lv_strbody1.
SELECT SINGLE *
FROM zfsbr0357
INTO @DATA(ls_zfsbr0357)
WHERE zrfeedname = 'FS_CP2'.
IF sy-subrc = 0.
* Pass the URL to get Data
lv_string = ls_zfsbr0357-zapi_url.
PERFORM set_url USING lv_string 'POST' CHANGING lo_http_client . "Creation of New IF_lo_http_client Object
"pass authorization & bearer token
PERFORM set_header USING gv_auth gv_authkey CHANGING lo_http_client.
PERFORM set_header USING ls_zfsbr0357-zauth_fname ls_zfsbr0357-zauth_fvalue CHANGING lo_http_client.
* PERFORM set_form_fields USING ls_zfsbr0357-zuser_fname ls_zfsbr0357-zuser_fvalue CHANGING lo_http_client.
* PERFORM set_form_fields USING ls_zfsbr0357-zpass_fname ls_zfsbr0357-zpass_fvalue CHANGING lo_http_client.
LOOP AT gt_dis INTO gs_dis WHERE status = 'Success'.
IF sy-tabix = 1.
lv_strbody = '[ { "' && ls_zfsbr0357-zuser_fname && '": "' && ls_zfsbr0357-zuser_fvalue && '",' && "userid
' " ' && ls_zfsbr0357-zpass_fname && '": "' && ls_zfsbr0357-zpass_fvalue && '" },'. "password
ENDIF.
lv_strbody = lv_strbody && '{"company":"' && gs_dis-bukrs && '","txnno":"'
&& |{ gs_dis-rfha ALPHA = OUT }| && '","classid":"'
&& |{ gs_dis-ranl ALPHA = OUT }| && '" },' .
ENDLOOP.
IF lv_strbody IS NOT INITIAL.
SHIFT lv_strbody RIGHT DELETING TRAILING ','.
lv_strbody = lv_strbody && ']'.
ENDIF.
"Converting Body data to pass in set data method
PERFORM string_to_xstring USING lv_strbody CHANGING lv_xstrbody .
PERFORM set_data USING lv_xstrbody.
PERFORM send CHANGING lo_http_client . "send data
""get response
lo_http_client->response->get_status(
IMPORTING
code = lv_code
reason = reason ).
IF lv_code = 200.
UNASSIGN :<data>,<results>,<table>.
CLEAR lr_data.
DATA(lv_string3) = lo_http_client->response->get_cdata( ).
CONDENSE lv_string3 NO-GAPS.
REPLACE ALL OCCURRENCES OF '' IN lv_string3 WITH ' '.
/ui2/cl_json=>deserialize(
EXPORTING json = lv_string3
pretty_name = /ui2/cl_json=>pretty_mode-camel_case
CHANGING data = lr_data ).
IF lr_data IS BOUND.
ASSIGN lr_data->* TO <data>.
ASSIGN COMPONENT 'DATA' OF STRUCTURE <data> TO <results>.
IF sy-subrc = 0.
ASSIGN <results>->* TO <table>.
LOOP AT <table> ASSIGNING <structure>.
ASSIGN <structure>->* TO <data>.
IF <structure> IS NOT INITIAL.
ASSIGN <structure>->* TO <table1>.
LOOP AT <table1> ASSIGNING <structure1>.
ASSIGN <structure1>->* TO <data1>.
ASSIGN COMPONENT `CODE` OF STRUCTURE <data1> TO <field>.
IF <field> IS ASSIGNED.
lr_data1 = <field>.
ASSIGN lr_data1->* TO <field_value>.
gs_402-file_name = <field_value>.
ENDIF.
UNASSIGN : <field>,<field_value>.
ASSIGN COMPONENT `DESCRIPTION` OF STRUCTURE <data1> TO <field>.
IF <field> IS ASSIGNED.
lr_data = <field>.
ASSIGN lr_data->* TO <field_value>.
gs_402-base_64_code = <field_value>.
ENDIF.
UNASSIGN : <field>,<field_value>.
gs_402-company_code = p_bukrs.
IF gs_402-file_name+0(3) = 'IDF'.
gs_402-zltr_cat = gs_402-file_name+20(5).
gs_402-zltr_type = gs_402-file_name+26(4).
gs_402-ranl = |{ gs_402-file_name+4(7) ALPHA = IN }|.
gs_402-rfha = |{ gs_402-file_name+12(7) ALPHA = IN }|.
ELSE.
gs_402-zltr_cat = gs_402-file_name+21(5). "letter category
gs_402-zltr_type = gs_402-file_name+27(4). "letter type
gs_402-ranl = |{ gs_402-file_name+5(7) ALPHA = IN }|.
gs_402-rfha = |{ gs_402-file_name+13(7) ALPHA = IN }|.
ENDIF.
gs_402-zcreated_by = sy-uname.
gs_402-zcreated_date = sy-datum.
gs_402-zcreated_time = sy-uzeit.
gs_402-zchanged_by = sy-uname.
gs_402-zchanged_date = sy-datum.
gs_402-zchanged_time = sy-uzeit.
APPEND gs_402 TO gt_402.
CLEAR gs_402.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
gv_msg = 'X'.
IF gt_402 IS NOT INITIAL.
* LOOP at gt_dis ASSIGNING FIELD-SYMBOL(<fs_dis>) .
* SELECT COUNT(*) FROM gt_402 WHERE
* ENDLOOP.
MODIFY zfsbr0402 FROM TABLE gt_402.
* CLEAR gt_402.
ENDIF.
ELSE.
IF sy-tcode = 'ZTRM0569'.
MESSAGE 'Please maintain URL Details for getting letters' TYPE 'W' DISPLAY LIKE 'S' .
ELSE.
gv_msg = 'Error while getting letters, Please maintain URL Details for getting letters'.
EXPORT gv_msg TO MEMORY ID 'GV_MSG'.
LEAVE LIST-PROCESSING.
ENDIF.
* LEAVE LIST-PROCESSING.
ENDIF.
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team
