cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with printing the smrtform

Former Member
0 Kudos

Hi experts,

I want to print material number through smartform. i have a internal table containing material number and its quantity. I want to print particular material number for number of quantity times. it means if i have 3 rows in internal table , that means 3 material numbers are there and number of quantity is 50 for each material . so i want to print each material number for 50 times.

Accepted Solutions (1)

Accepted Solutions (1)

nabheetscn
Active Contributor
0 Kudos

Do one things

Lets say may table is GT_MATNR containg quantity and material.

Loop at GT_MATNR.

LV_Count = LWA_MATNR-QUANTITY.

DO----> ENDOO LVCOUNT times and print inside it.

thanks

Nabheet

Former Member
0 Kudos

Hi Nabheet ,

Problem is the page break is not happening . i have given print but whole data comes on one page and it appends the previous data on that page only.

i have made a loop on internal table called GT_MATNR in smartform main window. Then inside it i called another loop and inside that loop i jst pass the text thn i put page break command . But the pagebreak command is not workong nd whole data is printed on one page .

nabheetscn
Active Contributor
0 Kudos

Hi do one thing

First LOOP

Secondl LOOP to print based on where clasue.

Endloop 2nd-->

Put page break here or insert the commandtogottonext page

Endloop 1st

Former Member
0 Kudos

Hi Nibheet Thanks For Your Help ,

I have tried it but still not working.

Former Member
0 Kudos

For each time,you print the material number, should the page break happen?? Can u tell me when should the page break happen???

Vishwa.

Former Member
0 Kudos

hi vishwa ,

i have called first loop in main window than in program lines fill the internal table with serial no and material code for quantity times. than loop on that internal table and under that loop i select one textfield and pass the material number to it . than under textfield one program line and in that program line sfsy-page = sfsy-page + 1. and than in command pagebreak : go to page page1.

Answers (3)

Answers (3)

former_member193284
Active Participant
0 Kudos

Hi Rupesh,

You can try following code.

Lets take an example of just one material number in your internal table.

what you can do here is create two similar tables with quantity & material number.

Loop at itab.

here capture the quantity field.

do < quantity times >

append the material numbers to the second internal table.

enddo.

endloop.

This way you can build an internal table with material numbers for total number of quantities.

Then use this table in your smartform.

Hope this helps.

former_member196280
Active Contributor
0 Kudos

Create program line in your smartform and build the following logic.

1) you need additional internal table, with material.(ex: it_new)

2) loop at internal table that has material and quantity. (ex: internal table name it_mat)

Do quantity times " Make sure quantity does not have decimals

populate it_new.

end do.

endloop.

Example:

Loop it_mat.

Do it_new-quantity times. " make sure quantity does not have decimals

it_new-matnr = it_mat-matnr.

append it_new.

Enddo.

Endloop.

3) now try to display the contents of new internal table in the output.

I guess, above solution will help you to close the thread.

Regards,

SaiRam

Former Member
0 Kudos

Hi Sai Ram,

i am getting the output of number of pages i want to print but now the problem is pagebreak command is not working. when i give commanad print than only one page comes out and all the material number prints on each other in that one page only.

Former Member
0 Kudos

Put the command node in the second loop, after printing the material number, then the page break will happen for each material number.

Vishwa.

Former Member
0 Kudos

Hi Vsihwa ,

I have put the command line in second loop only but its not working all material number prints on one page and overlaps previous one..

Former Member
0 Kudos

Thank you all .. Problem is solved. I have taken template in 2nd loop and define the size what i want.

Former Member
0 Kudos

Hi,

First we need to take two LOOPS.

First place under the main window

Second loop place in the table write the condion in the main view how many records u want to display in that mainview

every u can display 30 records.

After that use the page break statment for that table.

between first loop and endloop we can create pagebreak statement.

After main window.

First loop: LOOP AT ITAB INTO WA.

LOOP AT IT_MAT INTO WA_MAT. "give inthe table

****write the conditon display the 20 rrcords for each page.

page break statement.

ENDLOOOP.

If second loop condtion 100 records First loop must be excuted 10 times.

Regards,

MURlii

Former Member
0 Kudos

hi murali,

i m getting output of pages i want in print preview but now the problem is pagebreak command is not working. when i give commanad print than only one page comes out and all the material number prints on each other in that one page only.