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

Module Pool in Batch Mode

Former Member
0 Likes
1,101

Hi

Can I run module pool program in batch mode....

If so how.... can anyone help me out.....

Thanks

Jay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
876

Hi Jaya

Yes it can be done, but its highly objective. Let me give an example:

Say you display 10 records on your module pool program and usually in foreground user selects one record and processes it.

While executing in background, since you dont have any user interaction, you will have to select records programatically - as in either select all records and process them or select certain records based on conditions.

To achieve this, you will have to write a wrapper program, one which will select records and do a BDC on them .

I have done the same for COR8 transaction.

If you need any more help, do reply back.

Hope this helps.

Regards

Ravish

5 REPLIES 5
Read only

Former Member
0 Likes
877

Hi Jaya

Yes it can be done, but its highly objective. Let me give an example:

Say you display 10 records on your module pool program and usually in foreground user selects one record and processes it.

While executing in background, since you dont have any user interaction, you will have to select records programatically - as in either select all records and process them or select certain records based on conditions.

To achieve this, you will have to write a wrapper program, one which will select records and do a BDC on them .

I have done the same for COR8 transaction.

If you need any more help, do reply back.

Hope this helps.

Regards

Ravish

Read only

0 Likes
876

hI,

Yes sure I need the help..... how to run in batch process this progra,/// can I go direct and define in sm36 or so....

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

                  • Program

PROGRAM ZASSET .

tables: anla,zasset.

constants :

C_O(1) TYPE C VALUE 0,

C_INSERT(10) TYPE C VALUE 'INSERT'.

DATA: IT_ZASSET LIKE ZASSET.

DATA: V_emp_exist(1) type c,

V_ANLN1 like zASSET-ANLN1.

*--For Pf status

data: begin of it_pf occurs 0,

stat(8) type c,

end of it_pf.

DATA: SAVE TYPE C,

DELETE TYPE C,

CLEAR TYPE C,

EXIT TYPE C,

BACK TYPE C,

CANCEL TYPE C,

OK_CODE LIKE SY-UCOMM.

&----


*& Module EXIT INPUT

&----


  • text

----


MODULE EXIT INPUT.

case sy-ucomm.

when 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " EXIT INPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

OK_CODE = SY-UCOMM.

CASE OK_CODE. "OK_CODE.

WHEN 'INSERT'.

IF NOT ZASSET-ANLN1 IS INITIAL.

MOVE ZASSET-ANLN1 TO IT_ZASSET-ANLN1.

ENDIF.

WHEN 'SAVE'.

MOVE IT_ZASSET-ANLN1 TO ZASSET-ANLN1.

INSERT INTO ZASSET VALUES IT_ZASSET .

COMMIT WORK.

CLEAR IT_ZASSET.

*REFRESH IT_ZASSET.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

*APPEND IT_ZASSET.

*CLEAR ZASSET.

  • leave to screen 200.

*ENDIF.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


  • & Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

  • SET PF-STATUS 'ASSET'.

SET PF-STATUS 'POOL'.

SET TITLEBAR 'UPDATING ZASSET TABLE'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module exitscreen INPUT

&----


  • text

----


MODULE exitscreen INPUT.

Case OK_CODE. "_100.

WHEN EXIT.

Leave to screen 0.

when BACK.

Leave to screen 0.

when CANCEL.

Leave to screen 0.

Endcase.

ENDMODULE. " exitscreen INPUT

&----


*& Module USER_COMMAND_0200 INPUT

&----


  • text

----


*OK_CODE = SY-UCOMM.

*MODULE USER_COMMAND_0200 INPUT.

*

*Case OK_CODE.

*

    • When 'MODIFY'.

**

    • Perform move_values.

**

      • Perform lock_table.

**

    • Perform change_dbase.

**

      • Perform unlock_table.

**

      • Message s999(z1) with text-001.

**

    • Leave to screen 100.

*

  • When SAVE.

*

  • Perform move_values.

*

    • Perform lock_table.

*

  • Perform insert_dbase.

*

    • Perform unlock_table.

*

    • Message s999(z1) with text-002.

*

  • Leave to screen 100.

*

    • When c_delete.

**

    • Perform move_values.

**

      • Perform lock_table.

**

    • Perform delete_dbase.

**

      • Perform unlock_table.

**

    • Message s999(z1) with text-003.

**

    • Leave to screen 100.

*

  • When EXIT.

*

*Endcase.

*

*

*

*

*

*

*ENDMODULE. " USER_COMMAND_0200 INPUT

&----


*& Form check_emp_exist

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM check_emp_exist.

Clear IT_ZASSET-ANLN1.

Move zASSET-ANLN1 to IT_ZASSET-ANLN1.

Clear zASSET.

  • Select single * from zASSET where ANLN1 = IT_ZASSET-ANLN1.

  • If sy-subrc ne 0.

  • Clear v_emp_exist.

  • Else.

  • Clear zASSET.

*

  • Select * up to 1 rows from ztrytxn where empno = v_empno.

  • Endselect.

  • Move : ztrytxn-valfr to v_date,

*

  • C_x to v_emp_exist.

  • Endif.

ENDFORM. " check_emp_exist

&----


*& Form move_values

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


*FORM move_values.

**MOVE ZASSET-ANLN1 TO IT_ZASSET-ANLN1.

**MOVE IT_ZASSET-ANLN1 TO ZASSET-ANLN1.

**MOVE ZASSET-ANLN1 TO IT_ZASSET-ANLN1.

*MOVE IT_ZASSET-ANLN1 TO ZASSET-ANLN1.

*

*

*

*INSERT INTO ZASSET VALUES IT_ZASSET.

*COMMIT WORK.

*

**MODIFY ZASSET . "INDEX SY-TABIX. " FROM TABLE IT_ZASSET1 .

**COMMIT WORK.

**LEAVE TO SCREEN 100.

**

*

*ENDFORM. " move_values

ENDFORM. " change_dbase

&----


*& Form delete_dbase

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM delete_dbase.

Delete zASSET from IT_ZASSET-ANLN1.

Commit work.

ENDFORM. " delete_dbase

&----


*& Module check_BUKRS INPUT

&----


  • validating bukrs

----


MODULE check_BUKRS INPUT.

if zasset-bukrs <> 0.

  • Message e999(z1) with text-005.

Endif.

ENDMODULE. " check_BUKRS INPUT

Read only

0 Likes
876

Hi Jaya

i dont know the logic of your program, but i can give you pseudo logic for the BDC program.

1) Data selection.

2) On the internal table that you perform operations, you have to run a BDC (Record the BDC on the module pool program first). This step will need a lot of tweaking as you need to think of every scenario, for processing a record.

3) Collect BDC messages into an internal table and generate it as an output.

Note that while in background, you will have to explicitly specify which all records you want to process.

Regards

Ravish

Read only

0 Likes
876

Yeah thats fine and thank you so much...

A small question.. Can I just run it in sm37.... without usikng BDC...

Read only

former_member265047
Active Participant
0 Likes
876

Hi ,

How can you run in module pool in background mode with out BDC. Module pool means , an user interface where user has to feed some values and process it online.

If we want to run it on background , then we have to record that transaction and create BDC program to post entries with out user intervention.

then we have to create a batch job for the BDC program and schedule it in SM36 to run in background.

Hope it clarifies you. please let me know if you have any queries.

Regards,

Naveen Veshala