Application Development and Automation 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: 
Read only

FM POPUP_WITH_TABLE_DISPLAY neumeric value issue

Former Member
0 Likes
9,417

I m writing an interactive ALV , on a user command click of matnr ( material no ) i want the pop up to diaplay the stock of plant using MARD table. I m getting MATNR , WERKS , LGORT in the pop up but the data of LABST that is the unristrected stock is coming in special characters mainly hash & some japneese font . Also there is no space between the coulmn . I tried a lot to figure it out , but couldn't . This is my first post can anyone help me out ? Part of the program given below for reference.

DATA : BEGIN OF T_MARD OCCURS 0,

MATNR LIKE MARD-MATNR,

WERKS LIKE MARD-WERKS,

LGORT LIKE MARD-LGORT,

LABST LIKE MARD-LABST,

END OF T_MARD.

----


  • Form CLICK

----


  • For interactive ALV Report

----


Form CLICK using command like sy-ucomm

SELFIELD TYPE SLIS_SELFIELD.

*BREAK-POINT.

CASE COMMAND.

WHEN '&IC1'.

if SELFIELD-fieldname = 'MATNR'.

READ TABLE i_final INTO

wa_final INDEX SELFIELD-TABINDEX.

SELECT MATNR WERKS LGORT LABST

FROM MARD

INTO corresponding fields of TABLE T_MARD

WHERE MATNR = wa_final-MATNR.

*break-point.

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

endpos_col = 110

endpos_row = 20

startpos_col = 10

startpos_row = 5

titletext = 'WEEEE11'

  • IMPORTING

  • CHOISE = COUNTS

tables

valuetab = T_MARD

EXCEPTIONS

BREAK_OFF = 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.

endif.

*

  • LOOP AT T_MARD .

  • WRITE: / T_MARD-MATNR ,T_MARD-WERKS ,T_MARD-LGORT ,

  • T_MARD-LABST.

  • ENDLOOP.

ENDCASE.

ENDFORM.

Regards,

ami

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,394

Hi,

You can check the test programs BALV_POPUP_TO_SELECT & BALV_POPUP_TO_SELECT_2 for the same.

The structure of the internal table and the structure should match. If not, then use fieldcatalog.

Hope it helps.

Sujay

I m writing an interactive ALV , on a user command click of matnr ( material no ) i want the pop up to diaplay the stock of plant using MARD table. I m getting MATNR , WERKS , LGORT in the pop up but the data of LABST that is the unristrected stock is coming in special characters mainly hash & some japneese font . Also there is no space between the coulmn . I tried a lot to figure it out , but couldn't . This is my first post can anyone help me out ? Part of the program given below for reference.

DATA : BEGIN OF T_MARD OCCURS 0,

MATNR LIKE MARD-MATNR,

WERKS LIKE MARD-WERKS,

LGORT LIKE MARD-LGORT,

LABST LIKE MARD-LABST,

END OF T_MARD.

----


  • Form CLICK

----


  • For interactive ALV Report

----


Form CLICK using command like sy-ucomm

SELFIELD TYPE SLIS_SELFIELD.

*BREAK-POINT.

CASE COMMAND.

WHEN '&IC1'.

if SELFIELD-fieldname = 'MATNR'.

READ TABLE i_final INTO

wa_final INDEX SELFIELD-TABINDEX.

SELECT MATNR WERKS LGORT LABST

FROM MARD

INTO corresponding fields of TABLE T_MARD

WHERE MATNR = wa_final-MATNR.

*break-point.

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

endpos_col = 110

endpos_row = 20

startpos_col = 10

startpos_row = 5

titletext = 'WEEEE11'

  • IMPORTING

  • CHOISE = COUNTS

tables

valuetab = T_MARD

EXCEPTIONS

BREAK_OFF = 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.

endif.

*

  • LOOP AT T_MARD .

  • WRITE: / T_MARD-MATNR ,T_MARD-WERKS ,T_MARD-LGORT ,

  • T_MARD-LABST.

  • ENDLOOP.

ENDCASE.

ENDFORM.

Regards,

ami

11 REPLIES 11
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,394

I would rather use REUSE_ALV_POPUP_TO_SELECT to display table as a popup.

Read only

Former Member
0 Likes
3,394

Hi Amit,

Welcome to SCN.

In the function module, To display, statement write is used. Since the field LABST is a quantity field, it doesn't work. So, you can use the function module as suggested by Suhas.

Hope it helps.

Sujay

Read only

0 Likes
3,394

Thanks sujay and Suhas for promt reply.

Ya i tried the same FM before but was not working.

I hav paste the FM code and ITAB structure hope you can spot the error .

Sorry , i m using this POP up FM first time .

DATA : BEGIN OF T_MARD OCCURS 0,

MATNR LIKE MARD-MATNR,

WERKS LIKE MARD-WERKS,

LGORT LIKE MARD-LGORT,

LABST LIKE MARD-LABST,

END OF T_MARD.

SELECT MATNR WERKS LGORT LABST

FROM MARD

INTO corresponding fields of TABLE T_MARD

WHERE MATNR = wa_final-MATNR.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

  • I_TITLE = 'HI Buddy'

  • I_SELECTION = 'X'

  • I_ALLOW_NO_SELECTION =

  • I_ZEBRA = ' '

I_SCREEN_START_COLUMN = 50

I_SCREEN_START_LINE = 80

