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: 

Sample code to design a screen to retrieve details from MARA and display it

Former Member
0 Kudos

Hi,

Can anyone provide me a sample code to design a screen to retrieve details from MARA table and display them using DYNPRO.

Regards,

Prabhu

4 REPLIES 4

rodrigo_paisante3
Active Contributor
0 Kudos

Hi, what you need to do? An alv grid with container, a table control? Please, specific it.

Regards

Former Member
0 Kudos

Hi Prabhu

Do you want a control of the table MARA field by field?

Regards

Allan Cristian

Former Member
0 Kudos

Hi,

The output of a report should give a screen with "matnr" as parameter and a push button with text "Display". When I click the button display it should give details(matnr,mtart, ersda,ernam) about the input "matnr".

Thanks,

Prabhu

0 Kudos

Hi prabhu,

You can use a list box with the "values" of the table in the same screen, like this:

I create here e table with the name "ZMARA" with the same fields, modify it please.

  • Create a screen (like 100 for example)

  • Go to layout of the screen and insert the fields of the table mara - press F6 (Dictionary/program field window);

  • rename the input/output field (MATNR) to ZMARAMATNR and set the FctCODE to ZMARAMATNR too;

You'll need 3 Module's and the "TOP".

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100. (Status GUI at your choice)

MODULE vrm_0100. (to use the ListBox)

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100. (to set the values of the fields to the IO fields at the screen)

  • TOP

PROGRAM SAPMZMARA .

TYPE-POOLS: vrm.

tables: zmara.

data: ivrm_values TYPE vrm_values,

xvrm_values LIKE LINE OF ivrm_values,

name TYPE vrm_id,

ZMARAMATNR(20),

ti_zmara type standard table of zmara with header line.

MODULE vrm_0100 OUTPUT.

select * from zmara into table ti_zmara.

clear ivrm_values.

name = 'ZMARAMATNR'.

loop at ti_zmara.

xvrm_values-key = ti_zmara-matnr.

xvrm_values-text = ti_zmara-matnr.

APPEND xvrm_values TO ivrm_values.

endloop.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = ivrm_values.

ENDMODULE. " vrm_0100 OUTPUT

MODULE USER_COMMAND_0100 INPUT.

if sy-ucomm = 'ZMARAMATNR'.

read table ti_zmara with key MATNR = ZMARAMATNR.

if SY-SUBRC = 0.

ZMARA-MTART = ti_ZMARA-MTART.

ZMARA-ERSDA = ti_ZMARA-ERSDA.

ZMARA-ERNAM = ti_ZMARA-ERNAM.

else.

ZMARA-MTART = ''.

ZMARA-ERSDA = ''.

ZMARA-ERNAM = ''.

endif.

endif.

ENDMODULE. " USER_COMMAND_0100 INPUT

I'm looking for the parameters and I'll post here.

Regards

Allan Cristian

Message was edited by:

Allan Cristian