Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Form entry
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->RETURN_CODE text
* -->US_SCREEN text
*----------------------------------------------------------------------*
FORM entry USING return_code us_screen.
CLEAR retcode.
xscreen = us_screen.
PERFORM processing.
IF retcode NE 0.
return_code = 1.
ELSE.
return_code = 0.
ENDIF.
ENDFORM. "entry
*---------------------------------------------------------------------*
* FORM PROCESSING *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM processing.
TYPES: BEGIN OF ty_lips,
kdmat TYPE lips-kdmat,
matnr TYPE lips-matnr,
vbeln TYPE lips-vbeln,
lgmng TYPE lips-lgmng,
charg TYPE lips-charg,
END OF ty_lips.
DATA: lv_docparams TYPE sfpdocparams, "Doc Parameters
lv_outparams TYPE sfpoutputparams, "Output Parameters
result TYPE sfpjoboutput. "Output parameter returned in job close
DATA: lv_form_name TYPE fpwbformname,
lv_fm_name TYPE rs38l_fnam,
lv_mess TYPE string,
l_cx_root TYPE REF TO cx_root.
DATA: l_status TYPE char1,
l_mtart TYPE mtart,
l_maktx TYPE maktx,
l_name TYPE tdobname,
l_message TYPE na_kschl.
DATA: t_lines TYPE tline_t,
w_lines TYPE tline.
DATA: gv_code TYPE char12.
DATA: gt_lips TYPE TABLE OF ty_lips,
gs_lips like line of gt_lips.
CLEAR l_status.
fp_outputparams-preview = 'X'.
PERFORM get_data.
SELECT kdmat, matnr, vbeln, lgmng, charg
FROM lips
INTO CORRESPONDING FIELDS OF TABLE @gt_lips
WHERE vbeln = @gv_nast-objky
and CHARG <> ''.
LOOP at gt_lips INTO gs_lips.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
TRY.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = form
IMPORTING
e_funcname = fm_name.
CATCH cx_fp_api INTO lx_fp_api.
* MESSAGE ID lx_fp_api->msgid TYPE lx_fp_api->msgty
* NUMBER lx_fp_api->msgno
* WITH lx_fp_api->msgv1 lx_fp_api->msgv2
* lx_fp_api->msgv3 lx_fp_api->msgv4
EXIT.
ENDTRY.
fp_docparams-langu = sy-langu.
SELECT SINGLE laiso
FROM t002
INTO cntry
WHERE spras EQ sy-langu.
fp_docparams-country = cntry.
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
is_nast = gv_nast
gs_lips = gs_lips
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3.
IF sy-subrc <> 0.
ENDIF.
PERFORM close_form_pdf .
ENDLOOP.
ENDFORM. "processing
*---------------------------------------------------------------------*
* FORM GET_DATA *
*---------------------------------------------------------------------*
* General provision of data for the form *
*---------------------------------------------------------------------*
FORM get_data.
gv_nast = nast.
ENDFORM. "GET_DATA
*---------------------------------------------------------------------*
* FORM close_form_pdf *
*---------------------------------------------------------------------*
* *
*---------------------------------------------------------------------*
FORM close_form_pdf .
CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM. " close_form_pdf
Du musst dazu im Layout ein Teilformular im "Binding" mit deiner Tabelle aus dem Kontext verknüpfen und die "wiederholte Verarbeitung" aktivieren. Da ja mehrere Knoten (als Zeilen) in der Tabelle existieren wird somit auch das Teilformular entsprechend oft wiederholt. Alle Daten die pro Seite ausgegeben werden sollen landen unter diesem Teilformular. Das Teilformular erhält noch zusätzlich bei der Eigenschaften "nachfolgend" die Einstellung "Übergang auf neue Seite" und somit wird pro Zeile in der Tabelle eine neue Seite erzeugt.