I_SCREEN_END_COLUMN = 50

I_SCREEN_END_LINE = 60

  • I_CHECKBOX_FIELDNAME =

  • I_LINEMARK_FIELDNAME =

  • I_SCROLL_TO_SEL_LINE = 'X'

i_tabname = 'T_MARD'

I_STRUCTURE_NAME = 'MARD'

  • IT_FIELDCAT =

  • IT_EXCLUDING =

I_CALLBACK_PROGRAM = report_id

  • I_CALLBACK_USER_COMMAND =

  • IS_PRIVATE =

  • IMPORTING

  • ES_SELFIELD = SELFIELD

  • E_EXIT = W_exit

tables

t_outtab = T_MARD

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

endif.

LOOP AT T_MARD .

WRITE: / T_MARD-MATNR ,T_MARD-WERKS ,T_MARD-LGORT ,

T_MARD-LABST.

ENDLOOP.

ENDCASE.

Read only

0 Likes
3,394

Hi,

You have to populate the fieldcatalog and it to the parameter "IT_FIELDCAT". See SAP Standard program "BALV_POPUP_TO_SELECT_2" for reference.

Regards

Vinod

Read only

Former Member
0 Likes
3,394

see the following example



  DATA: BEGIN OF ITAB OCCURS 0,
        NAME(10)     TYPE C,
        TEL_NO(12)   TYPE C ,
        MOB_NO(12)   TYPE C,
        END OF ITAB.
  ITAB-NAME    = 'krish'.
  ITAB-TEL_NO  = '0114556654' .
  ITAB-MOB_NO  = '981145'.
  APPEND ITAB .
  CLEAR ITAB.
  ITAB-NAME    = 'Narender'.
  ITAB-TEL_NO  = '0114588954' .
  ITAB-MOB_NO  = '987745'.
  APPEND ITAB .
  CLEAR ITAB.
  ITAB-NAME    = 'amit'.
  ITAB-TEL_NO  = '0118996654' .
  ITAB-MOB_NO  = '984545'.
  APPEND ITAB .
  CLEAR ITAB.
  CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
    EXPORTING
      ENDPOS_COL         = 80
      ENDPOS_ROW         = 25
      STARTPOS_COL       = 1
      STARTPOS_ROW       = 1
      TITLETEXT          = 'Title POPUP_WITH_TABLE_DISPLAY'
*   IMPORTING
*     CHOISE             =
    TABLES
      VALUETAB           = ITAB
   EXCEPTIONS
     BREAK_OFF          = 1
     OTHERS             = 2
            .


Read only

Former Member
0 Likes
3,395

Hi,

You can check the test programs BALV_POPUP_TO_SELECT & BALV_POPUP_TO_SELECT_2 for the same.

The structure of the internal table and the structure should match. If not, then use fieldcatalog.

Hope it helps.

Sujay

Read only

0 Likes
3,394

Thanks for your ans Sujay and Vinod , it helped .

Now the pop up is coming good , but whole table data is coming .can we ristrict it to desired coulmns by defining it into structure ? Please suggest .

*DATA : BEGIN OF T_MARD ,

*

  • MATNR LIKE MARD-MATNR,

  • WERKS LIKE MARD-WERKS,

  • LGORT LIKE MARD-LGORT,

  • LABST LIKE MARD-LABST,

*

  • END OF T_MARD.

DATA: T_MARD1 LIKE STANDARD TABLE OF MARD WITH HEADER LINE,

WA_MARD LIKE LINE OF T_MARD1.

SELECT *

FROM MARD

INTO corresponding fields of TABLE T_MARD1

WHERE MATNR = wa_final-MATNR.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'HI Buddy'

  • I_SELECTION = 'X'

  • I_ALLOW_NO_SELECTION =

  • I_ZEBRA = ' '

  • I_SCREEN_START_COLUMN = 50

  • I_SCREEN_START_LINE = 80

  • I_SCREEN_END_COLUMN = 50

  • I_SCREEN_END_LINE = 60

  • I_CHECKBOX_FIELDNAME =

  • I_LINEMARK_FIELDNAME =

  • I_SCROLL_TO_SEL_LINE = 'X'

i_tabname = '1'

I_STRUCTURE_NAME = 'MARD'

  • IT_FIELDCAT =

  • IT_EXCLUDING =

I_CALLBACK_PROGRAM = report_id

  • I_CALLBACK_USER_COMMAND =

IS_PRIVATE = GS_PRIVATE

IMPORTING

ES_SELFIELD = SELFIELD

E_EXIT = W_exit

tables

t_outtab = T_MARD1

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.

Read only

0 Likes
3,394

make changes in your decleration

Move fields of t_mard1 table into some another table.

for example it_mard_out

create types for that structure for t_mard_out

TYPES : BEGIN OF ty_mard_out,

a type abc, fields you want to display

b type xyz,

END OF ty_mard_out.

data : it_mard_out TYPE TABLE OF ty_mard_out,

wa_mard_out TYPE ty_mard_out.

Now move your data in this table it_mard_out.

& use this table for display in Function Module

Read only

0 Likes
3,394

Hi,

Populate the Field catalog Internal table with required fields and pass this internal table to the parameter "IT_FIELDCAT".

Regards

Vinod

Read only

0 Likes
3,394

Solved , Thanks all .

Read only

Former Member
0 Likes
3,394

Please ans the above query