Skip to Content
author's profile photo Former Member
Former Member

please help me with this code

hi to all experts ,

my requirement is print a barcode..The first part is an alv with two editable fields when user checks the checkbox and changes the second coloumn that no of prints are to be printed ....everything is fine but the problem is if suppose first 3 checkboxes are checked and qty to print is 3 for each .So the total no of prints should be 9 which im able to see in the print preview ......but the problem is when after seeing the print preview when we are back to the alv screen and uncheck one checkbox so now the pages should be 6 but it is still 9 what could be the problem here is my code since i cannot post full im sending in parts.......any help will greatly apprieciated ..........................thanks

 

TYPE-POOLS: slis.

*TYPES DECLARATIONS

TYPES:BEGIN OF ty_output,

cbox(1) TYPE c,"selection checkbox

menge1 TYPE char16,"QUANTITY TO PRINT

mblnr TYPE mkpf-mblnr,"MATERIAL DOCUMENT NUMBER

bwart TYPE mseg-bwart,"MOVEMENT TYPE

btext TYPE t156t-btext,"MOVEMENT TYPE DESCRIPTION

matnr TYPE mseg-matnr,"MATERIAL NUMBER

maktx TYPE makt-maktx,"MATERIAL DESCRIPTION

menge2 TYPE mseg-menge,"QUANTITY

meins TYPE mseg-meins,"BASE UNIT OF MEASUREMENT

werks TYPE mseg-werks,"PLANT

lgort TYPE mseg-lgort,"STORAGE LOCATION

ebeln TYPE mseg-ebeln,"PO DOCUMENT NUMBER

lifnr TYPE mseg-lifnr,"VENDOR

bldat TYPE mkpf-bldat,"DOCUMENT DATE

budat TYPE mkpf-budat,"POSTING DATE

usnam TYPE mkpf-usnam,"USER ID

xblnr TYPE mkpf-xblnr,"MATERIAL SLIP

END OF ty_output.

TYPES : BEGIN OF ty_data,

menge TYPE mseg-menge,"QUANTITY

mblnr TYPE mkpf-mblnr,"MATERIAL DOCUMENT NUMBER

bwart TYPE mseg-bwart,"MOVEMENT TYPE

matnr TYPE mseg-matnr,"MATERIAL NUMBER

meins TYPE mseg-meins,"BASE UNIT OF MEASUREMENT

werks TYPE mseg-werks,"PLANT

lgort TYPE mseg-lgort,"STORAGE LOCATION

ebeln TYPE mseg-ebeln,"PO DOCUMENT NUMBER

lifnr TYPE mseg-lifnr,"VENDOR

bldat TYPE mkpf-bldat,"DOCUMENT DATE

budat TYPE mkpf-budat,"POSTING DATE

usnam TYPE mkpf-usnam,"USER ID

xblnr TYPE mkpf-xblnr,"MATERIAL SLIP

END OF ty_data.

TYPES: BEGIN OF ty_btext,

btext TYPE t156t-btext,

bwart TYPE t156-bwart,

END OF ty_btext.

TYPES : BEGIN OF ty_maktx,

maktx TYPE makt-maktx,

matnr TYPE makt-matnr,

END OF ty_maktx.

TYPES: BEGIN OF ty_mard,

matnr TYPE mard-matnr,

lgpbe TYPE mard-lgpbe,

END OF ty_mard.

*INTERNAL TABLES

DATA: it_output TYPE STANDARD TABLE OF ty_output,

it_data TYPE STANDARD TABLE OF ty_data,

it_btext TYPE STANDARD TABLE OF ty_btext,

it_maktx TYPE STANDARD TABLE OF ty_maktx,

it_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv,

it_events TYPE STANDARD TABLE OF slis_alv_event,

it_header TYPE slis_t_listheader,

it_smart TYPE STANDARD TABLE OF zmm_im_001_struc,

it_mard TYPE STANDARD TABLE OF ty_mard.

