Beruflich Dokumente
Kultur Dokumente
"doc_no
"comp_code
"pay_term
"vendor
"ex_rate
"curr
"pur_org
"pur_grp
"line Item
"text
"PO qty
"netpr
************************************************************************
*07 SELECTION OF DATA
************************************************************************
* break-point.
perform selection.
* break-point.
perform output.
*&---------------------------------------------------------------------*
*&
Form SELECTION
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM SELECTION .
* Check the validity of the input
select * from ekko into table it_ekko where bukrs = p_var
and ebeln in p_var2.
select * from ekpo into table it_ekpo
for all entries in it_ekko
where bukrs = it_ekko-bukrs
and ebeln = it_ekko-ebeln.
IF sy-subrc <> 0.
* No data exists
MESSAGE 'No data exists for this PO.' TYPE 'I'.
EXIT.
ENDIF.
loop at it_ekpo into wa_ekpo.
clear: wa_output.
Read table it_ekko into wa_ekko with key
bukrs = wa_ekpo-bukrs
ebeln = wa_ekpo-ebeln.
move-corresponding wa_ekko to wa_output.
move-corresponding wa_ekpo to wa_output.
* Set Counter
wa_count = wa_count + 1.
wa_output-count = wa_count.
append wa_output to it_output.
endloop.
ENDFORM.
" SELECTION
*&---------------------------------------------------------------------*
*&
Form OUTPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM OUTPUT .
if R_hdr eq 'X'.
***
*Generating Output using ALV functions *
*Generate output using it_output table
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = go_alv
CHANGING
t_table = it_output ).
* "put your output internal table here
*
" set column optimized
go_columns = go_alv->get_columns( ).
go_columns->set_optimize( ).
" set functions
go_funcs = go_alv->get_functions( ).
go_funcs->set_all( ).
go_alv->display( ).
CATCH cx_salv_msg INTO go_ex.
MESSAGE go_ex TYPE 'E'.
ENDTRY.
else.
***
* Generating Output using Write statement
* Generate output using it_ekpo table
Write: 'Item data:'.
loop at it_ekpo into wa_ekpo.
write: /1 'Document:' , wa_ekpo-ebeln,
20 'line Item No.:', wa_ekpo-ebelp,
45 'Text:', wa_ekpo-txz01,
'Net Price:', wa_ekpo-netpr.
endloop.
endif.
ENDFORM.
" OUTPUT