Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Display the bar code horizontally in Smartforms

former_member184958
Active Participant
0 Kudos

Hi All,

I'm created one smart form which display the material bar code one by one. If suppose there is hundred bar code, now i want to display that bar code line by line but each line should printed with five material bar code. I tried with bottom up bar code it doesn't work. How can i achieve this.

Here each page have 5 bar code line by line but my requirement is to display that bar code line by line but each line have Four bar code.

Help me to fix my problem.

Thank You.

1 ACCEPTED SOLUTION

former_member184958
Active Participant
0 Kudos

Hi Akash,

     As per your idea's, i done the following coding,

clear: wa_mseg, tot, tot1.

REFRESH: it_fina, it_final1.

"Select the Quantity and Material based on Document Number

select single mblnr

               matnr

               lifnr

               kunnr

               menge

              from mseg into wa_mseg where mblnr = p_mblnr.

"Divide the Quantity by 4

tot = wa_mseg-menge / 4 .                                                 "Here assume wa_mseg-menge = 78

                                                                                          "Then TOT = 20

"Find the MOD Value

TOT1 = wa_mseg-MENGE MOD 4.                                     "Then TOT1 = 2

                          

"IF mod value is initial Reduce the value from tot

IF tot1 gt 0.

tot = tot - 1.

ENDIF.

clear wa_final.

"Appen the MATNR to first internal table TOT time

do tot times.

wa_final-matnr = wa_mseg-matnr.

append wa_final to it_final.

enddo.                                                                           "It's printing fine

clear wa_final.

"Append MOD value to another itable

DO  tot TIMES.

wa_final-matnr = wa_mseg-matnr.

append wa_final to it_final.

ENDDO.                                                                 "I don't know how to print this sequentially 

                                                                              "following the first internal table

Using the above coding i can print the 4*19 = 76 times matnr, but i want to print MOD i.e tot1 time(2) matnr continuously following the first table.

How can i achieve this.

13 REPLIES 13

Former Member
0 Kudos

hi John,

Divide the Line type in smartform into multiple colums.Currently you have only 1 column

so it is printing only once in a row if you split the row into multiple colums you can acheive

your requirement.

former_member184958
Active Participant
0 Kudos

Hi Sai,

    If i doing like that the bar code will print 4X100 = 400 times like below screen shots,

before that each page have 5 bar code totally 20 pages, see now also display 20 pages.

Hope you know my problem now.

Thank You.

0 Kudos

It seems you are printing same material 4 times.Create another internal table with 4 fields say mat1,mat2,mat3,mat4.Divide the total 20 *  5  = 100 materials into 4 fields so you have only 25 records in total instead of 100.

Now loop at this internal table and start printing.This will resolve your Issue

Former Member
0 Kudos

Divide line type into multiple columns(5 in your case), secondly in your final table have multiple matnr fields(5 in your case) instead of single, and while populating values loop mseg-menge/5 times and assign values to each matnr.

Hope this would help you...

0 Kudos

Hi Akash,

   I'm new to this. so I'm not getting your answer will you give me some more explanation on that particularly mseg-menge/5 

0 Kudos

Hi Akash,

    I tried as per our discussion but i don't where i handle the mseg-menge/5. Can you please help me to find my problem.

Thank You.

0 Kudos

you are printing same material 5 times in a row.Create final internal table with 5 fields say mat1,mat2,mat3,mat4, mat5. i.e Divide the total 20 *  5  = 100 materials into 5 fields so you have only 20 records in total instead of 100.

So in  initialization.

do (mseg-menge/5) times.

wa_final-mat1 = wa_mseg-matnr.

.

.

.

wa_final-mat5 = wa_mseg-matnr.

enddo.

Now loop at this internal table and start printing.

Hope this resolve your doubt.

0 Kudos

Hi akash,

    If it's finish with zero like 10,50,200.., then we can divide and do it. If suppose the quantity is 66, 106, 77.., like that then it will work fine?

0 Kudos

No, in that case you can use the below code for preparing the final table.

DATA: lv_menge TYPE i,

       lv_rem   TYPE i,

       lv_num TYPE n,

       lv_fname TYPE string.

