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

Listbox & OBLIGATORY

Former Member
0 Likes
1,260

Hi Experts,

I have a problem with LISTBOX and option OBLIGATORY, when the LISTBOX was selected then I execute a report but the system still return me "Make an entry in all required fields"

How to correct it? Please give me some advice.

Regards,

Tiwa.

REPORT.

DEFINE LB_MACRO_KOART.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(31) &3.

PARAMETERS: &1 AS LISTBOX VISIBLE LENGTH &2 OBLIGATORY.

SELECTION-SCREEN END OF LINE.

END-OF-DEFINITION.

************************************************************************

  • SELECTION-SCREEN *

************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK S1 WITH FRAME TITLE TEXT-001.

LB_MACRO_KOART MYLIST(1) 5 COMMENT.

SELECTION-SCREEN END OF BLOCK S1.

************************************************************************

  • AT SELECTION - SCREEN

************************************************************************

AT SELECTION-SCREEN OUTPUT.

PERFORM ADD_VALUES_TO_KOART.

COMMENT = 'Account type'.

&----


*& Form ADD_VALUES_TO_KOART

&----


  • Fill the values in dropdownlistbox

----


FORM ADD_VALUES_TO_KOART .

TYPE-POOLS: VRM.

DATA: MY_LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF MY_LIST.

DATA : BEGIN OF I_TAB OCCURS 0,

KOART TYPE C,

END OF I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'A'.

APPEND I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'D'.

APPEND I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'K'.

APPEND I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'M'.

APPEND I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'S'.

APPEND I_TAB.

CLEAR I_TAB.

&----


*& Filling the list structure with values from MARA table

&----


LOOP AT I_TAB.

VALUE-KEY = SY-TABIX.

VALUE-TEXT = I_TAB-KOART.

APPEND VALUE TO MY_LIST.

ENDLOOP.

&----


*& Finally calling the function module to create the list box.

&----


CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'MYLIST'

VALUES = MY_LIST.

ENDFORM. " ADD_VALUES_TO_KOAR

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
914

Hi Tiwa,

As u have defined that parameter as obligatory. U can't skip that parameter.First u have to fill that parameter and then u can do other thing. better remove that obligatory from ur code.

Regards,

Hemant

4 REPLIES 4
Read only

Former Member
0 Likes
915

Hi Tiwa,

As u have defined that parameter as obligatory. U can't skip that parameter.First u have to fill that parameter and then u can do other thing. better remove that obligatory from ur code.

Regards,

Hemant

Read only

0 Likes
914

Hi,

it has something to do with setting sy-tabix as as key. Try like this.


REPORT Z.
DEFINE LB_MACRO_KOART.
  SELECTION-SCREEN BEGIN OF LINE.
  SELECTION-SCREEN COMMENT 1(31) &3.
  PARAMETERS: &1 AS LISTBOX VISIBLE LENGTH &2 OBLIGATORY.
  SELECTION-SCREEN END OF LINE.
END-OF-DEFINITION.

************************************************************************
* SELECTION-SCREEN *
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK S1 WITH FRAME TITLE TEXT-001.
LB_MACRO_KOART MYLIST(1) 5 COMMENT.
SELECTION-SCREEN END OF BLOCK S1.

************************************************************************
* AT SELECTION - SCREEN
************************************************************************
AT SELECTION-SCREEN OUTPUT.

  PERFORM ADD_VALUES_TO_KOART.
  COMMENT = 'Account type'.

*&---------------------------------------------------------------------*
*& Form ADD_VALUES_TO_KOART
*&---------------------------------------------------------------------*
* Fill the values in dropdownlistbox
*----------------------------------------------------------------------*
FORM ADD_VALUES_TO_KOART .

  TYPE-POOLS: VRM.

  DATA: MY_LIST TYPE VRM_VALUES,
  VALUE LIKE LINE OF MY_LIST.

  DATA : BEGIN OF I_TAB OCCURS 0,
  KEY TYPE C,
  KOART TYPE C,
  END OF I_TAB.

  CLEAR I_TAB.
  I_TAB-KEY = '1'.
  I_TAB-KOART = 'A'.
  APPEND I_TAB.
  CLEAR I_TAB.
  I_TAB-KEY = '2'.
  I_TAB-KOART = 'D'.
  APPEND I_TAB.
  CLEAR I_TAB.
  I_TAB-KEY = '3'.
  I_TAB-KOART = 'K'.
  APPEND I_TAB.
  CLEAR I_TAB.
  I_TAB-KEY = '4'.
  I_TAB-KOART = 'M'.
  APPEND I_TAB.
  CLEAR I_TAB.
  I_TAB-KEY = '5'.
  I_TAB-KOART = 'S'.
  APPEND I_TAB.
  CLEAR I_TAB.


*&---------------------------------------------------------------------*
*& Filling the list structure with values from MARA table
*&---------------------------------------------------------------------*

  LOOP AT I_TAB.
    VALUE-KEY = I_TAB-KEY."SY-TABIX.
    VALUE-TEXT = I_TAB-KOART.
    APPEND VALUE TO MY_LIST.
  ENDLOOP.

*&---------------------------------------------------------------------*
*& Finally calling the function module to create the list box.
*&---------------------------------------------------------------------*

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      ID     = 'MYLIST'
      VALUES = MY_LIST.

ENDFORM. " ADD_VALUES_TO_KOAR


Kostas

Read only

Former Member
0 Likes
914

Hi,

for a list box u can select a value only based on that selection then write code.

Read only

Former Member
0 Likes
914

hi Tiwa,

as u have specified OBLIGATORY, thats y it is asking u to make an entry in all the fields.

u can't execute the report leaving those fields blank.

" PARAMETERS: &1 AS LISTBOX VISIBLE LENGTH &2 OBLIGATORY."

Don't specify OBLIGATORY and try executing.

Reward if useful