Batch Input With 'Call Transaction': Requirement
Batch Input With 'Call Transaction': Requirement
Requirement:
Choose a transaction and write a Batch Input program with 'Call Transaction'. Do not use the
Message tab feature of 'Call Transaction'. In this case the last error message will be at the SY-
MSG* system fields. Recreate the complete error message from table T100! (This example is
also used by the demonstration of SY-MSG* system fields)
Solution:
REPORT ZSYSTEM LINE-SIZE 255.
TABLES: T100.
* Batch-input data
DATA: BEGIN OF G_BDCDATA OCCURS 100.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF G_BDCDATA.
DATA: G_MESSAGE(200).
PERFORM FILL_BDCDATA.
CALL TRANSACTION 'FI01' USING G_BDCDATA MODE 'N'.
* of course it is nicer with a message itab, but this example
* should also demostrate the use of system variables.
SELECT SINGLE * FROM T100 WHERE
SPRSL = 'E'
AND ARBGB = SY-MSGID
AND MSGNR = SY-MSGNO.
G_MESSAGE = T100-TEXT.
*---------------------------------------------------------------------*
* Build up the BDC-table *
*---------------------------------------------------------------------*
FORM FILL_BDCDATA.
REFRESH G_BDCDATA.
ENDFORM.
*---------------------------------------------------------------------*
* FORM BDC_DYNPRO *
*---------------------------------------------------------------------*
* Batchinput: Start new Dynpro *
*---------------------------------------------------------------------*
FORM BDC_DYNPRO USING P_PROGRAM P_DYNPRO.
CLEAR G_BDCDATA.
G_BDCDATA-PROGRAM = P_PROGRAM.
G_BDCDATA-DYNPRO = P_DYNPRO.
G_BDCDATA-DYNBEGIN = 'X'.
APPEND G_BDCDATA.
ENDFORM. " BDC_DYNPRO
*---------------------------------------------------------------------*
* FORM BDC_FIELD *
*---------------------------------------------------------------------*
* Batchinput: Feld hinzufugen *
*---------------------------------------------------------------------*
FORM BDC_FIELD USING P_FNAM P_FVAL.
CLEAR G_BDCDATA.
G_BDCDATA-FNAM = P_FNAM.
G_BDCDATA-FVAL = P_FVAL.
APPEND G_BDCDATA.
ENDFORM. " BDC_FIELD
*---------------------------------------------------------------------*
* FORM REPLACE_PARAMETERS *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> P_PAR_1 *
* --> P_PAR_2 *
* --> P_PAR_3 *
* --> P_PAR_4 *
* --> P_MESSAGE *
*---------------------------------------------------------------------*
FORM REPLACE_PARAMETERS USING P_PAR_1
P_PAR_2
P_PAR_3
P_PAR_4
CHANGING P_MESSAGE.
ENDFORM. "replace_parameters
Interactive Reporting
Requirement:
List the first 100 purchase requsitions at the plant 'PL01' (table EBAN). Then make it possible to
change the purchase requisition itself from the list by clicking twice on the row or by using a
push-button.
Solution:
In the purchasing (MM modul) you can process the purchase requisitions. The purchase
requisitions define primarily the need for a material/service. List the first 100 purchase
requsitions at the plant 'PL01' (table EBAN). Then make it possible to change the purchase
requisition itself from the list by clicking twice on the row or by using a push-button.
NOTES:
In the Menu Painter a status must be created where you can maintain the function keys
(SE38 choose the object component 'TEXT ELEMENTS' at the first screen, then
the'TEXT SYMBOLS'. Here you can add a number (I.E. 001) to 'TEXT SYMBOL' and
write the header title into the text field like this:
001
Numb.__Requisition__Item___Document_____Material_____________________Quantity_Uni
t_of
002
_________Number_____Num______Type________________________________________Me
asure
ZMJUD001 FUN-FACTORY
Purch. Gr.: 001 Purchase Requisition List As Of Date: 05/09/1997
Plant: D031 Page: 1
-------------------------------------------------------------------------
Numb. Requisition Item Document Material Quantity Unit of
Number Num Type Measure
-------------------------------------------------------------------------
1 10049227 00010 NB 11141-030 23.000 CS
2 10049223 00010 NB 11141-030 23.000 CS
3 10049225 00010 NB 11141-030 13.000 CS
4 10049226 00010 NB 11141-030 9.000 CS
5 10049224 00010 NB 11141-030 23.000 CS
6 10049222 00010 NB 11141-030 23.000 CS
7 10049221 00010 NB 11141-030 38.000 CS
8 10049228 00010 NB 11141-030 23.000 CS
9 10049229 00010 NB 11141-030 23.000 CS
10 10049230 00010 NB 11141-030 22.000 CS
11 10049231 00010 NB 11141-030 24.000 CS
12 10049232 00010 NB 11141-030 24.000 CS
13 10049233 00010 NB 11141-030 24.000 CS
14 10049234 00010 NB 11141-030 23.000 CS
15 10049235 00010 NB 11141-030 5.000 CS
Creating Extract Dataset
Requirement:
Write a program that lists the Vendors and their Accounting documents. Create extract dataset
from KDF logical database. Loop through the dataset to create the required report. Don't list
those vendors which has no documents
Solution:
start-of-selection.
get lfa1.
....extract item1.
get bsik.
....extract item2.
end-of-selection.
loop.
........skip.
....endat.
....at item2.
........write:/ bsik-belnr, 13 bsik-budat.
....endat.
endloop.
Additional task:
Don't forget to set the Logical database to KDF on the "Program Attributes" screen.
Result:
Vendor number: 100124 Name:Coca Cola City: New York
Document no. Date
1800000316 01/08/1997
Vendor number: 100126 Name: Universal Studios City: Los Angeles
Document no. Date
1800000109 12/02/1996
1800000341 01/10/1997
1800000321 01/14/1997