Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Plz meke me understand the given code!!!!!!

Dear All,

I am giving you the code below. Please any one can explain me the whole program and the purpose. specially form LOOP section to the end of the program.

I will be very kind if someone will help to make me understood.

Regards,

Abhay.

TABLES:bseg.

DATA: it_bseg LIKE bseg OCCURS 0 WITH HEADER LINE.

DATA: it_zseco LIKE zseco OCCURS 0 WITH HEADER LINE.

*DATA: it_zseco TYPE zseco OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS:s_bukrs FOR bseg-bukrs,

s_gjahr FOR bseg-gjahr,

s_belnr FOR bseg-belnr.

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

PERFORM get_data.

&----


*& Form get_data

&----


FORM get_data .

SELECT *

FROM bseg INTO TABLE it_bseg

WHERE belnr IN s_belnr AND

bukrs IN s_bukrs AND

gjahr IN s_gjahr.

IF sy-subrc = 0.

LOOP AT it_bseg .

MOVE-CORRESPONDING it_bseg TO it_zseco.

it_zseco-bupla_old = it_bseg-bupla.

it_zseco-zdate = sy-datum.

it_zseco-usernam = sy-uname.

it_zseco-ztime = sy-uzeit.

IF it_bseg-bupla NE 'B001'.

it_bseg-bupla = 'B001'.

MODIFY it_bseg.

ENDIF.

it_zseco-bupla_new = 'B001'.

APPEND it_zseco.

CLEAR it_zseco.

ENDLOOP.

MODIFY bseg FROM TABLE it_bseg.

MODIFY zseco FROM TABLE it_zseco.

MESSAGE i000 WITH 'tables BSEG & ZSECO updated successfully'.

ELSE.

MESSAGE i000 WITH 'No data found'.

ENDIF.

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question