Skip to Content

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

READ TABLE

I have the following question.

How can use the following sentence ABAP if have i want do

READ TABLE gt_bsid WITH KEY belnr = gt_bkpf-belnr and field2 = gt_bkpf-field2.

Regards

Tags:
replied

Hi,

Try like this....


CLEAR : lv_monat_condition.
CONCATENATE 'MONAT' ' IN ' '''' monat '''' INTO
lv_monat_condition.


IF NOT sociedad IS INITIAL.
CLEAR : lv_sociedad_condition.
CONCATENATE 'sociedad' ' = ' '''' sociedad '''' INTO
lv_sociedad_condition.
ENDIF.

IF NOT ejerc IS INITIAL.
CLEAR : lv_ejerc_condition.
CONCATENATE 'ejerc' ' = ' '''' ejerc '''' INTO
lv_ejerc_condition.
ENDIF.

IF NOT docum IS INITIAL.
CLEAR : lv_docum_condition.
CONCATENATE 'docum' ' = ' '''' docum '''' INTO
lv_docum_condition.
ENDIF.


IF NOT lv_monat_condition IS INITIAL.
CONCATENATE lv_monat_condition lv_condition
INTO lv_condition SEPARATED BY space.
ENDIF.

IF NOT lv_sociedad_condition IS INITIAL.
IF lv_condition IS INITIAL.
CONCATENATE lv_sociedad_condition lv_condition
INTO lv_condition SEPARATED BY space.
ELSE.
CONCATENATE lv_condition 'AND' lv_sociedad_condition
INTO lv_condition SEPARATED BY space.
ENDIF.

ENDIF.

IF NOT lv_docum_condition IS INITIAL.
IF lv_condition IS INITIAL.
CONCATENATE lv_docum_condition lv_condition
INTO lv_condition SEPARATED BY space.
ELSE.
CONCATENATE lv_condition 'AND' lv_docum_condition
INTO lv_condition SEPARATED BY space.
ENDIF.

ENDIF.


SELECT * FROM bkpf INTO CORRESPONDING FIELDS OF TABLE gt_bkpf WHERE lv_condition . " Dynamic where condition

Hope it will helps

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question