on 02-24-2009 10:16 AM
Hi Experts,
How can i create Header and items in SMART FORM in the below driver program.
_Header fields_
SELECT BUKRS BUDAT GJAHR CPUDT USNAM BLART BELNR XBLNR BLDAT WAERS KURSF
FROM BKPF INTO CORRESPONDING FIELDS OF TABLE IT_HEAD WHERE BELNR IN S_BELNR AND BUDAT IN S_BUDAT AND GJAHR EQ S_GJAHR AND BUKRS EQ S_BUKRS AND CPUDT IN S_CPUDT AND USNAM IN S_USNAM.
Item firlds
SELECT BUZEI BSCHL SGTXT SHKZG KOSTL PRCTR WERKS WRBTR HKONT KUNNR ZFBDT FROM BSEG INTO CORRESPONDING FIELDS OF TABLE IT_ITEM
FOR ALL ENTRIES IN IT_HEAD WHERE BELNR = IT_HEAD-BELNR AND GJAHR = IT_HEAD-GJAHR AND BUKRS = IT_HEAD-BUKRS.
LOOP AT IT_HEAD.
MOVE-CORRESPONDING IT_HEAD TO FINAL.
LOOP AT IT_ITEM
WHERE BELNR = IT_HEAD-BELNR.
MOVE-CORRESPONDING IT_ITEM TO FINAL.
ENDLOOP.
ENDLOOP.
Regards,
Sreedhar.
HI
In the main window create two loops one for header and another for an item.
In the Header loop create the template drag and drop the fields into the text node and repeat the same process
for the for the item.
Regards,
Sravanthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sreedhar,
Try it this way: under your main window create a table, in that in main area loop your header table and display the header data in a text, now under your first loop create a nested loop for your item table and maintain the where condition in that, now display the item data:
MAIN WINDOW
Header
Main Area
LOOP1 ( Loop it_head into wa_head)
ROW1
CELL1
TEXT1 ( print header data here)
LOOP2 ( Loop it_item into wa_item where condition )
ROW2
CELL2
TEXT2 ( print item data here)
Footer
With luck,
Pritam.
Edited by: Pritam Ghosh on Feb 24, 2009 1:09 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sree,
Refer this wiki.
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/printing+invoices
Regards,
Sravanthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi:
Nested loop is required
Loop at header
loop at item where item = header-item
endloop
endloop.
Regards
Shashi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for these internal tables you can pass some Identifier for both tables.
in header file : IT_HEAD
IDENT type char10,
BUKRS type BUKRS,
BUDAT type BUDAT, like
in header file :IT_ITEM
IDENT type char10,
BUZEI type BUZEI,
BSCHL type BSCHL, like in item data
you need to fille the IDENT value like
IT_HEAD:
10 -- DE01-- 10.20.2009
20 -- CH01-- 10.20.2009
IT_ITEM
10 -- 1234-- KSCHL value like all records
10 -- 2345-- KSCHL value like all records
10 -- 6783-- KSCHL value like all records
20 -- 3452-- 1KSCHL value like all records
20 -- 4532-- KSCHL value like all records
20 -- 4535-- KSCHL value like all records
in smartform you need to create 2 tables.
or create
LOOP with IT_HEAD
table with IT_HEAD
table with IT_ITEM
and put the condition for each table in DATA tab where condtion like IDENT = IT_HEAD-IDENT
in item table also INDENT = IT_ITEM-INDENT..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think sravanthi means a nested loop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.