*WORK AREAS

DATA: wa_output TYPE ty_output,

wa_data TYPE ty_data,

wa_btext TYPE ty_btext,

wa_maktx TYPE ty_maktx,

wa_fieldcat TYPE slis_fieldcat_alv,

wa_events TYPE slis_alv_event,

wa_header TYPE slis_listheader,

wa_smart LIKE LINE OF it_smart,

wa_layout TYPE slis_layout_alv,

wa_mard TYPE ty_mard.

*FLAGS AND CONSTANTS

DATA: fl_sel TYPE flag.

DATA: fl_del TYPE flag,

gv_count TYPE i.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS:

so_mblnr FOR mkpf-mblnr,

so_bwart FOR mseg-bwart,"MOVEMENT TYPE

so_bldat FOR mkpf-bldat,"DOCUMENT DATE

so_budat FOR mkpf-budat,"POSTING DATE

so_matnr FOR mseg-matnr,"MATERIAL ID

  • so_meins FOR mseg-meins,"BASE UNIT OF MEASUREMENT

so_werks FOR mseg-werks,"PLANT

so_lgort FOR mseg-lgort,"STORAGE LOCATION

so_lifnr FOR mseg-lifnr,"VENDOR

so_xblnr FOR mkpf-xblnr,"MATERIAL SLIP

so_ebeln FOR mseg-ebeln,"PURCHASE DOC

so_usnam FOR mkpf-usnam.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2

WITH FRAME TITLE text-002.

PARAMETERS : 1x3 RADIOBUTTON GROUP

grp1 DEFAULT 'X',

2x4 RADIOBUTTON GROUP

grp1.

SELECTION-SCREEN END OF BLOCK b2.

*

*SELECTION-SCREEN BEGIN OF LINE.

*SELECTION-SCREEN COMMENT 1(82) text-007.

*

*SELECTION-SCREEN COMMENT 89(4) text-008. " First part of your comment

*SELECTION-SCREEN END OF LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_mblnr-low.

*GETTING F4 HELP FOR THE

  • >FIELD MBLNR( MATERIAL DOCUMENT NUMBER)

PERFORM get_f4val .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_mblnr-high.

  • GETTING F4 HELP FOR THE

  • FIELD MBLNR( MATERIAL DOCUMENT NUMBER)

PERFORM get_f4val .

AT SELECTION-SCREEN.

PERFORM valid_bwart.

PERFORM valid_selscreen.

  • if no records are found displaying an error message

IF sy-dbcnt EQ 0.

MESSAGE e003(zmimr012).

ENDIF.

START-OF-SELECTION.

PERFORM get_data.

PERFORM populate_data.

PERFORM get_fcat.

PERFORM get_events.

PERFORM populate_events.

PERFORM get_layout.

PERFORM display_alv.

*

  • Refresh : it_output,

  • it_data,

  • it_smart.

&----


*& Form GET_DATA

&----


FORM get_data .

SELECT b~menge

a~mblnr

b~bwart

b~matnr

b~meins

b~werks

b~lgort

b~ebeln

b~lifnr

a~bldat

a~budat

a~usnam

a~xblnr

INTO CORRESPONDING

FIELDS OF TABLE it_data

FROM mkpf AS a

INNER JOIN mseg AS b ON

amblnr = bmblnr

AND amjahr = bmjahr

WHERE a~mblnr IN so_mblnr

AND b~bwart IN so_bwart

AND b~bwart IN ('101', '105')

AND a~bldat IN so_bldat

AND a~budat IN so_budat

AND b~matnr IN so_matnr

AND b~matnr NE space

AND b~werks IN so_werks

AND b~lgort IN so_lgort

AND b~ebeln IN so_ebeln

AND b~lifnr IN so_lifnr

AND a~xblnr IN so_xblnr

AND a~usnam IN so_usnam.

SELECT btext

bwart

FROM t156t

INTO TABLE it_btext

