Check Company code with authorization object F_BKPF_BUK and activity 03.
If the check fails, display error message: "No authorization for [Company Code value] ".
Fetch data from table BKPF with Company Code, Document Number and Fiscal Year matching selection-screen values.
Fetch data from table BSEG for the same keys.
Use function 'SSF_FUNCTION_MODULE_NAME' with FORMNAME = the name of the smartform. The exporting parameter FM_NAME represents the associated function module.
Loop at records from BKPF.
Map the importing parameters and tables of the smartform interface.
For example, let's say you have an importing structure HEADER with same definition than BKPF, and a table ITEMS with same definition than BSEG.
Transfer current BKPF record into the importing structure HEADER. Perform an indexed loop at BSEG records for identical keys and fill the importing table ITEMS.
Adapt your mapping if necessary.
Call smartform function module (FM_NAME) with these additional importing parameters:
Importing parameter |
Value |
CONTROL_PARAMETERS-LANGU |
SY-LANGU |
CONTROL_PARAMETERS-NO_DIALOG |
'X' |
CONTROL_PARAMETERS-GETOTF |
'X' |
USER_SETTINGS |
'X' |
And get the exporting parameter JOB_OUTPUT_INFO.
Display an information message if the return code of the function call is not 0.
Call function CONVERT_OTF with following parameters:
Input parameter |
Value |
FORMAT |
'PDF' |
OTF |
JOB_OUTPUT_INFO-OTFDATA |
And get the exporting parameter LINES.
Call function SX_TABLE_LINE_WIDTH_CHANGE with following parameters:
Importing parameter |
Value |
CONTENT_IN |
LINES |
And get the exporting parameter CONTENT_OUT.
Call function SO_CONVERT_CONTENTS_BIN with following parameters:
Importing parameter |
Value |
IT_CONTENTS_BIN |
CONTENT_OUT |
And get the exporting parameter ET_CONTENTS_BIN.
Call function SO_OBJECT_INSERT with following parameters:
Importing parameter |
Value |
FOLDER_ID |
Call function 'SO_FOLDER_ROOT_ID_GET' with REGION = 'B' and get exporting parameter FOLDER_ID. |
OBJECT_TYPE |
'EXT' |
OBJECT_HD_CHANGE-OBJSNS |
'O' |
OBJECT_HD_CHANGE-OBJLA |
SY-LANGU |
OBJECT_HD_CHANGE-OBJDES |
Attachment description (free text) |
OBJECT_HD_CHANGE-FILE_EXT |
'PDF' |
OBJECT_HD_CHANGE-OBJLEN |
Number of lines in table ET_CONTENTS_BIN * 255 |
OBJCONT |
ET_CONTENTS_BIN |
And get the exporting parameter OBJECT_ID.
Call function BINARY_RELATION_CREATE with following parameters:
Importing parameter |
Value |
OBJ_ROLEA-OBJTYPE |
'BKPF' |
OBJ_ROLEA-OBJKEY |
Concatenation of BKPF-BUKRS, BKPF-BELNR and BKPF-GJAHR |
OBJ_ROLEB-OBJTYPE |
'MESSAGE' |
OBJ_ROLEB-OBJKEY |
Move a structure with type SOFMK having following components:
FOLTP = FOLDER_ID-OBJTP
FOLYR = FOLDER_ID-OBJYR
FOLNO = FOLDER_ID-OBJNO
DOCTP = OBJECT_ID-OBJTP
DOCYR = OBJECT_ID-OBJYR
DOCNO = OBJECT_ID-OBJNO
|
RELATIONTYPE |
'ATTA' |
If return code is 0, commit work and display a success message, else display an information message.