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

Hi experts,

Former Member
0 Likes
1,271

My object is about Module Pool in ABAP. I am a beginner in this. My object is to design a layout on a screen and display as a table (display should be shown as below)

 

Header 1Header 2Header 3Header 4Header 5Header 6Header 7
City(ort01)editable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)
Cityeditable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)
Cityeditable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)

I have created a selection screen having plant as parameter .

I have used table wizard as well .

But , If the user enters a particular plant as input on selection screen, with respect to that plant, it shud display uneditable column- city(ort01) , along with all other empty editable fields as output.

Here user can enter the values wich shud be saved in a z table. Please help.

1 ACCEPTED SOLUTION
Read only

former_member209120
Active Contributor
0 Likes
1,244

Hi Krupa Shenkar,

See this Example Module Pool Program it may hap you

Screen 9001

process before output.
loop at it_final into wa_final with control vcontrol cursor
vcontrol-current_line.
endloop.

module status_9001.

*
process after
input.
*chain.
field rollno.
*endchain.

loop at it_final.
chain.
field wa_final-name.
field wa_final-age.
field wa_final-gropu.
field wa_final-marks1.
field wa_final-marks2.
field wa_final-marks3.
field wa_final-tot.
module wa_final.
endchain.
endloop.

module user_command_9001.

 
 

Table:

Program:

TABLES : zram1,.

DATA : wa_final TYPE zram1.
DATA : it_final TYPE TABLE OF zram1.
DATA : rollno TYPE zram1-rollno.

CONTROLS: vcontrol TYPE TABLEVIEW USING SCREEN 9001.

CALL SCREEN 9001.
*&---------------------------------------------------------------------*
*&      Module  STATUS_9001  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_9001 OUTPUT.
SET PF-STATUS '9001'.
SET TITLEBAR '9001'.

ENDMODULE.                 " STATUS_9001  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_9001 INPUT.
CASE sy-ucomm.

WHEN 'CREATE'.
MODIFY zram1 FROM TABLE it_final.
CLEAR it_final.
CLEAR rollno.

IF sy-subrc = 0.
MESSAGE : 'CREATED....' TYPE 'S'.
ENDIF.


WHEN 'DISPLAY'.

SELECT * FROM zram1 INTO TABLE it_final WHERE rollno = rollno.


WHEN 'UPDATE'.

MODIFY zram1 FROM TABLE it_final.
CLEAR it_final.
CLEAR rollno.

IF sy-subrc = 0.
MESSAGE : 'UPDATED....' TYPE 'S'.
ENDIF.

WHEN 'DELETE'.

DELETE zram1 FROM TABLE it_final.
CLEAR it_final.
CLEAR rollno.

IF sy-subrc = 0.
MESSAGE : 'DELETED....' TYPE 'S'.
ENDIF.

WHEN 'EXIT'.

LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE.                 " USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------*
*&      Module  wa_final  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE wa_final INPUT.
wa_final-rollno = rollno.
APPEND wa_final TO it_final.

ENDMODULE.                 " wa_final  INPUT

Output

Regards,

Ramesh.T

My object is about Module Pool in ABAP. I am a beginner in this. My object is to design a layout on a screen and display as a table (display should be shown as below)

 

Header 1Header 2Header 3Header 4Header 5Header 6Header 7
City(ort01)editable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)
Cityeditable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)
Cityeditable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)editable (matnr)

I have created a selection screen having plant as parameter .

I have used table wizard as well .

But , If the user enters a particular plant as input on selection screen, with respect to that plant, it shud display uneditable column- city(ort01) , along with all other empty editable fields as output.

Here user can enter the values wich shud be saved in a z table. Please help.

5 REPLIES 5
Read only

Former Member
0 Likes
1,244

Hi Shekar,

You can visit the below link to create the table control with your ZTABLE.

http://learnmysap.com/sap-abab/58-create-table-control-using-abap-programming.html

In the property window of the field you can make it editable or non editable.

In table control as per the above tutorial all the data entered by the user will be available in the

Internal table after PAI.

Create a save button.

and on the UCOMM of SAVE use the modify statement to update the DB table with the Internal table.

Regards,

Read only

0 Likes
1,244

Thanks Mohammed

Read only

Former Member
0 Likes
1,244

Hi Krupa,

I am assuming that you are designing a 'Normal Screen' in SE51 and you have a custom report program with a selection screen which in turn calls the above designed screen.

*) To restrict the city values as per plant, code in PBO of screen by passing the plant from your report program. Plant value can be passed using concept of SET & GET parameter id.

*)The screen painter has properties for every control which you place on screen. They come on the right side once you double click the control. Using it you can make fields as input only, output only, input & output etc.

*) For saving to Z table, validate all the entries in PAI ( You can use Chain.....Endchain for this) and put in another internal table, get lock on the Z table, Update/Modify it from this internal table and release lock on Z table.

*-> I am also assuming that all the rows will have same city.

Please ask further if not clear.

BR.

Read only

former_member209120
Active Contributor
0 Likes
1,245

Hi Krupa Shenkar,

See this Example Module Pool Program it may hap you

Screen 9001

process before output.
loop at it_final into wa_final with control vcontrol cursor
vcontrol-current_line.
endloop.

module status_9001.

*
process after
input.
*chain.
field rollno.
*endchain.

loop at it_final.
chain.
field wa_final-name.
field wa_final-age.
field wa_final-gropu.
field wa_final-marks1.
field wa_final-marks2.
field wa_final-marks3.
field wa_final-tot.
module wa_final.
endchain.
endloop.

module user_command_9001.

 
 

Table:

Program:

TABLES : zram1,.

DATA : wa_final TYPE zram1.
DATA : it_final TYPE TABLE OF zram1.
DATA : rollno TYPE zram1-rollno.

CONTROLS: vcontrol TYPE TABLEVIEW USING SCREEN 9001.

CALL SCREEN 9001.
*&---------------------------------------------------------------------*
*&      Module  STATUS_9001  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_9001 OUTPUT.
SET PF-STATUS '9001'.
SET TITLEBAR '9001'.

ENDMODULE.                 " STATUS_9001  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_9001 INPUT.
CASE sy-ucomm.

WHEN 'CREATE'.
MODIFY zram1 FROM TABLE it_final.
CLEAR it_final.
CLEAR rollno.

IF sy-subrc = 0.
MESSAGE : 'CREATED....' TYPE 'S'.
ENDIF.


WHEN 'DISPLAY'.

SELECT * FROM zram1 INTO TABLE it_final WHERE rollno = rollno.


WHEN 'UPDATE'.

MODIFY zram1 FROM TABLE it_final.
CLEAR it_final.
CLEAR rollno.

IF sy-subrc = 0.
MESSAGE : 'UPDATED....' TYPE 'S'.
ENDIF.

WHEN 'DELETE'.

DELETE zram1 FROM TABLE it_final.
CLEAR it_final.
CLEAR rollno.

IF sy-subrc = 0.
MESSAGE : 'DELETED....' TYPE 'S'.
ENDIF.

WHEN 'EXIT'.

LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE.                 " USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------*
*&      Module  wa_final  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE wa_final INPUT.
wa_final-rollno = rollno.
APPEND wa_final TO it_final.

ENDMODULE.                 " wa_final  INPUT

Output

Regards,

Ramesh.T

Read only

0 Likes
1,244

Thanks Ramesh it worked