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: 

Module pool question

Former Member
0 Kudos

Hi,

I have a module pool program, in that the initial screen contains 'Display Contents', when I click that the Custom table contents will be displayed

with a check box in the front for each record. In that screen I added the button 'Creat Credit Memo' on application tool bar in pf-status 'List'. Where should I write the code to create Credit Memo.

I have to create credit memo request for only checked records.

Please help me.

Thanks,

Neelu.


PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.
--------------

MODULE USER_COMMAND_0100 INPUT.
  CASE OK_CODE.
    WHEN 'DISP'.
      CLEAR OK_CODE.
      CALL SCREEN 200.
----------------

PROCESS BEFORE OUTPUT.
* MODULE STATUS_0200.
MODULE PREPARE_LIST.
PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0200.
--------------------------------

MODULE PREPARE_LIST OUTPUT.
  LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 100.
  PERFORM EDIT_LIST.
  LEAVE SCREEN.
ENDMODULE.                 " PREPARE_LIST  OUTPUT
------------------------------------

FORM EDIT_LIST.
 Data: chbox(1) type c value ' '.

  SET PF-STATUS 'LIST'.
  NEW-PAGE LINE-SIZE 158.
  SELECT * FROM ZPPPRICE.
    SELECT SINGLE NAME1 FROM KNA1 INTO KNA1-NAME1
                   WHERE KUNNR = ZPPPRICE-KUNNR.
    WRITE: /01 SY-VLINE,
            02 chbox as checkbox,
            04 SY-VLINE,
            05 ZPPPRICE-KUNNR,
            16 SY-VLINE,
            17 KNA1-NAME1,
            43 SY-VLINE,
            44 ZPPPRICE-MATNR,
            63 SY-VLINE,
            64 ZPPPRICE-CRDATE,
            75 SY-VLINE,
            76 ZPPPRICE-EFDATE,
            87 SY-VLINE,
            88 ZPPPRICE-SPRICE,
            104 SY-VLINE,
            105 ZPPPRICE-EPRICE,
            122 SY-VLINE,
            123 ZPPPRICE-EOHQTY,
            134 SY-VLINE,
            135 ZPPPRICE-AOHQTY,
            146 SY-VLINE,
            147 ZPPPRICE-CRMEMO,
            158 SY-VLINE.
  ENDSELECT.
  CLEAR ZPPPRICE.
  WRITE: /01(158) SY-ULINE.
ENDFORM.


1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Neelu,

In my opinion this is not a nice design. You can achive the same result using

1. A simple interactive report.

Where you will read the list outout using

DO.

READ LINE INTN SY-LISEL INDEX SY-INDEX.

IF NOT SY-SUBRC IS INITIAL.

EXIT

ELSE.

IF SY-LISEL+OFFSET(1) EQ 'X'. " Your check box position on the screen.

*Check box is ticked.

ENDIF.

ENDIF.

2. ALV grid where selected row will taken care by the standard ALV functionality.

at use-commnand event of ALV grid insert your own code.

3. Module pool, instead of displaying the list, use a table control with multiple row selection. and module use-command insert the code to create the credit memo.

Please refer any SAP standard help program starting with DEMOtable

In you design you are mixing a list processing & module pool making it complex.

Regards,

A.Singh

Message was edited by:

Amarjit Singh

Message was edited by:

Amarjit Singh

6 REPLIES 6

Former Member
0 Kudos

HI,

write the code in th PAI of the screen to which u kept the PF_STATUS.

i.e, in MODULE USER_COMMAND_0200.

rgds,

bharat.

Former Member
0 Kudos

hi neelu,

u should write code in pbo module of flow logic [ if u want to perform any validations for those records].

create a sub routine in flow logic of pbo module as

PROCESS BEFORE OUTPUT.

  • MODULE STATUS_0200.

MODULE PREPARE_LIST.

Module checkorder. -> double click n write code for that module.

PROCESS AFTER INPUT.

if helpful reward some points.

with regards,

Suresh.A

che_eky
Active Contributor
0 Kudos

In USER_COMMAND_0200 loop over all checked records and create credit memo for each.

Former Member
0 Kudos

Hello Neelu,

In my opinion this is not a nice design. You can achive the same result using

1. A simple interactive report.

Where you will read the list outout using

DO.

READ LINE INTN SY-LISEL INDEX SY-INDEX.

IF NOT SY-SUBRC IS INITIAL.

EXIT

ELSE.

IF SY-LISEL+OFFSET(1) EQ 'X'. " Your check box position on the screen.

*Check box is ticked.

ENDIF.

ENDIF.

2. ALV grid where selected row will taken care by the standard ALV functionality.

at use-commnand event of ALV grid insert your own code.

3. Module pool, instead of displaying the list, use a table control with multiple row selection. and module use-command insert the code to create the credit memo.

Please refer any SAP standard help program starting with DEMOtable

In you design you are mixing a list processing & module pool making it complex.

Regards,

A.Singh

Message was edited by:

Amarjit Singh

Message was edited by:

Amarjit Singh

0 Kudos

Hi Amarjit,

I really got confused but the solution you said looks simple. Are you saying that I can read the checked records and create Credit Memo using Alv Grid.

Where should I put the code mentioned by you, is it in PAI or PBO. Can I write the code to create Credit Memo in the loop IF SY-LISEL+OFFSET(1) EQ 'X'.

Please tell be little bit clearly and also if you have any example program please send it.

Thanks,

Veni.

0 Kudos

In your code:

WRITE CKBOX AS CHECKBOX INPUT ON. "To make input enable

Please follow the demo report: DEMO_DYNPROS_AND_LISTS

I hope you are providing the button 'Create Credit memo' on the list output.

In your list report at the AT USER-COMMAND event.

You insert the code.

1. First select all the ticked records.

DO.

READ LINE INTO SY-LISEL INDEX SY-INDEX

IF NOT sy-subrc IS INITIAL.

EXIT.

ELSE.

IF SY-LISEL+OFFSET(1) EQ 'X'.

CLEAR ITAB.

ITAB-<FLD01> = SY-LISEL+OFFSET1(LEN1).

ITAB-<FLD02> = SY-LISEL+OFFSET2(LEN2).

......................................................................

......................................................................

APPEND ITAB.

ENDIF.

ENDIF.

ENDDO.

2. Selected records loop to create the credit memo.

*----


LOOP AT ITAB.

*<Your BDC/BAPI/FM etc to create creadit Memo>

ENDLOOP.

Regards,

A.Singh