cancel
Showing results for 
Search instead for 
Did you mean: 

Can you print shopping cart from BBP_MON_SC?

dean_hinson2
Active Contributor
0 Kudos

The requestor can print the shopping cart from 'check status'. However, the approver needs the ability to print the shopping cart but there is no button from the Approval Inbox? Nor from the Shopping Cart Monitor?

I found some constants in BBP_MON_SC in the 'SECURITY' include but nothing regarding printing in the function group. I looked through function group BBP_SC_UI_ITS but it seems the print is only available in 'check status'.

Is this correct or am I missing something? Like an authorization?

Thank you in advance and points will be awarded accordingly.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dean,

Hi. I could not find a way to do this with the standard, but a simple modification on the respective ITS templaces as well as a small bit of coding gave our uses this functionality.

To do this we created a link (openable as an external web page with extension .pdf) on the respective templactes to a bespoke HTTP service passing the cart no or GUID. In the service we called the function module that converts the cart to a PDF, and return that to the HTTP service.

It works quite well.... I will include the code below in need.

Cheers

Rob

-


> On the ITS service that you would like to include the link i.e.

BBP_MON_SC SAPLBBP_MON_SC 2100

<script>

function launchCartPrint(sCartNum) {

var sOptions = 'menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes,'

+ 'resizable=yes, dependent=yes, width=900, height=800, left=50, top=50';

var sUrl = '/cartpreview/SC' + sCartNum + '/Cart' + sCartNum + '.pdf';

var load = window.open(sUrl, 'open_window', sOptions);

}

</script>

Find where you want the print icon and include code below....

`BBPNavigation("",BTN_SC_PRINT.label,"",jsFunction="launchCartPrint()")`

-


> On the web server create a HTTP service.

Tcode SICF; create service "cartpreview"; handlerlist ZCL_HTTP_BBP_SC_PREVIEW.

In SE24 create class with interface 'IF_HTTP_EXTENSION'.

Code as below....

method IF_HTTP_EXTENSION~HANDLE_REQUEST.

data:

l_Length type i,

l_Path type string,

l_StrGuid type string,

l_Guid type bbp_guid,

l_Cart type crmd_orderadm_h-object_id,

l_FileName type string,

l_Pdf type xstring,

l_Error type string,

l_ErrorX type xstring,

ls_orderadm_h type crmd_orderadm_h,

lt_orderadm_h type table of crmd_orderadm_h,

lo_Conversion type ref to cl_abap_conv_out_ce.

l_Path = server->request->get_header_field( name = '~path_info' ).

  • Remove the first '/'.

shift l_Path left by 1 places.

split l_Path at '/' into l_StrGuid l_FileName.

if l_StrGuid(2) eq 'SC'.

  • Shopping cart number instead of guid passed to us. Figure out the guid.

l_Length = strlen( l_StrGuid ) - 2.

l_Cart = l_StrGuid+2(l_Length).

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = l_Cart

importing

output = l_Cart.

select guid

from crmd_orderadm_h up to 1 rows

into l_Guid

where object_id = l_Cart

and object_type = 'BUS2121'.

exit.

endselect.

if sy-subrc ne 0.

  • Maybe it was the guid that was passed to us after all.

l_Guid = l_StrGuid.

endif.

else.

l_Guid = l_StrGuid.

endif.

  • Convert Cart to pdf

call method smart_form_output

exporting

i_guid = l_Guid

importing

e_pdf = l_pdf

exceptions

oops = 1

others = 2.

if sy-subrc eq 0.

server->response->set_header_field( name = 'Content-Type' value = 'application/pdf' ).

server->response->set_data( data = l_Pdf ).

else.

"Cater for error here

endif.

endmethod.

-


>Smart form output

Method smart_for_output

data:

l_smartform type tdsfname,

l_scenario type bbp_preview_smart_scenario.

----


  • Initial checking *

----


  • Check the cart no is correct

call method zcl_print=>check_cartid

changing

i_guid = i_guid

i_cartid = i_cartid

exceptions

blank = 1

error = 2

others = 3.

check_for_error_and_message 'Check Cart ID'.

----


  • Buffer setup *

----


l_smartform = 'BBP_SC'.

l_scenario = 'OUTPUT'.

call function 'BBP_OUTPUT_SC_GETDETAIL_SMART'

exporting

iv_sc_guid = i_guid

iv_smartform = l_smartform

importing

ev_smartform = l_smartform

exceptions

others = 1.

if sy-subrc ne 0.

l_smartform = 'BBP_SC'.

endif.

call function 'BBP_OUTPUT_SC_PREVIEW_SMART'

exporting

iv_guid = i_guid

iv_smartform = l_smartform

iv_scenario = l_scenario

importing

es_pdf = e_pdf

exceptions

others = 1.

dean_hinson2
Active Contributor
0 Kudos

I will see if my technical manager will permit this much modification. However, I will award full points for providing a whole solution.

Thanks!

dean_hinson2
Active Contributor
0 Kudos

Robin,

Can you provide code for the method....call method zcl_print=>check_cartid?

Also, is there anything else that was not indicated?

Thanks, Dean.

Answers (2)

Answers (2)

dean_hinson2
Active Contributor
0 Kudos

Made copy of BBP_MON_SC and added code to launch the print preview.

dean_hinson2
Active Contributor
0 Kudos

Missing a few details.

dean_hinson2
Active Contributor
0 Kudos

Ok, I did some work arounds for the checking the shopping cart by reading crmd_orderadm_h. However, when setting up the service in SICF, I get an error saying the ICF Handler is not an ABAP OO Class.

I am not familar with Classes in SAP and am not sure what it dos not like.

Does anyone have any ideas for me?