FOR ALL ENTRIES IN it_data

WHERE spras EQ 'EN'

AND bwart = it_data-bwart

AND sobkz = ''

AND kzbew = 'B'

AND kzzug = ''

AND kzvbr = ''.

SELECT maktx

matnr

FROM makt INTO

TABLE it_maktx

FOR ALL ENTRIES IN it_data

WHERE matnr EQ it_data-matnr

AND spras EQ 'E'.

SELECT matnr

lgpbe

FROM mard INTO

TABLE it_mard

FOR ALL ENTRIES IN it_data

WHERE matnr EQ it_data-matnr

AND werks EQ it_data-werks

AND lgort EQ it_data-lgort.

  • ENDIF.

ENDFORM. " GET_DATA

&----


*& Form GET_F4VAL

&----


FORM get_f4val .

TYPES : BEGIN OF ly_mblnr,

mblnr TYPE mkpf-mblnr,

END OF ly_mblnr.

DATA: lc_mblnr TYPE dfies-fieldname

VALUE 'MBLNR',

lc_s_mblnr TYPE help_info-dynprofld

VALUE 'SO_MBLNR-LOW',

lc_dynnr

TYPE sy-dynnr VALUE '1000',

lc_repid TYPE sy-repid.

DATA: lt_mblnr TYPE STANDARD

TABLE OF ly_mblnr,

lv_mblnr TYPE ly_mblnr,

lt_return TYPE STANDARD TABLE OF

ddshretval WITH HEADER LINE.

CLEAR:lt_mblnr[],lv_mblnr,lt_return[],lt_return.

SELECT mblnr FROM mkpf

INTO TABLE lt_mblnr.

SORT lt_mblnr.

DELETE ADJACENT DUPLICATES FROM lt_mblnr.

lc_repid = sy-repid.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = lc_mblnr

value_org = 'S'

dynpprog = lc_repid

dynpnr = lc_dynnr

dynprofield = lc_s_mblnr

TABLES

value_tab = lt_mblnr

return_tab = lt_return

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

ELSE.

lc_mblnr = lt_return-fieldval.

ENDIF.

ENDFORM. " GET_F4VAL

