12-15-2013 5:13 PM
12-15-2013 7:24 PM
HI Brujo,
As am i understood from your question is that you want to print the one order in one page.
So when you have the internal table in all the Orders instead of making it more complex.
Do simple thing Inside your program line define one variable.
data flag type Char.
data gl_idx type sy-tabix,
Loop at it_itab into wa_itab. " Example loop in the main window.
gl_idx = sy-tabix + 1. " Increase the index of the loop.
read table it_itab into ls_itab index gl_idx " Read the next index. " Code inside your program line.
if wa_itab-aufnr = ls_itab-aufnr. " if the next order is same of the current order number.
Set
flag = 'X'.
else.
flag = ' '.
endif.
At last of the Main area use the command if the flag value is space.
endloop.
Let me know if you have other issue.
Regards.
Nishant Bansal.
12-15-2013 7:24 PM
HI Brujo,
As am i understood from your question is that you want to print the one order in one page.
So when you have the internal table in all the Orders instead of making it more complex.
Do simple thing Inside your program line define one variable.
data flag type Char.
data gl_idx type sy-tabix,
Loop at it_itab into wa_itab. " Example loop in the main window.
gl_idx = sy-tabix + 1. " Increase the index of the loop.
read table it_itab into ls_itab index gl_idx " Read the next index. " Code inside your program line.
if wa_itab-aufnr = ls_itab-aufnr. " if the next order is same of the current order number.
Set
flag = 'X'.
else.
flag = ' '.
endif.
At last of the Main area use the command if the flag value is space.
endloop.
Let me know if you have other issue.
Regards.
Nishant Bansal.
12-16-2013 3:33 PM
Thank you for responding, if I need to display a page in order SmartForm, the code that describes where you write, in the report that calls the SmartForm?, and the command where I declare the variable flag, i send you the code I'm using in the report:
DATA: gt_result TYPE STANDARD TABLE OF gty_result, "gty_result = internal table
gs_result LIKE LINE OF gt_result.
DATA: st_head TYPE ypp_ordenaufm_head,"HEAD STRUCTURE
it_head TYPE STANDARD TABLE OF ypp_ordenaufm_head,
st_det TYPE ypp_ordenaufm_det,"MAIN STRUCTURE
it_det TYPE STANDARD TABLE OF ypp_ordenaufm_det
LOOP AT gt_result ASSIGNING <fs_datos>.
CLEAR: st_head, st_det.
st_head-budat = <fs_datos>-budat.
st_head-maktx = <fs_datos>-maktx.
st_head-matnr = <fs_datos>-matnr.
st_head-aufnr = <fs_datos>-aufnr.
APPEND st_head TO it_head.
st_det-budat = <fs_datos>-budat.
st_det-turno = <fs_datos>-turno.
st_det-charg = <fs_datos>-charg.
g_total = <fs_datos>-erfmg + g_total.
APPEND st_det TO it_det.
ENDLOOP.
FORM print_smartform .
IF cf_retcode = 0.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Y_PP_DYNAMIC' "SMARTFORM
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
cf_retcode = sy-subrc.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
* BREAK-POINT.
IF cf_retcode = 0.
t_ssfcompop-tdpageslct = space.
t_ssfcompop-tdnewid = 'X'.
t_ssfcompop-tddelete = 'X'.
t_ssfcompop-tdnoprint = ' '.
t_ssfctrlop-no_dialog = ' '.
t_ssfctrlop-device = ' '.
t_ssfcompop-tdcover = ' '.
t_ssfcompop-tdcopies = '01'.
t_ssfcompop-tdimmed = 'X'.
CALL FUNCTION lf_fm_name
EXPORTING
control_parameters = t_ssfctrlop
output_options = t_ssfcompop
user_settings = ' '
g_total = g_total " Valor total
TABLES
t_head = it_head
t_det = it_det
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.
ENDIF.
Thanks for your time.
12-16-2013 4:11 PM
I add the following, because I made a debbug:
When I enter a command such order 00100 shows me the exact number of records:
order 00100
1
2
3
For example the same order 00101 shows the exact number of records:
order 00101
5
6
7
When the two orders income 00100 to 00101 on my internal table records with six, but when viewing the SmartForm, looks like this:
order 00100
1
2
3
4
5
6
order 00101
1
2
3
4
5
6...
12-16-2013 6:01 PM
An easy fix would be to add order number as a key to the item table
LOOP AT gt_result ASSIGNING <fs_datos>.
CLEAR: st_head, st_det.
st_head-budat = <fs_datos>-budat.
st_head-maktx = <fs_datos>-maktx.
st_head-matnr = <fs_datos>-matnr.
st_head-aufnr = <fs_datos>-aufnr.
APPEND st_head TO it_head.
st_det-aufnr = <fs_datos>-aufnr
st_det-budat = <fs_datos>-budat.
st_det-turno = <fs_datos>-turno.
st_det-charg = <fs_datos>-charg.
g_total = <fs_datos>-erfmg + g_total.
APPEND st_det TO it_det.
ENDLOOP.
In the Item Loop , add the where condition
In the loop to bring detail T_DET INTO ST_DET ---> add the condition "where aufnr = header_table-aufnr"
12-17-2013 9:32 PM
Hello Byju Edamana can help me in the following, when income range orders ie 0000111 to 000015, these should be placed in a sheet in order, but does not perform this action.
Hopefully you can guide me, I've seen in other conditions smartforms that placed such
g_tab = 46
OR
g_tab = 91
or
g_tab = 120
....
Please I hope you help me, thanks.
12-18-2013 4:21 AM
Currently we have a main/header internal table which loops the order number and based on the order number the item is looped.
So if we need to display them in order 000111->000015 , then sort based on the AUFNR descending for the header internal table.
SORT it_head by AUFNR descending.
Since the it_det loops based on the aufnr of the it_head,it will print accordingly
If the decending sort order needs to be done only for income based orders,then put a logic/condition before sorting.Example
Loop at it_head into st_det where ( AUFNR >= 15 OR AUFNR <= 111 ).
EXIT.
endloop.
if sy-subrc = 0.
SORT it_head by AUFNR descending.
endif.
Hope it helps...