Steps :-
To create form
- Select radio button as Form and enter the form name start's with Y or Z< form name > .
- Click on Create.
To design form
To create a window.
- Window looks like,
- Adjust the width , height , Left Margin and Upper Margin of window using drag and drop.
- Click on Save.
- Pop up will appear.
- Assign Package.
Implementation
To create Paragraph Format and Character Format.
- Click on Style Radio button and enter the Style name which start's with Y or Z< Style name > .
- Click on Create .
To create Paragraph format
Heading Paragraph Format.
- Pop-up will appear.
- Enter the Paragraph format name and click on Enter.
Side Heading Paragraph Format.
- Right click on paragraph format -> Create node.
Default Paragraph Format.
- Pop-up will appear.
- Enter the Paragraph format name and click on Enter.
- Enter the Description and Indent.
Header
- Right click on HEAD window -> Create -> Text.
- Looks like ,
- Click on " General Attributes " tab.
- Click on Goto -> Change Editor.
- Select the paragraph format and Enter the Text.
- Click on Back button.
- Double Click on HEAD Window.
- Click on Output Options Tab.
- Enable Frames line with , Shadings.
- Save -> Check -> Activate.
Test
- Click on Test.
- Automatically Function Module will generates.
- Click on Test.
- Go to transaction code SE38 to write Driver program .
- Enter the Source code.
TYPES : BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN, " BILLING HEADER DATA
KUNAG TYPE VBRK-KUNAG,
END OF TY_VBRK.
TYPES : BEGIN OF TY_KNA1,
KUNNR TYPE KNA1-KUNNR, " CUSTOMER
ADRNR TYPE KNA1-ADRNR,
END OF TY_KNA1.
DATA : WA_VBRK TYPE TY_VBRK,
WA_KNA1 TYPE TY_KNA1.
PARAMETERS : P_VBELN TYPE VBRK-VBELN.
START-OF-SELECTION.
PERFORM FETCH_DATA.
*&---------------------------------------------------------------------*
*& Form FETCH_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FETCH_DATA .
SELECT SINGLE VBELN KUNAG FROM VBRK INTO WA_VBRK WHERE VBELN = P_VBELN.
SELECT SINGLE KUNNR ADRNR FROM KNA1 INTO WA_KNA1 WHERE KUNNR = WA_VBRK-KUNAG.
ENDFORM. " FETCH_DATA
- Double click on Address.
- Click on Form painter.
- Click on Address Number's Dynamic Field Value.
- Pass the Address Number variable .
- Right click on SHIPTO window -> Create -> Text.
- Enter the side heading and select the paragraph format.
- Save -> Check -> Activate.
- Click on Test.
- Copy the Function Module name.
- Go back to Diver program.
- Call the function module using Pattern.
- Pass the Exporting Value.
TYPES : BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN, " BILLING HEADER DATA
KUNAG TYPE VBRK-KUNAG,
END OF TY_VBRK.
TYPES : BEGIN OF TY_KNA1,
KUNNR TYPE KNA1-KUNNR, " CUSTOMER
ADRNR TYPE KNA1-ADRNR,
END OF TY_KNA1.
DATA : WA_VBRK TYPE TY_VBRK,
WA_KNA1 TYPE TY_KNA1.
PARAMETERS : P_VBELN TYPE VBRK-VBELN.
START-OF-SELECTION.
PERFORM FETCH_DATA.
PERFORM CALL_FORM.
*&---------------------------------------------------------------------*
*& Form FETCH_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FETCH_DATA .
SELECT SINGLE VBELN KUNAG FROM VBRK INTO WA_VBRK WHERE VBELN = P_VBELN.
SELECT SINGLE KUNNR ADRNR FROM KNA1 INTO WA_KNA1 WHERE KUNNR = WA_VBRK-KUNAG.
ENDFORM. " FETCH_DATA
*&---------------------------------------------------------------------*
*& Form CALL_FORM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CALL_FORM .
CALL FUNCTION '/1BCDWB/SF00000189'
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
* CONTROL_PARAMETERS =
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
* OUTPUT_OPTIONS =
* USER_SETTINGS = 'X'
WA_KNA1F = WA_KNA1
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " CALL_FORM
- Save -> Check -> Activate.
Test
Bill to Address
- Go to Driver program.
- Fetch the Bill to Customer Address Number.
Source Code
TYPES : BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN, " BILLING HEADER DATA
KUNAG TYPE VBRK-KUNAG,
KUNRG TYPE VBRK-KUNRG,
END OF TY_VBRK.
TYPES : BEGIN OF TY_KNA1,
KUNNR TYPE KNA1-KUNNR, " CUSTOMER
ADRNR TYPE KNA1-ADRNR,
END OF TY_KNA1.
DATA : WA_VBRK TYPE TY_VBRK,
WA_KNA1 TYPE TY_KNA1,
WA_KNA2 TYPE TY_KNA1.
PARAMETERS : P_VBELN TYPE VBRK-VBELN.
START-OF-SELECTION.
PERFORM FETCH_DATA.
PERFORM CALL_FORM.
*&---------------------------------------------------------------------*
*& Form FETCH_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FETCH_DATA .
SELECT SINGLE VBELN KUNAG KUNRG FROM VBRK INTO WA_VBRK WHERE VBELN = P_VBELN.
SELECT SINGLE KUNNR ADRNR FROM KNA1 INTO WA_KNA1 WHERE KUNNR = WA_VBRK-KUNAG.
SELECT SINGLE KUNNR ADRNR FROM KNA1 INTO WA_KNA2 WHERE KUNNR = WA_VBRK-KUNRG.
ENDFORM. " FETCH_DATA
- Go to SMARTFORMS .
- Click on Form Interface.
- Enter the Import parameter.
- Double click on BILLTO window.
- Click on Output Options.
- Enable Frames with Line.
- Right click on BILLTO window -> Create -> Text.
- Click on General Attributes tab.
- Enter the text as well as paragraph format.
- Right click on BILLTO window -> Create -> Address.
Test
Input
Output
Sales Organization
- Go back to Driver Program .
Source code
TYPES : BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN, " BILLING HEADER DATA
KUNAG TYPE VBRK-KUNAG,
KUNRG TYPE VBRK-KUNRG,
VKORG TYPE VBRK-VKORG,
END OF TY_VBRK.
TYPES : BEGIN OF TY_KNA1,
KUNNR TYPE KNA1-KUNNR, " CUSTOMER
ADRNR TYPE KNA1-ADRNR,
END OF TY_KNA1.
TYPES : BEGIN OF TY_TVKO,
VKORG TYPE TVKO-VKORG,
WAERS TYPE TVKO-WAERS, "Sales Organization
ADRNR TYPE TVKO-ADRNR,
KUNNR TYPE TVKO-KUNNR,
END OF TY_TVKO.
DATA : WA_VBRK TYPE TY_VBRK,
WA_KNA1 TYPE TY_KNA1,
WA_KNA2 TYPE TY_KNA1,
WA_TVKO TYPE TY_TVKO.
PARAMETERS : P_VBELN TYPE VBRK-VBELN.
START-OF-SELECTION.
PERFORM FETCH_DATA.
PERFORM CALL_FORM.
*&---------------------------------------------------------------------*
*& Form FETCH_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FETCH_DATA .
SELECT SINGLE VBELN KUNAG KUNRG VKORG FROM VBRK INTO WA_VBRK WHERE VBELN = P_VBELN.
SELECT SINGLE KUNNR ADRNR FROM KNA1 INTO WA_KNA1 WHERE KUNNR = WA_VBRK-KUNAG.
SELECT SINGLE KUNNR ADRNR FROM KNA1 INTO WA_KNA2 WHERE KUNNR = WA_VBRK-KUNRG.
SELECT SINGLE VKORG
WAERS
ADRNR
KUNNR
FROM TVKO INTO WA_TVKO WHERE VKORG = WA_VBRK-VKORG.
ENDFORM. " FETCH_DATA
No comments:
Post a Comment