Edited by: mozam khan on Feb 28, 2009 4:39 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 28, 2009 at 03:40 AM

    &----


    *& Form get_fcat

    &----


    FORM get_fcat.

    *BUILDING UP THE FIELD CATALOGUE

    wa_fieldcat-col_pos = 1 .

    wa_fieldcat-fieldname = 'CBOX' .

    wa_fieldcat-tabname = 'IT_OUTPUT' .

    wa_fieldcat-outputlen = '1' .

    wa_fieldcat-seltext_m = 'SELECTION'.

    wa_fieldcat-checkbox = 'X'.

    wa_fieldcat-edit = 'X' .

    wa_fieldcat-input = 'X'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 2.

    wa_fieldcat-fieldname = 'MENGE1'.

    wa_fieldcat-seltext_m = 'QTY TO PRINT'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-qfieldname = 'MENGE'.

    wa_fieldcat-edit = 'X'.

    wa_fieldcat-input = 'X'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 3 .

    wa_fieldcat-fieldname = 'MBLNR' .

    wa_fieldcat-tabname = 'IT_OUTPUT' .

    wa_fieldcat-seltext_m = 'MATERIAL DOCUMENT NO'.

    wa_fieldcat-outputlen = '10'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 4.

    wa_fieldcat-fieldname = 'BWART'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'MOVEMENT TYPE'.

    wa_fieldcat-outputlen = '3'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 5.

    wa_fieldcat-fieldname = 'MATNR' .

    wa_fieldcat-tabname = 'IT_OUTPUT' .

    wa_fieldcat-seltext_m = 'MATERIAL ID'.

    wa_fieldcat-outputlen = '10'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 6 .

    wa_fieldcat-fieldname = 'BTEXT' .

    wa_fieldcat-tabname = 'IT_OUTPUT' .

    wa_fieldcat-seltext_m = 'MOVEMENT TYPE DESC'.

    wa_fieldcat-outputlen = '10'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 7.

    wa_fieldcat-fieldname = 'MAKTX'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-outputlen = '40'.

    wa_fieldcat-seltext_l = 'MATERIAL DESCRIPTION'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 8.

    wa_fieldcat-fieldname = 'MENGE'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'QUANTITY'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 9.

    wa_fieldcat-fieldname = 'MEINS'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'UNIT OF MEASUREMENT'.

    wa_fieldcat-ref_tabname = 'T006'.

    wa_fieldcat-outputlen = '3'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 10.

    wa_fieldcat-fieldname = 'WERKS'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'PLANT'.

    wa_fieldcat-outputlen = '4'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 11.

    wa_fieldcat-fieldname = 'LGORT'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'STORAGE LOCATION'.

    wa_fieldcat-outputlen = '4'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 12.

    wa_fieldcat-fieldname = 'EBELN'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'PUR ORDER NO'.

    wa_fieldcat-outputlen = '10'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 13.

    wa_fieldcat-fieldname = 'LIFNR'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'VENDOR'.

    wa_fieldcat-outputlen = '10'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 14.

    wa_fieldcat-fieldname = 'XBLNR'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'DELIVERY NOTE'.

    wa_fieldcat-outputlen = '16'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 15.

    wa_fieldcat-fieldname = 'BLDAT'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'DOCUMENT DATE'.

    wa_fieldcat-outputlen = '10'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 16.

    wa_fieldcat-fieldname = 'BUDAT'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'POSTING DATE'.

    wa_fieldcat-outputlen = '10'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = 17.

    wa_fieldcat-fieldname = 'USNAM'.

    wa_fieldcat-tabname = 'IT_OUTPUT'.

    wa_fieldcat-seltext_m = 'USER ID'.

    wa_fieldcat-outputlen = '12'.

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    ENDFORM. " get_fcat

    &----


    *& Form top_of_page

    &----


    FORM html_top_of_page USING document

    TYPE REF TO cl_dd_document .

    CREATE OBJECT: document.

    DATA:text TYPE sdydo_text_element.

    DATA: l_repid TYPE sy-repid,

    l_mandt TYPE sy-mandt,

    l_date(10),

    l_yr(4),

    l_mm(2),

    l_dd(2),

    l_hr(2),

    l_sec(2),

    l_min(2),

    l_time(10).

    CALL METHOD document->add_gap

    EXPORTING

    width = 100.

    text = text-005.

    CALL METHOD document->add_text

    EXPORTING

    text = text-005

    sap_style = 'HEADING'.

    CALL METHOD document->new_line.

    CONCATENATE 'Report:' sy-repid INTO text.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_emphasis = 'Strong'.

    CALL METHOD document->add_gap

    EXPORTING

    width = 300.

    l_date = sy-datum.

    MOVE: l_date+0(4) TO l_yr,

    l_date+4(2) TO l_mm,

    l_date+6(2) TO l_dd.

    CONCATENATE 'Run Date:' l_dd l_mm l_yr

    INTO text SEPARATED BY '.'.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_style = space

    sap_color = space

    sap_fontsize = cl_dd_document=>medium

    sap_emphasis = cl_dd_document=>strong

    style_class = space

    • CHANGING

    • document =

    .

    CALL METHOD document->new_line.

    CONCATENATE 'Client:' sy-mandt INTO text.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontstyle = cl_dd_document=>medium

    sap_emphasis = cl_dd_document=>strong.

    CALL METHOD document->add_gap

    EXPORTING

    width = 315.

    l_time = sy-uzeit.

    l_hr = l_time+0(2).

    l_mm = l_time+2(4) .

    l_sec = l_time+4(6).

    CONCATENATE l_hr l_mm l_sec

    INTO l_time SEPARATED BY '.'.

    CONCATENATE 'Time:' l_time INTO text.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontstyle = cl_dd_document=>medium

    sap_emphasis = cl_dd_document=>strong

    style_class = space

    • CHANGING

    • document =

    .

    CALL METHOD document->new_line.

    CONCATENATE 'User Id:' sy-uname INTO text.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_style = space

    sap_color = space

    sap_fontstyle = cl_dd_document=>medium

    sap_emphasis = cl_dd_document=>strong

    style_class = space

    • CHANGING

    • document =

    .

    CALL METHOD document->add_gap

    EXPORTING

    width = 307

    • width_like =

    .

    text = 'page no:'.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    • sap_fontsize =

    sap_fontstyle = cl_dd_document=>medium

    sap_emphasis = cl_dd_document=>strong

    • style_class =

    • CHANGING

    • document =

    .

    CALL METHOD document->new_line.

    CALL METHOD document->new_line.

    CALL METHOD document->new_line.

    text = 'Selection Criteria:'.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    • text_table =

    • fix_lines =

    sap_style = 'KEY'

    • sap_color =

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    CALL METHOD document->new_line.

    CALL METHOD document->new_line.

    IF so_mblnr[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_mblnr-high IS NOT INITIAL.

    CONCATENATE 'MATERIAL DOC:' so_mblnr-low ' TO ' so_mblnr-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'MATERIAL DOC:' so_mblnr-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    IF so_bwart[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_bwart-high IS NOT INITIAL.

    CONCATENATE 'MOVEMENT TYPE:' so_bwart-low ' TO ' so_bwart-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'MOVEMENT TYPE:' so_bwart-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    IF so_bldat[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_bldat-high IS NOT INITIAL.

    CONCATENATE 'DOCUMENT DATE:' so_bldat-low ' TO ' so_bldat-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'DOCUMENT DATE:' so_bldat-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    IF so_budat[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_budat-high IS NOT INITIAL.

    CONCATENATE 'POSTING DATE:' so_budat-low ' TO ' so_budat-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'POSTING DATE:' so_budat-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    IF so_matnr[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_matnr-high IS NOT INITIAL.

    CONCATENATE 'MATERIAL ID:' so_matnr-low ' TO ' so_matnr-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'MATERIAL ID:' so_matnr-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    IF so_werks[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_werks-high IS NOT INITIAL.

    CONCATENATE 'PLANT:' so_werks-low ' TO ' so_werks-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'PLANT:' so_werks-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    IF so_lgort[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_lgort-high IS NOT INITIAL.

    CONCATENATE 'STORAGE LOCATION:' so_lgort-low ' TO ' so_lgort-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'STORAGE LOCATION:' so_lgort-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    IF so_lifnr[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_lifnr-high IS NOT INITIAL.

    CONCATENATE 'VENDOR:' so_lifnr-low ' TO ' so_lifnr-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'VENDOR:' so_lifnr-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    IF so_xblnr[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_xblnr-high IS NOT INITIAL.

    CONCATENATE 'DELIVERY NOTE:' so_xblnr-low 'TO' so_xblnr-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'DELIVERY NOTE:' so_xblnr-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    IF so_ebeln[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_ebeln-high IS NOT INITIAL.

    CONCATENATE 'PO NO:' so_ebeln-low ' TO ' so_ebeln-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'PO NO:' so_ebeln-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    CALL METHOD document->new_line.

    IF so_usnam[] IS NOT INITIAL.

    CALL METHOD document->new_line.

    IF so_usnam-high IS NOT INITIAL.

    CONCATENATE 'USER NAME:' so_usnam-low ' TO ' so_usnam-high INTO text SEPARATED BY space.

    ELSE.

    CONCATENATE 'USER NAME:' so_usnam-low INTO text SEPARATED BY space.

    ENDIF.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    CALL METHOD document->new_line.

    IF 1x3 = 'X'.

    text = 'Barcode label 1x3 maintained'.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ELSE.

    text = 'Bar Code label 2x4 maintained'.

    CALL METHOD document->add_text

    EXPORTING

    text = text

    sap_fontsize = cl_dd_document=>medium

    sap_fontstyle = cl_dd_document=>strong.

    ENDIF.

    ENDFORM. "HTML_TOP_OF_PAGE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 28, 2009 at 03:42 AM

    &----


    *

    *& Form PF_STATUS

    &----


    FORM pf_status_set USING

    ex_tab TYPE slis_t_extab .

    SET PF-STATUS 'ZMIMR012_GUI' EXCLUDING ex_tab.

    ENDFORM. " PF_STATUS

    &----


    *& Form user_command

    &----


    • text

    FORM user_command USING r_ucomm TYPE sy-ucomm

    rs_selfield TYPE slis_selfield .

    DATA: p_ref1 TYPE REF TO cl_gui_alv_grid.

    CASE r_ucomm .

    WHEN 'EXEC' .

    CLEAR p_ref1.

    IF p_ref1 IS INITIAL.

    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

    IMPORTING

    e_grid = p_ref1.

    ENDIF.

    IF p_ref1 IS NOT INITIAL.

    CALL METHOD p_ref1->check_changed_data.

    ENDIF.

    LOOP AT it_output INTO wa_output WHERE cbox EQ 'X'.

    READ TABLE it_mard INTO wa_mard WITH KEY matnr = wa_output-matnr.

    IF sy-subrc EQ 0.

    wa_smart-lgpbe = wa_mard-lgpbe.

    ENDIF.

    wa_smart-matnr = wa_output-matnr.

    wa_smart-maktx = wa_output-maktx.

    wa_smart-meins = wa_output-meins.

    wa_smart-bldat = wa_output-bldat.

    wa_smart-no_cop = wa_output-menge1.

    APPEND wa_smart TO it_smart.

    CLEAR: wa_smart,wa_output.

    ENDLOOP.

    CALL METHOD p_ref1->REFRESH_TABLE_DISPLAY.

    • CHECK fl_del NE 'X'.

    IF 1x3 = 'X'.

    PERFORM print_smartform1x3.

    ELSE.

    PERFORM print_smartform2x4.

    ENDIF.

    *

    *

    • WHEN 'SEL_ALL'.

    • fl_sel = 'X'." setting up the flag for all selection.

    *

    • PERFORM sel_rec.

    *

    • rs_selfield-refresh = 'X'.

    *

    • WHEN 'DES_ALL'.

    • fl_del = 'X'.

    • PERFORM del_sel.

    • rs_selfield-refresh = 'X'.

    ENDCASE.

    ENDFORM. " user_command

    " top_of_page

    &----


    *& Form display_alv

    &----


    FORM display_alv .

    DATA: l_repid TYPE sy-repid.

    l_repid = sy-repid.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = l_repid

    i_callback_pf_status_set = 'PF-STATUS_SET'

    i_callback_user_command = 'USER_COMMAND'

    • I_CALLBACK_TOP_OF_PAGE = 'top_of_page'

    i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'

    • I_CALLBACK_HTML_END_OF_LIST = ' '

    • I_STRUCTURE_NAME =

    • I_BACKGROUND_ID = ' '

    • I_GRID_TITLE =

    • I_GRID_SETTINGS =

    is_layout = wa_layout

    it_fieldcat = it_fieldcat

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    it_events = it_events

    • IT_EVENT_EXIT =

    • IS_PRINT =

    • IS_REPREP_ID =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • I_HTML_HEIGHT_TOP = 0

    • I_HTML_HEIGHT_END = 0

    • IT_ALV_GRAPHICS =

    • IT_HYPERLINK =

    • IT_ADD_FIELDCAT =

    • IT_EXCEPT_QINFO =

    • IR_SALV_FULLSCREEN_ADAPTER =

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    t_outtab = it_output

    EXCEPTIONS

    program_error = 1

    OTHERS = 2

    .

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " display_alv

    &----


    *& Form get_layout

    &----


    FORM get_layout .

    wa_layout-box_fieldname = 'CBOX' .

    wa_layout-box_tabname = 'IT_OUTPUT'.

    wa_layout-colwidth_optimize = 'X'.

    ENDFORM. " get_layout

    " print_smartform_1x3

    &----


    *& Form valid_bwart

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM valid_bwart .

    TYPES:BEGIN OF ly_bwart,

    bwart TYPE mseg-bwart,

    END OF ly_bwart.

    DATA:it_bwart TYPE TABLE OF ly_bwart WITH HEADER LINE.

    IF so_bwart[] IS NOT INITIAL.

    SELECT bwart FROM mseg INTO TABLE it_bwart

    FOR ALL ENTRIES IN so_bwart[]

    WHERE bwart <= so_bwart-high AND bwart => so_bwart-low.

    LOOP AT it_bwart.

    IF it_bwart-bwart NE '101' OR it_bwart-bwart NE '105' .

    CONTINUE.

    ENDIF.

    ENDLOOP.

    ENDIF.

    ENDFORM. " valid_bwart

    &----


    *& Form print_smartform2x4

    &----


    • text

    ----


    • -->P_WA_SMART text

    • -->P_IT_SMART text

    ----


    FORM print_smartform1x3.

    DATA : fm_name TYPE rs38l_fnam,

    control_parameters TYPE ssfctrlop,

    wa_job_output_info TYPE ssfcrescl,

    ssfcompin TYPE ssfcompin,

    ssfcompop TYPE ssfcompop.

    ssfcompin-dialog = 'X'.

    CALL FUNCTION 'SSF_OPEN'

    • EXPORTING

    • ARCHIVE_PARAMETERS =

    • USER_SETTINGS = 'X'

    • MAIL_SENDER =

    • MAIL_RECIPIENT =

    • MAIL_APPL_OBJ =

    • OUTPUT_OPTIONS =

    • control_parameters = control_parameters

    • IMPORTING

    • JOB_OUTPUT_OPTIONS =

    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.

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

    formname = 'ZMM_IM_001'

    variant = ' '

    direct_call = ' '

    IMPORTING

    fm_name = fm_name

    EXCEPTIONS

    no_form = 1

    no_function_module = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    control_parameters-no_open = 'X'.

    control_parameters-no_close = 'X'.

    LOOP AT it_smart INTO wa_smart.

    IF wa_smart-no_cop IS NOT INITIAL.

    MOVE wa_smart-no_cop TO gv_count.

    ENDIF.

    DO gv_count TIMES.

    CALL FUNCTION fm_name

    EXPORTING

    • ARCHIVE_INDEX =

    • ARCHIVE_INDEX_TAB =

    • ARCHIVE_PARAMETERS =

    control_parameters = control_parameters

    • MAIL_APPL_OBJ =

    • MAIL_RECIPIENT =

    • MAIL_SENDER =

    output_options = ssfcompop

    • USER_SETTINGS = 'X'

    wa_display = wa_smart

    • IMPORTING

    • DOCUMENT_OUTPUT_INFO =

    • JOB_OUTPUT_INFO =

    • JOB_OUTPUT_OPTIONS =

    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.

    ENDDO.

    CLEAR gv_count.

    CLEAR : wa_smart.

    ENDLOOP.

    CALL FUNCTION 'SSF_CLOSE'

    IMPORTING

    job_output_info = wa_job_output_info

    EXCEPTIONS

    formatting_error = 1

    internal_error = 2

    send_error = 3

    OTHERS = 4.

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " print_smartform2x4

    &----


    *& Form print_smartform2x4

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM print_smartform2x4 .

    DATA : fm_name TYPE rs38l_fnam,

    control_parameters TYPE ssfctrlop,

    wa_job_output_info TYPE ssfcrescl,

    ssfcompin TYPE ssfcompin,

    ssfcompop TYPE ssfcompop.

    ssfcompin-dialog = 'X'.

    CALL FUNCTION 'SSF_OPEN'

    EXPORTING

    • ARCHIVE_PARAMETERS =

    • USER_SETTINGS = 'X'

    • MAIL_SENDER =

    • MAIL_RECIPIENT =

    • MAIL_APPL_OBJ =

    • OUTPUT_OPTIONS =

    control_parameters = control_parameters

    • IMPORTING

    • JOB_OUTPUT_OPTIONS =

    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.

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

    formname = 'ZMM_IM_002'

    variant = ' '

    direct_call = ' '

    IMPORTING

    fm_name = fm_name

    EXCEPTIONS

    no_form = 1

    no_function_module = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    control_parameters-no_open = 'X'.

    control_parameters-no_close = 'X'.

    LOOP AT it_smart INTO wa_smart.

    IF wa_smart-no_cop IS NOT INITIAL.

    MOVE wa_smart-no_cop TO gv_count.

    ENDIF.

    DO gv_count TIMES.

    CALL FUNCTION fm_name

    EXPORTING

    • ARCHIVE_INDEX =

    • ARCHIVE_INDEX_TAB =

    • ARCHIVE_PARAMETERS =

    control_parameters = control_parameters

    • MAIL_APPL_OBJ =

    • MAIL_RECIPIENT =

    • MAIL_SENDER =

    • OUTPUT_OPTIONS = ssfcompop

    • USER_SETTINGS = 'X'

    wa_display = wa_smart

    • IMPORTING

    • DOCUMENT_OUTPUT_INFO =

    • JOB_OUTPUT_INFO =

    • JOB_OUTPUT_OPTIONS =

    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.

    ENDDO.

    CLEAR: gv_count.

    ENDLOOP.

    CALL FUNCTION 'SSF_CLOSE'

    IMPORTING

    job_output_info = wa_job_output_info

    EXCEPTIONS

    formatting_error = 1

    internal_error = 2

    send_error = 3

    OTHERS = 4.

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " print_smartform2x4

    &----


    *& Form valid_selscreen

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM valid_selscreen .

    SELECT b~menge

    a~mblnr

    b~bwart

    b~matnr

    b~meins

    b~werks

    b~lgort

    b~ebeln

    b~lifnr

    a~bldat

    a~budat

    a~usnam

    a~xblnr

    INTO CORRESPONDING

    FIELDS OF TABLE it_data

    FROM mkpf AS a

    INNER JOIN mseg AS b ON

    amblnr = bmblnr

    AND amjahr = bmjahr

    WHERE a~mblnr IN so_mblnr

    AND b~bwart IN so_bwart

    AND b~bwart IN ('101', '105')

    AND a~bldat IN so_bldat

    AND a~budat IN so_budat

    AND b~matnr IN so_matnr

    AND b~matnr NE space

    AND b~werks IN so_werks

    AND b~lgort IN so_lgort

    AND b~ebeln IN so_ebeln

    AND b~lifnr IN so_lifnr

    AND a~xblnr IN so_xblnr

    AND a~usnam IN so_usnam.

    ENDFORM. " valid_selscreen

    &----


    *& Form sel_rec

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM sel_rec .

    DATA: lv_tabix TYPE sy-tabix.

    LOOP AT it_output INTO wa_output.

    lv_tabix = sy-tabix.

    wa_output-cbox = 'X'.

    MODIFY it_output FROM wa_output TRANSPORTING cbox.

    CLEAR: wa_output.

    ENDLOOP.

    ENDFORM. " sel_rec

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 28, 2009 at 05:36 AM

    Hi,

    Try find in your code, where you are catching the action of Check box clicking, and the variables which stores that, just clear that field before it catchs the check box ticking.

    Regards

    Bala Krishna

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.