DATA: BEGIN OF gt_final OCCURS 0,

       mat1 TYPE matnr,

       mat2 TYPE matnr,

       mat3 TYPE matnr,

       mat4 TYPE matnr,

       mat5 TYPE matnr,

       END OF gt_out.

DATA wa_final LIKE LINE OF gt_final.

*Find the integer part.

lv_menge = gs_mseg-menge DIV 5.

* find the remainder

lv_rem   = gs_mseg-menge MOD 5.

do lv_menge times.

wa_final-mat1 = wa_mseg-matnr.

.

.

.

wa_final-mat5 = wa_mseg-matnr.

APPEND wa_final to gt_final

enddo.

IF lv_rem NE 0.

   DO lv_menge TIMES.

     lv_num = lv_num + 1.

     CONCATENATE 'WA_FINAL-MAT' lv_num INTO lv_fname.

     ASSIGN (lv_fname) TO <fs_fname>.

     <fs_fname> = gs_mseg-matnr.

   ENDDO.

   APPEND wa_final to gt_final.

ENDIF.

Hope this solves your problem..:)

former_member184958
Active Participant
0 Kudos

Hi Akash,

     As per your idea's, i done the following coding,

clear: wa_mseg, tot, tot1.

REFRESH: it_fina, it_final1.

"Select the Quantity and Material based on Document Number

select single mblnr

               matnr

               lifnr

               kunnr

               menge

              from mseg into wa_mseg where mblnr = p_mblnr.

"Divide the Quantity by 4

tot = wa_mseg-menge / 4 .                                                 "Here assume wa_mseg-menge = 78

                                                                                          "Then TOT = 20

"Find the MOD Value

TOT1 = wa_mseg-MENGE MOD 4.                                     "Then TOT1 = 2

                          

"IF mod value is initial Reduce the value from tot

IF tot1 gt 0.

tot = tot - 1.

ENDIF.

clear wa_final.

"Appen the MATNR to first internal table TOT time

do tot times.

wa_final-matnr = wa_mseg-matnr.

append wa_final to it_final.

enddo.                                                                           "It's printing fine

clear wa_final.

"Append MOD value to another itable

DO  tot TIMES.

wa_final-matnr = wa_mseg-matnr.

append wa_final to it_final.

ENDDO.                                                                 "I don't know how to print this sequentially 

                                                                              "following the first internal table

Using the above coding i can print the 4*19 = 76 times matnr, but i want to print MOD i.e tot1 time(2) matnr continuously following the first table.

How can i achieve this.

0 Kudos

Try This code...

DATA: lv_menge TYPE i,

       lv_rem   TYPE i,

       lv_num TYPE n,

       lv_fname TYPE string.

DATA: BEGIN OF gt_final OCCURS 0,

       mat1 TYPE matnr,

       mat2 TYPE matnr,

       mat3 TYPE matnr,

       mat4 TYPE matnr,

       mat5 TYPE matnr,

       END OF gt_out.

DATA wa_final LIKE LINE OF gt_final.

*Find the integer part.

lv_menge = gs_mseg-menge DIV 5.

* find the remainder

lv_rem   = gs_mseg-menge MOD 5.

do lv_menge times.

wa_final-mat1 = wa_mseg-matnr.

.

.

.

wa_final-mat5 = wa_mseg-matnr.

APPEND wa_final to gt_final

enddo.

IF lv_rem NE 0.

   DO lv_rem TIMES.

     lv_num = lv_num + 1.

     CONCATENATE 'WA_FINAL-MAT' lv_num INTO lv_fname.

     ASSIGN (lv_fname) TO <fs_fname>.

     <fs_fname> = gs_mseg-matnr.

   ENDDO.

   APPEND wa_final to gt_final.

ENDIF.

Hope this solves your problem..:)

In second loop it should run for Lv_rem times Message was edited by: Akash Keserwani

0 Kudos

Hi Akash,

Here the data was not append to my final table.

IF lv_rem NE 0.

   DO lv_rem TIMES.

     lv_num = lv_num + 1.

     CONCATENATE 'WA_FINAL-MAT' lv_num INTO lv_fname.

     ASSIGN (lv_fname) TO <fs_fname>.

     <fs_fname> = gs_mseg-matnr.

   ENDDO.

   APPEND wa_final to gt_final.

ENDIF.

0 Kudos

Hi Akash,

    Now it's correctly appending.

Thank You.